Go to most recent revision | Details | 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 | |||
51 | |||
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] |
||
252 | or edx, 0x33000000 |
||
253 | mcall 0, <200,320>, <200,130>, , , title |
||
254 | mcall 8, <113,100>,<65,25>,2,[sc.work_button] |
||
255 | mcall 8, <280,15>,<11,14>,3,[sc.work_button] |
||
256 | mcall 8, <280,15>,<33,14>,4,[sc.work_button] |
||
257 | |||
258 | edit_boxes_set_sys_color edtPack,endEdits,sc |
||
259 | stdcall [edit_box_draw],edtPack |
||
260 | stdcall [edit_box_draw],edtUnpPath |
||
261 | |||
262 | |||
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: |
||
271 | mcall 4, <15,11>, , strInp |
||
272 | mov ecx,[sc.work_text] |
||
273 | or ecx,90000000h |
||
274 | mcall 4, <15,32>, , strPath |
||
275 | mov ecx,[sc.work_button_text] |
||
276 | or ecx,90000000h |
||
277 | mcall 4, <140,70>, , strGo |
||
278 | |||
279 | mcall 12, 2 |
||
280 | ret |
||
281 | endp |
||
282 | |||
283 | ;region |
||
284 | selectInput: |
||
285 | mov [OpenDialog_data.type],0 |
||
286 | stdcall [OpenDialog_Start],OpenDialog_data |
||
287 | mov edi,ODAreaPath |
||
288 | xor al,al |
||
289 | or ecx,-1 |
||
290 | repne scasb |
||
291 | sub edi,ODAreaPath |
||
292 | dec edi |
||
293 | mov dword[edtPack+12*4],edi |
||
294 | mov ecx,edi |
||
295 | inc ecx |
||
296 | mov edi,fInp |
||
297 | mov esi,ODAreaPath |
||
298 | rep movsb |
||
299 | mov [redInput],0 |
||
300 | ret |
||
301 | ;endregion |
||
302 | |||
303 | ;region |
||
304 | selectOutFold: |
||
305 | mov [OpenDialog_data.type],2 |
||
306 | stdcall [OpenDialog_Start],OpenDialog_data |
||
307 | mov edi,ODAreaPath |
||
308 | xor al,al |
||
309 | or ecx,-1 |
||
310 | repne scasb |
||
311 | sub edi,ODAreaPath |
||
312 | dec edi |
||
313 | mov dword[edtUnpPath+12*4],edi |
||
314 | mov ecx,edi |
||
315 | inc ecx |
||
316 | mov edi,pathOut |
||
317 | mov esi,ODAreaPath |
||
318 | rep movsb |
||
319 | ret |
||
320 | ;endregion |
||
321 | |||
322 | |||
323 | ;------------------------------------------------------------------------------- |
||
324 | |||
325 | allfiles dd 0 |
||
326 | succfiles dd 0 |
||
327 | numbytes dd 0 |
||
328 | |||
329 | proc startUnpack |
||
330 | locals |
||
331 | paramUnp rd 1 |
||
332 | sizeUnpack rd 1 |
||
333 | hFile rd 1 |
||
334 | hFileZip rd 1 |
||
335 | hPlugin rd 1 |
||
336 | pathFold rb 256 |
||
337 | endl |
||
338 | ;if input not corrected |
||
339 | cmp [fInp],byte 0 |
||
340 | je .errNullInp |
||
341 | |||
342 | ; mcall 68, 24, Exception, 0FFFFFFFFh ;?? |
||
343 | ;init plugin |
||
344 | push ebp |
||
345 | stdcall [aPluginLoad],kfar_info |
||
346 | pop ebp |
||
347 | |||
348 | |||
349 | ;set current directory, create folder |
||
350 | cmp [pathOut],0 |
||
351 | jne @f |
||
352 | lea eax,[pathFold] |
||
353 | stdcall cpLastName, fInp, eax |
||
354 | lea eax,[pathFold] |
||
355 | mov [fsNewDir.path],eax |
||
356 | mcall 70, fsNewDir |
||
357 | mov ecx, [fsNewDir.path] |
||
358 | |||
359 | mcall 30,4,,1 |
||
360 | jmp .n |
||
361 | @@: |
||
362 | mcall 30,4,pathOut,1 |
||
363 | .n: |
||
364 | |||
365 | ;open and read first 1KB |
||
366 | stdcall open, fInp, O_READ |
||
367 | mov [hFileZip], eax |
||
368 | mcall 70,fsZip |
||
369 | test eax,eax |
||
370 | jnz .errNotFound |
||
371 | mcall 70,fsZipRead |
||
372 | |||
373 | |||
374 | ;open pack |
||
375 | push ebp |
||
376 | stdcall [aOpenFilePlugin],[hFileZip],bdvkPack,filedata_buffer,filedata_buffer_size ,0 ,0 , fInp |
||
377 | pop ebp |
||
378 | |||
379 | test eax,eax |
||
380 | jnz @f |
||
381 | cmp ebx,0 ;;/ КОСТЫЛЬ!!!! |
||
382 | je .errNotFound ;;значение ebx получено опытным путём. |
||
383 | cmp ebx,400h ;;как оно будет работать с другими версиями |
||
384 | je .errNotSupp ;;библиотеки - не ясно! |
||
385 | @@: |
||
386 | mov [hPlugin],eax |
||
387 | |||
388 | ;get num of all files |
||
389 | ; stdcall calcSizeArch,[hPlugin] |
||
390 | ; push ebp |
||
391 | ; stdcall [aReadFolder], [hPlugin] |
||
392 | ; pop ebp |
||
393 | |||
394 | |||
395 | |||
396 | ; push ebp |
||
397 | ; stdcall [aOpen], [hPlugin], .str1, O_READ |
||
398 | ; pop ebp |
||
399 | ; |
||
400 | ; push ebp |
||
401 | ; stdcall [aSetpos],[hPlugin],0,POSEND |
||
402 | ; pop ebp |
||
403 | ; add [numbytes],eax |
||
404 | |||
405 | |||
406 | |||
407 | ;unpack |
||
408 | ; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir); |
||
409 | push ebp |
||
410 | stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir |
||
411 | pop ebp |
||
412 | |||
413 | ;jmp @f |
||
414 | ; .str1 db '/LICENSE.txt',0 |
||
415 | ;@@: |
||
416 | |||
417 | ;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); |
||
418 | ;Открыть файл filename. Параметр mode зарезервирован и в текущей версии kfar всегда равен 1. |
||
419 | ; push ebp |
||
420 | ; stdcall [aOpen], [hPlugin], .str1, O_READ |
||
421 | ; pop ebp |
||
422 | |||
423 | ; mov [hFile],eax |
||
424 | ;unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); |
||
425 | ;Чтение size байт в буфер buf из файла hFile, ранее открытого через open. |
||
426 | ;size кратен 512 байт |
||
427 | ;Возвращаемое значение: число прочитанных байт, -1 при ошибке. |
||
428 | ; push ebp |
||
429 | ; stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF |
||
430 | ; pop ebp |
||
431 | ; |
||
432 | ; mcall 70, fsWrite |
||
433 | ;void __stdcall close(HANDLE hFile); |
||
434 | push ebp |
||
435 | stdcall [aClose], [hFile] |
||
436 | mov [bWinChild],0 |
||
437 | pop ebp |
||
438 | |||
439 | push ebp |
||
440 | stdcall [aClosePlugin], [hPlugin] |
||
441 | mov [bWinChild],0 |
||
442 | |||
443 | mov [fsRunNotifyOK.param],strUnpackOk |
||
444 | mcall 70,fsRunNotifyOK |
||
445 | pop ebp |
||
446 | ret ;SUCCESS |
||
447 | |||
448 | |||
449 | .errNotFound: |
||
450 | ; stdcall SimpleSayErr,strNotFound |
||
451 | mov [bWinChild],0 |
||
452 | mov [fsRunNotifyOK.param],strUnpackFault |
||
453 | mcall 70,fsRunNotifyOK |
||
454 | ret |
||
455 | |||
456 | .errNotSupp: |
||
457 | mov eax,[fsNewDir.path] |
||
458 | mov [fsDelDir.path],eax |
||
459 | mcall 70, fsDelDir |
||
460 | |||
461 | mov [bWinChild],0 |
||
462 | mov [fsRunNotifyOK.param],strUnpackFault |
||
463 | mcall 70,fsRunNotifyOK |
||
464 | ret |
||
465 | |||
466 | .errNullInp: |
||
467 | mov [redInput],1 |
||
468 | mov [bWinChild],0 |
||
469 | ret |
||
470 | endp |
||
471 | |||
472 | |||
473 | proc Exception param1:dword |
||
474 | stdcall SimpleSayErr,strErrorExc |
||
475 | ret |
||
476 | endp |
||
477 | |||
478 | proc debugInt3 |
||
479 | dps 'Паника!!!!!!!!!!!!!!!!!!!!!!!!!' |
||
480 | dnl |
||
481 | int3 |
||
482 | ret |
||
483 | endp |
||
484 | |||
485 | |||
486 | proc calcSizeArch hPlugin:dword |
||
487 | locals |
||
488 | bdwk rb 560 |
||
489 | endl |
||
490 | ;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, |
||
491 | ; unsigned dirinfo_size, void* dirdata); |
||
492 | int3 |
||
493 | push ebp |
||
494 | lea eax,[bdwk] |
||
495 | stdcall [aReadFolder], [hPlugin],1,560,eax |
||
496 | pop ebp |
||
497 | |||
498 | ret |
||
499 | endp |
||
500 | ;------------------------------------------------------------------------------- |
||
501 | ;------------------------------------------------------------------------------- |
||
502 | ;------------------------------------------------------------------------------- |
||
503 | |||
504 | ;SayErr int num_strings, const char* strings[], |
||
505 | ; int num_buttons, const char* buttons[]); |
||
506 | |||
507 | proc SayErr num_strings:dword, strings:dword,num_buttons:dword, buttons:dword |
||
508 | pushad |
||
509 | cmp [num_strings],1 |
||
510 | je @f |
||
511 | m2m [errmess0], strErrorExc |
||
512 | jmp .l1 |
||
513 | @@: |
||
514 | mov ebx,[strings] |
||
515 | m2m [errmess0], dword [ebx] |
||
516 | .l1: |
||
517 | mcall 51,1,threadSayErr,stackDlg |
||
518 | popad |
||
519 | mov eax,1 |
||
520 | ret |
||
521 | endp |
||
522 | |||
523 | proc SimpleSayErr str:dword |
||
524 | pushad |
||
525 | m2m [errmess0],[str] |
||
526 | mcall 51,1,threadSayErr,stackDlg |
||
527 | popad |
||
528 | ret |
||
529 | endp |
||
530 | |||
531 | |||
532 | proc threadSayErr |
||
533 | mcall 40, 111b+0C000000h |
||
534 | .wm_redraw: |
||
535 | mcall 12, 1 |
||
536 | mcall 48, 3, sc, sizeof.system_colors |
||
537 | mov edx, [sc.work] |
||
538 | or edx, 0x33000000 |
||
539 | mcall 0, <220,420>, <220,110>, , , title |
||
540 | |||
541 | mov ecx,[sc.work_text] |
||
542 | or ecx,90000000h |
||
543 | mov edx,[errmess0] |
||
544 | mcall 4, <15,11> |
||
545 | |||
546 | mcall 8, <105,100>,<45,25>,1,[sc.work_button] |
||
547 | mov ecx,[sc.work_button_text] |
||
548 | or ecx,90000000h |
||
549 | mcall 4, <147,51>, , strOk |
||
550 | |||
551 | mcall 12, 2 |
||
552 | |||
553 | .still: |
||
554 | mcall 10 |
||
555 | cmp eax, 1 |
||
556 | je .wm_redraw |
||
557 | cmp eax, 2 |
||
558 | je .wm_key |
||
559 | cmp eax, 3 |
||
560 | je .wm_button |
||
561 | jmp .still |
||
562 | |||
563 | .wm_button: |
||
564 | mcall 17 |
||
565 | |||
566 | cmp ah, 1 |
||
567 | je .exit |
||
568 | jmp .still |
||
569 | |||
570 | .wm_key: |
||
571 | mcall 2 |
||
572 | jmp .still |
||
573 | .exit: |
||
574 | mcall -1 |
||
575 | endp |
||
576 | |||
577 | ;------------------------------------------------------------------------------- |
||
578 | ;------------------------------------------------------------------------------- |
||
579 | ;------------------------------------------------------------------------------- |
||
580 | ; "enter password" dialog for KFar |
||
581 | ;password_dlg: |
||
582 | ; dd 1 ; use standard dialog colors |
||
583 | ; dd -1 ; center window by x |
||
584 | ; dd -1 ; center window by y |
||
585 | ;.width dd ? ; width (will be filled according to current console width) |
||
586 | ; dd 2 ; height |
||
587 | ; dd 4, 2 ; border size |
||
588 | ; dd aEnterPasswordTitle ; title |
||
589 | ; dd ? ; colors (will be set by KFar) |
||
590 | ; dd 0 ; used internally by dialog manager, ignored |
||
591 | ; dd 0, 0 ; reserved for DlgProc |
||
592 | ; dd 2 ; 2 controls |
||
593 | ;; the string "enter password" |
||
594 | ; dd 1 ; type: static |
||
595 | ; dd 1,0 ; upper-left position |
||
596 | ;.width1 dd ?,0 ; bottom-right position |
||
597 | ; dd aEnterPassword ; data |
||
598 | ; dd 0 ; flags |
||
599 | ;; editbox for password |
||
600 | ; dd 3 ; type: edit |
||
601 | ; dd 1,1 ; upper-left position |
||
602 | ;.width2 dd ?,0 ; bottom-right position |
||
603 | ; dd password_data ; data |
||
604 | ; dd 2Ch ; flags |
||
605 | |||
606 | |||
607 | |||
608 | proc DialogBox dlgInfo:dword |
||
609 | pushad |
||
610 | mov ebx,[dlgInfo] |
||
611 | mov eax,[ebx+19*4] |
||
612 | mov [forpassword],eax |
||
613 | mov byte[eax], 0 |
||
614 | mov [stateDlg], 0 |
||
615 | mcall 51,1,threadDialogBox,stackDlg |
||
616 | |||
617 | ;wait thread... |
||
618 | @@: cmp [stateDlg],0 |
||
619 | jne @f |
||
620 | mcall 5,1 |
||
621 | jmp @b |
||
622 | @@: |
||
623 | popad |
||
624 | cmp [stateDlg], 1 |
||
625 | jne @f |
||
626 | xor eax, eax |
||
627 | ret |
||
628 | @@: |
||
629 | or eax, -1 |
||
630 | ret |
||
631 | endp |
||
632 | |||
633 | proc threadDialogBox |
||
634 | |||
635 | mcall 40, 100111b+0C000000h |
||
636 | mov eax,[forpassword] |
||
637 | mov [edtPassword+4*9],eax |
||
638 | xor eax,eax |
||
639 | mov dword[edtPassword.size], eax |
||
640 | mov dword[edtPassword.pos], eax |
||
641 | |||
642 | .wm_redraw: |
||
643 | mcall 12, 1 |
||
644 | mcall 48, 3, sc, sizeof.system_colors |
||
645 | mov edx, [sc.work] |
||
646 | or edx, 0x33000000 |
||
647 | mcall 0, <200,320>, <200,140>, , , title |
||
648 | |||
649 | edit_boxes_set_sys_color edtPack,endEdits,sc |
||
650 | stdcall [edit_box_draw],edtPassword |
||
651 | |||
652 | |||
653 | mov ecx,[sc.work_text] |
||
654 | or ecx,90000000h |
||
655 | mcall 4, <56,12>, , strGetPass |
||
656 | |||
657 | mcall 8, <70,80>,<74,22>,2,[sc.work_button] |
||
658 | mov ecx,[sc.work_button_text] |
||
659 | or ecx,90000000h |
||
660 | mcall 4, <103,79>, , strOk |
||
661 | |||
662 | mcall 8, <165,80>,<74,22>,1,[sc.work_button] |
||
663 | mov ecx,[sc.work_button_text] |
||
664 | or ecx,90000000h |
||
665 | mcall 4, <182,79>, , strCancel |
||
666 | |||
667 | |||
668 | mcall 12, 2 |
||
669 | |||
670 | .still: |
||
671 | mcall 10 |
||
672 | cmp eax, 1 |
||
673 | je .wm_redraw |
||
674 | cmp eax, 2 |
||
675 | je .wm_key |
||
676 | cmp eax, 3 |
||
677 | je .wm_button |
||
678 | cmp eax, 6 |
||
679 | je .wm_mouse |
||
680 | |||
681 | jmp .still |
||
682 | |||
683 | .wm_key: |
||
684 | mcall 2 |
||
685 | stdcall [edit_box_key],edtPassword |
||
686 | jmp .still |
||
687 | |||
688 | |||
689 | .wm_button: |
||
690 | mcall 17 |
||
691 | |||
692 | cmp ah, 2 ;OK |
||
693 | jne @f |
||
694 | mov [stateDlg],1 |
||
695 | jmp .exit |
||
696 | @@: |
||
697 | |||
698 | cmp ah, 1 ;Close window or Cancel |
||
699 | jne .still |
||
700 | mov [stateDlg],2 |
||
701 | jmp .exit |
||
702 | |||
703 | .wm_mouse: |
||
704 | stdcall [edit_box_mouse],edtPassword |
||
705 | |||
706 | |||
707 | jmp .still |
||
708 | |||
709 | .exit: |
||
710 | mcall -1 |
||
711 | endp |
||
712 | |||
713 | |||
714 | ;-- DATA ------------------------------------------------------------------- |
||
715 | |||
716 | |||
717 | |||
718 | sc system_colors |
||
719 | |||
720 | |||
721 | title db 'uNZ v0.1 alpha',0 |
||
722 | bWinChild db 0 ;1 - дочернее окно есть, главное окно не должно реагировать |
||
723 | redInput db 0 ;1 - подсветить красным надпись |
||
724 | |||
725 | |||
726 | if lang eq ru |
||
727 | strGo db 'Распаковать',0 |
||
728 | strInp db 'Архив',0 |
||
729 | strPath db 'Куда',0 |
||
730 | else |
||
731 | strGo db 'Unpack',0 |
||
732 | strInp db 'Pack',0 |
||
733 | strPath db 'Wohin',0 |
||
734 | strError db 'Error',0 |
||
735 | strErrorExc db 'Unrecognized error',0 |
||
736 | strOk db 'OK',0 |
||
737 | strGetPass db 'Password:',0 |
||
738 | strCancel db 'Cancel',0 |
||
739 | strUnpackOk db 'Unpacked successfuly',0 |
||
740 | strUnpackFault db 'Unpacked fault',0 |
||
741 | strNotSupport db 'Format not support',0 |
||
742 | strNotFound db 'File not found',0 |
||
743 | strNull db 0 |
||
744 | end if |
||
745 | |||
746 | |||
747 | strDots db '..',0 |
||
748 | |||
749 | ;-------- |
||
750 | ; int __stdcall SayErr(int num_strings, const char* strings[], |
||
751 | ; int num_buttons, const char* buttons[]); |
||
752 | ; int __stdcall DialogBox(DLGDATA* dlg); |
||
753 | |||
754 | forpassword rd 1 |
||
755 | stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel |
||
756 | errmess0 dd strErrorExc |
||
757 | |||
758 | |||
759 | kfar_info: |
||
760 | dd .size |
||
761 | dd version_dword |
||
762 | dd open |
||
763 | dd open2 |
||
764 | dd read |
||
765 | dd -1 ; write: to be implemented |
||
766 | dd seek |
||
767 | dd tell |
||
768 | dd -1 ; flush: to be implemented |
||
769 | dd filesize |
||
770 | dd close |
||
771 | dd xpgalloc |
||
772 | dd xpgrealloc |
||
773 | dd pgfree |
||
774 | dd getfreemem |
||
775 | dd debugInt3;libini_alloc |
||
776 | dd debugInt3;libini_realloc |
||
777 | dd debugInt3;libini_free |
||
778 | dd debugInt3;menu |
||
779 | dd debugInt3;menu_centered_in |
||
780 | dd DialogBox;DialogBox |
||
781 | dd SayErr ;SayErr |
||
782 | dd debugInt3;Message |
||
783 | dd 0 ;cur_width |
||
784 | .size = $ - kfar_info |
||
785 | ;-------- |
||
786 | |||
787 | |||
788 | iFiles dd 0 ;количество выгружаемых файлов |
||
789 | endPointer dd buffer |
||
790 | |||
791 | |||
792 | fsZip: |
||
793 | .cmd dd 5 |
||
794 | dd 0 |
||
795 | dd 0 |
||
796 | .size dd 0 |
||
797 | .buf dd bdvkPack |
||
798 | db 0 |
||
799 | dd fInp |
||
800 | |||
801 | fsZipRead: |
||
802 | .cmd dd 0 |
||
803 | dd 0 |
||
804 | dd 0 |
||
805 | .size dd 1024 |
||
806 | .buf dd filedata_buffer |
||
807 | db 0 |
||
808 | dd fInp |
||
809 | |||
810 | |||
811 | fsWrite: |
||
812 | .cmd dd 2 ;2 rewrite, 3 - write |
||
813 | .pos dd 0 |
||
814 | .hpos dd 0 |
||
815 | .size dd SIZE_COPY_BUF |
||
816 | .buf dd copy_buf |
||
817 | db 0 |
||
818 | .path dd 0 |
||
819 | |||
820 | |||
821 | fsNewDir: |
||
822 | .cmd dd 9 |
||
823 | dd 0 |
||
824 | dd 0 |
||
825 | dd 0 |
||
826 | dd 0 |
||
827 | db 0 |
||
828 | .path dd 0 |
||
829 | |||
830 | fsDelDir: |
||
831 | .cmd dd 8 |
||
832 | dd 0 |
||
833 | dd 0 |
||
834 | dd 0 |
||
835 | dd 0 |
||
836 | db 0 |
||
837 | .path dd 0 |
||
838 | |||
839 | |||
840 | |||
841 | fsRunNotifyOK: |
||
842 | .cmd dd 7 |
||
843 | dd 0 |
||
844 | .param dd strUnpackOk |
||
845 | .size dd 0 |
||
846 | .buf dd 0 |
||
847 | db '/sys/@notify',0 |
||
848 | |||
849 | |||
850 | |||
851 | edtPack edit_box 200,70,11 ,0FFFFFFh,06F9480h,0FFh,0h,0x90000000,255,\ |
||
852 | fInp, mouse_dd,0,0,0 |
||
853 | edtUnpPath edit_box 200,70,33,0FFFFFFh,06F9480h,0FFh,0h,0x90000000,255, \ |
||
854 | pathOut, mouse_dd,0,0,0 |
||
855 | edtPassword edit_box 200,56,40,0FFFFFFh,06F9480h,0FFh,0h,0x90000000,255, \ |
||
856 | password, mouse_dd,0,0,0 |
||
857 | endEdits: |
||
858 | |||
859 | ;------------------------------------------------------------------------------- |
||
860 | OpenDialog_data: |
||
861 | .type dd 0 ;0-open, 1-save, 2-select folder |
||
862 | .procinfo dd RBProcInfo ;+4 |
||
863 | .com_area_name dd communication_area_name ;+8 |
||
864 | .com_area dd 0 ;+12 |
||
865 | .opendir_pach dd temp_dir_pach ;+16 |
||
866 | .dir_default_pach dd communication_area_default_pach ;+20 |
||
867 | .start_path dd open_dialog_path ;+24 |
||
868 | .draw_window dd winRedraw ;+28 |
||
869 | .status dd 0 ;+32 |
||
870 | .openfile_pach dd ODAreaPath; ;+36 |
||
871 | .filename_area dd 0; ;+40 |
||
872 | .filter_area dd Filter |
||
873 | .x: |
||
874 | .x_size dw 420 ;+48 ; Window X size |
||
875 | .x_start dw 100 ;+50 ; Window X position |
||
876 | .y: |
||
877 | .y_size dw 320 ;+52 ; Window y size |
||
878 | .y_start dw 100 ;+54 ; Window Y position |
||
879 | |||
880 | communication_area_name: |
||
881 | db 'FFFFFFFF_open_dialog',0 |
||
882 | open_dialog_path: |
||
883 | db '/sys/File managers/opendial',0 |
||
884 | |||
885 | communication_area_default_pach: |
||
886 | db '/sys',0 |
||
887 | |||
888 | Filter dd 0 |
||
889 | |||
890 | |||
891 | ; int __stdcall ReadFolder(HANDLE hPlugin, |
||
892 | ; unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata); |
||
893 | ; void __stdcall ClosePlugin(HANDLE hPlugin); |
||
894 | ; bool __stdcall SetFolder(HANDLE hPlugin, |
||
895 | ; const char* relative_path, const char* absolute_path); |
||
896 | ; void __stdcall GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info); |
||
897 | ; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], |
||
898 | ; void* addfile, void* adddir); |
||
899 | ; bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile); |
||
900 | ; bool __stdcall adddir(const char* name, void* bdfe_info); |
||
901 | ; int __stdcall getattr(HANDLE hPlugin, const char* filename, void* info); |
||
902 | ; HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); |
||
903 | ; void __stdcall setpos(HANDLE hFile, __int64 pos); |
||
904 | ; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size); |
||
905 | ; void __stdcall close(HANDLE hFile); |
||
906 | IMPORTS: |
||
907 | library archiver, 'archiver.obj',\ |
||
908 | box_lib ,'box_lib.obj',\ |
||
909 | proc_lib,'proc_lib.obj' |
||
910 | |||
911 | import archiver,\ |
||
912 | aPluginLoad , 'plugin_load',\ |
||
913 | aOpenFilePlugin , 'OpenFilePlugin',\ |
||
914 | aClosePlugin , 'ClosePlugin',\ |
||
915 | aReadFolder , 'ReadFolder',\ |
||
916 | aSetFolder , 'SetFolder',\ |
||
917 | aGetFiles , 'GetFiles',\ |
||
918 | aGetOpenPluginInfo , 'GetOpenPluginInfo',\ |
||
919 | aGetattr , 'getattr',\ |
||
920 | aOpen , 'open',\ |
||
921 | aRead , 'read',\ |
||
922 | aSetpos , 'setpos',\ |
||
923 | aClose , 'close',\ |
||
924 | aDeflateUnpack , 'deflate_unpack',\ |
||
925 | aDeflateUnpack2 , 'deflate_unpack2' |
||
926 | |||
927 | import proc_lib,\ |
||
928 | OpenDialog_Init ,'OpenDialog_init',\ |
||
929 | OpenDialog_Start ,'OpenDialog_start' |
||
930 | import box_lib,\ |
||
931 | edit_box_draw ,'edit_box',\ |
||
932 | edit_box_key ,'edit_box_key',\ |
||
933 | edit_box_mouse ,'edit_box_mouse' |
||
934 | |||
935 | |||
936 | IncludeIGlobals |
||
937 | |||
938 | ;-- UDATA ----------------------------------------------------------------------------- |
||
939 | init_end: |
||
940 | align 16 |
||
941 | IncludeUGlobals |
||
942 | |||
943 | |||
944 | ;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0 |
||
945 | ;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0 |
||
946 | ;params db '/hd0/1/unz/xboot-1-0-build-14-en-win.zip',0 |
||
947 | ;rb 4096 |
||
948 | |||
949 | fInp rb 1024 |
||
950 | pathOut rb 1024 |
||
951 | files rd 256 |
||
952 | password rb 256 |
||
953 | |||
954 | fZipInfo rb 40 |
||
955 | |||
956 | mouse_dd rd 1 |
||
957 | RBProcInfo rb 1024 |
||
958 | temp_dir_pach rb 1024 |
||
959 | ODAreaPath rb 1024 |
||
960 | |||
961 | |||
962 | |||
963 | ;-------- |
||
964 | |||
965 | copy_buf rb SIZE_COPY_BUF |
||
966 | |||
967 | execdata rb 1024 |
||
968 | execdataend: |
||
969 | |||
970 | filedata_buffer_size = 1024 |
||
971 | filedata_buffer rb filedata_buffer_size |
||
972 | |||
973 | CopyDestEditBuf rb 12+512+1 |
||
974 | .length = $ - CopyDestEditBuf - 13 |
||
975 | |||
976 | bdvkPack rb 560 |
||
977 | |||
978 | ;-------- |
||
979 | |||
980 | buffer rb 4096 ;for string of file name or extract |
||
981 | params rb 4096 |
||
982 | |||
983 | rb 1024 |
||
984 | stackUnpack: |
||
985 | |||
986 | rb 1024 |
||
987 | stackDlg: |
||
988 | |||
989 | rb 1024 |
||
990 | stack_top: |
||
991 | |||
992 | end_mem:182,79>74,22>165,80>103,79>74,22>70,80>56,12>200,140>200,320>147,51>45,25>105,100>15,11>220,110>220,420>140,70>15,32>15,11>33,14>280,15>11,14>280,15>65,25>113,100>200,130>200,320> |
||
993 |