Subversion Repositories Kolibri OS

Rev

Rev 7161 | Rev 7169 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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