Subversion Repositories Kolibri OS

Rev

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