Subversion Repositories Kolibri OS

Rev

Rev 7162 | Rev 7538 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  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. WIN_W = 400
  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, 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]
  257.  
  258.         edit_boxes_set_sys_color edtPack,endEdits,sc
  259.         stdcall [edit_box_draw],edtPack
  260.         stdcall [edit_box_draw],edtUnpPath
  261.  
  262.         ; plain window labels
  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,16>, , strInp
  272.         mov     ecx,[sc.work_text]
  273.         or      ecx,90000000h
  274.         mcall 4, <15,37>, , strPath
  275.        
  276.         ; text on buttons
  277.         mov     ecx,[sc.work_button_text]
  278.         or      ecx,90000000h
  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    
  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.  
  526.         m2m     [fsRunNotifyOK.param],[errmess0]
  527.         mcall   70,fsRunNotifyOK
  528.  
  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
  682.  title db 'uNZ v0.12 -  á¯ ª®¢é¨ª Zip ¨ 7z',0
  683.  strGo db ' á¯ ª®¢ âì',0
  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
  695. else if lang eq es
  696.  title db 'uNZ v0.12 - Desarchivador para Zip y 7z',0
  697.  strGo db 'Desarchivar',0
  698.  strInp db 'Archivar',0
  699.  strPath db 'Extraer en',0
  700.  strError db 'Error',0
  701.  strErrorExc db 'Error desconocido',0
  702.  strOk db 'OK',0
  703.  strGetPass db 'Contrasena',0
  704.  strCancel db 'Cancelar',0
  705.  strUnpackOk db "'Extracion exitosa' -O",0
  706.  strUnpackFault db "'Fallo al extraer' -E",0
  707.  strNotSupport db "'El formato del archivo no es soportado' -E",0
  708.  strNotFound db "'Archivo no encontrado' -E",0
  709. else
  710.  title db 'uNZ v0.12 - Unarchiver of Zip and 7z',0
  711.  strGo db   'Unpack',0
  712.  strInp db  'Archive',0
  713.  strPath db 'Extract to',0
  714.  strError db 'Error',0
  715.  strErrorExc db 'Unrecognized error',0
  716.  strOk  db 'OK',0
  717.  strGetPass db 'Password',0
  718.  strCancel  db 'Cancel',0
  719.  strUnpackOk  db "'Unpacked successfuly' -O",0
  720.  strUnpackFault  db "'Unprack failed' -E",0
  721.  strNotSupport db "'Archive format is not supported' -E",0
  722.  strNotFound db "'File not found' -E",0
  723. end if
  724.  
  725. strNull db 0
  726. strDots db '...',0
  727.  
  728. ;--------
  729. ; int __stdcall SayErr(int num_strings, const char* strings[],
  730. ;                      int num_buttons, const char* buttons[]);
  731. ; int __stdcall DialogBox(DLGDATA* dlg);
  732.  
  733. forpassword rd 1
  734. stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel
  735. errmess0 dd strErrorExc
  736.  
  737.  
  738. kfar_info:
  739.         dd      .size
  740.         dd      version_dword
  741.         dd      open
  742.         dd      open2
  743.         dd      read
  744.         dd      -1      ; write: to be implemented
  745.         dd      seek
  746.         dd      tell
  747.         dd      -1      ; flush: to be implemented
  748.         dd      filesize
  749.         dd      close
  750.         dd      xpgalloc
  751.         dd      xpgrealloc
  752.         dd      pgfree
  753.         dd      getfreemem
  754.         dd      debugInt3;libini_alloc
  755.         dd      debugInt3;libini_realloc
  756.         dd      debugInt3;libini_free
  757.         dd      debugInt3;menu
  758.         dd      debugInt3;menu_centered_in
  759.         dd      DialogBox;DialogBox
  760.         dd      SayErr   ;SayErr
  761.         dd      debugInt3;Message
  762.         dd      0       ;cur_width
  763. .size = $ - kfar_info
  764. ;--------
  765.  
  766.  
  767. iFiles dd 0     ;ª®«¨ç¥á⢮ ¢ë£à㦠¥¬ëå ä ©«®¢
  768. endPointer dd buffer
  769.  
  770.  
  771. fsZip:
  772. .cmd    dd 5
  773.         dd 0
  774.         dd 0
  775. .size   dd 0
  776. .buf    dd bdvkPack
  777.         db 0
  778.         dd fInp
  779.  
  780. fsZipRead:
  781. .cmd    dd 0
  782.         dd 0
  783.         dd 0
  784. .size   dd 1024
  785. .buf    dd filedata_buffer
  786.         db 0
  787.         dd fInp
  788.  
  789.  
  790. fsWrite:
  791. .cmd    dd 2    ;2 rewrite, 3 - write
  792. .pos    dd 0
  793. .hpos   dd 0
  794. .size   dd SIZE_COPY_BUF
  795. .buf    dd copy_buf
  796.         db 0
  797. .path   dd 0
  798.  
  799.  
  800. fsNewDir:
  801. .cmd    dd 9
  802.         dd 0
  803.         dd 0
  804.         dd 0
  805.         dd 0
  806.         db 0
  807. .path   dd 0
  808.  
  809. fsDelDir:
  810. .cmd    dd 8
  811.         dd 0
  812.         dd 0
  813.         dd 0
  814.         dd 0
  815.         db 0
  816. .path   dd 0
  817.  
  818.  
  819.  
  820. fsRunNotifyOK:
  821. .cmd    dd 7
  822.         dd 0
  823. .param  dd strUnpackOk
  824. .size   dd 0
  825. .buf    dd 0
  826.         db '/sys/@notify',0
  827.  
  828.  
  829.  
  830. edtPack     edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
  831.             255, fInp, mouse_dd,0,0,0
  832. edtUnpPath  edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
  833.             255, pathOut, mouse_dd,0,0,0
  834. edtPassword edit_box 200,56,70,0FFFFFFh,0xff,0x80ff,0h,0x90000000,255,\
  835.                 password, mouse_dd,0,0,0
  836. endEdits:
  837.  
  838. ;-------------------------------------------------------------------------------
  839. OpenDialog_data:
  840. .type                   dd 0    ;0-open, 1-save, 2-select folder
  841. .procinfo               dd RBProcInfo       ;+4
  842. .com_area_name          dd communication_area_name      ;+8
  843. .com_area               dd 0    ;+12
  844. .opendir_pach           dd temp_dir_pach        ;+16
  845. .dir_default_pach       dd communication_area_default_pach      ;+20
  846. .start_path             dd open_dialog_path     ;+24
  847. .draw_window            dd winRedraw               ;+28
  848. .status                 dd 0    ;+32
  849. .openfile_pach          dd ODAreaPath;   ;+36
  850. .filename_area          dd 0;        ;+40
  851. .filter_area            dd Filter
  852. .x:
  853. .x_size                 dw 420 ;+48 ; Window X size
  854. .x_start                dw 100 ;+50 ; Window X position
  855. .y:
  856. .y_size                 dw 320 ;+52 ; Window y size
  857. .y_start                dw 100 ;+54 ; Window Y position
  858.  
  859. communication_area_name:
  860.         db 'FFFFFFFF_open_dialog',0
  861. open_dialog_path:
  862.         db '/sys/File managers/opendial',0
  863.  
  864. communication_area_default_pach:
  865.         db '/sys',0
  866.  
  867. Filter  dd 0
  868.  
  869.  
  870. ; int __stdcall         ReadFolder(HANDLE hPlugin,
  871. ;       unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata);
  872. ; void __stdcall        ClosePlugin(HANDLE hPlugin);
  873. ; bool __stdcall        SetFolder(HANDLE hPlugin,
  874. ;       const char* relative_path, const char* absolute_path);
  875. ; void __stdcall        GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info);
  876. ; void __stdcall        GetFiles(HANDLE hPlugin, int NumItems, void* items[],
  877. ;       void* addfile, void* adddir);
  878. ;       bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile);
  879. ;       bool __stdcall adddir(const char* name, void* bdfe_info);
  880. ; int __stdcall         getattr(HANDLE hPlugin, const char* filename, void* info);
  881. ; HANDLE __stdcall      open(HANDLE hPlugin, const char* filename, int mode);
  882. ; void __stdcall        setpos(HANDLE hFile, __int64 pos);
  883. ; unsigned __stdcall    read(HANDLE hFile, void* buf, unsigned size);
  884. ; void __stdcall        close(HANDLE hFile);
  885. IMPORTS:
  886. library archiver, 'archiver.obj',\
  887.         box_lib ,'box_lib.obj',\
  888.         proc_lib,'proc_lib.obj'
  889.  
  890. import  archiver,\
  891.         aPluginLoad     ,      'plugin_load',\
  892.         aOpenFilePlugin ,      'OpenFilePlugin',\
  893.         aClosePlugin    ,      'ClosePlugin',\
  894.         aReadFolder     ,      'ReadFolder',\
  895.         aSetFolder      ,      'SetFolder',\
  896.         aGetFiles       ,      'GetFiles',\
  897.         aGetOpenPluginInfo ,   'GetOpenPluginInfo',\
  898.         aGetattr        ,      'getattr',\
  899.         aOpen           ,      'open',\
  900.         aRead           ,      'read',\
  901.         aSetpos         ,      'setpos',\
  902.         aClose          ,      'close',\
  903.         aDeflateUnpack  ,      'deflate_unpack',\
  904.         aDeflateUnpack2 ,      'deflate_unpack2'
  905.  
  906. import  proc_lib,\
  907.         OpenDialog_Init         ,'OpenDialog_init',\
  908.         OpenDialog_Start        ,'OpenDialog_start'
  909. import  box_lib,\
  910.         edit_box_draw           ,'edit_box',\
  911.         edit_box_key            ,'edit_box_key',\
  912.         edit_box_mouse          ,'edit_box_mouse'
  913.  
  914.  
  915. IncludeIGlobals
  916.  
  917. ;--  UDATA  -----------------------------------------------------------------------------
  918. init_end:
  919. align 16
  920. IncludeUGlobals
  921.  
  922.  
  923. ;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0
  924. ;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0
  925. ;params db '/hd0/1/unz/xboot-1-0-build-14-en-win.zip',0
  926. ;rb 4096
  927.  
  928. fInp    rb 1024
  929. pathOut rb 1024
  930. files   rd 256
  931. password        rb 256
  932.  
  933. fZipInfo         rb 40
  934.  
  935. mouse_dd        rd 1
  936. RBProcInfo      rb 1024
  937. temp_dir_pach   rb 1024
  938. ODAreaPath      rb 1024
  939.  
  940.  
  941.  
  942. ;--------
  943.  
  944. copy_buf rb SIZE_COPY_BUF
  945.  
  946. execdata rb     1024
  947. execdataend:
  948.  
  949. filedata_buffer_size = 1024
  950. filedata_buffer rb      filedata_buffer_size
  951.  
  952. CopyDestEditBuf         rb      12+512+1
  953. .length = $ - CopyDestEditBuf - 13
  954.  
  955. bdvkPack rb 560
  956.  
  957. ;--------
  958.  
  959. buffer  rb 4096 ;for string of file name or extract
  960. params rb 4096
  961.  
  962.         rb 1024
  963. stackUnpack:
  964.  
  965.         rb 1024
  966. stackDlg:
  967.  
  968.         rb 1024
  969. stack_top:
  970.  
  971. end_mem:
  972.  
  973.  
  974.