Subversion Repositories Kolibri OS

Rev

Rev 7159 | Rev 7162 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7159 Rev 7161
1
;unz - à á¯ ª®¢é¨ª, ¨á¯®«ì§ãî騩 archiver.obj. ®¤¤¥à¦¨¢ ¥â zip ¨ 7z.
1
;unz - à á¯ ª®¢é¨ª, ¨á¯®«ì§ãî騩 archiver.obj. ®¤¤¥à¦¨¢ ¥â zip ¨ 7z.
2
 
2
 
3
;unz [-o output path] [-f file for unpack] [-f ...] [-h] file.zip
3
;unz [-o output path] [-f file for unpack] [-f ...] [-h] file.zip
4
;-h - hide GUI. If params is empty - do exit.
4
;-h - hide GUI. If params is empty - do exit.
5
 
5
 
6
;unz -o /hd0/1/arci -f text1.txt file.zip -unpack in folder only file text1.txt
6
;unz -o /hd0/1/arci -f text1.txt file.zip -unpack in folder only file text1.txt
7
;or
7
;or
8
;unz -o "/hd0/1/arci" -f "text1.txt" text2.txt "file.zip" -unpack in folder only file text1.txt and text2.txt
8
;unz -o "/hd0/1/arci" -f "text1.txt" text2.txt "file.zip" -unpack in folder only file text1.txt and text2.txt
9
 
9
 
10
 
10
 
11
;… …€‹ˆ‡Ž‚€Ž
11
;… …€‹ˆ‡Ž‚€Ž
12
;unz -n "namezone" "file.zip"  - open packed file, write list files of main folder in namezone
12
;unz -n "namezone" "file.zip"  - open packed file, write list files of main folder in namezone
13
;namezone:
13
;namezone:
14
;dd 0 - ¥á«¨ ¨¬¥­­®¢ ­ ï §®­  § ­ïâ , â® 1
14
;dd 0 - ¥á«¨ ¨¬¥­­®¢ ­ ï §®­  § ­ïâ , â® 1
15
;dd cmd - 0 ­¥â ª®¬ ­¤ë
15
;dd cmd - 0 ­¥â ª®¬ ­¤ë
16
;         1 ¯®«ãç¨âì ᯨ᮪ ä ©«®¢
16
;         1 ¯®«ãç¨âì ᯨ᮪ ä ©«®¢
17
;         2 ¯®«ãç¨âì ä ©«
17
;         2 ¯®«ãç¨âì ä ©«
18
;         3 ãáâ ­®¢¨âì ⥪ã訩 ª â «®£ ¢  à娢¥
18
;         3 ãáâ ­®¢¨âì ⥪ã訩 ª â «®£ ¢  à娢¥
19
;         4 § ¢¥àè¨âì à ¡®âã
19
;         4 § ¢¥àè¨âì à ¡®âã
20
;data - ¤ ­­ë¥, § ¢¨á¨â ®â ª®¬¬ ­¤ë
20
;data - ¤ ­­ë¥, § ¢¨á¨â ®â ª®¬¬ ­¤ë
21
; 1 ¯®«ãç¨âì ᯨ᮪ ä ©«®¢
21
; 1 ¯®«ãç¨âì ᯨ᮪ ä ©«®¢
22
; input
22
; input
23
;   none
23
;   none
24
; output
24
; output
25
;   dd numfiles - ª®«¨ç¥á⢮ ä ©«®¢ ¨ ¯ ¯®ª ¢ ⥪ã饬 ª â «®£¥
25
;   dd numfiles - ª®«¨ç¥á⢮ ä ©«®¢ ¨ ¯ ¯®ª ¢ ⥪ã饬 ª â «®£¥
26
;   strz file1...fileN - ᯨ᮪ áâப, à §¤¥«ñ­­ëå 0
26
;   strz file1...fileN - ᯨ᮪ áâப, à §¤¥«ñ­­ëå 0
27
; 2 ¯®«ãç¨âì ä ©«
27
; 2 ¯®«ãç¨âì ä ©«
28
; input
28
; input
29
;   dd num bytes
29
;   dd num bytes
30
;   strz filename (file1.txt of /fold1/file1.txt)
30
;   strz filename (file1.txt of /fold1/file1.txt)
31
; output
31
; output
32
;   dd num bytes
32
;   dd num bytes
33
;   data
33
;   data
34
 
34
 
35
use32
35
use32
36
org    0
36
org    0
37
db     'MENUET01'
37
db     'MENUET01'
38
dd     1, start, init_end, end_mem, stack_top, params,	0
38
dd     1, start, init_end, end_mem, stack_top, params,	0
39
 
39
 
40
 
40
 
41
include 'lang.inc'
41
include 'lang.inc'
42
include '../../macros.inc'
42
include '../../macros.inc'
43
include '../../proc32.inc'
43
include '../../proc32.inc'
44
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
44
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
45
include '../../dll.inc'
45
include '../../dll.inc'
46
include 'debug.inc'
46
include 'debug.inc'
47
 
47
 
48
version equ '0.65'
48
version equ '0.65'
49
version_dword equ 0*10000h + 65
49
version_dword equ 0*10000h + 65
50
 
50
 
51
WIN_W = 400
51
WIN_W = 400
52
 
52
 
53
SIZE_COPY_BUF = 1024*1024*2
53
SIZE_COPY_BUF = 1024*1024*2
54
 
54
 
55
virtual at 0
55
virtual at 0
56
kfar_info_struc:
56
kfar_info_struc:
57
.lStructSize	dd	?
57
.lStructSize	dd	?
58
.kfar_ver	dd	?
58
.kfar_ver	dd	?
59
.open		dd	?
59
.open		dd	?
60
.open2		dd	?
60
.open2		dd	?
61
.read		dd	?
61
.read		dd	?
62
.write		dd	?
62
.write		dd	?
63
.seek		dd	?
63
.seek		dd	?
64
.tell		dd	?
64
.tell		dd	?
65
.flush		dd	?
65
.flush		dd	?
66
.filesize	dd	?
66
.filesize	dd	?
67
.close		dd	?
67
.close		dd	?
68
.pgalloc	dd	?
68
.pgalloc	dd	?
69
.pgrealloc	dd	?
69
.pgrealloc	dd	?
70
.pgfree 	dd	?
70
.pgfree 	dd	?
71
.getfreemem	dd	?
71
.getfreemem	dd	?
72
.pgalloc2	dd	?
72
.pgalloc2	dd	?
73
.pgrealloc2	dd	?
73
.pgrealloc2	dd	?
74
.pgfree2	dd	?
74
.pgfree2	dd	?
75
.menu		dd	?
75
.menu		dd	?
76
.menu_centered_in dd	?
76
.menu_centered_in dd	?
77
.DialogBox	dd	?
77
.DialogBox	dd	?
78
.SayErr 	dd	?
78
.SayErr 	dd	?
79
.Message	dd	?
79
.Message	dd	?
80
.cur_console_size dd	?
80
.cur_console_size dd	?
81
end virtual
81
end virtual
82
 
82
 
83
 
83
 
84
 
84
 
85
 
85
 
86
 
86
 
87
include 'parse.inc'
87
include 'parse.inc'
88
include 'fs.inc'
88
include 'fs.inc'
89
 
89
 
90
;--  CODE  -------------------------------------------------------------------
90
;--  CODE  -------------------------------------------------------------------
91
 
91
 
92
 
92
 
93
start:
93
start:
94
	mcall	68, 11
94
	mcall	68, 11
95
	mcall	40, 100111b + 0C0000000h
95
	mcall	40, 100111b + 0C0000000h
96
	stdcall dll.Load, IMPORTS
96
	stdcall dll.Load, IMPORTS
97
	test	eax, eax
97
	test	eax, eax
98
	jnz	exit
98
	jnz	exit
99
	mov	[pathOut],0
99
	mov	[pathOut],0
100
 
100
 
101
;stdcall SayErr,strErrorExc
101
;stdcall SayErr,strErrorExc
102
;mcall -1
102
;mcall -1
103
;----------------------------
103
;----------------------------
104
	;1. find input file, clear
104
	;1. find input file, clear
105
	;2. find -o, copy data, clear
105
	;2. find -o, copy data, clear
106
	;3. find -f, add pointer, copy data, clear
106
	;3. find -f, add pointer, copy data, clear
107
	;4. find -c, check variable, clear
107
	;4. find -c, check variable, clear
108
;1.
108
;1.
109
	call	getLastParam
109
	call	getLastParam
110
	test	eax, eax
