Unz 0.2 by GerdtR

git-svn-id: svn://kolibrios.org@7538 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2018-11-07 17:45:36 +00:00
parent f81857f08c
commit 5b9108e430
11 changed files with 2376 additions and 220 deletions

211
programs/fs/unz/dialogs.inc Normal file
View File

@ -0,0 +1,211 @@
;SayErr int num_strings, const char* strings[],
; int num_buttons, const char* buttons[]);
proc SayErr num_strings:dword, strings:dword,num_buttons:dword, buttons:dword
pushad
cmp [num_strings],1
je @f
m2m [errmess0], strErrorExc
jmp .l1
@@:
mov ebx,[strings]
m2m [errmess0], dword [ebx]
.l1:
mcall 51,1,threadSayErr,stackDlg
popad
mov eax,1
ret
endp
proc SimpleSayErr str:dword
pushad
m2m [errmess0],[str]
mcall 51,1,threadSayErr,stackDlg
popad
ret
endp
proc threadSayErr
mcall 40, 000111b+0C000000h
.wm_redraw:
mcall 12, 1
mcall 48, 3, sc, sizeof.system_colors
mov edx, [sc.work]
or edx, 0x33000000
mcall 0, <220,420>, <220,110>, , , title
mov ecx,[sc.work_text]
or ecx,90000000h
mov edx,[errmess0]
mcall 4, <15,11>
mcall 8, <105,100>,<45,25>,1,[sc.work_button]
mov ecx,[sc.work_button_text]
or ecx,90000000h
mcall 4, <147,51>, , strOk
mcall 12, 2
.still:
mcall 10
cmp eax, 1
je .wm_redraw
cmp eax, 2
je .wm_key
cmp eax, 3
je .wm_button
jmp .still
.wm_button:
mcall 17
cmp ah, 1
je .exit
jmp .still
.wm_key:
mcall 2
jmp .still
.exit:
mcall -1
endp
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; "enter password" dialog for KFar
;password_dlg:
; dd 1 ; use standard dialog colors
; dd -1 ; center window by x
; dd -1 ; center window by y
;.width dd ? ; width (will be filled according to current console width)
; dd 2 ; height
; dd 4, 2 ; border size
; dd aEnterPasswordTitle ; title
; dd ? ; colors (will be set by KFar)
; dd 0 ; used internally by dialog manager, ignored
; dd 0, 0 ; reserved for DlgProc
; dd 2 ; 2 controls
;; the string "enter password"
; dd 1 ; type: static
; dd 1,0 ; upper-left position
;.width1 dd ?,0 ; bottom-right position
; dd aEnterPassword ; data
; dd 0 ; flags
;; editbox for password
; dd 3 ; type: edit
; dd 1,1 ; upper-left position
;.width2 dd ?,0 ; bottom-right position
; dd password_data ; data
; dd 2Ch ; flags
proc DialogBox dlgInfo:dword
pushad
mov ebx,[dlgInfo]
mov eax,[ebx+19*4]
mov [forpassword],eax
mov byte[eax], 0
mov [stateDlg], 0
mcall 51,1,threadDialogBox,stackDlg
;wait thread...
@@: cmp [stateDlg],0
jne @f
mcall 5,1
jmp @b
@@:
popad
cmp [stateDlg], 1
jne @f
xor eax, eax
ret
@@:
or eax, -1
ret
endp
proc threadDialogBox
mcall 40, 100111b+0C000000h
mov eax,[forpassword]
mov [edtPassword+4*9],eax
xor eax,eax
mov dword[edtPassword.size], eax
mov dword[edtPassword.pos], eax
.wm_redraw:
mcall 12, 1
mcall 48, 3, sc, sizeof.system_colors
mov edx, [sc.work]
or edx, 0x33000000
mcall 0, <200,320>, <200,140>, , , title
edit_boxes_set_sys_color edtPack,endEdits,sc
stdcall [edit_box_draw],edtPassword
mov ecx,[sc.work_text]
or ecx,90000000h
mcall 4, <56,12>, , strGetPass
mcall 8, <70,80>,<74,22>,2,[sc.work_button]
mov ecx,[sc.work_button_text]
or ecx,90000000h
mcall 4, <103,79>, , strOk
mcall 8, <165,80>,<74,22>,1,[sc.work_button]
mov ecx,[sc.work_button_text]
or ecx,90000000h
mcall 4, <182,79>, , strCancel
mcall 12, 2
.still:
mcall 10
cmp eax, 1
je .wm_redraw
cmp eax, 2
je .wm_key
cmp eax, 3
je .wm_button
cmp eax, 6
je .wm_mouse
jmp .still
.wm_key:
mcall 2
stdcall [edit_box_key],edtPassword
jmp .still
.wm_button:
mcall 17
cmp ah, 2 ;OK
jne @f
mov [stateDlg],1
jmp .exit
@@:
cmp ah, 1 ;Close window or Cancel
jne .still
mov [stateDlg],2
jmp .exit
.wm_mouse:
stdcall [edit_box_mouse],edtPassword
jmp .still
.exit:
mcall -1
endp

File diff suppressed because it is too large Load Diff

