1 /*
2 	TAR32API.H
3 		TAR32.DLL API header.
4 		by Yoshioka Tsuneo(QWF00133@nifty.ne.jp)
5 */
6 /*
7 	���̃t�@�C���̗��p�����F
8 		���̃\�[�X�t�@�C���̗��p�����͈�؂���܂���B
9 		�\�[�X�̈ꕔ�A�S�������p�A���p�ȂǖړI��
10 		�������Ȃ����̃v���O�����Ŏ��R�Ɏg�p�ł��܂��B
11 		�p�u���b�N�E�h���C���E�\�t�g�E�F�A�Ɠ��l�Ɉ����܂��B
12 
13 	�v���O���}�����̗v�](�����ł͂���܂���)�F
14 		�\�[�X���ɉ��P���ׂ��_������΂��m�点���������B
15 		�\�[�X�R�[�h���Ƀo�O�����‚����ꍇ�͕����Ă��������B
16 		�����������Ȃǂ���܂����狳���Ă��������B
17 		�f�ГI�ȏ��ł����\�ł��B
18 		���̃t�@�C�����p�����ꍇ�͂Ȃ�ׂ������Ă��������B
19 */
20 /*
21 	LICENSE of this file:
22 		There is no restriction for using this file.
23 		You can use this file in your software for any purpose.
24 		In other words, you can use this file as Public Domain Software.
25 
26 	RECOMMENDATION for Programmer(not restriction):
27 		If you find points to improve code, please report me.
28 		If you find bug in source code, please report me.
29 		If you fixed bug, please teach me.
30 		I want any trivial information.
31 		If you use this file, please report me.
32 */
33 
34 #ifndef TAR32API_H
35 #define TAR32API_H
36 
37 #ifndef FNAME_MAX32
38 #define FNAME_MAX32		512
39 #endif
40 #if defined(__BORLANDC__)
41 #pragma option -a-
42 #else
43 #pragma pack(1)
44 #endif
45 
46 #ifndef _TIME_T_DEFINED
47 typedef long time_t;
48 #define _TIME_T_DEFINED
49 #endif
50 
51 #ifndef ARC_DECSTRACT
52 #define ARC_DECSTRACT
53 /* #define void *HGLOBAL */
54 
55 #include <wtypes.h>
56 
57 typedef	HGLOBAL	HARC;
58 
59 typedef struct {
60 	DWORD 			dwOriginalSize;
61 	DWORD 			dwCompressedSize;
62 	DWORD			dwCRC;
63 	UINT			uFlag;
64 	UINT			uOSType;
65 	WORD			wRatio;
66 	WORD			wDate;
67 	WORD 			wTime;
68 	char			szFileName[FNAME_MAX32 + 1];
69 	char			dummy1[3];
70 	char			szAttribute[8];
71 	char			szMode[8];
72 }	INDIVIDUALINFO;
73 
74 typedef INDIVIDUALINFO *LPINDIVIDUALINFO;
75 
76 /* only declare struct( NO IMPLEMENTED )*/
77 typedef struct {
78 	DWORD 			dwFileSize;
79 	DWORD			dwWriteSize;
80 	char			szSourceFileName[FNAME_MAX32 + 1];
81 	char			dummy1[3];
82 	char			szDestFileName[FNAME_MAX32 + 1];
83 	char			dummy[3];
84 }	EXTRACTINGINFO;
85 typedef struct {
86 	EXTRACTINGINFO exinfo;
87 	DWORD dwCompressedSize;
88 	DWORD dwCRC;
89 	UINT  uOSType;
90 	WORD  wRatio;
91 	WORD  wDate;
92 	WORD  wTime;
93 	char  szAttribute[8];
94 	char  szMode[8];
95 } EXTRACTINGINFOEX;
96 typedef BOOL CALLBACK ARCHIVERPROC(HWND _hwnd,UINT _uMsg,UINT _nState, EXTRACTINGINFOEX * _lpEis);
97 
98 #endif
99 
100 #if !defined(__BORLANDC__)
101 #pragma pack()
102 #else
103 #pragma option -a.
104 #endif
105 
106 #if !defined(__BORLANDC__)
107 #define	_export
108 #endif
109 
110 #ifdef __cplusplus
111 extern "C" {
112 #endif
113 WORD WINAPI _export TarGetVersion(VOID);
114 
115 BOOL WINAPI _export TarGetRunning(VOID);
116 
117 BOOL WINAPI _export TarGetBackGroundMode(VOID);/* NO IMPLEMENT:return FALSE */
118 BOOL WINAPI _export TarSetBackGroundMode(const BOOL _BackGroundMode);/* NO IMPLEMENT:return FALSE */
119 BOOL WINAPI _export TarGetCursorMode(VOID);/* NO IMPLEMENT:return FALSE */
120 BOOL WINAPI _export TarSetCursorMode(const BOOL _CursorMode);/* NO IMPLEMENT:return FALSE */
121 WORD WINAPI _export TarGetCursorInterval(VOID);/* NO IMPLEMENT:return 80 */
122 BOOL WINAPI _export TarSetCursorInterval(const WORD _Interval);/* NO IMPLEMENT:return FALSE */
123 
124 int WINAPI _export Tar(const HWND _hwnd, LPCSTR _szCmdLine,LPSTR _szOutput, const DWORD _dwSize);
125 /* NO IMPLEMENT:return -1 */
126 int WINAPI _export TarExtractMem(const HWND _hwndParent,LPCSTR _szCmdLine, LPBYTE _lpBuffer, const DWORD _dwSize,time_t *_lpTime, LPWORD _lpwAttr, LPDWORD _lpdwWriteSize);
127 /* NO IMPLEMENT:return -1 */
128 int WINAPI _export TarCompressMem(const HWND _hwndParent,LPCSTR _szCmdLine, const LPBYTE _lpBuffer, const DWORD _dwSize,const time_t *_lpTime, const LPWORD _lpwAttr,LPDWORD _lpdwWriteSize);
129 BOOL WINAPI _export TarCheckArchive(LPCSTR _szFileName, const int _iMode);
130 /* Simple Dialog Only :return TRUE */
131 BOOL WINAPI _export TarConfigDialog(const HWND _hwnd, LPSTR _lpszComBuffer,const int _iMode);
132 int WINAPI _export TarGetFileCount(LPCSTR _szArcFile);
133 HARC WINAPI _export TarOpenArchive(const HWND _hwnd, LPCSTR _szFileName,const DWORD _dwMode);
134 int WINAPI _export TarCloseArchive(HARC _harc);
135 int WINAPI _export TarFindFirst(HARC _harc, LPCSTR _szWildName,INDIVIDUALINFO *_lpSubInfo);
136 int WINAPI _export TarFindNext(HARC _harc, INDIVIDUALINFO *_lpSubInfo);
137 int WINAPI _export TarGetArcFileName(HARC _harc, LPSTR _lpBuffer,const int _nSize);
138 
139 DWORD WINAPI _export TarGetArcFileSize(HARC _harc);
140 DWORD WINAPI _export TarGetArcOriginalSize(HARC _harc);
141 /* NO IMPLEMENT:return 0: */
142 DWORD WINAPI _export TarGetArcCompressedSize(HARC _harc);
143 /* NO IMPLEMENT:return 0: */
144 WORD WINAPI _export TarGetArcRatio(HARC _harc);
145 WORD WINAPI _export TarGetArcDate(HARC _harc);
146 WORD WINAPI _export TarGetArcTime(HARC _harc);
147 /* NO IMPLEMENT:return -1: */
148 UINT WINAPI _export TarGetArcOSType(HARC _harc);
149 int WINAPI _export TarGetFileName(HARC _harc, LPSTR _lpBuffer,
150 							const int _nSize);
151 int WINAPI _export TarGetMethod(HARC _harc, LPSTR _lpBuffer,
152 							const int _nSize);
153 BOOL WINAPI _export TarGetOriginalSizeEx(HARC _harc, __int64 *_lpllSize);
154 DWORD WINAPI _export TarGetOriginalSize(HARC _harc);
155 BOOL WINAPI _export TarGetCompressedSizeEx(HARC _harc, __int64 *_lpllSize);
156 DWORD WINAPI _export TarGetCompressedSize(HARC _harc);
157 WORD WINAPI _export TarGetRatio(HARC _harc);
158 WORD WINAPI _export TarGetDate(HARC _harc);
159 WORD WINAPI _export TarGetTime(HARC _harc);
160 DWORD WINAPI _export TarGetWriteTime(HARC _harc);
161 DWORD WINAPI _export TarGetAccessTime(HARC _harc);
162 DWORD WINAPI _export TarGetCreateTime(HARC _harc);
163 DWORD WINAPI _export TarGetCRC(HARC _harc);
164 int WINAPI _export TarGetAttribute(HARC _harc);
165 UINT WINAPI _export TarGetOSType(HARC _harc);
166 
167 BOOL WINAPI _export TarQueryFunctionList(const int _iFunction);
168 
169 BOOL WINAPI _export TarSetOwnerWindow(const HWND _hwnd);
170 BOOL WINAPI _export TarClearOwnerWindow(void);
171 BOOL WINAPI _export TarSetOwnerWindowEx(HWND _hwnd,ARCHIVERPROC *_lpArcProc);
172 BOOL WINAPI _export TarKillOwnerWindowEx(HWND _hwnd);
173 
174 int WINAPI _export TarGetArchiveType(LPCSTR _szFileName);
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #define	WM_ARCEXTRACT	"wm_arcextract"
181 
182 #define	ARCEXTRACT_BEGIN		0	/* �Y���t�@�C���̏����̊J�n */
183 #define	ARCEXTRACT_INPROCESS	1	/* �Y���t�@�C���̓W�J�� */
184 #define	ARCEXTRACT_END			2	/* �����I���A�֘A���������J�� */
185 #define ARCEXTRACT_OPEN			3	/* �Y�����ɂ̏����̊J�n */
186 #define ARCEXTRACT_COPY			4	/* ���[�N�t�@�C���̏����߂� */
187 
188 #define	UNPACK_CONFIG_MODE		1
189 #define PACK_CONFIG_MODE		2
190 
191 #define	CHECKARCHIVE_RAPID		0
192 #define	CHECKARCHIVE_BASIC		1
193 #define	CHECKARCHIVE_FULLCRC	2
194 
195 #if !defined(EXTRACT_FOUND_FILE)
196 /* MODE (for ???OpenArchive) */
197 #define M_INIT_FILE_USE			0x00000001L
198 #define M_REGARDLESS_INIT_FILE	0x00000002L
199 #define M_CHECK_ALL_PATH		0x00000100L
200 #define M_CHECK_FILENAME_ONLY	0x00000200L
201 #define M_USE_DRIVE_LETTER		0x00001000L
202 #define M_NOT_USE_DRIVE_LETTER	0x00002000L
203 #define M_ERROR_MESSAGE_ON		0x00400000L
204 #define M_ERROR_MESSAGE_OFF		0x00800000L
205 #define M_ERROR_MESSAGE_ON		0x00400000L	/* �G���[���b�Z�[�W��\�� */
206 #define M_ERROR_MESSAGE_OFF		0x00800000L	/* �V��\�����Ȃ� */
207 #define M_BAR_WINDOW_ON			0x01000000L
208 #define M_BAR_WINDOW_OFF		0x02000000L
209 
210 #define EXTRACT_FOUND_FILE		0x40000000L
211 #define EXTRACT_NAMED_FILE		0x80000000L
212 #endif /* EXTRACT_FOUND_FILE */
213 
214 #if !defined(ISARC_FUNCTION_START)
215 #define ISARC_FUNCTION_START			0
216 #define ISARC							0
217 #define ISARC_GET_VERSION				1
218 #define ISARC_GET_CURSOR_INTERVAL		2
219 #define ISARC_SET_CURSOR_INTERVAL		3
220 #define ISARC_GET_BACK_GROUND_MODE		4
221 #define ISARC_SET_BACK_GROUND_MODE		5
222 #define ISARC_GET_CURSOR_MODE			6
223 #define ISARC_SET_CURSOR_MODE			7
224 #define ISARC_GET_RUNNING				8
225 
226 #define ISARC_CHECK_ARCHIVE				16
227 #define ISARC_CONFIG_DIALOG				17
228 #define ISARC_GET_FILE_COUNT			18
229 #define ISARC_QUERY_FUNCTION_LIST		19
230 #define ISARC_HOUT						20
231 #define ISARC_STRUCTOUT					21
232 #define ISARC_GET_ARC_FILE_INFO			22
233 
234 #define ISARC_OPEN_ARCHIVE				23
235 #define ISARC_CLOSE_ARCHIVE				24
236 #define ISARC_FIND_FIRST				25
237 #define ISARC_FIND_NEXT					26
238 #define ISARC_EXTRACT					27
239 #define ISARC_ADD						28
240 #define ISARC_MOVE						29
241 #define ISARC_DELETE					30
242 #define ISARC_SETOWNERWINDOW			31	/* UnlhaSetOwnerWindow */
243 #define ISARC_CLEAROWNERWINDOW			32	/* UnlhaClearOwnerWindow */
244 #define ISARC_SETOWNERWINDOWEX			33	/* UnlhaSetOwnerWindowEx */
245 #define ISARC_KILLOWNERWINDOWEX			34	/* UnlhaKillOwnerWindowEx */
246 
247 #define ISARC_GET_ARC_FILE_NAME			40
248 #define ISARC_GET_ARC_FILE_SIZE			41
249 #define ISARC_GET_ARC_ORIGINAL_SIZE		42
250 #define ISARC_GET_ARC_COMPRESSED_SIZE	43
251 #define ISARC_GET_ARC_RATIO				44
252 #define ISARC_GET_ARC_DATE				45
253 #define ISARC_GET_ARC_TIME				46
254 #define ISARC_GET_ARC_OS_TYPE			47
255 #define ISARC_GET_ARC_IS_SFX_FILE		48
256 #define ISARC_GET_FILE_NAME				57
257 #define ISARC_GET_ORIGINAL_SIZE			58
258 #define ISARC_GET_COMPRESSED_SIZE		59
259 #define ISARC_GET_RATIO					60
260 #define ISARC_GET_DATE					61
261 #define ISARC_GET_TIME					62
262 #define ISARC_GET_CRC					63
263 #define ISARC_GET_ATTRIBUTE				64
264 #define ISARC_GET_OS_TYPE				65
265 #define ISARC_GET_METHOD				66
266 #define ISARC_GET_WRITE_TIME			67
267 #define ISARC_GET_CREATE_TIME			68
268 #define ISARC_GET_ACCESS_TIME			69
269 
270 #define ISARC_GET_ORIGINAL_SIZE_EX		85	/* UnlhaGetOriginalSizeEx */
271 #define ISARC_GET_COMPRESSED_SIZE_EX	86	/* UnlhaGetCompressedSizeEx */
272 
273 
274 #define ISARC_FUNCTION_END				100
275 #endif	/* ISARC_FUNCTION_START */
276 
277 #ifndef FA_RDONLY
278 /* Attribute */
279 #define FA_RDONLY       0x01            /* Read only attribute */
280 #define FA_HIDDEN       0x02            /* Hidden file */
281 #define FA_SYSTEM       0x04            /* System file */
282 #define FA_LABEL        0x08            /* Volume label */
283 #define FA_DIREC        0x10            /* Directory */
284 #define FA_ARCH         0x20            /* Archive */
285 #endif
286 
287 #ifndef ERROR_ARC_FILE_OPEN
288 /* WARNING */
289 #define ERROR_DISK_SPACE		0x8005
290 #define ERROR_READ_ONLY			0x8006
291 #define ERROR_USER_SKIP			0x8007
292 #define ERROR_UNKNOWN_TYPE		0x8008
293 #define ERROR_METHOD			0x8009
294 #define ERROR_PASSWORD_FILE		0x800A
295 #define ERROR_VERSION			0x800B
296 #define ERROR_FILE_CRC			0x800C
297 #define ERROR_FILE_OPEN			0x800D
298 #define ERROR_MORE_FRESH		0x800E
299 #define ERROR_NOT_EXIST			0x800F
300 #define ERROR_ALREADY_EXIST		0x8010
301 
302 #define ERROR_TOO_MANY_FILES	0x8011
303 
304 /* ERROR */
305 #define ERROR_MAKEDIRECTORY		0x8012
306 #define ERROR_CANNOT_WRITE		0x8013
307 #define ERROR_HUFFMAN_CODE		0x8014
308 #define ERROR_COMMENT_HEADER	0x8015
309 #define ERROR_HEADER_CRC		0x8016
310 #define ERROR_HEADER_BROKEN		0x8017
311 #define ERROR_ARC_FILE_OPEN		0x8018
312 #define ERROR_NOT_ARC_FILE		0x8019
313 #define ERROR_CANNOT_READ		0x801A
314 #define ERROR_FILE_STYLE		0x801B
315 #define ERROR_COMMAND_NAME		0x801C
316 #define ERROR_MORE_HEAP_MEMORY	0x801D
317 #define ERROR_ENOUGH_MEMORY		0x801E
318 #if !defined(ERROR_ALREADY_RUNNING)
319 #define ERROR_ALREADY_RUNNING	0x801F
320 #endif
321 #define ERROR_USER_CANCEL		0x8020
322 #define ERROR_HARC_ISNOT_OPENED	0x8021
323 #define ERROR_NOT_SEARCH_MODE	0x8022
324 #define ERROR_NOT_SUPPORT		0x8023
325 #define ERROR_TIME_STAMP		0x8024
326 #define ERROR_TMP_OPEN			0x8025
327 #define ERROR_LONG_FILE_NAME	0x8026
328 #define ERROR_ARC_READ_ONLY		0x8027
329 #define ERROR_SAME_NAME_FILE	0x8028
330 #define ERROR_NOT_FIND_ARC_FILE 0x8029
331 #define ERROR_RESPONSE_READ		0x802A
332 #define ERROR_NOT_FILENAME		0x802B
333 #define ERROR_TMP_COPY			0x802C
334 #define ERROR_EOF				0x802D
335 #define ERROR_ADD_TO_LARC		0x802E
336 #define ERROR_TMP_BACK_SPACE	0x802F
337 #define ERROR_SHARING			0x8030
338 #define ERROR_NOT_FIND_FILE		0x8031
339 #define ERROR_LOG_FILE			0x8032
340 #define	ERROR_NO_DEVICE			0x8033
341 #define ERROR_GET_ATTRIBUTES	0x8034
342 #define ERROR_SET_ATTRIBUTES	0x8035
343 #define ERROR_GET_INFORMATION	0x8036
344 #define ERROR_GET_POINT			0x8037
345 #define ERROR_SET_POINT			0x8038
346 #define ERROR_CONVERT_TIME		0x8039
347 #define ERROR_GET_TIME			0x803a
348 #define ERROR_SET_TIME			0x803b
349 #define ERROR_CLOSE_FILE		0x803c
350 #define ERROR_HEAP_MEMORY		0x803d
351 #define ERROR_HANDLE			0x803e
352 #define ERROR_TIME_STAMP_RANGE	0x803f
353 
354 #define ERROR_END	ERROR_TIME_STAMP_RANGE
355 #endif /* ERROR_ARC_FILE_OPEN */
356 
357 #define ARCHIVETYPE_NORMAL 0
358 #define ARCHIVETYPE_TAR 1
359 #define ARCHIVETYPE_TARGZ 2
360 #define ARCHIVETYPE_TARZ 3
361 #define ARCHIVETYPE_GZ 4
362 #define ARCHIVETYPE_Z 5
363 #define ARCHIVETYPE_TARBZ2 6
364 #define ARCHIVETYPE_BZ2	7
365 
366 #define ARCHIVETYPE_CPIO	32
367 #define ARCHIVETYPE_CPIOGZ	32+4
368 #define ARCHIVETYPE_CPIOZ	32+5
369 #define ARCHIVETYPE_CPIOBZ2	32+7
370 
371 #define ARCHIVETYPE_AR		48
372 #define ARCHIVETYPE_ARGZ	48+4
373 #define ARCHIVETYPE_ARZ		48+5
374 #define ARCHIVETYPE_ARBZ2	48+7
375 
376 #endif // TAR32API_H
377 
378