110
	test	eax, eax
111
	je	wm_redraw
111
	je	wm_redraw
112
	dec	eax
112
	dec	eax
113
	je	.arbeit
113
	je	.arbeit
114
	jmp	errorParsing
114
	jmp	errorParsing
115
 
115
 
116
.arbeit:
116
.arbeit:
117
;2.
117
;2.
118
	call	getParam2
118
	call	getParam2
119
	cmp	eax, 2
119
	cmp	eax, 2
120
	je	errorParsing
120
	je	errorParsing
121
 
121
 
122
;3.
122
;3.
123
 
123
 
124
   @@:
124
   @@:
125
	mov	eax, [iFiles]
125
	mov	eax, [iFiles]
126
	shl	eax, 2
126
	shl	eax, 2
127
	add	eax, files
127
	add	eax, files
128
	m2m	dword[eax], dword[endPointer]
128
	m2m	dword[eax], dword[endPointer]
129
	stdcall getParam, '-f'
129
	stdcall getParam, '-f'
130
	cmp	eax, 2
130
	cmp	eax, 2
131
	je	errorParsing
131
	je	errorParsing
132
	inc	[iFiles]
132
	inc	[iFiles]
133
	cmp	eax, 1
133
	cmp	eax, 1
134
	je	@b
134
	je	@b
135
 
135
 
136
;4.
136
;4.
137
	mov	edi, params
137
	mov	edi, params
138
	mov	ax,'-h'
138
	mov	ax,'-h'
139
@@:	cmp	word [edi], ax
139
@@:	cmp	word [edi], ax
140
	je	.check
140
	je	.check
141
	inc	edi
141
	inc	edi
142
	cmp	edi, params+1024
142
	cmp	edi, params+1024
143
	je	@f
143
	je	@f
144
	cmp	byte[edi],0
144
	cmp	byte[edi],0
145
	je	@f
145
	je	@f
146
	jmp	@b
146
	jmp	@b
147
.check:
147
.check:
148
	call	startUnpack
148
	call	startUnpack
149
	mcall	-1
149
	mcall	-1
150
@@:
150
@@:
151
	stdcall [OpenDialog_Init],OpenDialog_data
151
	stdcall [OpenDialog_Init],OpenDialog_data
152
 
152
 
153
;init edit fields  --------------
153
;init edit fields  --------------
154
	xor	al,al
154
	xor	al,al
155
	mov	edi,fInp
155
	mov	edi,fInp
156
	mov	ecx,1024
156
	mov	ecx,1024
157
	repne	scasb
157
	repne	scasb
158
	inc	ecx
158
	inc	ecx
159
	mov	eax,1024
159
	mov	eax,1024
160
	sub	eax,ecx
160
	sub	eax,ecx
161
	mov	dword[edtPack.size],eax
161
	mov	dword[edtPack.size],eax
162
	mov	dword[edtPack.pos],eax
162
	mov	dword[edtPack.pos],eax
163
 
163
 
164
	xor	al, al
164
	xor	al, al
165
	mov	edi, pathOut
165
	mov	edi, pathOut
166
	mov	ecx, 1024
166
	mov	ecx, 1024
167
	repne	scasb
167
	repne	scasb
168
	inc	ecx
168
	inc	ecx
169
	mov	eax, 1024
169
	mov	eax, 1024
170
	sub	eax, ecx
170
	sub	eax, ecx
171
	mov	dword[edtUnpPath.size], eax
171
	mov	dword[edtUnpPath.size], eax
172
	mov	dword[edtUnpPath.pos], eax
172
	mov	dword[edtUnpPath.pos], eax
173
 
173
 
174
 
174
 
175
;main loop --------------------
175
;main loop --------------------
176
wm_redraw:
176
wm_redraw:
177
	call winRedraw
177
	call winRedraw
178
 
178
 
179
still:
179
still:
180
	mcall	10
180
	mcall	10
181
	cmp	eax, 1
181
	cmp	eax, 1
182
	je	wm_redraw
182
	je	wm_redraw
183
	cmp	eax, 2
183
	cmp	eax, 2
184
	je	wm_key
184
	je	wm_key
185
	cmp	eax, 3
185
	cmp	eax, 3
186
	je	wm_button
186
	je	wm_button
187
	cmp	eax, 6
187
	cmp	eax, 6
188
	je	wm_mouse
188
	je	wm_mouse
189
 
189
 
190
	jmp	still
190
	jmp	still
191
 
191
 
192
wm_key:
192
wm_key:
193
	mcall	2
193
	mcall	2
194
	cmp	[bWinChild],0
194
	cmp	[bWinChild],0
195
	jne	still
195
	jne	still
196
 
196
 
197
	stdcall [edit_box_key],edtPack
197
	stdcall [edit_box_key],edtPack
198
	stdcall [edit_box_key],edtUnpPath
198
	stdcall [edit_box_key],edtUnpPath
199
 
199
 
200
	jmp	still
200
	jmp	still
201
 
201
 
202
 
202
 
203
wm_button:
203
wm_button:
204
	mcall	17
204
	mcall	17
205
	cmp	[bWinChild],0
205
	cmp	[bWinChild],0
206
	jne	still
206
	jne	still
207
 
207
 
208
	cmp	ah, 3
208
	cmp	ah, 3
209
	jne	@f
209
	jne	@f
210
	call selectInput
210
	call selectInput
211
	jmp	wm_redraw
211
	jmp	wm_redraw
212
    @@:
212
    @@:
213
	cmp	ah, 4
213
	cmp	ah, 4
214
	jne	@f
214
	jne	@f
215
	call selectOutFold
215
	call selectOutFold
216
	jmp	wm_redraw
216
	jmp	wm_redraw
217
    @@:
217
    @@:
218
 
218
 
219
	cmp	ah, 2
219
	cmp	ah, 2
220
	jne	@f
220
	jne	@f
221
	;mcall   51,1,startUnpack,stackUnpack
221
	;mcall   51,1,startUnpack,stackUnpack
222
	;mov     [bWinChild],1
222
	;mov     [bWinChild],1
223
	call   startUnpack
223
	call   startUnpack
224
	jmp	wm_redraw
224
	jmp	wm_redraw
225
    @@:
225
    @@:
226
 
226
 
227
	cmp	ah, 1
227
	cmp	ah, 1
228
	je	exit
228
	je	exit
229
	jmp	still
229
	jmp	still
230
 
230
 
231
wm_mouse:
231
wm_mouse:
232
	cmp	[bWinChild],0
232
	cmp	[bWinChild],0
233
	jne	still
233
	jne	still
234
	stdcall [edit_box_mouse],edtPack
234
	stdcall [edit_box_mouse],edtPack
235
	stdcall [edit_box_mouse],edtUnpPath
235
	stdcall [edit_box_mouse],edtUnpPath
236
 
236
 
237
	jmp	still
237
	jmp	still
238
 
238
 
239
exit:
239
exit:
240
	mcall	-1
240
	mcall	-1
241
 
241
 
242
errorParsing:
242
errorParsing:
243
	dps 'errorParsing'
243
	dps 'errorParsing'
244
	mcall	-1
244
	mcall	-1
245
 
245
 
246
;--- functions ------------------------------------------------------------------
246
;--- functions ------------------------------------------------------------------
247
 
247
 
248
proc winRedraw
248
proc winRedraw
249
	mcall 12, 1
249
	mcall 12, 1
250
	mcall 48, 3, sc, sizeof.system_colors
250
	mcall 48, 3, sc, sizeof.system_colors
251
	mov   edx, [sc.work]
251
	mov   edx, [sc.work]
252
	or	  edx, 0x34000000
252
	or	  edx, 0x34000000
253
	mcall 0, <200,WIN_W>, <200,130>, , , title
253
	mcall 0, <200,WIN_W>, <200,130>, , , title
254
	mcall 8, <100,100>,<65,25>,2,[sc.work_button]
254
	mcall 8, <100,100>,<65,25>,2,[sc.work_button]
255
	mcall 8, <(WIN_W-52),33>,<10,20>,3,[sc.work_button]
255
	mcall 8, <(WIN_W-52),33>,<10,20>,3,[sc.work_button]
256
	mcall 8, <(WIN_W-52),33>,<35,20>,4,[sc.work_button]
256
	mcall 8, <(WIN_W-52),33>,<35,20>,4,[sc.work_button]
257
 
257
 
258
	edit_boxes_set_sys_color edtPack,endEdits,sc
258
	edit_boxes_set_sys_color edtPack,endEdits,sc
259
	stdcall [edit_box_draw],edtPack