BIN
programs/fs/unz/free.raw Normal file

Binary file not shown.

View File

@ -653,10 +653,10 @@ endp
proc myAddDir name:dword, bdfe_info:dword proc myAddDir name:dword, bdfe_info:dword
dps 'log adddir' ; dps 'log adddir'
mov eax,[name] mov eax,[name]
dpsP eax ; dpsP eax
dnl ; dnl
pusha pusha
mov eax,[name] mov eax,[name]

1
programs/fs/unz/lang.inc Normal file
View File

@ -0,0 +1 @@
lang fix ru

View File

@ -0,0 +1,330 @@
;MM_ = MemoryManager
;<EFBFBD>â®â ¬®¤ã«ì ¯®§¢®«ï¥â ¢ë¤¥«ïâì ¯ ¬ïâì ¬ «¥­ìª¨¬¨ ªãá®çª ¬¨, ®¯â¨¬ «ì­® ¨á¯®«ì§ãï
;áâà ­¨æë ¯ ¬ïâ¨
;<EFBFBD>«®ª¨ - íâ® ®¤­  ¨«¨ ­¥áª®«ìª® áâà ­¨æ, ª®â®àë¥ ¨¬¥îâ § ¯¨áì
;¢ MM_BlockInfo ¨ ª®â®àë¥ ¢ ª®­æ¥ ¨¬¥îâ á⥪®®¡à §­ãî áâàãªâãàã(¢ á¬ëá«¥
;à áâñâ ª ¬¥­ì訬  ¤à¥á ¬), § ª ­ç¨¢ î饩áï dword 0. ­ ç «¥ ¡«®ª 
;­ å®¤ïâáï ¤ ­­ë¥. áâàãªâãॠ­ å®¤ïâáï ¯ àë dword'®¢: ­ ç «®
;ãç á⪮¢, ¨å ª®­¥æ(¯®á«. ¡ ©â+1). <EFBFBD>⨠¯ àë ¢á¥£¤  á®àâ¨àãîâáï ¯®
;à á¯®«®¦¥­¨î ®¯¨á뢠¥¬ëå
;ãç á⪮¢ ¢ ®¡à â­®¬ ¯®à浪¥, â.¥. ¢ á ¬®¬ ª®­æ¥ ¡«®ª  ¡ã¤¥â ¯ à  ¤ ­­ëå
;­  á ¬ë© ¯¥à¢ë© ãç á⮪. „«ï ¢ë¤¥«¥­¨ï ¯ ¬ï⨠­ã¦­® ­ ©â¨ ¡«®ª, ¢ ª®â®à®¬
;¤®áâ â®ç­® ¬¥áâ  (¯à¨çñ¬ ­¥®¡å®¤¨¬®¥ ¬¥áâ® = § ¯à è¨¢ ¥¬ë© ®¡êñ¬ + ¬¥áâ®
;¯®¤ ¯ àã á ¤ ­­ë¬¨ ¢ ª®­æ¥ ¡«®ª ) ¨ ¢áâ ¢¨âì ¯ àã á ­ã¦­ë¬¨ ¤ ­­ë¬¨.
;„«ï 㤠«¥­¨ï ãç á⪠ ­ã¦­® ⮫쪮 ã¡à âì ¨§ ¯ à ¯ àã á ­ã¦­ë¬ ãç á⪮¬
;¨ ¯®¯à ¢¨âì à á¯®«®¦¥­¨¥ ®áâ «ì­ëå ¯ à.
;begData1.....endData1,begData2...endData2,.......0,beg2,end2,beg1,end1
;¢ë¤¥«ï¥â ¯ ¬ïâì
;return eax = 㪠§ â¥«ì ­  ¢ë¤¥«¥­ë© ¡«®ª
;proc MM_AllocMem stdcall,Size:DWORD
;<EFBFBD>€ƒ ¢ ¢ë¤¥«¥­¨¨ ªà㯭ëå ªã᪮¢: ¢á¥£¤  ¢ë¤¥«ï¥â ­®¢ãî áâà ­¨æã
align 4
MM_AllocMem:
Size equ ebp+8
begFree equ ebp-8 ;­ ç «®
endFree equ ebp-4 ;¨ ª®­¥æ ᢮¡®¤­®£® ¬¥áâ  ®â ª®­æ  ¨­äë ¤®
endArea equ ebp-12
push ebp
mov ebp,esp
add esp,-4*3
push ebx edi esi
;dps 'MEM: '
;dph [Size]
;dps ' '
;­ ç «  ¯ à § ¯¨á¥©
mov edx,[MM_NBlocks]
cmp edx,0
jne .BegTestBlocks ;¥á«¨ ¡«®ª®¢ ­¥â, â® ¤®¡ ¢¨âì ­®¢ë©
mov ecx,[Size]
call AddBlock
jmp .return
align 4
.BegTestBlocks:
xor ebx,ebx
mov ecx,edx
align 4
.TestBlock: ;¯à®¢¥àª  ¡«®ª 
;¯à®¢¥àª : ¥áâì «¨ ¬¥áâ® ¤«ï ¥éñ ®¤­®© ¯ àë
mov edi,[MM_BlocksInfo+ebx]
add edi,[MM_BlocksInfo+ebx+4]
mov [endArea], edi
sub edi,4
cmp dword[edi],0 ;¥á«¨ ¢ ¡«®ª¥ ­¥â ­¨ ®¤­®© § ¯¨á¨
jne .NoEmptyBlock
mov eax,[MM_BlocksInfo+ebx]
mov dword[edi-4],eax
mov dword[edi],eax
mov edx,[Size]
add dword[edi],edx
mov dword[edi-8],0
jmp .return
align 4
.NoEmptyBlock:
xor eax,eax
push ecx
or ecx,-1
std
repne scasd
cld
pop ecx
mov eax,[edi+12] ;ª®­¥æ ¯®á« ãç á⪠
add eax,4
cmp eax,edi
jb @f
add ebx,8
dec ecx
jnz .TestBlock
mov ecx,[Size]
call AddBlock
jmp .return
@@:
mov [begFree],eax ;eax = ª®­¥æ ¯®á«. ãç á⪠ + 4
mov [endFree],edi ;edi = 㪠§ â¥«ì ­  ª®­¥æ ¯®á« ãç á⪠ - 12
sub dword[begFree],4
add dword[endFree],12
;¯à®¢¥àª  ¯¥à¥¤ ¢á¥¬¨ ãç á⪠¬¨
mov edi,[MM_BlocksInfo+ebx]
mov eax,[endArea]
mov eax,[eax-8]
sub eax,[MM_BlocksInfo+ebx]
cmp eax,[Size]
ja .AddInBegBlock
;¯à®¢¥àª  ¬¥¦¤ã ãç á⪠¬¨
mov eax,[endArea]
cmp dword[eax-12],0
je .EndTest ;¥á«¨ ¢ ¡«®ª¥ ⮫쪮 1 ãç á⮪
sub eax,4
@@:
mov edi,[eax-12]
sub edi,[eax]
cmp edi,[Size]
jae .AddInMiddle
sub eax,8
cmp dword[eax-8],0
jne @b
.EndTest:
;¯à®¢¥àª  ¯®á«¥ ¢á¥å ¡«®ª®¢
mov eax,[begFree]
mov edi,[endFree]
lea esi,[edi-8] ;8 - ¬¥áâ® ¯®¤ § ¯¨áì
sub esi,eax
cmp esi,[Size]
ja .AddInEnd
add ebx,8
dec ecx
jnz .TestBlock
mov ecx,[Size]
call AddBlock
jmp .return
align 4
.AddInBegBlock: ;„®¡ ¢¨âì ¢ ­ ç «®. edi ­ ç «® ¡«®ª 
;pop eax
mov eax,edi
add eax,[MM_BlocksInfo+ebx+4]
sub eax,4
push eax
call MoveRecordsLeft
pop eax
mov [eax-4],edi
push edi
add edi,[Size]
mov [eax],edi
pop eax
jmp .return
align 4
.AddInMiddle: ;„®¡ ¢¨âì ¬¥¦¤ã ãç á⪠¬¨, ¥ å=ª®­¥æ ãç á⪠ ¯¥à¥¤ ᢮¡®¤­ë¬ ¬¥á⮬
;pop ecx ;add esp,4
push eax
sub eax,8
call MoveRecordsLeft
pop eax
mov edx,[eax]
mov [eax-12],edx
add edx,[Size]
mov [eax-8],edx
mov eax,[eax]
jmp .return
align 4
.AddInEnd: ;„®¡ ¢¨âì ¯®á«¥ ãç á⪮¢. ¥di=㪠§ â¥«ì ­  2®© í«¥¬ ¯ àë á ¨­ä®© ® ¯®á« ãç á⪥
;add esp,4
mov eax,[edi]
mov [edi-12],eax
push eax
add eax,[Size]
mov [edi-8],eax
pop eax
.return:
pop esi edi ebx
leave
ret 4
restore Xren
restore Size
restore begFree
restore endFree
;eax - ¯¥à¢ë© ᤢ¨£ ¥¬ë© dword
;ᤢ¨£ ¥â ¯ àë dword'®¢ ­  8B ­ § ¤ ¢ª«îç ï dword 0
align 4
proc MoveRecordsLeft
local var1:DWORD,\
var2:DWORD
p2p [var1],[eax]
p2p [var2],[eax-4]
@@:
sub eax,8
cmp dword[var1],0
je @f
push dword[eax]
p2p [eax],[var1]
pop dword[var1]
push dword[eax-4]
p2p [eax-4],[var2]
pop dword[var2]
jmp @b
@@:
mov dword[eax],0
ret
endp
;ecx = à §¬¥à âॡ㥬®£® ãç á⪠
;¤®¡ ¢«ï¥â ¡«®ª ¨ ᮧ¤ ñâ ¢ ­ñ¬ ãç á⮪ à §¬¥à®¬ ecx
align 4
proc AddBlock
mov edx,[MM_NBlocks]
inc edx
cmp edx,MM_MAX_BLOCKS
ja .ErrAlloc
push ecx
add ecx,12
test ecx,0FFFh ;®ªà㣫塞 ¤® ¡®«ì襩 £à ­¨æë áâà ­¨æë
jz @f
add ecx,1000h
and ecx,0FFFFF000h
@@:
mcall 68,12,ecx
mov [MM_NBlocks],edx ;§ ¯®«­¥­¨¥ ¤ ­­ëå ® ¡«®ª¥
mov [edx*4*2-4*2+MM_BlocksInfo],eax ;begin
mov [edx*4*2-4+MM_BlocksInfo],ecx ;size
;dps 'Block '
;dph eax
;dps ' '
;dph ecx
;dnl
mov edx,eax
add edx,ecx
mov [edx-8],eax
pop dword[edx-4]
add [edx-4],eax
mov dword[edx-12],0
ret
.ErrAlloc:
pop ecx
xor eax,eax
ret
endp
;-------------------------------------------------------------------------------
;㤠«ï¥â ¯ ¬ïâì
;proc MM_DelMem Pointer:DWORD
align 4
MM_DelMem:
Pointer equ ebp+8
push ebp
mov ebp,esp
; int3
push ebx
mov ecx,[MM_NBlocks]
test ecx,ecx
jnz @f
xor eax,eax
pop ebx
leave
ret 4
@@:
mov eax,[Pointer]
xor ebx,ebx ;ebx - (­®¬¥à ¡«®ª )*8
.TestBlocks:
mov edx,[MM_BlocksInfo+ebx]
add edx,[MM_BlocksInfo+ebx+4]
sub edx,8 ;edx - 㪠§ â¥«ì ­  1ãî ¯ àã
.TestMems:
cmp [edx],eax
je .FoundMem
sub edx,8
cmp dword[edx+4],0
jne .TestMems
add ebx,4
loop .TestBlocks
xor eax,eax
pop ebx
leave
ret 4
.FoundMem:
cmp dword[edx-4],0
jz .EndDelMem
.NextMoveMem:
p2p [edx+4],[edx-4]
p2p [edx],[edx-8]
sub edx,8
cmp dword[edx-4],0
jnz .NextMoveMem
.EndDelMem:
mov dword[edx+4],0
mov dword[edx],0
mov eax,1
pop ebx
leave
ret 4
restore Pointer

