Subversion Repositories Kolibri OS

Rev

Rev 7157 | Rev 7161 | 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:
525
	mcall	51,1,threadSayErr,stackDlg
526
	popad
527
	mov	eax,1
528
	ret
529
endp
530
 
531
proc SimpleSayErr str:dword
532
	pushad
533
	m2m	[errmess0],[str]
534
	mcall	51,1,threadSayErr,stackDlg
535
	popad
536
	ret
537
endp
538
 
539
 
540
proc threadSayErr
541
	mcall	40, 111b+0C000000h
542
.wm_redraw:
543
	mcall 12, 1
544
	mcall 48, 3, sc, sizeof.system_colors
545
	mov   edx, [sc.work]
546
	or	  edx, 0x33000000
7157 leency 547
	mcall 0, <220,WIN_W>, <220,110>, , , title
7113 GerdtR 548
 
549
	mov	ecx,[sc.work_text]
550
	or	ecx,90000000h
551
	mov	edx,[errmess0]
552
	mcall 4, <15,11>
553
 
554
	mcall 8, <105,100>,<45,25>,1,[sc.work_button]
555
	mov	ecx,[sc.work_button_text]
556
	or	ecx,90000000h
557
	mcall 4, <147,51>, , strOk
558
 
559
	mcall 12, 2
560
 
561
.still:
562
	mcall	10
563
	cmp	eax, 1
564
	je	.wm_redraw
565
	cmp	eax, 2
566
	je	.wm_key
567
	cmp	eax, 3
568
	je	.wm_button
569
	jmp	.still
570
 
571
.wm_button:
572
	mcall	17
573
 
574
	cmp	ah, 1
575
	je	.exit
576
	jmp	.still
577
 
578
.wm_key:
579
	mcall	2
580
	jmp	.still
581
.exit:
582
	mcall	-1
583
endp
584
 
585
;-------------------------------------------------------------------------------
586
;-------------------------------------------------------------------------------
587
;-------------------------------------------------------------------------------
588
    ; "enter password" dialog for KFar
589
;password_dlg:
590
;        dd      1       ; use standard dialog colors
591
;        dd      -1      ; center window by x
592
;        dd      -1      ; center window by y
593
;.width  dd      ?       ; width (will be filled according to current console width)
594
;        dd      2       ; height
595
;        dd      4, 2    ; border size
596
;        dd      aEnterPasswordTitle     ; title
597
;        dd      ?       ; colors (will be set by KFar)
598
;        dd      0       ; used internally by dialog manager, ignored
599
;        dd      0, 0    ; reserved for DlgProc
600
;        dd      2       ; 2 controls
601
;; the string "enter password"
602
;        dd      1       ; type: static
603
;        dd      1,0     ; upper-left position
604
;.width1 dd      ?,0     ; bottom-right position
605
;        dd      aEnterPassword  ; data
606
;        dd      0       ; flags
607
;; editbox for password
608
;        dd      3       ; type: edit
609
;        dd      1,1     ; upper-left position
610
;.width2 dd      ?,0     ; bottom-right position
611
;        dd      password_data   ; data
612
;        dd      2Ch     ; flags
613
 
614
 
615
 
616
proc DialogBox dlgInfo:dword
617
	pushad
618
	mov	ebx,[dlgInfo]
619
	mov	eax,[ebx+19*4]
620
	mov	[forpassword],eax
621
	mov	byte[eax], 0
622
	mov	[stateDlg], 0
623
	mcall	51,1,threadDialogBox,stackDlg
624
 
625
	;wait thread...
626
    @@: cmp	[stateDlg],0
627
	jne	@f
628
	mcall	5,1
629
	jmp	@b
630
     @@:
631
	popad
632
	cmp	[stateDlg], 1
633
	jne	@f
634
	xor	eax, eax
635
	ret
636
    @@:
637
	or	eax, -1
638
	ret
639
endp
640
 
641
proc threadDialogBox
642
 
643
	mcall	40, 100111b+0C000000h
644
	mov	eax,[forpassword]
645
	mov	[edtPassword+4*9],eax
646
	xor	eax,eax