259
	stdcall [edit_box_draw],edtPack
260
	stdcall [edit_box_draw],edtUnpPath
260
	stdcall [edit_box_draw],edtUnpPath
261
 
261
 
262
	; plain window labels
262
	; plain window labels
263
	cmp	[redInput],0
263
	cmp	[redInput],0
264
	jne	@f
264
	jne	@f
265
	mov	ecx,[sc.work_text]
265
	mov	ecx,[sc.work_text]
266
	or	ecx,90000000h
266
	or	ecx,90000000h
267
	jmp	.l1
267
	jmp	.l1
268
      @@:
268
      @@:
269
	mov	 ecx,90FF0000h
269
	mov	 ecx,90FF0000h
270
     .l1:
270
     .l1:
271
	mcall 4, <15,16>, , strInp
271
	mcall 4, <15,16>, , strInp
272
	mov	ecx,[sc.work_text]
272
	mov	ecx,[sc.work_text]
273
	or	ecx,90000000h
273
	or	ecx,90000000h
274
	mcall 4, <15,37>, , strPath
274
	mcall 4, <15,37>, , strPath
275
	
275
	
276
	; text on buttons
276
	; text on buttons
277
	mov	ecx,[sc.work_button_text]
277
	mov	ecx,[sc.work_button_text]
278
	or	ecx,90000000h
278
	or	ecx,90000000h
279
if lang eq ru
279
if lang eq ru
280
	mcall 4, <107,70>, , strGo
280
	mcall 4, <107,70>, , strGo
281
else
281
else
282
	mcall 4, <127,70>, , strGo
282
	mcall 4, <127,70>, , strGo
283
end if
283
end if
284
	mcall 4, <(WIN_W-47),12>, , strDots
284
	mcall 4, <(WIN_W-47),12>, , strDots
285
	mcall 4, <(WIN_W-47),37>, , strDots	
285
	mcall 4, <(WIN_W-47),37>, , strDots	
286
 
286
 
287
	mcall 12, 2
287
	mcall 12, 2
288
	ret
288
	ret
289
endp
289
endp
290
 
290
 
291
;region
291
;region
292
selectInput:
292
selectInput:
293
	mov	[OpenDialog_data.type],0
293
	mov	[OpenDialog_data.type],0
294
	stdcall [OpenDialog_Start],OpenDialog_data
294
	stdcall [OpenDialog_Start],OpenDialog_data
295
	mov	edi,ODAreaPath
295
	mov	edi,ODAreaPath
296
	xor	al,al
296
	xor	al,al
297
	or	ecx,-1
297
	or	ecx,-1
298
	repne	scasb
298
	repne	scasb
299
	sub	edi,ODAreaPath
299
	sub	edi,ODAreaPath
300
	dec	edi
300
	dec	edi
301
	mov	dword[edtPack+12*4],edi
301
	mov	dword[edtPack+12*4],edi
302
	mov	ecx,edi
302
	mov	ecx,edi
303
	inc	ecx
303
	inc	ecx
304
	mov	edi,fInp
304
	mov	edi,fInp
305
	mov	esi,ODAreaPath
305
	mov	esi,ODAreaPath
306
	rep	movsb
306
	rep	movsb
307
	mov	[redInput],0
307
	mov	[redInput],0
308
	ret
308
	ret
309
;endregion
309
;endregion
310
 
310
 
311
;region
311
;region
312
selectOutFold:
312
selectOutFold:
313
	mov	[OpenDialog_data.type],2
313
	mov	[OpenDialog_data.type],2
314
	stdcall [OpenDialog_Start],OpenDialog_data
314
	stdcall [OpenDialog_Start],OpenDialog_data
315
	mov	edi,ODAreaPath
315
	mov	edi,ODAreaPath
316
	xor	al,al
316
	xor	al,al
317
	or	ecx,-1
317
	or	ecx,-1
318
	repne	scasb
318
	repne	scasb
319
	sub	edi,ODAreaPath
319
	sub	edi,ODAreaPath
320
	dec	edi
320
	dec	edi
321
	mov	dword[edtUnpPath+12*4],edi
321
	mov	dword[edtUnpPath+12*4],edi
322
	mov	ecx,edi
322
	mov	ecx,edi
323
	inc	ecx
323
	inc	ecx
324
	mov	edi,pathOut
324
	mov	edi,pathOut
325
	mov	esi,ODAreaPath
325
	mov	esi,ODAreaPath
326
	rep	movsb
326
	rep	movsb
327
	ret
327
	ret
328
;endregion
328
;endregion
329
 
329
 
330
 
330
 
331
;-------------------------------------------------------------------------------
331
;-------------------------------------------------------------------------------
332
 
332
 
333
allfiles dd 0
333
allfiles dd 0
334
succfiles dd 0
334
succfiles dd 0
335
numbytes dd 0
335
numbytes dd 0
336
 
336
 
337
proc startUnpack
337
proc startUnpack
338
locals
338
locals
339
  paramUnp	rd 1
339
  paramUnp	rd 1
340
  sizeUnpack	rd 1
340
  sizeUnpack	rd 1
341
  hFile rd 1
341
  hFile rd 1
342
  hFileZip rd 1
342
  hFileZip rd 1
343
  hPlugin rd 1
343
  hPlugin rd 1
344
  pathFold rb 256
344
  pathFold rb 256
345
endl
345
endl
346
;if input not corrected
346
;if input not corrected
347
	cmp	[fInp],byte 0
347
	cmp	[fInp],byte 0
348
	je	.errNullInp
348
	je	.errNullInp
349
 
349
 
350
    ;    mcall   68, 24, Exception, 0FFFFFFFFh ;??
350
    ;    mcall   68, 24, Exception, 0FFFFFFFFh ;??
351
;init plugin
351
;init plugin
352
	push	ebp
352
	push	ebp
353
	stdcall [aPluginLoad],kfar_info
353
	stdcall [aPluginLoad],kfar_info
354
	pop	ebp
354
	pop	ebp
355
 
355
 
356
 
356
 
357
;set current directory, create folder
357
;set current directory, create folder
358
	cmp	[pathOut],0
358
	cmp	[pathOut],0
359
	jne	@f
359
	jne	@f
360
	lea	eax,[pathFold]
360
	lea	eax,[pathFold]
361
	stdcall cpLastName, fInp, eax
361
	stdcall cpLastName, fInp, eax
362
	lea	eax,[pathFold]
362
	lea	eax,[pathFold]
363
	mov	[fsNewDir.path],eax
363
	mov	[fsNewDir.path],eax
364
	mcall	70, fsNewDir
364
	mcall	70, fsNewDir
365
	mov	ecx, [fsNewDir.path]
365
	mov	ecx, [fsNewDir.path]
366
 
366
 
367
	mcall	30,4,,1
367
	mcall	30,4,,1
368
	jmp	.n
368
	jmp	.n
369
@@:
369
@@:
370
	mcall	30,4,pathOut,1
370
	mcall	30,4,pathOut,1
371
.n:
371
.n:
372
 
372
 
373
;open and read first 1KB
373
;open and read first 1KB
374
	stdcall open, fInp, O_READ
374
	stdcall open, fInp, O_READ
375
	mov	[hFileZip], eax
375
	mov	[hFileZip], eax
376
	mcall	70,fsZip
376
	mcall	70,fsZip
377
	test	eax,eax
377
	test	eax,eax
378
	jnz	.errNotFound
378
	jnz	.errNotFound
379
	mcall	70,fsZipRead
379
	mcall	70,fsZipRead
380
 
380
 
381
 
381
 
382
;open pack
382
;open pack
383
	push	ebp
383
	push	ebp
384
	stdcall [aOpenFilePlugin],[hFileZip],bdvkPack,filedata_buffer,filedata_buffer_size ,0 ,0 , fInp
384
	stdcall [aOpenFilePlugin],[hFileZip],bdvkPack,filedata_buffer,filedata_buffer_size ,0 ,0 , fInp
385
	pop	ebp
385
	pop	ebp
386
 
386
 
387
	test	eax,eax
387
	test	eax,eax
388
	jnz	@f
388
	jnz	@f
389
	cmp	ebx,0		;;/ ŠŽ‘’›‹œ!!!!
389
	cmp	ebx,0		;;/ ŠŽ‘’›‹œ!!!!
390
	je	 .errNotFound	;;§­ ç¥­¨¥ ebx ¯®«ã祭® ®¯ëâ­ë¬ ¯ãâñ¬.