BIN
programs/fs/unz/minus.raw Normal file

Binary file not shown.

BIN
programs/fs/unz/ok.raw Normal file

Binary file not shown.

View File

@ -4,7 +4,7 @@
; 2 - error parsing ; 2 - error parsing
proc getLastParam ;¯®á«¥¤­¨© ¯ à ¬¥âà ¯¨è¥â ¢ fInp proc getLastParam ;¯®á«¥¤­¨© ¯ à ¬¥âà ¯¨è¥â ¢ fInp
xor al, al ;to end sring xor al, al ;to end string
mov edi, params mov edi, params
mov ecx, 4096 mov ecx, 4096
repne scasb repne scasb
@ -100,26 +100,30 @@ xor al, al ;to end sring
xor eax, eax xor eax, eax
endp endp
;§ ¯®«­ï¥ pathOut
proc getParam2 proc getParamOutPath
locals locals
retrn rd 0 retrn rd 0
endl endl
mov [retrn], 0 mov [retrn], 0
mov ebx, params mov ebx, params
.find_o: .find_o:
cmp [ebx], word '-o' cmp [ebx], word '-o'
jne .find_o2 jne .find_o2
mov edx, ebx mov edx, ebx
lea esi, [ebx+3] lea esi, [ebx+3]
@@: ;skiping spaces @@: ;skiping spaces
cmp esi, pathOut+1024 cmp esi, params+4096
jae .errorParsing jae .errorParsing
cmp byte[esi], ' ' cmp byte[esi], ' '
jne @f jne @f
inc esi inc esi
jmp @b jmp @b
@@: ;copying ; -o "file" @@:
;copying ; -o "file"
mov ecx, 3 mov ecx, 3
cmp byte[esi], '"' cmp byte[esi], '"'
jne ._notspace jne ._notspace
@ -132,7 +136,7 @@ endl
je .clear je .clear
stosb stosb
inc ecx inc ecx
cmp esi, pathOut+1024 cmp esi, params+1024
jae errorParsing jae errorParsing
jmp @b jmp @b
@ -143,7 +147,7 @@ endl
inc ecx inc ecx
cmp al, ' ' cmp al, ' '
je .clear je .clear
cmp esi, pathOut+1024 cmp esi, params+1024
jae errorParsing jae errorParsing
jmp @b jmp @b
@ -159,7 +163,7 @@ endl
.find_o2: .find_o2:
inc ebx inc ebx
cmp ebx, pathOut+1024 cmp ebx, params+1024
jae @f jae @f
cmp byte[ebx], 0 cmp byte[ebx], 0
je @f je @f
@ -200,7 +204,7 @@ endl
jmp @b jmp @b
@@: @@:
;copying ; -f "file" ;variant1: copying ; -f "file"
mov ecx, 3 mov ecx, 3
cmp byte[esi], '"' cmp byte[esi], '"'
jne ._notspace jne ._notspace
@ -217,7 +221,7 @@ endl
jae errorParsing jae errorParsing
jmp @b jmp @b
._notspace: ;copying ; -f file ._notspace: ;variant2: copying ; -f file
mov edi, [endPointer] mov edi, [endPointer]
@@: lodsb @@: lodsb
stosb stosb