647
	mov	dword[edtPassword.size], eax
648
	mov	dword[edtPassword.pos], eax
649
 
650
.wm_redraw:
651
	mcall	12, 1
652
	mcall	48, 3, sc, sizeof.system_colors
653
	mov	edx, [sc.work]
654
	or	edx, 0x33000000
655
	mcall	0, <200,320>, <200,140>, , , title
656
 
657
	edit_boxes_set_sys_color edtPack,endEdits,sc
658
	stdcall [edit_box_draw],edtPassword
659
 
660
 
661
	mov	ecx,[sc.work_text]
662
	or	ecx,90000000h
663
	mcall 4, <56,12>, , strGetPass
664
 
665
	mcall 8, <70,80>,<74,22>,2,[sc.work_button]
666
	mov	ecx,[sc.work_button_text]
667
	or	ecx,90000000h
668
	mcall 4, <103,79>, , strOk
669
 
670
	mcall 8, <165,80>,<74,22>,1,[sc.work_button]
671
	mov	ecx,[sc.work_button_text]
672
	or	ecx,90000000h
673
	mcall 4, <182,79>, , strCancel
674
 
675
 
676
	mcall 12, 2
677
 
678
.still:
679
	mcall	10
680
	cmp	eax, 1
681
	je	.wm_redraw
682
	cmp	eax, 2
683
	je	.wm_key
684
	cmp	eax, 3
685
	je	.wm_button
686
	cmp	eax, 6
687
	je	.wm_mouse
688
 
689
	jmp	.still
690
 
691
.wm_key:
692
	mcall	2
693
	stdcall [edit_box_key],edtPassword
694
	jmp	.still
695
 
696
 
697
.wm_button:
698
	mcall	17
699
 
700
	cmp	ah, 2		;OK
701
	jne	@f
702
	mov	[stateDlg],1
703
	jmp	.exit
704
    @@:
705
 
706
	cmp	ah, 1		;Close window or Cancel
707
	jne	 .still
708
	mov	[stateDlg],2
709
	jmp	.exit
710
 
711
.wm_mouse:
712
	stdcall [edit_box_mouse],edtPassword
713
 
714
 
715
	jmp	.still
716
 
717
.exit:
718
	mcall	-1
719
endp
720
 
721
 
722
;--  DATA  -------------------------------------------------------------------
723
 
724
 
725
 
726
sc system_colors
727
 
728
 
7157 leency 729
title db 'uNZ v0.11 - Unarchiver of Zip and 7z',0
7113 GerdtR 730
bWinChild db 0	;1 - дочернее окно есть, главное окно не должно реагировать
731
redInput  db 0	;1 - подсветить красным надпись
732
 
733
if lang eq ru
734
 strGo db 'Распаковать',0
7157 leency 735
 strInp db  '    Архив',0
736
 strPath db 'Извлечь в',0
737
 strError db 'Ошибка',0
738
 strErrorExc db 'Неопознанная ошибка',0
739
 strOk	db 'OK',0
740
 strGetPass db 'Пароль',0
741
 strCancel  db 'Отмена',0
742
 strUnpackOk  db "'Успешно распаковано' -O",0
743
 strUnpackFault  db "'Ошибка распаковки' -E",0
744
 strNotSupport db "'Неподдерживаемый формат архива' -E",0
745
 strNotFound db "'Файл не найден' -E",0
7113 GerdtR 746
else
7157 leency 747
 strGo db   'Unpack',0
748
 strInp db  'Archive',0
749
 strPath db 'Extract to',0
7113 GerdtR 750
 strError db 'Error',0
751
 strErrorExc db 'Unrecognized error',0
752
 strOk	db 'OK',0
7157 leency 753
 strGetPass db 'Password',0
7113 GerdtR 754
 strCancel  db 'Cancel',0
7157 leency 755
 strUnpackOk  db "'Unpacked successfuly' -O",0
756
 strUnpackFault  db "'Unpack failed' -E",0
757
 strNotSupport db "'Archive format is not supported' -E",0
758
 strNotFound db "'File not found' -E",0
7113 GerdtR 759
end if
760
 