390
	je	 .errNotFound	;;§­ ç¥­¨¥ ebx ¯®«ã祭® ®¯ëâ­ë¬ ¯ãâñ¬.
391
	cmp	ebx,400h	;;ª ª ®­® ¡ã¤¥â à ¡®â âì á ¤à㣨¬¨ ¢¥àá¨ï¬¨
391
	cmp	ebx,400h	;;ª ª ®­® ¡ã¤¥â à ¡®â âì á ¤à㣨¬¨ ¢¥àá¨ï¬¨
392
	je	 .errNotSupp	;;¡¨¡«¨®â¥ª¨ - ­¥ ïá­®!
392
	je	 .errNotSupp	;;¡¨¡«¨®â¥ª¨ - ­¥ ïá­®!
393
      @@:
393
      @@:
394
	mov	[hPlugin],eax
394
	mov	[hPlugin],eax
395
 
395
 
396
;get num of all files
396
;get num of all files
397
;        stdcall calcSizeArch,[hPlugin]
397
;        stdcall calcSizeArch,[hPlugin]
398
;        push    ebp
398
;        push    ebp
399
;        stdcall [aReadFolder], [hPlugin]
399
;        stdcall [aReadFolder], [hPlugin]
400
;        pop     ebp
400
;        pop     ebp
401
 
401
 
402
 
402
 
403
 
403
 
404
;        push    ebp
404
;        push    ebp
405
;        stdcall [aOpen], [hPlugin], .str1, O_READ
405
;        stdcall [aOpen], [hPlugin], .str1, O_READ
406
;        pop     ebp
406
;        pop     ebp
407
;
407
;
408
;        push    ebp
408
;        push    ebp
409
;        stdcall [aSetpos],[hPlugin],0,POSEND
409
;        stdcall [aSetpos],[hPlugin],0,POSEND
410
;        pop     ebp
410
;        pop     ebp
411
;        add     [numbytes],eax
411
;        add     [numbytes],eax
412
 
412
 
413
 
413
 
414
 
414
 
415
;unpack
415
;unpack
416
;       void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir);
416
;       void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir);
417
	push	ebp
417
	push	ebp
418
	stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir
418
	stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir
419
	pop	ebp
419
	pop	ebp
420
 
420
 
421
;jmp @f
421
;jmp @f
422
;   .str1 db '/LICENSE.txt',0
422
;   .str1 db '/LICENSE.txt',0
423
;@@:
423
;@@:
424
 
424
 
425
;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode);
425
;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode);
426
;Žâªàëâì ä ©« filename.  à ¬¥âà mode § à¥§¥à¢¨à®¢ ­ ¨ ¢ ⥪ã饩 ¢¥àᨨ kfar ¢á¥£¤  à ¢¥­ 1.
426
;Žâªàëâì ä ©« filename.  à ¬¥âà mode § à¥§¥à¢¨à®¢ ­ ¨ ¢ ⥪ã饩 ¢¥àᨨ kfar ¢á¥£¤  à ¢¥­ 1.
427
 ;       push    ebp
427
 ;       push    ebp
428
 ;       stdcall [aOpen], [hPlugin], .str1, O_READ
428
 ;       stdcall [aOpen], [hPlugin], .str1, O_READ
429
 ;       pop     ebp
429
 ;       pop     ebp
430
 
430
 
431
 ;       mov     [hFile],eax
431
 ;       mov     [hFile],eax
432
;unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
432
;unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
433
;—⥭¨¥ size ¡ ©â ¢ ¡ãä¥à buf ¨§ ä ©«  hFile, à ­¥¥ ®âªàë⮣® ç¥à¥§ open.
433
;—⥭¨¥ size ¡ ©â ¢ ¡ãä¥à buf ¨§ ä ©«  hFile, à ­¥¥ ®âªàë⮣® ç¥à¥§ open.
434
;size ªà â¥­ 512 ¡ ©â
434
;size ªà â¥­ 512 ¡ ©â
435
;‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â, -1 ¯à¨ ®è¨¡ª¥.
435
;‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â, -1 ¯à¨ ®è¨¡ª¥.
436
 ;       push    ebp
436
 ;       push    ebp
437
 ;       stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF
437
 ;       stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF
438
 ;       pop     ebp
438
 ;       pop     ebp
439
 ;
439
 ;
440
;        mcall   70, fsWrite
440
;        mcall   70, fsWrite
441
;void __stdcall close(HANDLE hFile);
441
;void __stdcall close(HANDLE hFile);
442
	push	ebp
442
	push	ebp
443
	stdcall [aClose], [hFile]
443
	stdcall [aClose], [hFile]
444
	mov	[bWinChild],0
444
	mov	[bWinChild],0
445
	pop	ebp
445
	pop	ebp
446
 
446
 
447
	push	ebp
447
	push	ebp
448
	stdcall [aClosePlugin], [hPlugin]
448
	stdcall [aClosePlugin], [hPlugin]
449
	mov	[bWinChild],0
449
	mov	[bWinChild],0
450
 
450
 
451
	mov	[fsRunNotifyOK.param],strUnpackOk
451
	mov	[fsRunNotifyOK.param],strUnpackOk
452
	mcall	70,fsRunNotifyOK
452
	mcall	70,fsRunNotifyOK
453
	pop	ebp
453
	pop	ebp
454
	ret		;SUCCESS
454
	ret		;SUCCESS
455
 
455
 
456
 
456
 
457
.errNotFound:
457
.errNotFound:
458
;        stdcall SimpleSayErr,strNotFound
458
;        stdcall SimpleSayErr,strNotFound
459
	mov	[bWinChild],0
459
	mov	[bWinChild],0
460
	mov	[fsRunNotifyOK.param],strUnpackFault
460
	mov	[fsRunNotifyOK.param],strUnpackFault
461
	mcall	70,fsRunNotifyOK
461
	mcall	70,fsRunNotifyOK
462
	ret
462
	ret
463
 
463
 
464
.errNotSupp:
464
.errNotSupp:
465
	mov	eax,[fsNewDir.path]
465
	mov	eax,[fsNewDir.path]
466
	mov	[fsDelDir.path],eax
466
	mov	[fsDelDir.path],eax
467
	mcall	70, fsDelDir
467
	mcall	70, fsDelDir
468
 
468
 
469
	mov	[bWinChild],0
469
	mov	[bWinChild],0
470
	mov	[fsRunNotifyOK.param],strUnpackFault
470
	mov	[fsRunNotifyOK.param],strUnpackFault
471
	mcall	70,fsRunNotifyOK
471
	mcall	70,fsRunNotifyOK
472
	ret
472
	ret
473
 
473
 
474
.errNullInp:
474
.errNullInp:
475
	mov	[redInput],1
475
	mov	[redInput],1
476
	mov	[bWinChild],0
476
	mov	[bWinChild],0
477
	ret
477
	ret
478
endp
478
endp
479
 
479
 
480
 
480
 
481
proc Exception param1:dword
481
proc Exception param1:dword
482
	stdcall SimpleSayErr,strErrorExc
482
	stdcall SimpleSayErr,strErrorExc
483
	ret
483
	ret
484
endp
484
endp
485
 
485
 
486
proc debugInt3
486
proc debugInt3
487
	dps ' ­¨ª !!!!!!!!!!!!!!!!!!!!!!!!!'
487
	dps ' ­¨ª !!!!!!!!!!!!!!!!!!!!!!!!!'
488
	dnl
488
	dnl
489
	int3
489
	int3
490
	ret
490
	ret
491
endp
491
endp
492
 
492
 
493
 
493
 
494
proc calcSizeArch hPlugin:dword
494
proc calcSizeArch hPlugin:dword
495
locals
495
locals
496
  bdwk rb 560
496
  bdwk rb 560
497
endl
497
endl
498
;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start,
498
;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start,
499
;        unsigned dirinfo_size, void* dirdata);
499
;        unsigned dirinfo_size, void* dirdata);
500
int3
500
int3
501
	push	ebp
501
	push	ebp
502
	lea	eax,[bdwk]
502
	lea	eax,[bdwk]
503
	stdcall [aReadFolder], [hPlugin],1,560,eax
503
	stdcall [aReadFolder], [hPlugin],1,560,eax
504
	pop	ebp
504
	pop	ebp
505
 
505
 
506
	ret
506
	ret
507
endp
507
endp
508
;-------------------------------------------------------------------------------
508
;-------------------------------------------------------------------------------
509
;-------------------------------------------------------------------------------
509
;-------------------------------------------------------------------------------
510
;-------------------------------------------------------------------------------
510
;-------------------------------------------------------------------------------
511
 