BIN
programs/fs/unz/plus.raw Normal file

Binary file not shown.

View File

@ -43,14 +43,22 @@ include '../../macros.inc'
include '../../proc32.inc' include '../../proc32.inc'
include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../dll.inc' include '../../dll.inc'
;include '../../debug.inc'
;include 'include/macros.inc'
;include 'include/proc32.inc'
;include 'include/box_lib.mac'
;include 'include/dll.inc'
include 'debug.inc' include 'debug.inc'
version equ '0.65' version equ '0.70'
version_dword equ 0*10000h + 65 version_dword equ 0*10000h + 70
WIN_W = 400 WIN_W = 400
SIZE_COPY_BUF = 1024*1024*2 SIZE_COPY_BUF = 1024*1024*2
MM_MAX_BLOCKS equ 1024
virtual at 0 virtual at 0
kfar_info_struc: kfar_info_struc:
@ -82,15 +90,19 @@ end virtual
;-- CODE -------------------------------------------------------------------
include 'parse.inc' include 'parse.inc'
include 'fs.inc' include 'fs.inc'
include 'file_tree.inc'
;-- CODE ------------------------------------------------------------------- include 'memory_manager.inc'
include 'dialogs.inc'
start: start:
;dnl
;dpsP params
;dnl
mcall 68, 11 mcall 68, 11
mcall 40, 100111b + 0C0000000h mcall 40, 100111b + 0C0000000h
stdcall dll.Load, IMPORTS stdcall dll.Load, IMPORTS
@ -98,8 +110,6 @@ start:
jnz exit jnz exit
mov [pathOut],0 mov [pathOut],0
;stdcall SayErr,strErrorExc
;mcall -1
;---------------------------- ;----------------------------
;1. find input file, clear ;1. find input file, clear
;2. find -o, copy data, clear ;2. find -o, copy data, clear
@ -115,7 +125,7 @@ start:
.arbeit: .arbeit:
;2. ;2.
call getParam2 call getParamOutPath
cmp eax, 2 cmp eax, 2
je errorParsing je errorParsing
@ -148,6 +158,7 @@ start:
call startUnpack call startUnpack
mcall -1 mcall -1
@@: @@:
stdcall [OpenDialog_Init],OpenDialog_data stdcall [OpenDialog_Init],OpenDialog_data
;init edit fields -------------- ;init edit fields --------------
@ -171,6 +182,9 @@ start:
mov dword[edtUnpPath.size], eax mov dword[edtUnpPath.size], eax
mov dword[edtUnpPath.pos], eax mov dword[edtUnpPath.pos], eax
;--------
; call file_tree_Init
;main loop -------------------- ;main loop --------------------
wm_redraw: wm_redraw:
@ -218,9 +232,9 @@ wm_button:
cmp ah, 2 cmp ah, 2
jne @f jne @f
;mcall 51,1,startUnpack,stackUnpack mcall 51,1,startUnpack,stackUnpack
;mov [bWinChild],1 mov [bWinChild],1
call startUnpack ;call startUnpack
jmp wm_redraw jmp wm_redraw
@@: @@:
@ -233,14 +247,16 @@ wm_mouse:
jne still jne still
stdcall [edit_box_mouse],edtPack stdcall [edit_box_mouse],edtPack
stdcall [edit_box_mouse],edtUnpPath stdcall [edit_box_mouse],edtUnpPath
; stdcall file_tree_Mouse
jmp still jmp still
exit: exit:
mcall -1 mcall -1
errorParsing: errorParsing:
dps 'errorParsing' dph edx
dps ' errorParsing'
mcall -1 mcall -1
;--- functions ------------------------------------------------------------------ ;--- functions ------------------------------------------------------------------
@ -259,7 +275,7 @@ proc winRedraw
stdcall [edit_box_draw],edtPack stdcall [edit_box_draw],edtPack
stdcall [edit_box_draw],edtUnpPath stdcall [edit_box_draw],edtUnpPath
; plain window labels
cmp [redInput],0 cmp [redInput],0
jne @f jne @f
mov ecx,[sc.work_text] mov ecx,[sc.work_text]
@ -272,8 +288,6 @@ proc winRedraw
mov ecx,[sc.work_text] mov ecx,[sc.work_text]
or ecx,90000000h or ecx,90000000h
mcall 4, <15,37>, , strPath mcall 4, <15,37>, , strPath
; text on buttons
mov ecx,[sc.work_button_text] mov ecx,[sc.work_button_text]
or ecx,90000000h or ecx,90000000h
if lang eq ru if lang eq ru
@ -284,6 +298,8 @@ end if
mcall 4, <(WIN_W-47),12>, , strDots mcall 4, <(WIN_W-47),12>, , strDots
mcall 4, <(WIN_W-47),37>, , strDots mcall 4, <(WIN_W-47),37>, , strDots
; call file_tree_Draw
mcall 12, 2 mcall 12, 2
ret ret
endp endp
@ -388,39 +404,26 @@ endl
jnz @f jnz @f
cmp ebx,0 ;;/ ŠŽ‘’›‹œ!!!! cmp ebx,0 ;;/ ŠŽ‘’›‹œ!!!!
je .errNotFound ;;§­ ç¥­¨¥ ebx ¯®«ã祭® ®¯ëâ­ë¬ ¯ãâñ¬. je .errNotFound ;;§­ ç¥­¨¥ ebx ¯®«ã祭® ®¯ëâ­ë¬ ¯ãâñ¬.
cmp ebx,400h ;;ª ª ®­® ¡ã¤¥â à ¡®â âì á ¤à㣨¬¨ ¢¥àá¨ï¬¨ cmp ebx,400h
je .errNotSupp ;;¡¨¡«¨®â¥ª¨ - ­¥ ïá­®! je .errNotSupp
@@: @@:
mov [hPlugin],eax mov [hPlugin],eax
;get num of all files ;get num of all files
; stdcall calcSizeArch,[hPlugin] ; stdcall calcSizeArch,[hPlugin]
; push ebp push ebp
; stdcall [aReadFolder], [hPlugin] stdcall [aSetFolder],[hPlugin], .strRoot,0
; pop ebp pop ebp
; push ebp
; stdcall [aOpen], [hPlugin], .str1, O_READ
; pop ebp
;
; push ebp
; stdcall [aSetpos],[hPlugin],0,POSEND
; pop ebp
; add [numbytes],eax
;unpack ;unpack
; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir); ; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir);
push ebp push ebp
stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir
pop ebp pop ebp
;jmp @f jmp @f
; .str1 db '/LICENSE.txt',0 .str1 db '/LICENSE.txt',0
;@@: .strRoot db '.svn',0
@@:
;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode); ;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode);
;Žâªàëâì ä ©« filename. <20> à ¬¥âà mode § à¥§¥à¢¨à®¢ ­ ¨ ¢ ⥪ã饩 ¢¥àᨨ kfar ¢á¥£¤  à ¢¥­ 1. ;Žâªàëâì ä ©« filename. <20> à ¬¥âà mode § à¥§¥à¢¨à®¢ ­ ¨ ¢ ⥪ã饩 ¢¥àᨨ kfar ¢á¥£¤  à ¢¥­ 1.
@ -491,13 +494,83 @@ proc debugInt3
endp endp
allnumbytes dd 0
strBackFold db '../',0
proc calcSizeArch hPlugin:dword proc calcSizeArch hPlugin:dword
locals
bdwk rb 560
num rd 1
endl
;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start,
; unsigned dirinfo_size, void* dirdata);
mov [num],0
; int3
.mainloop:
push ebp
lea eax, [bdwk]
stdcall [aReadFolder], [hPlugin],[num],1,eax
pop ebp
cmp eax,6
je .lastFile
;??????????????????????????????????????????????????????????????????????????????????????????????????
lea ebx,[bdwk+0x20] ;¯®ç¥¬ã «¨¡  ¯¨è¥â ¢ ᬥ饭¨¥ +0x20 - ­¥¨§¥áâ­®
test [ebx],dword 10h
jz @f
;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path,
; const char* absolute_path);
push ebp
lea eax,[ebx+40]
dps 'Folder: '
dpsP eax
dnl
stdcall [aSetFolder],[hPlugin], eax,0
pop ebp
stdcall calcSizeArch, [hPlugin]
inc [num]
jmp .mainloop
@@:
lea ebx,[bdwk+0x20]
lea eax,[ebx+40]
dps 'File: '
dpsP eax
dnl
mov eax,[ebx+32]
add [allnumbytes],eax
inc [num]
jmp .mainloop
.lastFile:
; lea ebx,[bdwk+0x20]
; test [ebx],dword 10h
; jz @f
;
; push ebp
; lea eax,[ebx+40]
; stdcall [aSetFolder],[hPlugin], eax,0
; pop ebp
; stdcall calcSizeArch, [hPlugin]
; @@:
push ebp
stdcall [aSetFolder],[hPlugin], strBackFold,0
pop ebp
ret
endp
proc rec_calcSize hPlugin:dword
locals locals
bdwk rb 560 bdwk rb 560
endl endl
;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start, ;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start,
; unsigned dirinfo_size, void* dirdata); ; unsigned dirinfo_size, void* dirdata);
int3 ;bool __stdcall SetFolder(HANDLE hPlugin, const char* relative_path, const char* absolute_path);
push ebp push ebp
lea eax,[bdwk] lea eax,[bdwk]
stdcall [aReadFolder], [hPlugin],1,560,eax stdcall [aReadFolder], [hPlugin],1,560,eax
@ -509,165 +582,37 @@ endp
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
;SayErr int num_strings, const char* strings[], hTrPlugin dd 0
; int num_buttons, const char* buttons[]);
proc SayErr num_strings:dword, strings:dword,num_buttons:dword, buttons:dword ;eax - file struct for sys70
pushad
cmp [num_strings],1
je @f
m2m [errmess0], strErrorExc
jmp .l1
@@:
mov ebx,[strings]
m2m [errmess0], dword [ebx]
.l1:
m2m [fsRunNotifyOK.param],[errmess0] proc rdFoldforTree
mcall 70,fsRunNotifyOK locals
fi rd 0
endl
cmp [hTrPlugin],0
je .exit
push ebx edi esi
popad mov [fi],eax
mov eax,1 push ebp
ret stdcall [aSetFolder],[hTrPlugin], [eax+20],0
endp mov ebp,[esp]
;hPlug,startBlock,numBlocks,buffer
stdcall [aReadFolder], [hTrPlugin],dword[eax+4],\
dword[eax+12],dword[eax+16]
pop ebp
;------------------------------------------------------------------------------- ;cmp eax,6
;------------------------------------------------------------------------------- ;je .lastFile
;-------------------------------------------------------------------------------
; "enter password" dialog for KFar
;password_dlg:
; dd 1 ; use standard dialog colors
; dd -1 ; center window by x
; dd -1 ; center window by y
;.width dd ? ; width (will be filled according to current console width)
; dd 2 ; height
; dd 4, 2 ; border size
; dd aEnterPasswordTitle ; title
; dd ? ; colors (will be set by KFar)
; dd 0 ; used internally by dialog manager, ignored
; dd 0, 0 ; reserved for DlgProc
; dd 2 ; 2 controls
;; the string "enter password"
; dd 1 ; type: static
; dd 1,0 ; upper-left position
;.width1 dd ?,0 ; bottom-right position
; dd aEnterPassword ; data
; dd 0 ; flags
;; editbox for password
; dd 3 ; type: edit
; dd 1,1 ; upper-left position
;.width2 dd ?,0 ; bottom-right position
; dd password_data ; data
; dd 2Ch ; flags
;lea ebx,[bdwk+0x20] ;¯®ç¥¬ã «¨¡  ¯¨è¥â ¢ ᬥ饭¨¥ +0x20 - ­¥¨§¥áâ­®
pop esi edi ebx
proc DialogBox dlgInfo:dword
pushad
mov ebx,[dlgInfo]
mov eax,[ebx+19*4]
mov [forpassword],eax
mov byte[eax], 0
mov [stateDlg], 0
mcall 51,1,threadDialogBox,stackDlg
;wait thread...
@@: cmp [stateDlg],0
jne @f
mcall 5,1
jmp @b
@@:
popad
cmp [stateDlg], 1
jne @f
xor eax, eax
ret
@@:
or eax, -1
ret
endp
proc threadDialogBox
mcall 40, 100111b+0C000000h
mov eax,[forpassword]
mov [edtPassword+4*9],eax
xor eax,eax
mov dword[edtPassword.size], eax
mov dword[edtPassword.pos], eax
.wm_redraw:
mcall 12, 1
mcall 48, 3, sc, sizeof.system_colors
mov edx, [sc.work]
or edx, 0x33000000
mcall 0, <200,320>, <200,140>, , , title
edit_boxes_set_sys_color edtPack,endEdits,sc
stdcall [edit_box_draw],edtPassword
mov ecx,[sc.work_text]
or ecx,90000000h
mcall 4, <56,12>, , strGetPass
mcall 8, <70,80>,<74,22>,2,[sc.work_button]
mov ecx,[sc.work_button_text]
or ecx,90000000h
mcall 4, <103,79>, , strOk
mcall 8, <165,80>,<74,22>,1,[sc.work_button]
mov ecx,[sc.work_button_text]
or ecx,90000000h
mcall 4, <182,79>, , strCancel
mcall 12, 2
.still:
mcall 10
cmp eax, 1
je .wm_redraw
cmp eax, 2
je .wm_key
cmp eax, 3
je .wm_button
cmp eax, 6
je .wm_mouse
jmp .still
.wm_key:
mcall 2
stdcall [edit_box_key],edtPassword
jmp .still
.wm_button:
mcall 17
cmp ah, 2 ;OK
jne @f
mov [stateDlg],1
jmp .exit
@@:
cmp ah, 1 ;Close window or Cancel
jne .still
mov [stateDlg],2
jmp .exit
.wm_mouse:
stdcall [edit_box_mouse],edtPassword
jmp .still
.exit: .exit:
mcall -1 ret
endp endp
;-- DATA ------------------------------------------------------------------- ;-- DATA -------------------------------------------------------------------
@ -679,7 +624,7 @@ bWinChild db 0 ;1 -
redInput db 0 ;1 - ¯®¤á¢¥â¨âì ªà á­ë¬ ­ ¤¯¨áì redInput db 0 ;1 - ¯®¤á¢¥â¨âì ªà á­ë¬ ­ ¤¯¨áì
if lang eq ru if lang eq ru
title db 'uNZ v0.12 - <20> á¯ ª®¢é¨ª Zip ¨ 7z',0 title db 'uNZ v0.2 - <20> á¯ ª®¢é¨ª Zip ¨ 7z',0
strGo db '<27> á¯ ª®¢ âì',0 strGo db '<27> á¯ ª®¢ âì',0
strInp db ' €à娢',0 strInp db ' €à娢',0
strPath db 'ˆ§¢«¥çì ¢',0 strPath db 'ˆ§¢«¥çì ¢',0
@ -693,7 +638,7 @@ if lang eq ru
strNotSupport db "'<27>¥¯®¤¤¥à¦¨¢ ¥¬ë© ä®à¬ â  à娢 ' -E",0 strNotSupport db "'<27>¥¯®¤¤¥à¦¨¢ ¥¬ë© ä®à¬ â  à娢 ' -E",0
strNotFound db "'” ©« ­¥ ­ ©¤¥­' -E",0 strNotFound db "'” ©« ­¥ ­ ©¤¥­' -E",0
else if lang eq es else if lang eq es
title db 'uNZ v0.12 - Desarchivador para Zip y 7z',0 title db 'uNZ v0.2 - Desarchivador para Zip y 7z',0
strGo db 'Desarchivar',0 strGo db 'Desarchivar',0
strInp db 'Archivar',0 strInp db 'Archivar',0
strPath db 'Extraer en',0 strPath db 'Extraer en',0
@ -707,7 +652,7 @@ else if lang eq es
strNotSupport db "'El formato del archivo no es soportado' -E",0 strNotSupport db "'El formato del archivo no es soportado' -E",0
strNotFound db "'Archivo no encontrado' -E",0 strNotFound db "'Archivo no encontrado' -E",0
else else
title db 'uNZ v0.12 - Unarchiver of Zip and 7z',0 title db 'uNZ v0.2 - Unarchiver of Zip and 7z',0
strGo db 'Unpack',0 strGo db 'Unpack',0
strInp db 'Archive',0 strInp db 'Archive',0
strPath db 'Extract to',0 strPath db 'Extract to',0
@ -722,8 +667,9 @@ else
strNotFound db "'File not found' -E",0 strNotFound db "'File not found' -E",0
end if end if
strNull db 0
strDots db '...',0
strDots db '...', 0
;-------- ;--------
; int __stdcall SayErr(int num_strings, const char* strings[], ; int __stdcall SayErr(int num_strings, const char* strings[],
@ -764,7 +710,7 @@ kfar_info:
;-------- ;--------
iFiles dd 0 ;ª®«¨ç¥á⢮ ¢ë£à㦠¥¬ëå ä ©«®¢ iFiles dd 0 ;ª®«¨ç¥á⢮ à á¯ ª®¢ë¢ ¥¬ëå ä ©«®¢
endPointer dd buffer endPointer dd buffer
@ -828,13 +774,15 @@ fsRunNotifyOK:
edtPack edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ edtPack edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
255, fInp, mouse_dd,0,0,0 255, fInp, 0,0,0,0
edtUnpPath edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\ edtUnpPath edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
255, pathOut, mouse_dd,0,0,0 255, pathOut, 0,0,0,0
edtPassword edit_box 200,56,70,0FFFFFFh,0xff,0x80ff,0h,0x90000000,255,\ edtPassword edit_box 200,56,70,0FFFFFFh,0xff,0x80ff,0h,0x90000000,255,\
password, mouse_dd,0,0,0 password, 0,0,0,0
endEdits: endEdits:
;------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------
OpenDialog_data: OpenDialog_data:
.type dd 0 ;0-open, 1-save, 2-select folder .type dd 0 ;0-open, 1-save, 2-select folder
@ -914,25 +862,24 @@ import box_lib,\
IncludeIGlobals IncludeIGlobals
params1 db '-o "/hd0/1/unz/pig" -h "/hd0/1/unz/abc1"',0
;-- UDATA ----------------------------------------------------------------------------- ;-- UDATA -----------------------------------------------------------------------------
init_end: init_end:
align 16 align 16
IncludeUGlobals IncludeUGlobals
path rb 512
;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0 ;params db 'unz -o "fil epar1" -f "arch1.txt" -f "ar ch2.txt" file1',0
;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0 ;params db 'unz -o "fil epar1" -f arch1.txt -f "ar ch2.txt" file1',0
;params db '/hd0/1/unz/xboot-1-0-build-14-en-win.zip',0
;rb 4096
fInp rb 1024 fInp rb 1024
pathOut rb 1024 pathOut rb 1024 ;¯ãâì, ªã¤  à á¯ ªã¥âáï ¢áñ
files rd 256 files rd 256
password rb 256 password rb 256
fZipInfo rb 40 fZipInfo rb 40
mouse_dd rd 1
RBProcInfo rb 1024 RBProcInfo rb 1024
temp_dir_pach rb 1024 temp_dir_pach rb 1024
ODAreaPath rb 1024 ODAreaPath rb 1024
@ -954,9 +901,17 @@ CopyDestEditBuf rb 12+512+1
bdvkPack rb 560 bdvkPack rb 560
;------------ memory_manager.inc
align 4
MM_NBlocks rd 1 ;ª®«¨ç¥á⢮ ¢ë¤¥«¥­­ëå ¡«®ª®¢ ¯ ¬ïâ¨
MM_BlocksInfo rd 2*MM_MAX_BLOCKS ;begin,size
;-------- ;--------
buffer rb 4096 ;for string of file name or extract buffer rb 4096 ;for string of file name for extract
params rb 4096 params rb 4096
rb 1024 rb 1024