Subversion Repositories Kolibri OS

Rev

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