511
 
512
;SayErr  int num_strings, const char* strings[],
512
;SayErr  int num_strings, const char* strings[],
513
;                      int num_buttons, const char* buttons[]);
513
;                      int num_buttons, const char* buttons[]);
514
 
514
 
515
proc SayErr num_strings:dword, strings:dword,num_buttons:dword, buttons:dword
515
proc SayErr num_strings:dword, strings:dword,num_buttons:dword, buttons:dword
516
	pushad
516
	pushad
517
	cmp	[num_strings],1
517
	cmp	[num_strings],1
518
	je	@f
518
	je	@f
519
	m2m	[errmess0], strErrorExc
519
	m2m	[errmess0], strErrorExc
520
	jmp	.l1
520
	jmp	.l1
521
       @@:
521
       @@:
522
	mov	ebx,[strings]
522
	mov	ebx,[strings]
523
	m2m	[errmess0], dword [ebx]
523
	m2m	[errmess0], dword [ebx]
524
       .l1:
524
       .l1:
525
	mcall	51,1,threadSayErr,stackDlg
525
	mcall	51,1,threadSayErr,stackDlg
526
	popad
526
	popad
527
	mov	eax,1
527
	mov	eax,1
528
	ret
528
	ret
529
endp
529
endp
530
 
530
 
531
proc SimpleSayErr str:dword
531
proc SimpleSayErr str:dword
532
	pushad
532
	pushad
533
	m2m	[errmess0],[str]
533
	m2m	[errmess0],[str]
534
	mcall	51,1,threadSayErr,stackDlg
534
	mcall	51,1,threadSayErr,stackDlg
535
	popad
535
	popad
536
	ret
536
	ret
537
endp
537
endp
538
 
538
 
539
 
539
 
540
proc threadSayErr
540
proc threadSayErr
541
	mcall	40, 111b+0C000000h
541
	mcall	40, 111b+0C000000h
542
.wm_redraw:
542
.wm_redraw:
543
	mcall 12, 1
543
	mcall 12, 1
544
	mcall 48, 3, sc, sizeof.system_colors
544
	mcall 48, 3, sc, sizeof.system_colors
545
	mov   edx, [sc.work]
545
	mov   edx, [sc.work]
546
	or	  edx, 0x33000000
546
	or	  edx, 0x33000000
547
	mcall 0, <220,WIN_W>, <220,110>, , , title
547
	mcall 0, <220,WIN_W>, <220,110>, , , title
548
 
548
 
549
	mov	ecx,[sc.work_text]
549
	mov	ecx,[sc.work_text]
550
	or	ecx,90000000h
550
	or	ecx,90000000h
551
	mov	edx,[errmess0]
551
	mov	edx,[errmess0]
552
	mcall 4, <15,11>
552
	mcall 4, <15,11>
553
 
553
 
554
	mcall 8, <105,100>,<45,25>,1,[sc.work_button]
554
	mcall 8, <105,100>,<45,25>,1,[sc.work_button]
555
	mov	ecx,[sc.work_button_text]
555
	mov	ecx,[sc.work_button_text]
556
	or	ecx,90000000h
556
	or	ecx,90000000h
557
	mcall 4, <147,51>, , strOk
557
	mcall 4, <147,51>, , strOk
558
 
558
 
559
	mcall 12, 2
559
	mcall 12, 2
560
 
560
 
561
.still:
561
.still:
562
	mcall	10
562
	mcall	10
563
	cmp	eax, 1
563
	cmp	eax, 1
564
	je	.wm_redraw
564
	je	.wm_redraw
565
	cmp	eax, 2
565
	cmp	eax, 2
566
	je	.wm_key
566
	je	.wm_key
567
	cmp	eax, 3
567
	cmp	eax, 3
568
	je	.wm_button
568
	je	.wm_button
569
	jmp	.still
569
	jmp	.still
570
 
570
 
571
.wm_button:
571
.wm_button:
572
	mcall	17
572
	mcall	17
573
 
573
 
574
	cmp	ah, 1
574
	cmp	ah, 1
575
	je	.exit
575
	je	.exit
576
	jmp	.still
576
	jmp	.still
577
 
577
 
578
.wm_key:
578
.wm_key:
579
	mcall	2
579
	mcall	2
580
	jmp	.still
580
	jmp	.still
581
.exit:
581
.exit:
582
	mcall	-1
582
	mcall	-1
583
endp
583
endp
584
 
584
 
585
;-------------------------------------------------------------------------------
585
;-------------------------------------------------------------------------------
586
;-------------------------------------------------------------------------------
586
;-------------------------------------------------------------------------------
587
;-------------------------------------------------------------------------------
587
;-------------------------------------------------------------------------------
588
    ; "enter password" dialog for KFar
588
    ; "enter password" dialog for KFar
589
;password_dlg:
589
;password_dlg:
590
;        dd      1       ; use standard dialog colors
590
;        dd      1       ; use standard dialog colors
591
;        dd      -1      ; center window by x
591
;        dd      -1      ; center window by x
592
;        dd      -1      ; center window by y
592
;        dd      -1      ; center window by y
593
;.width  dd      ?       ; width (will be filled according to current console width)
593
;.width  dd      ?       ; width (will be filled according to current console width)
594
;        dd      2       ; height
594
;        dd      2       ; height
595
;        dd      4, 2    ; border size
595
;        dd      4, 2    ; border size
596
;        dd      aEnterPasswordTitle     ; title
596
;        dd      aEnterPasswordTitle     ; title
597
;        dd      ?       ; colors (will be set by KFar)
597
;        dd      ?       ; colors (will be set by KFar)
598
;        dd      0       ; used internally by dialog manager, ignored
598
;        dd      0       ; used internally by dialog manager, ignored
599
;        dd      0, 0    ; reserved for DlgProc
599
;        dd      0, 0    ; reserved for DlgProc
600
;        dd      2       ; 2 controls
600
;        dd      2       ; 2 controls
601
;; the string "enter password"
601
;; the string "enter password"
602
;        dd      1       ; type: static
602
;        dd      1       ; type: static
603
;        dd      1,0     ; upper-left position
603
;        dd      1,0     ; upper-left position
604
;.width1 dd      ?,0     ; bottom-right position
604
;.width1 dd      ?,0     ; bottom-right position
605
;        dd      aEnterPassword  ; data
605
;        dd      aEnterPassword  ; data
606
;        dd      0       ; flags
606
;        dd      0       ; flags
607
;; editbox for password
607
;; editbox for password
608
;        dd      3       ; type: edit
608
;        dd      3       ; type: edit
609
;        dd      1,1     ; upper-left position
609
;        dd      1,1     ; upper-left position
610
;.width2 dd      ?,0     ; bottom-right position
610
;.width2 dd      ?,0     ; bottom-right position
611
;        dd      password_data   ; data
611
;        dd      password_data   ; data
612
;        dd      2Ch     ; flags
612
;        dd      2Ch     ; flags
613
 
613
 
614
 
614
 
615
 
615
 
616
proc DialogBox dlgInfo:dword
616
proc DialogBox dlgInfo:dword
617
	pushad
617
	pushad
618
	mov	ebx,[dlgInfo]
618
	mov	ebx,[dlgInfo]
619
	mov	eax,[ebx+19*4]
619
	mov	eax,[ebx+19*4]
620
	mov	[forpassword],eax
620
	mov	[forpassword],eax
621
	mov	byte[eax], 0
621
	mov	byte[eax], 0
622
	mov	[stateDlg], 0
622
	mov	[stateDlg], 0
623
	mcall	51,1,threadDialogBox,stackDlg
623
	mcall	51,1,threadDialogBox,stackDlg
624
 
624
 
625
	;wait thread...
625
	;wait thread...
626
    @@: cmp	[stateDlg],0
626
    @@: cmp	[stateDlg],0
627
	jne	@f
627
	jne	@f
628
	mcall	5,1
628
	mcall	5,1
629
	jmp	@b
629
	jmp	@b
630
     @@:
630
     @@:
631
	popad
631
	popad
632
	cmp	[stateDlg], 1
632
	cmp	[stateDlg], 1
633
	jne	@f
633
	jne	@f
634
	xor	eax, eax
634
	xor	eax, eax
635
	ret
635
	ret
636
    @@:
636
    @@:
637
	or	eax, -1
637
	or	eax, -1
638
	ret
638
	ret
639
endp
639
endp
640
 
640
 
641
proc threadDialogBox
641
proc threadDialogBox
642
 
642
 