7157 leency 761
strNull db 0
762
strDots db '...',0
7113 GerdtR 763
 
764
;--------
765
; int __stdcall SayErr(int num_strings, const char* strings[],
766
;                      int num_buttons, const char* buttons[]);
767
; int __stdcall DialogBox(DLGDATA* dlg);
768
 
769
forpassword rd 1
770
stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel
771
errmess0 dd strErrorExc
772
 
773
 
774
kfar_info:
775
	dd	.size
776
	dd	version_dword
777
	dd	open
778
	dd	open2
779
	dd	read
780
	dd	-1	; write: to be implemented
781
	dd	seek
782
	dd	tell
783
	dd	-1	; flush: to be implemented
784
	dd	filesize
785
	dd	close
786
	dd	xpgalloc
787
	dd	xpgrealloc
788
	dd	pgfree
789
	dd	getfreemem
790
	dd	debugInt3;libini_alloc
791
	dd	debugInt3;libini_realloc
792
	dd	debugInt3;libini_free
793
	dd	debugInt3;menu
794
	dd	debugInt3;menu_centered_in
795
	dd	DialogBox;DialogBox
796
	dd	SayErr	 ;SayErr
797
	dd	debugInt3;Message
798
	dd	0	;cur_width
799
.size = $ - kfar_info
800
;--------
801
 
802
 
803
iFiles dd 0	;количество выгружаемых файлов
804
endPointer dd buffer
805
 
806
 
807
fsZip:
808
.cmd	dd 5
809
	dd 0
810
	dd 0
811
.size	dd 0
812
.buf	dd bdvkPack
813
	db 0
814
	dd fInp
815
 
816
fsZipRead:
817
.cmd	dd 0
818
	dd 0
819
	dd 0
820
.size	dd 1024
821
.buf	dd filedata_buffer
822
	db 0
823
	dd fInp
824
 
825
 
826
fsWrite:
827
.cmd	dd 2	;2 rewrite, 3 - write
828
.pos	dd 0
829
.hpos	dd 0
830
.size	dd SIZE_COPY_BUF
831
.buf	dd copy_buf
832
	db 0
833
.path	dd 0
834
 
835
 
836
fsNewDir:
837
.cmd	dd 9
838
	dd 0
839
	dd 0
840
	dd 0
841
	dd 0
842
	db 0
843
.path	dd 0
844
 
845
fsDelDir:
846
.cmd	dd 8
847
	dd 0
848
	dd 0
849
	dd 0
850
	dd 0
851
	db 0
852
.path	dd 0
853
 
854
 
855
 
856
fsRunNotifyOK:
857
.cmd	dd 7
858
	dd 0
859
.param	dd strUnpackOk
860
.size	dd 0
861
.buf	dd 0
862
	db '/sys/@notify',0
863
 
864
 
865
 
7157 leency 866
edtPack     edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
867
            255, fInp, mouse_dd,0,0,0
868
edtUnpPath  edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
869
            255, pathOut, mouse_dd,0,0,0
870
edtPassword edit_box 200,56,70,0FFFFFFh,0xff,0x80ff,0h,0x90000000,255,\
7113 GerdtR 871
		password, mouse_dd,0,0,0
872
endEdits:
873
 
874
;-------------------------------------------------------------------------------
875
OpenDialog_data:
876
.type			dd 0	;0-open, 1-save, 2-select folder
877
.procinfo		dd RBProcInfo	    ;+4
878
.com_area_name		dd communication_area_name	;+8
879
.com_area		dd 0	;+12
880
.opendir_pach		dd temp_dir_pach	;+16
881
.dir_default_pach	dd communication_area_default_pach	;+20
882
.start_path		dd open_dialog_path	;+24
883
.draw_window		dd winRedraw		   ;+28
884
.status 		dd 0	;+32
885
.openfile_pach		dd ODAreaPath;   ;+36
886
.filename_area		dd 0;        ;+40
887
.filter_area		dd Filter
888
.x:
889
.x_size 		dw 420 ;+48 ; Window X size
890
.x_start		dw 100 ;+50 ; Window X position
891
.y:
892
.y_size 		dw 320 ;+52 ; Window y size
893
.y_start		dw 100 ;+54 ; Window Y position
894
 