643
	mcall	40, 100111b+0C000000h
643
	mcall	40, 100111b+0C000000h
644
	mov	eax,[forpassword]
644
	mov	eax,[forpassword]
645
	mov	[edtPassword+4*9],eax
645
	mov	[edtPassword+4*9],eax
646
	xor	eax,eax
646
	xor	eax,eax
647
	mov	dword[edtPassword.size], eax
647
	mov	dword[edtPassword.size], eax
648
	mov	dword[edtPassword.pos], eax
648
	mov	dword[edtPassword.pos], eax
649
 
649
 
650
.wm_redraw:
650
.wm_redraw:
651
	mcall	12, 1
651
	mcall	12, 1
652
	mcall	48, 3, sc, sizeof.system_colors
652
	mcall	48, 3, sc, sizeof.system_colors
653
	mov	edx, [sc.work]
653
	mov	edx, [sc.work]
654
	or	edx, 0x33000000
654
	or	edx, 0x33000000
655
	mcall	0, <200,320>, <200,140>, , , title
655
	mcall	0, <200,320>, <200,140>, , , title
656
 
656
 
657
	edit_boxes_set_sys_color edtPack,endEdits,sc
657
	edit_boxes_set_sys_color edtPack,endEdits,sc
658
	stdcall [edit_box_draw],edtPassword
658
	stdcall [edit_box_draw],edtPassword
659
 
659
 
660
 
660
 
661
	mov	ecx,[sc.work_text]
661
	mov	ecx,[sc.work_text]
662
	or	ecx,90000000h
662
	or	ecx,90000000h
663
	mcall 4, <56,12>, , strGetPass
663
	mcall 4, <56,12>, , strGetPass
664
 
664
 
665
	mcall 8, <70,80>,<74,22>,2,[sc.work_button]
665
	mcall 8, <70,80>,<74,22>,2,[sc.work_button]
666
	mov	ecx,[sc.work_button_text]
666
	mov	ecx,[sc.work_button_text]
667
	or	ecx,90000000h
667
	or	ecx,90000000h
668
	mcall 4, <103,79>, , strOk
668
	mcall 4, <103,79>, , strOk
669
 
669
 
670
	mcall 8, <165,80>,<74,22>,1,[sc.work_button]
670
	mcall 8, <165,80>,<74,22>,1,[sc.work_button]
671
	mov	ecx,[sc.work_button_text]
671
	mov	ecx,[sc.work_button_text]
672
	or	ecx,90000000h
672
	or	ecx,90000000h
673
	mcall 4, <182,79>, , strCancel
673
	mcall 4, <182,79>, , strCancel
674
 
674
 
675
 
675
 
676
	mcall 12, 2
676
	mcall 12, 2
677
 
677
 
678
.still:
678
.still:
679
	mcall	10
679
	mcall	10
680
	cmp	eax, 1
680
	cmp	eax, 1
681
	je	.wm_redraw
681
	je	.wm_redraw
682
	cmp	eax, 2
682
	cmp	eax, 2
683
	je	.wm_key
683
	je	.wm_key
684
	cmp	eax, 3
684
	cmp	eax, 3
685
	je	.wm_button
685
	je	.wm_button
686
	cmp	eax, 6
686
	cmp	eax, 6
687
	je	.wm_mouse
687
	je	.wm_mouse
688
 
688
 
689
	jmp	.still
689
	jmp	.still
690
 
690
 
691
.wm_key:
691
.wm_key:
692
	mcall	2
692
	mcall	2
693
	stdcall [edit_box_key],edtPassword
693
	stdcall [edit_box_key],edtPassword
694
	jmp	.still
694
	jmp	.still
695
 
695
 
696
 
696
 
697
.wm_button:
697
.wm_button:
698
	mcall	17
698
	mcall	17
699
 
699
 
700
	cmp	ah, 2		;OK
700
	cmp	ah, 2		;OK
701
	jne	@f
701
	jne	@f
702
	mov	[stateDlg],1
702
	mov	[stateDlg],1
703
	jmp	.exit
703
	jmp	.exit
704
    @@:
704
    @@:
705
 
705
 
706
	cmp	ah, 1		;Close window or Cancel
706
	cmp	ah, 1		;Close window or Cancel
707
	jne	 .still
707
	jne	 .still
708
	mov	[stateDlg],2
708
	mov	[stateDlg],2
709
	jmp	.exit
709
	jmp	.exit
710
 
710
 
711
.wm_mouse:
711
.wm_mouse:
712
	stdcall [edit_box_mouse],edtPassword
712
	stdcall [edit_box_mouse],edtPassword
713
 
713
 
714
 
714
 
715
	jmp	.still
715
	jmp	.still
716
 
716
 
717
.exit:
717
.exit:
718
	mcall	-1
718
	mcall	-1
719
endp
719
endp
720
 
720
 
721
 
721
 
722
;--  DATA  -------------------------------------------------------------------
722
;--  DATA  -------------------------------------------------------------------
723
 
723
 
724
 
724
 
725
 
725
 
726
sc system_colors
726
sc system_colors
727
 
727
 
728
 
-
 
729
title db 'uNZ v0.11 - Unarchiver of Zip and 7z',0
728
 
730
bWinChild db 0	;1 - ¤®ç¥à­¥¥ ®ª­® ¥áâì, £« ¢­®¥ ®ª­® ­¥ ¤®«¦­® ॠ£¨à®¢ âì
729
bWinChild db 0	;1 - ¤®ç¥à­¥¥ ®ª­® ¥áâì, £« ¢­®¥ ®ª­® ­¥ ¤®«¦­® ॠ£¨à®¢ âì
731
redInput  db 0	;1 - ¯®¤á¢¥â¨âì ªà á­ë¬ ­ ¤¯¨áì
730
redInput  db 0	;1 - ¯®¤á¢¥â¨âì ªà á­ë¬ ­ ¤¯¨áì
732
 
731
 
733
if lang eq ru
732
if lang eq ru
-
 
733
 title db 'uNZ v0.11 -  á¯ ª®¢é¨ª Zip ¨ 7z',0
734
 strGo db ' á¯ ª®¢ âì',0
734
 strGo db ' á¯ ª®¢ âì',0
735
 strInp db  '    €à娢',0
735
 strInp db  '    €à娢',0
736
 strPath db 'ˆ§¢«¥çì ¢',0
736
 strPath db 'ˆ§¢«¥çì ¢',0
737
 strError db 'Žè¨¡ª ',0
737
 strError db 'Žè¨¡ª ',0
738
 strErrorExc db '¥®¯®§­ ­­ ï ®è¨¡ª ',0
738
 strErrorExc db '¥®¯®§­ ­­ ï ®è¨¡ª ',0
739
 strOk	db 'OK',0
739
 strOk	db 'OK',0
740
 strGetPass db ' à®«ì',0
740
 strGetPass db ' à®«ì',0
741
 strCancel  db 'Žâ¬¥­ ',0
741
 strCancel  db 'Žâ¬¥­ ',0
742
 strUnpackOk  db "'“ᯥ譮 à á¯ ª®¢ ­®' -O",0
742
 strUnpackOk  db "'“ᯥ譮 à á¯ ª®¢ ­®' -O",0
743
 strUnpackFault  db "'Žè¨¡ª  à á¯ ª®¢ª¨' -E",0
743
 strUnpackFault  db "'Žè¨¡ª  à á¯ ª®¢ª¨' -E",0
744
 strNotSupport db "'¥¯®¤¤¥à¦¨¢ ¥¬ë© ä®à¬ â  à娢 ' -E",0
744
 strNotSupport db "'¥¯®¤¤¥à¦¨¢ ¥¬ë© ä®à¬ â  à娢 ' -E",0
745
 strNotFound db "'” ©« ­¥ ­ ©¤¥­' -E",0
745
 strNotFound db "'” ©« ­¥ ­ ©¤¥­' -E",0
746
else
746
else
-
 
747
 title db 'uNZ v0.11 - Unarchiver of Zip and 7z',0
747
 strGo db   'Unpack',0
748
 strGo db   'Unpack',0
748
 strInp db  'Archive',0
749
 strInp db  'Archive',0
749
 strPath db 'Extract to',0
750
 strPath db 'Extract to',0
750
 strError db 'Error',0
751
 strError db 'Error',0
751
 strErrorExc db 'Unrecognized error',0
752
 strErrorExc db 'Unrecognized error',0
752
 strOk	db 'OK',0
753
 strOk	db 'OK',0
753
 strGetPass db 'Password',0
754
 strGetPass db 'Password',0
754
 strCancel  db 'Cancel',0
755
 strCancel  db 'Cancel',0
755
 strUnpackOk  db "'Unpacked successfuly' -O",0
756
 strUnpackOk  db "'Unpacked successfuly' -O",0
756
 strUnpackFault  db "'Unpack failed' -E",0
757
 strUnpackFault  db "'Unpack failed' -E",0
757
 strNotSupport db "'Archive format is not supported' -E",0
758
 strNotSupport db "'Archive format is not supported' -E",0
758
 strNotFound db "'File not found' -E",0
759
 strNotFound db "'File not found' -E",0
759
end if
760
end if
760
 
761
 
761
strNull db 0
762
strNull db 0
762
strDots db '...',0
763
strDots db '...',0
763
 
764
 
764
;--------
765
;--------
765
; int __stdcall SayErr(int num_strings, const char* strings[],
766
; int __stdcall SayErr(int num_strings, const char* strings[],
766
;                      int num_buttons, const char* buttons[]);
767
;                      int num_buttons, const char* buttons[]);
767
; int __stdcall DialogBox(DLGDATA* dlg);
768
; int __stdcall DialogBox(DLGDATA* dlg);
768
 
769
 
769
forpassword rd 1
770
forpassword rd 1
770
stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel
771
stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel
771
errmess0 dd strErrorExc
772
errmess0 dd strErrorExc
772
 
773
 
773
 
774
 
774
kfar_info:
775
kfar_info:
775
	dd	.size
776
	dd	.size
776
	dd	version_dword
777
	dd	version_dword
777
	dd	open
778
	dd	open
778
	dd	open2
779
	dd	open2
779
	dd	read
780
	dd	read
780
	dd	-1	; write: to be implemented
781
	dd	-1	; write: to be implemented
781
	dd	seek
782
	dd	seek
782
	dd	tell
783
	dd	tell
783
	dd	-1	; flush: to be implemented
784
	dd	-1	; flush: to be implemented
784
	dd	filesize
785
	dd	filesize
785
	dd	close
786
	dd	close
786
	dd	xpgalloc
787
	dd	xpgalloc
787
	dd	xpgrealloc
788
	dd	xpgrealloc
788
	dd	pgfree
789
	dd	pgfree
789
	dd	getfreemem
790
	dd	getfreemem
790
	dd	debugInt3;libini_alloc
791
	dd	debugInt3;libini_alloc
791
	dd	debugInt3;libini_realloc
792
	dd	debugInt3;libini_realloc
792
	dd	debugInt3;libini_free
793
	dd	debugInt3;libini_free
793
	dd	debugInt3;menu
794
	dd	debugInt3;menu
794
	dd	debugInt3;menu_centered_in
795
	dd	debugInt3;menu_centered_in
795
	dd	DialogBox;DialogBox
796
	dd	DialogBox;DialogBox
796
	dd	SayErr	 ;SayErr
797
	dd	SayErr	 ;SayErr
797
	dd	debugInt3;Message
798
	dd	debugInt3;Message
798
	dd	0	;cur_width
799
	dd	0	;cur_width
799
.size = $ - kfar_info
800
.size = $ - kfar_info
800
;--------
801
;--------
801
 
802
 
802
 
803
 
803
iFiles dd 0	;ª®«¨ç¥á⢮ ¢ë£à㦠¥¬ëå ä ©«®¢
804
iFiles dd 0	;ª®«¨ç¥á⢮ ¢ë£à㦠¥¬ëå ä ©«®¢
804
endPointer dd buffer
805
endPointer dd buffer
805
 
806
 
806
 
807
 
807
fsZip:
808
fsZip:
808
.cmd	dd 5
809
.cmd	dd 5
809
	dd 0
810
	dd 0
810
	dd 0
811
	dd 0
811
.size	dd 0
812
.size	dd 0
812
.buf	dd bdvkPack
813
.buf	dd bdvkPack
813
	db 0
814
	db 0
814
	dd fInp
815
	dd fInp
815
 
816
 
816
fsZipRead:
817
fsZipRead:
817
.cmd	dd 0
818
.cmd	dd 0
818
	dd 0
819
	dd 0
819
	dd 0
820
	dd 0
820
.size	dd 1024
821
.size	dd 1024
821
.buf	dd filedata_buffer
822
.buf	dd filedata_buffer
822
	db 0
823
	db 0
823
	dd fInp
824
	dd fInp
824
 
825
 
825
 
826
 
826
fsWrite:
827
fsWrite:
827
.cmd	dd 2	;2 rewrite, 3 - write
828
.cmd	dd 2	;2 rewrite, 3 - write
828
.pos	dd 0
829
.pos	dd 0
829
.hpos	dd 0
830
.hpos	dd 0
830
.size	dd SIZE_COPY_BUF
831
.size	dd SIZE_COPY_BUF
831
.buf	dd copy_buf
832
.buf	dd copy_buf
832
	db 0
833
	db 0
833
.path	dd 0
834
.path	dd 0
834
 
835
 
835
 
836
 
836
fsNewDir:
837
fsNewDir:
837
.cmd	dd 9
838
.cmd	dd 9
838
	dd 0
839
	dd 0
839
	dd 0
840
	dd 0
840
	dd 0
841
	dd 0
841
	dd 0
842
	dd 0
842
	db 0
843
	db 0
843
.path	dd 0
844
.path	dd 0
844
 
845
 
845
fsDelDir:
846
fsDelDir:
846
.cmd	dd 8
847
.cmd	dd 8
847
	dd 0
848
	dd 0
848
	dd 0
849
	dd 0
849
	dd 0
850
	dd 0
850
	dd 0
851
	dd 0
851
	db 0
852
	db 0
852
.path	dd 0
853
.path	dd 0
853
 
854
 
854
 
855
 
855
 
856
 
856
fsRunNotifyOK:
857
fsRunNotifyOK:
857
.cmd	dd 7
858
.cmd	dd 7
858
	dd 0
859
	dd 0
859
.param	dd strUnpackOk
860
.param	dd strUnpackOk
860
.size	dd 0
861
.size	dd 0
861
.buf	dd 0
862
.buf	dd 0
862
	db '/sys/@notify',0
863
	db '/sys/@notify',0
863
 
864
 
864
 
865
 
865
 
866
 
866
edtPack     edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
867
edtPack     edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
867
            255, fInp, mouse_dd,0,0,0
868
            255, fInp, mouse_dd,0,0,0
868
edtUnpPath  edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
869
edtUnpPath  edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
869
            255, pathOut, mouse_dd,0,0,0
870
            255, pathOut, mouse_dd,0,0,0
870
edtPassword edit_box 200,56,70,0FFFFFFh,0xff,0x80ff,0h,0x90000000,255,\
871
edtPassword edit_box 200,56,70,0FFFFFFh,0xff,0x80ff,0h,0x90000000,255,\
871
		password, mouse_dd,0,0,0
872
		password, mouse_dd,0,0,0
872
endEdits:
873
endEdits:
873
 
874
 
874
;-------------------------------------------------------------------------------
875
;-------------------------------------------------------------------------------
875
OpenDialog_data:
876
OpenDialog_data:
876
.type			dd 0	;0-open, 1-save, 2-select folder
877
.type			dd 0	;0-open, 1-save, 2-select folder
877
.procinfo		dd RBProcInfo	    ;+4
878
.procinfo		dd RBProcInfo	    ;+4
878
.com_area_name		dd communication_area_name	;+8
879
.com_area_name		dd communication_area_name	;+8
879
.com_area		dd 0	;+12
880
.com_area		dd 0	;+12
880
.opendir_pach		dd temp_dir_pach	;+16
881
.opendir_pach		dd temp_dir_pach	;+16
881
.dir_default_pach	dd communication_area_default_pach	;+20
882
.dir_default_pach	dd communication_area_default_pach	;+20
882
.start_path		dd open_dialog_path	;+24
883
.start_path		dd open_dialog_path	;+24
883
.draw_window		dd winRedraw		   ;+28
884
.draw_window		dd winRedraw		   ;+28
884
.status 		dd 0	;+32
885
.status 		dd 0	;+32
885
.openfile_pach		dd ODAreaPath;   ;+36
886
.openfile_pach		dd ODAreaPath;   ;+36
886
.filename_area		dd 0;        ;+40
887
.filename_area		dd 0;        ;+40
887
.filter_area		dd Filter
888
.filter_area		dd Filter
888
.x:
889
.x:
889
.x_size 		dw 420 ;+48 ; Window X size
890
.x_size 		dw 420 ;+48 ; Window X size
890
.x_start		dw 100 ;+50 ; Window X position
891
.x_start		dw 100 ;+50 ; Window X position
891
.y:
892
.y:
892
.y_size 		dw 320 ;+52 ; Window y size
893
.y_size 		dw 320 ;+52 ; Window y size
893
.y_start		dw 100 ;+54 ; Window Y position
894
.y_start		dw 100 ;+54 ; Window Y position
894
 