895
communication_area_name:
896
	db 'FFFFFFFF_open_dialog',0
897
open_dialog_path:
898
	db '/sys/File managers/opendial',0
899
 
900
communication_area_default_pach:
901
	db '/sys',0
902
 
903
Filter	dd 0
904
 
905
 
906
; int __stdcall         ReadFolder(HANDLE hPlugin,
907
;       unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata);
908
; void __stdcall        ClosePlugin(HANDLE hPlugin);
909
; bool __stdcall        SetFolder(HANDLE hPlugin,
910
;       const char* relative_path, const char* absolute_path);
911
; void __stdcall        GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info);
912
; void __stdcall        GetFiles(HANDLE hPlugin, int NumItems, void* items[],
913
;       void* addfile, void* adddir);
914
;       bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile);
915
;       bool __stdcall adddir(const char* name, void* bdfe_info);
916
; int __stdcall         getattr(HANDLE hPlugin, const char* filename, void* info);
917
; HANDLE __stdcall      open(HANDLE hPlugin, const char* filename, int mode);
918
; void __stdcall        setpos(HANDLE hFile, __int64 pos);
919
; unsigned __stdcall    read(HANDLE hFile, void* buf, unsigned size);
920
; void __stdcall        close(HANDLE hFile);
921
IMPORTS:
922
library archiver, 'archiver.obj',\
923
	box_lib ,'box_lib.obj',\
924
	proc_lib,'proc_lib.obj'
925
 
926
import	archiver,\
927
	aPluginLoad	,      'plugin_load',\
928
	aOpenFilePlugin ,      'OpenFilePlugin',\
929
	aClosePlugin	,      'ClosePlugin',\
930
	aReadFolder	,      'ReadFolder',\
931
	aSetFolder	,      'SetFolder',\
932
	aGetFiles	,      'GetFiles',\
933
	aGetOpenPluginInfo ,   'GetOpenPluginInfo',\
934
	aGetattr	,      'getattr',\
935
	aOpen		,      'open',\
936
	aRead		,      'read',\
937
	aSetpos 	,      'setpos',\
938
	aClose		,      'close',\
939
	aDeflateUnpack	,      'deflate_unpack',\
940
	aDeflateUnpack2 ,      'deflate_unpack2'
941
 
942
import	proc_lib,\
943
	OpenDialog_Init 	,'OpenDialog_init',\
944
	OpenDialog_Start	,'OpenDialog_start'
945
import	box_lib,\
946
	edit_box_draw		,'edit_box',\
947
	edit_box_key		,'edit_box_key',\
948
	edit_box_mouse		,'edit_box_mouse'
949
 
950
 
951
IncludeIGlobals
952
 
953
;--  UDATA  -----------------------------------------------------------------------------
954
init_end:
955
align 16
956
IncludeUGlobals
957
 
958
 
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
961
;params db '/hd0/1/unz/xboot-1-0-build-14-en-win.zip',0
962
;rb 4096
963
 
964
fInp	rb 1024
965
pathOut rb 1024
966
files	rd 256
967
password	rb 256
968
 
969
fZipInfo	 rb 40
970
 
971
mouse_dd	rd 1
972
RBProcInfo	rb 1024
973
temp_dir_pach	rb 1024
974
ODAreaPath	rb 1024
975
 
976
 
977
 
978
;--------
979
 
980
copy_buf rb SIZE_COPY_BUF
981
 
982
execdata rb	1024
983
execdataend:
984
 
985
filedata_buffer_size = 1024
986
filedata_buffer rb	filedata_buffer_size
987
 
988
CopyDestEditBuf 	rb	12+512+1
989
.length = $ - CopyDestEditBuf - 13
990
 
991
bdvkPack rb 560
992
 
993
;--------
994
 
995
buffer	rb 4096 ;for string of file name or extract
996
params rb 4096
997
 
998
	rb 1024
999
stackUnpack:
1000
 
1001
	rb 1024
1002
stackDlg:
1003
 
1004
	rb 1024
1005
stack_top:
1006
 
1007
end_mem:
1008