895
 
895
communication_area_name:
896
communication_area_name:
896
	db 'FFFFFFFF_open_dialog',0
897
	db 'FFFFFFFF_open_dialog',0
897
open_dialog_path:
898
open_dialog_path:
898
	db '/sys/File managers/opendial',0
899
	db '/sys/File managers/opendial',0
899
 
900
 
900
communication_area_default_pach:
901
communication_area_default_pach:
901
	db '/sys',0
902
	db '/sys',0
902
 
903
 
903
Filter	dd 0
904
Filter	dd 0
904
 
905
 
905
 
906
 
906
; int __stdcall         ReadFolder(HANDLE hPlugin,
907
; int __stdcall         ReadFolder(HANDLE hPlugin,
907
;       unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata);
908
;       unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata);
908
; void __stdcall        ClosePlugin(HANDLE hPlugin);
909
; void __stdcall        ClosePlugin(HANDLE hPlugin);
909
; bool __stdcall        SetFolder(HANDLE hPlugin,
910
; bool __stdcall        SetFolder(HANDLE hPlugin,
910
;       const char* relative_path, const char* absolute_path);
911
;       const char* relative_path, const char* absolute_path);
911
; void __stdcall        GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info);
912
; void __stdcall        GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info);
912
; void __stdcall        GetFiles(HANDLE hPlugin, int NumItems, void* items[],
913
; void __stdcall        GetFiles(HANDLE hPlugin, int NumItems, void* items[],
913
;       void* addfile, void* adddir);
914
;       void* addfile, void* adddir);
914
;       bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile);
915
;       bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile);
915
;       bool __stdcall adddir(const char* name, void* bdfe_info);
916
;       bool __stdcall adddir(const char* name, void* bdfe_info);
916
; int __stdcall         getattr(HANDLE hPlugin, const char* filename, void* info);
917
; int __stdcall         getattr(HANDLE hPlugin, const char* filename, void* info);
917
; HANDLE __stdcall      open(HANDLE hPlugin, const char* filename, int mode);
918
; HANDLE __stdcall      open(HANDLE hPlugin, const char* filename, int mode);
918
; void __stdcall        setpos(HANDLE hFile, __int64 pos);
919
; void __stdcall        setpos(HANDLE hFile, __int64 pos);
919
; unsigned __stdcall    read(HANDLE hFile, void* buf, unsigned size);
920
; unsigned __stdcall    read(HANDLE hFile, void* buf, unsigned size);
920
; void __stdcall        close(HANDLE hFile);
921
; void __stdcall        close(HANDLE hFile);
921
IMPORTS:
922
IMPORTS:
922
library archiver, 'archiver.obj',\
923
library archiver, 'archiver.obj',\
923
	box_lib ,'box_lib.obj',\
924
	box_lib ,'box_lib.obj',\
924
	proc_lib,'proc_lib.obj'
925
	proc_lib,'proc_lib.obj'
925
 
926
 
926
import	archiver,\
927
import	archiver,\
927
	aPluginLoad	,      'plugin_load',\
928
	aPluginLoad	,      'plugin_load',\
928
	aOpenFilePlugin ,      'OpenFilePlugin',\
929
	aOpenFilePlugin ,      'OpenFilePlugin',\
929
	aClosePlugin	,      'ClosePlugin',\
930
	aClosePlugin	,      'ClosePlugin',\
930
	aReadFolder	,      'ReadFolder',\
931
	aReadFolder	,      'ReadFolder',\
931
	aSetFolder	,      'SetFolder',\
932
	aSetFolder	,      'SetFolder',\
932
	aGetFiles	,      'GetFiles',\
933
	aGetFiles	,      'GetFiles',\
933
	aGetOpenPluginInfo ,   'GetOpenPluginInfo',\
934
	aGetOpenPluginInfo ,   'GetOpenPluginInfo',\
934
	aGetattr	,      'getattr',\
935
	aGetattr	,      'getattr',\
935
	aOpen		,      'open',\
936
	aOpen		,      'open',\
936
	aRead		,      'read',\
937
	aRead		,      'read',\
937
	aSetpos 	,      'setpos',\
938
	aSetpos 	,      'setpos',\
938
	aClose		,      'close',\
939
	aClose		,      'close',\
939
	aDeflateUnpack	,      'deflate_unpack',\
940
	aDeflateUnpack	,      'deflate_unpack',\
940
	aDeflateUnpack2 ,      'deflate_unpack2'
941
	aDeflateUnpack2 ,      'deflate_unpack2'
941
 
942
 
942
import	proc_lib,\
943
import	proc_lib,\
943
	OpenDialog_Init 	,'OpenDialog_init',\
944
	OpenDialog_Init 	,'OpenDialog_init',\
944
	OpenDialog_Start	,'OpenDialog_start'
945
	OpenDialog_Start	,'OpenDialog_start'
945
import	box_lib,\
946
import	box_lib,\
946
	edit_box_draw		,'edit_box',\
947
	edit_box_draw		,'edit_box',\
947
	edit_box_key		,'edit_box_key',\
948
	edit_box_key		,'edit_box_key',\
948
	edit_box_mouse		,'edit_box_mouse'
949
	edit_box_mouse		,'edit_box_mouse'
949
 
950
 
950
 
951
 
951
IncludeIGlobals
952
IncludeIGlobals
952
 
953
 
953
;--  UDATA  -----------------------------------------------------------------------------
954
;--  UDATA  -----------------------------------------------------------------------------
954
init_end:
955
init_end:
955
align 16
956
align 16
956
IncludeUGlobals
957
IncludeUGlobals
957
 
958
 
958
 
959
 
959
;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0
960
;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0
960
;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0
961
;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0
961
;params db '/hd0/1/unz/xboot-1-0-build-14-en-win.zip',0
962
;params db '/hd0/1/unz/xboot-1-0-build-14-en-win.zip',0
962
;rb 4096
963
;rb 4096
963
 
964
 
964
fInp	rb 1024
965
fInp	rb 1024
965
pathOut rb 1024
966
pathOut rb 1024
966
files	rd 256
967
files	rd 256
967
password	rb 256
968
password	rb 256
968
 
969
 
969
fZipInfo	 rb 40
970
fZipInfo	 rb 40
970
 
971
 
971
mouse_dd	rd 1
972
mouse_dd	rd 1
972
RBProcInfo	rb 1024
973
RBProcInfo	rb 1024
973
temp_dir_pach	rb 1024
974
temp_dir_pach	rb 1024
974
ODAreaPath	rb 1024
975
ODAreaPath	rb 1024
975
 
976
 
976
 
977
 
977
 
978
 
978
;--------
979
;--------
979
 
980
 
980
copy_buf rb SIZE_COPY_BUF
981
copy_buf rb SIZE_COPY_BUF
981
 
982
 
982
execdata rb	1024
983
execdata rb	1024
983
execdataend:
984
execdataend:
984
 
985
 
985
filedata_buffer_size = 1024
986
filedata_buffer_size = 1024
986
filedata_buffer rb	filedata_buffer_size
987
filedata_buffer rb	filedata_buffer_size
987
 
988
 
988
CopyDestEditBuf 	rb	12+512+1
989
CopyDestEditBuf 	rb	12+512+1
989
.length = $ - CopyDestEditBuf - 13
990
.length = $ - CopyDestEditBuf - 13
990
 
991
 
991
bdvkPack rb 560
992
bdvkPack rb 560
992
 
993
 
993
;--------
994
;--------
994
 
995
 
995
buffer	rb 4096 ;for string of file name or extract
996
buffer	rb 4096 ;for string of file name or extract
996
params rb 4096
997
params rb 4096
997
 
998
 
998
	rb 1024
999
	rb 1024
999
stackUnpack:
1000
stackUnpack:
1000
 
1001
 
1001
	rb 1024
1002
	rb 1024
1002
stackDlg:
1003
stackDlg:
1003
 
1004
 
1004
	rb 1024
1005
	rb 1024
1005
stack_top:
1006
stack_top:
1006
 
1007
 
1007
end_mem:
1008
end_mem: