Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7158 → Rev 7159

/programs/fs/unz/DEBUG.INC
File deleted
/programs/fs/unz/UNZ.ASM
File deleted
/programs/fs/unz/PARSE.INC
File deleted
/programs/fs/unz/FS.INC
File deleted
/programs/fs/unz/Tupfile.lua
1,3 → 1,3
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"})
tup.rule({"UNZ.ASM", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "unz")
tup.rule({"unz.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "unz")
/programs/fs/unz/debug.inc
0,0 → 1,191
dps fix debug_print
dpd fix debug_print_dec
dpds fix debug_print_dec_sign
dnl fix debug_newline
dpsP fix debug_printP
 
;if ~(newline eq)
newline fix debug_newline
;end if
 
 
macro debug_print str
{
local ..string, ..label
 
jmp ..label
..string db str,0
..label:
 
pushf
pushad
mov edx,..string
call debug_outstr
popad
popf
}
 
 
 
macro debug_print_dec arg
{
pushf
pushad
if ~arg eq eax
mov eax,arg
end if
call debug_outdec
popad
popf
}
 
macro debug_print_dec_sign arg
{
local .sign,.rtrn
pushf
pushad
if ~arg eq eax
mov eax,arg
end if
test eax,80000000h
jnz .sign
call debug_outdec
popad
popf
jmp .rtrn
.sign:
not eax
inc eax
push eax
mov cl,'-'
mov eax,63
mov ebx,1
int 0x40
pop eax
call debug_outdec
popad
popf
.rtrn:
}
 
;---------------------------------
debug_outdec: ;(eax - num, edi-str)
push 10 ;2
pop ecx ;1
push -'0' ;2
.l0:
xor edx,edx ;2
div ecx ;2
push edx ;1
test eax,eax ;2
jnz .l0 ;2
.l1:
pop eax ;1
add al,'0' ;2
call debug_outchar ; stosb
jnz .l1 ;2
ret ;1
;---------------------------------
 
debug_outchar: ; al - char
pushf
pushad
mov cl,al
mov eax,63
mov ebx,1
int 0x40
popad
popf
ret
 
debug_outstr:
mov eax,63
mov ebx,1
@@:
mov cl,[edx]
test cl,cl
jz @f
int 40h
inc edx
jmp @b
@@:
ret
 
_debug_crlf db 13, 10, 0
 
macro debug_newline
{
pushf
pushad
mov edx, _debug_crlf
call debug_outstr
popad
popf
}
 
macro debug_printP Pstr
{
pushf
pushad
mov edx,Pstr
call debug_outstr
popad
popf
 
}
 
 
macro print message
{
dps message
dnl
}
 
macro pregs
{
dps "EAX: "
dpd eax
dps " EBX: "
dpd ebx
newline
dps "ECX: "
dpd ecx
dps " EDX: "
dpd edx
newline
}
 
macro debug_print_hex arg
{
pushf
pushad
if ~arg eq eax
mov eax, arg
end if
call debug_outhex
popad
popf
}
dph fix debug_print_hex
 
debug_outhex:
; eax - number
mov edx, 8
.new_char:
rol eax, 4
movzx ecx, al
and cl, 0x0f
mov cl, [__hexdigits + ecx]
pushad
mcall 63, 1
popad
dec edx
jnz .new_char
ret
 
__hexdigits:
db '0123456789ABCDEF'
 
 
 
;-------------------------------------------------------------------------------
/programs/fs/unz/fs.inc
0,0 → 1,748
 
virtual at 0
_FILE:
.pos dq ?
.bufpos dq ?
.bufsize dd ?
.mode dd ?
.hPlugin dd ?
.hFile dd ?
.fileinfo:
.fimode dd ?
.fioffset dq ?
.fisize dd ?
.fibuf dd ?
.finame rb 1024
.attr rb 40
align 512
.buf rb 2048
.size = $
end virtual
 
O_READ = 1 ; allows read from file
O_WRITE = 2 ; allows write to file
O_CREATE = 4 ; if file does not exist and this flag is set, create file;
; if file does not exist and this flag is not set, fail
O_TRUNCATE = 8 ; truncate file if it exists
O_SEQUENTIAL_ONLY = 10h ; there will be no 'seek'/'setpos' calls
 
 
; void __stdcall close(HANDLE hFile);
close:
pushad
mov ecx, [esp+24h]
mov eax, [ecx+_FILE.hPlugin]
test eax, eax
jz @f
push ecx
push [ecx+_FILE.hFile]
call [aClose]
pop ecx
@@:
call pgfree
popad
ret 4
 
; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
read:
xor eax, eax
pushad
mov ecx, [esp+36]
test [ecx+_FILE.mode], O_READ
jnz @f
.ret:
popad
ret 12
@@:
cmp dword [esp+44], eax
jz .ret
mov [ecx+_FILE.fimode], eax
mov ebx, [ecx+_FILE.bufsize]
mov eax, dword [ecx+_FILE.pos]
and eax, 2047
sub ebx, eax
jbe .nobuf0
cmp ebx, [esp+44]
jbe @f
mov ebx, [esp+44]
@@:
push ecx
lea esi, [ecx+eax+_FILE.buf]
mov ecx, ebx
mov edi, [esp+44]
rep movsb
pop ecx
mov [esp+40], edi
add [esp+28], ebx
add dword [ecx+_FILE.pos], ebx
adc dword [ecx+_FILE.pos+4], 0
test dword [ecx+_FILE.pos], 2047
jnz @f
and [ecx+_FILE.bufsize], 0
@@:
sub [esp+44], ebx
jz .ret
.nobuf0:
test dword [ecx+_FILE.pos], 2047
jz .aligned
cmp dword [ecx+_FILE.bufsize], 0
jnz .ret
lea ebx, [ecx+_FILE.fileinfo]
mov dword [ebx+12], 2048
lea eax, [ecx+_FILE.buf]
mov dword [ebx+16], eax
mov eax, dword [ecx+_FILE.fioffset]
mov dword [ecx+_FILE.bufpos], eax
mov eax, dword [ecx+_FILE.fioffset+4]
mov dword [ecx+_FILE.bufpos+4], eax
call .doread
test eax, eax
jnz .ret
mov [ecx+_FILE.bufsize], ebx
mov eax, dword [ecx+_FILE.pos]
and eax, 2047
sub ebx, eax
jbe .ret
cmp ebx, [esp+44]
jbe @f
mov ebx, [esp+44]
@@:
push ecx
lea esi, [ecx+eax+_FILE.buf]
mov ecx, ebx
mov edi, [esp+44]
rep movsb
pop ecx
add dword [ecx+_FILE.pos], ebx
adc dword [ecx+_FILE.pos+4], 0
mov [esp+40], edi
add [esp+28], ebx
sub [esp+44], ebx
jz .ret
test dword [ecx+_FILE.pos], 2047
jnz .ret
.aligned:
lea ebx, [ecx+_FILE.fileinfo]
mov eax, [esp+44]
and eax, not 2047
jz .finish
and [ecx+_FILE.bufsize], 0
mov [ebx+12], eax
mov eax, [esp+40]
mov [ebx+16], eax
call .doread
test eax, eax
jnz .ret
add dword [ecx+_FILE.pos], ebx
adc dword [ecx+_FILE.pos+4], 0
add [esp+28], ebx
add [esp+40], ebx
sub [esp+44], ebx
jz .ret
cmp ebx, [ecx+_FILE.fisize]
jb .ret
.finish:
lea ebx, [ecx+_FILE.fileinfo]
mov dword [ebx+12], 2048
lea eax, [ecx+_FILE.buf]
mov [ebx+16], eax
and [ecx+_FILE.bufsize], 0
mov eax, dword [ecx+_FILE.fioffset]
mov dword [ecx+_FILE.bufpos], eax
mov eax, dword [ecx+_FILE.fioffset+4]
mov dword [ecx+_FILE.bufpos+4], eax
call .doread
test eax, eax
jnz .ret
mov [ecx+_FILE.bufsize], ebx
cmp ebx, [esp+44]
jb @f
mov ebx, [esp+44]
@@:
add [esp+28], ebx
add dword [ecx+_FILE.pos], ebx
adc dword [ecx+_FILE.pos+4], 0
lea esi, [ecx+_FILE.buf]
mov edi, [esp+40]
mov ecx, ebx
rep movsb
popad
ret 12
.doread:
mov eax, [ecx+_FILE.hPlugin]
test eax, eax
jz .native
push ecx
push [ecx+_FILE.fisize]
push [ecx+_FILE.fibuf]
push [ecx+_FILE.hFile]
call [eax+aRead]
pop ecx
cmp eax, -1
jz @f
mov ebx, eax
xor eax, eax
jmp .addpos
@@:
ret
.native:
push 70
pop eax
int 0x40
test eax, eax
jz .addpos
cmp eax, 6
jnz @b
xor eax, eax
.addpos:
add dword [ecx+_FILE.fioffset], ebx
adc dword [ecx+_FILE.fioffset+4], 0
ret
 
; void __stdcall seek(HANDLE hFile, int method, __int64 newpos);
seek:
pushad
mov ecx, [esp+36]
mov eax, [esp+44]
mov edx, [esp+48]
cmp dword [esp+40], 1
jb .set
ja .end
add eax, dword [ecx+_FILE.pos]
adc edx, dword [ecx+_FILE.pos+4]
jmp .set
.end:
add eax, dword [ecx+_FILE.attr+32]
adc edx, dword [ecx+_FILE.attr+36]
.set:
mov dword [ecx+_FILE.pos], eax
mov dword [ecx+_FILE.pos+4], edx
and eax, not 2047
cmp eax, dword [ecx+_FILE.bufpos]
jnz @f
cmp edx, dword [ecx+_FILE.bufpos+4]
jz .bufposok
@@:
and [ecx+_FILE.bufsize], 0
mov dword [ecx+_FILE.bufpos], eax
mov dword [ecx+_FILE.bufpos+4], edx
.bufposok:
cmp [ecx+_FILE.bufsize], 0
jnz .ret
cmp eax, dword [ecx+_FILE.fioffset]
jnz @f
cmp edx, dword [ecx+_FILE.fioffset+4]
jz .ret
@@:
mov dword [ecx+_FILE.fioffset], eax
mov dword [ecx+_FILE.fioffset+4], edx
mov eax, [ecx+_FILE.hPlugin]
test eax, eax
jz @f
push dword [ecx+_FILE.fioffset+4]
push dword [ecx+_FILE.fioffset]
push [ecx+_FILE.hFile]
call [eax+aSetpos]
@@:
.ret:
popad
ret 16
 
 
; __int64 __stdcall tell(HANDLE hFile);
tell:
mov eax, [esp+4]
mov edx, dword [eax+_FILE.pos+4]
mov eax, dword [eax+_FILE.pos]
ret 4
 
; HANDLE __stdcall open(const char* name, int mode);
; Opens physical file
open:
pushad
mov ecx, _FILE.size
call xpgalloc
test eax, eax
jz .ret0z
mov [esp+28], eax
mov ecx, eax
mov esi, [esp+36]
lea edi, [eax+_FILE.finame]
lea edx, [eax+_FILE.finame+1024]
@@:
lodsb
stosb
test al, al
jz @f
cmp edi, edx
jb @b
.ret0:
call pgfree
.ret0z:
popad
xor eax, eax
ret 8
@@:
mov eax, [esp+40]
mov [ecx+_FILE.mode], eax
.getattr:
lea edi, [ecx+_FILE.fileinfo]
mov ebx, edi
push 5
pop eax
stosd
xor eax, eax
stosd
stosd
stosd
lea eax, [ecx+_FILE.attr]
stosd
push 70
pop eax
int 0x40
test eax, eax
jz .found
cmp eax, 5
jnz .ret0
; file does not exist
test [ecx+_FILE.mode], O_CREATE
jz .ret0
.truncate:
lea ebx, [ecx+_FILE.fileinfo]
mov byte [ebx], 2
push 70
pop eax
int 0x40
test eax, eax
jz .getattr
jmp .ret0
.found:
test [ecx+_FILE.mode], O_TRUNCATE
jz @f
cmp dword [ecx+_FILE.attr+36], eax
jnz .truncate
cmp dword [ecx+_FILE.attr+32], eax
jnz .truncate
@@:
mov dword [ecx+_FILE.pos], eax
mov dword [ecx+_FILE.pos+4], eax
mov dword [ecx+_FILE.bufpos], eax
mov dword [ecx+_FILE.bufpos+4], eax
mov [ecx+_FILE.bufsize], eax
mov [ecx+_FILE.hPlugin], eax
mov [ecx+_FILE.hFile], eax
mov dword [ecx+_FILE.fioffset], eax
mov dword [ecx+_FILE.fioffset+4], eax
mov [esp+28], ecx
popad
ret 8
 
; HANDLE __stdcall open2(int plugin_id, HANDLE plugin_instance, const char* name, int mode);
; Opens file on plugin panel
open2:
cmp dword [esp+4], 0
jnz .plugin
pop eax
add esp, 8
push eax
jmp open
.plugin:
pushad
mov ecx, _FILE.size
call xpgalloc
test eax, eax
jz .ret0z
mov [esp+28], eax
mov ecx, eax
mov esi, [esp+44]
lea edi, [eax+_FILE.finame]
lea edx, [eax+_FILE.finame+1024]
@@:
lodsb
stosb
test al, al
jz @f
cmp edi, edx
jb @b
.ret0:
call pgfree
.ret0z:
popad
xor eax, eax
ret 8
@@:
mov edx, [esp+36]
mov [ecx+_FILE.hPlugin], edx
mov ebx, [esp+40]
mov eax, [esp+48]
mov [ecx+_FILE.mode], eax
push ebx ecx
push eax
lea eax, [ecx+_FILE.finame]
push eax
push ebx
call [edx+aOpen]
pop ecx ebx
test eax, eax
jz .ret0
mov [ecx+_FILE.hFile], eax
mov edx, [esp+36]
push ecx
lea edi, [ecx+_FILE.fileinfo]
push edi
xor eax, eax
push ecx
push 10
pop ecx
rep stosd
pop ecx
lea eax, [ecx+_FILE.finame]
push eax
push ebx
call [edx+aGetattr]
pop ecx
xor eax, eax
mov dword [ecx+_FILE.pos], eax
mov dword [ecx+_FILE.pos+4], eax
mov dword [ecx+_FILE.bufpos], eax
mov dword [ecx+_FILE.bufpos+4], eax
mov [ecx+_FILE.bufsize], eax
mov dword [ecx+_FILE.fioffset], eax
mov dword [ecx+_FILE.fioffset+4], eax
mov [esp+28], ecx
popad
ret 16
 
; __int64 __stdcall filesize(HANDLE hFile);
filesize:
mov eax, [esp+4]
mov edx, dword [eax+_FILE.attr+36]
mov eax, dword [eax+_FILE.attr+32]
ret 4
 
 
;
;makedir:
;; create directory with name from CopyDestEditBuf+12
;; destroys eax
; push ebx
; push 70
; pop eax
; mov ebx, mkdirinfo
; int 0x40
; pop ebx
; test eax, eax
; jz .ret
; cmp dword [esp+8], DeleteErrorBtn
; jnz @f
; cmp [copy_bSkipAll], 0
; jz @f
; push 1
; pop eax
; jmp .ret
;@@:
; push dword CopyDestEditBuf+12
; push dword aCannotMakeFolder
; call get_error_msg
; push eax
; mov eax, esp
; push dword [eax+20]
; push dword [eax+16]
; push eax
; push 3
; call SayErr
; add esp, 3*4
; test eax, eax
; jz makedir
;.ret:
; ret 8
;
 
 
 
;######################################################################################################
;######################################################################################################
;######################################################################################################
;######################################################################################################
 
 
CHECK_FOR_LEAKS = 0
if CHECK_FOR_LEAKS
uglobal
allocatedregions rd 1024
endg
iglobal
numallocatedregions dd 0
endg
end if
pgalloc:
; in: ecx=size
; out: eax=pointer or NULL
push ebx
push 68
pop eax
push 12
pop ebx
int 0x40
if CHECK_FOR_LEAKS
test eax, eax
jz .no
.b:
mov ebx, [numallocatedregions]
cmp ebx, 1024
jb @f
int3
jmp $
@@:
mov [allocatedregions+ebx*4], eax
inc [numallocatedregions]
.no:
end if
pop ebx
ret
 
pgfree:
; in: ecx=pointer
; destroys eax
if CHECK_FOR_LEAKS
jecxz .no
mov eax, [numallocatedregions]
@@:
dec eax
js .a
cmp [allocatedregions+eax*4], ecx
jnz @b
jmp @f
.a:
int3
jmp $
@@:
dec [numallocatedregions]
@@:
cmp eax, [numallocatedregions]
jae @f
push [allocatedregions+eax*4+4]
pop [allocatedregions+eax*4]
inc eax
jmp @b
@@:
.no:
end if
push ebx
push 68
pop eax
push 13
pop ebx
int 0x40
pop ebx
ret
 
 
 
 
pgrealloc:
; in: ecx=size, edx=pointer
; out: eax=pointer
push ebx
push 68
pop eax
push 20
pop ebx
int 0x40
if CHECK_FOR_LEAKS
test edx, edx
jz pgalloc.b
test eax, eax
jz .no
cmp eax, edx
jz .no
xor ebx, ebx
@@:
cmp ebx, [numallocatedregions]
jae .a
cmp [allocatedregions+ebx*4], edx
jz @f
inc ebx
jmp @b
@@:
mov [allocatedregions+ebx*4], eax
jmp .no
.a:
int3
jmp $
.no:
end if
pop ebx
ret
 
xpgalloc:
; in: ecx=size
; out: eax=pointer or NULL
call pgalloc
.common:
test eax, eax
jnz @f
;call SayNoMem
 
@@:
ret
 
xpgrealloc:
; in: edx=pointer, ecx=new size
; out: eax=pointer or NULL
call pgrealloc
jmp xpgalloc.common
 
getfreemem:
; out: eax=size of free RAM in Kb
push ebx
mcall 18,16
pop ebx
ret
 
 
 
proc myAddFile name:dword, bdfe_info:dword, hFile:dword
locals
beginFile dd 0
pos dd 0
endl
 
;dps 'file unpack '
;dpsP [name]
;dnl
pusha
mov [pos],0
 
push ebp
stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF
pop ebp
 
mov [fsWrite.cmd],2
mov [fsWrite.pos],0
mov [fsWrite.size],eax
mov eax,[name]
mov [fsWrite.path],eax
mcall 70,fsWrite
 
.loop:
mov eax, [fsWrite.size]
add [pos], eax
 
 
push ebp
stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF
pop ebp
 
cmp eax,0
jz .end
 
mov [fsWrite.cmd],3
mov [fsWrite.size],eax
mov eax,[pos]
mov [fsWrite.pos],eax
mcall 70,fsWrite
jmp .loop
.end:
 
 
popa
mov eax,1
ret
endp
 
 
proc myAddDir name:dword, bdfe_info:dword
dps 'log adddir'
mov eax,[name]
dpsP eax
dnl
 
pusha
mov eax,[name]
mov [fsNewDir.path],eax
mcall 70,fsNewDir
;
; mov edi,[name]
; xor al,al
; mov ecx,256
; repne scasb
; mov edx,256
; sub edx,ecx
; mov eax,[name]
; mcall 30,1,eax
popa
mov eax,1
ret
endp
 
 
;ª®¯¨àã¥â ¯®á«¥¤­¥¥ ¨¬ï ¢ ¯®«­®¬ ¨«¨ ®â­®á¨â¥«ì­®¬ ¯ã⨠¡¥§ à áè¨à¥­¨ï
proc cpLastName inp:dword, outp:dword
push edi esi
mov edi,[inp]
xor al,al
mov ecx,256 ; V
repne scasb ;/fol1/file1.zip
 
mov al,'/'
mov ecx,256
std ; V
repne scasb ;/fol1/file1.zip
cld
 
mov esi,edi
add esi,2
mov ecx,256 ;/fol1/file1.zip
mov edi,[outp] ;file1.zip
@@: lodsb
stosb
test al,al
jz @f
loop @b
@@:
 
mov al,'.'
mov ecx,256
std ; V
repne scasb ;file1.zip
cld
mov [edi+1], byte 0
 
pop esi edi
ret
endp
 
 
proc cpAllExcludeLastName inp:dword, outp:dword
push edi esi
mov edi,[inp]
xor al,al
mov ecx,256 ; V
repne scasb ;/fol1/file1.zip
 
mov al,'/'
mov ecx,256
std ; V
repne scasb ;/fol1/file1.zip
cld
mov edx,edi
add edx, 2
 
mov esi,[inp]
mov ecx,256 ;/fol1/file1.zip
mov edi,[outp] ;file1.zip
@@: lodsb
stosb
test al,al
jz @f
cmp esi,edx
jae @f
loop @b
@@:
xor al, al
stosb
 
pop esi edi
ret
endp
/programs/fs/unz/parse.inc
0,0 → 1,260
; ret:
; 0 - not found param
; 1 - found param
; 2 - error parsing
 
proc getLastParam ;¯®á«¥¤­¨© ¯ à ¬¥âà ¯¨è¥â ¢ fInp
xor al, al ;to end sring
mov edi, params
mov ecx, 4096
repne scasb
dec edi
dec edi
test ecx, ecx
jz errorParsing
 
mov eax, ecx ; - spaces
mov ecx, 4096
sub ecx, eax
mov al, ' '
std
repe scasb
cld
inc edi
inc ecx
 
cmp edi, params
je .noparams
 
cmp [edi], byte '"'
je .quotation
 
mov al, ' ' ;find previous space or begin string
std
repne scasb
cld
inc edi
inc edi
 
mov esi, edi ;copy
mov ebx, edi
mov edi, fInp
 
xor ecx, ecx
@@:lodsb
cmp al, ' '
je @f
test al, al
je @f
stosb
inc ecx
jmp @b
@@:
mov [edi], byte 0
inc edi
 
mov edi, ebx ;clear
mov al, ' '
rep stosb
 
jmp .end
.quotation:
dec edi
mov al, '"'
std
repne scasb
cld
add edi, 2
cmp [edi-1], byte '"'
jne .err
 
mov esi, edi
mov ebx, edi
mov edi, fInp
xor ecx, ecx
@@:lodsb
cmp al, '"'
je @f
test al, al
je @f
stosb
inc ecx
jmp @b
@@:
mov [edi], byte 0
inc edi
 
mov edi, ebx
dec edi
mov al, ' '
add ecx, 2
rep stosb
 
.end:
mov eax, 1
ret
.err:
mov eax, 2
ret
.noparams:
xor eax, eax
endp
 
 
proc getParam2
locals
retrn rd 0
endl
mov [retrn], 0
mov ebx, params
.find_o:
cmp [ebx], word '-o'
jne .find_o2
mov edx, ebx
lea esi, [ebx+3]
@@: ;skiping spaces
cmp esi, pathOut+1024
jae .errorParsing
cmp byte[esi], ' '
jne @f
inc esi
jmp @b
@@: ;copying ; -o "file"
mov ecx, 3
cmp byte[esi], '"'
jne ._notspace
inc esi
add ecx, 2
mov edi, pathOut
mov [retrn], 1
@@: lodsb
cmp al, '"'
je .clear
stosb
inc ecx
cmp esi, pathOut+1024
jae errorParsing
jmp @b
 
._notspace: ;copying ; -o file
mov edi, pathOut
@@: lodsb
stosb
inc ecx
cmp al, ' '
je .clear
cmp esi, pathOut+1024
jae errorParsing
jmp @b
 
.clear: ;cleaning param
mov [edi], byte 0
inc edi
mov [retrn], 1
@@:
mov byte[edx], ' '
inc edx
loop @b
jmp @f
 
.find_o2:
inc ebx
cmp ebx, pathOut+1024
jae @f
cmp byte[ebx], 0
je @f
jmp .find_o
@@:
 
 
 
mov eax, [retrn]
ret
.errorParsing:
mov eax, 2
ret
endp
 
 
proc getParam key:word
locals
retrn rd 0
endl
mov [retrn], 0
mov ebx, params
 
.find_o:
mov ax, [key]
cmp [ebx], ax
jne .find_o2
 
mov edx, ebx
lea esi, [ebx+3]
 
@@: ;skiping spaces
cmp esi, params+4096
jae .errorParsing
cmp byte[esi], ' '
jne @f
inc esi
jmp @b
@@:
 
;copying ; -f "file"
mov ecx, 3
cmp byte[esi], '"'
jne ._notspace
inc esi
add ecx, 2
mov edi, [endPointer]
mov [retrn], 1
@@: lodsb
cmp al, '"'
je .clear
stosb
inc ecx
cmp esi, params+4096
jae errorParsing
jmp @b
 
._notspace: ;copying ; -f file
mov edi, [endPointer]
@@: lodsb
stosb
inc ecx
cmp al, ' '
je .clear
cmp esi, params+4096
jae errorParsing
jmp @b
 
 
.clear: ;cleaning param
mov [edi], byte 0
inc edi
mov [endPointer], edi
mov [retrn], 1
@@:
mov byte[edx], ' '
inc edx
loop @b
 
jmp @f
 
.find_o2:
inc ebx
cmp ebx, params+4096
jae @f
cmp byte[ebx], 0
je @f
jmp .find_o
@@:
 
 
 
mov eax, [retrn]
ret
.errorParsing:
mov eax, 2
ret
endp
/programs/fs/unz/unz.asm
0,0 → 1,1009
;unz - à á¯ ª®¢é¨ª, ¨á¯®«ì§ãî騩 archiver.obj. ®¤¤¥à¦¨¢ ¥â zip ¨ 7z.
 
;unz [-o output path] [-f file for unpack] [-f ...] [-h] file.zip
;-h - hide GUI. If params is empty - do exit.
 
;unz -o /hd0/1/arci -f text1.txt file.zip -unpack in folder only file text1.txt
;or
;unz -o "/hd0/1/arci" -f "text1.txt" text2.txt "file.zip" -unpack in folder only file text1.txt and text2.txt
 
 
;… …€‹ˆ‡Ž‚€Ž
;unz -n "namezone" "file.zip" - open packed file, write list files of main folder in namezone
;namezone:
;dd 0 - ¥á«¨ ¨¬¥­­®¢ ­ ï §®­  § ­ïâ , â® 1
;dd cmd - 0 ­¥â ª®¬ ­¤ë
; 1 ¯®«ãç¨âì ᯨ᮪ ä ©«®¢
; 2 ¯®«ãç¨âì ä ©«
; 3 ãáâ ­®¢¨âì ⥪ã訩 ª â «®£ ¢  à娢¥
; 4 § ¢¥àè¨âì à ¡®âã
;data - ¤ ­­ë¥, § ¢¨á¨â ®â ª®¬¬ ­¤ë
; 1 ¯®«ãç¨âì ᯨ᮪ ä ©«®¢
; input
; none
; output
; dd numfiles - ª®«¨ç¥á⢮ ä ©«®¢ ¨ ¯ ¯®ª ¢ ⥪ã饬 ª â «®£¥
; strz file1...fileN - ᯨ᮪ áâப, à §¤¥«ñ­­ëå 0
; 2 ¯®«ãç¨âì ä ©«
; input
; dd num bytes
; strz filename (file1.txt of /fold1/file1.txt)
; output
; dd num bytes
; data
 
use32
org 0
db 'MENUET01'
dd 1, start, init_end, end_mem, stack_top, params, 0
 
 
include 'lang.inc'
include '../../macros.inc'
include '../../proc32.inc'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../dll.inc'
include 'debug.inc'
 
version equ '0.65'
version_dword equ 0*10000h + 65
 
WIN_W = 400
 
SIZE_COPY_BUF = 1024*1024*2
 
virtual at 0
kfar_info_struc:
.lStructSize dd ?
.kfar_ver dd ?
.open dd ?
.open2 dd ?
.read dd ?
.write dd ?
.seek dd ?
.tell dd ?
.flush dd ?
.filesize dd ?
.close dd ?
.pgalloc dd ?
.pgrealloc dd ?
.pgfree dd ?
.getfreemem dd ?
.pgalloc2 dd ?
.pgrealloc2 dd ?
.pgfree2 dd ?
.menu dd ?
.menu_centered_in dd ?
.DialogBox dd ?
.SayErr dd ?
.Message dd ?
.cur_console_size dd ?
end virtual
 
 
 
 
 
include 'parse.inc'
include 'fs.inc'
 
;-- CODE -------------------------------------------------------------------
 
 
start:
mcall 68, 11
mcall 40, 100111b + 0C0000000h
stdcall dll.Load, IMPORTS
test eax, eax
jnz exit
mov [pathOut],0
 
;stdcall SayErr,strErrorExc
;mcall -1
;----------------------------
;1. find input file, clear
;2. find -o, copy data, clear
;3. find -f, add pointer, copy data, clear
;4. find -c, check variable, clear
;1.
call getLastParam
test eax, eax
je wm_redraw
dec eax
je .arbeit
jmp errorParsing
 
.arbeit:
;2.
call getParam2
cmp eax, 2
je errorParsing
 
;3.
 
@@:
mov eax, [iFiles]
shl eax, 2
add eax, files
m2m dword[eax], dword[endPointer]
stdcall getParam, '-f'
cmp eax, 2
je errorParsing
inc [iFiles]
cmp eax, 1
je @b
 
;4.
mov edi, params
mov ax,'-h'
@@: cmp word [edi], ax
je .check
inc edi
cmp edi, params+1024
je @f
cmp byte[edi],0
je @f
jmp @b
.check:
call startUnpack
mcall -1
@@:
stdcall [OpenDialog_Init],OpenDialog_data
 
;init edit fields --------------
xor al,al
mov edi,fInp
mov ecx,1024
repne scasb
inc ecx
mov eax,1024
sub eax,ecx
mov dword[edtPack.size],eax
mov dword[edtPack.pos],eax
 
xor al, al
mov edi, pathOut
mov ecx, 1024
repne scasb
inc ecx
mov eax, 1024
sub eax, ecx
mov dword[edtUnpPath.size], eax
mov dword[edtUnpPath.pos], eax
 
 
;main loop --------------------
wm_redraw:
call winRedraw
 
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
cmp [bWinChild],0
jne still
 
stdcall [edit_box_key],edtPack
stdcall [edit_box_key],edtUnpPath
 
jmp still
 
 
wm_button:
mcall 17
cmp [bWinChild],0
jne still
 
cmp ah, 3
jne @f
call selectInput
jmp wm_redraw
@@:
cmp ah, 4
jne @f
call selectOutFold
jmp wm_redraw
@@:
 
cmp ah, 2
jne @f
;mcall 51,1,startUnpack,stackUnpack
;mov [bWinChild],1
call startUnpack
jmp wm_redraw
@@:
 
cmp ah, 1
je exit
jmp still
 
wm_mouse:
cmp [bWinChild],0
jne still
stdcall [edit_box_mouse],edtPack
stdcall [edit_box_mouse],edtUnpPath
 
jmp still
 
exit:
mcall -1
 
errorParsing:
dps 'errorParsing'
mcall -1
 
;--- functions ------------------------------------------------------------------
 
proc winRedraw
mcall 12, 1
mcall 48, 3, sc, sizeof.system_colors
mov edx, [sc.work]
or edx, 0x34000000
mcall 0, <200,WIN_W>, <200,130>, , , title
mcall 8, <100,100>,<65,25>,2,[sc.work_button]
mcall 8, <(WIN_W-52),33>,<10,20>,3,[sc.work_button]
mcall 8, <(WIN_W-52),33>,<35,20>,4,[sc.work_button]
 
edit_boxes_set_sys_color edtPack,endEdits,sc
stdcall [edit_box_draw],edtPack
stdcall [edit_box_draw],edtUnpPath
 
; plain window labels
cmp [redInput],0
jne @f
mov ecx,[sc.work_text]
or ecx,90000000h
jmp .l1
@@:
mov ecx,90FF0000h
.l1:
mcall 4, <15,16>, , strInp
mov ecx,[sc.work_text]
or ecx,90000000h
mcall 4, <15,37>, , strPath
; text on buttons
mov ecx,[sc.work_button_text]
or ecx,90000000h
if lang eq ru
mcall 4, <107,70>, , strGo
else
mcall 4, <127,70>, , strGo
end if
mcall 4, <(WIN_W-47),12>, , strDots
mcall 4, <(WIN_W-47),37>, , strDots
 
mcall 12, 2
ret
endp
 
;region
selectInput:
mov [OpenDialog_data.type],0
stdcall [OpenDialog_Start],OpenDialog_data
mov edi,ODAreaPath
xor al,al
or ecx,-1
repne scasb
sub edi,ODAreaPath
dec edi
mov dword[edtPack+12*4],edi
mov ecx,edi
inc ecx
mov edi,fInp
mov esi,ODAreaPath
rep movsb
mov [redInput],0
ret
;endregion
 
;region
selectOutFold:
mov [OpenDialog_data.type],2
stdcall [OpenDialog_Start],OpenDialog_data
mov edi,ODAreaPath
xor al,al
or ecx,-1
repne scasb
sub edi,ODAreaPath
dec edi
mov dword[edtUnpPath+12*4],edi
mov ecx,edi
inc ecx
mov edi,pathOut
mov esi,ODAreaPath
rep movsb
ret
;endregion
 
 
;-------------------------------------------------------------------------------
 
allfiles dd 0
succfiles dd 0
numbytes dd 0
 
proc startUnpack
locals
paramUnp rd 1
sizeUnpack rd 1
hFile rd 1
hFileZip rd 1
hPlugin rd 1
pathFold rb 256
endl
;if input not corrected
cmp [fInp],byte 0
je .errNullInp
 
; mcall 68, 24, Exception, 0FFFFFFFFh ;??
;init plugin
push ebp
stdcall [aPluginLoad],kfar_info
pop ebp
 
 
;set current directory, create folder
cmp [pathOut],0
jne @f
lea eax,[pathFold]
stdcall cpLastName, fInp, eax
lea eax,[pathFold]
mov [fsNewDir.path],eax
mcall 70, fsNewDir
mov ecx, [fsNewDir.path]
 
mcall 30,4,,1
jmp .n
@@:
mcall 30,4,pathOut,1
.n:
 
;open and read first 1KB
stdcall open, fInp, O_READ
mov [hFileZip], eax
mcall 70,fsZip
test eax,eax
jnz .errNotFound
mcall 70,fsZipRead
 
 
;open pack
push ebp
stdcall [aOpenFilePlugin],[hFileZip],bdvkPack,filedata_buffer,filedata_buffer_size ,0 ,0 , fInp
pop ebp
 
test eax,eax
jnz @f
cmp ebx,0 ;;/ ŠŽ‘’›‹œ!!!!
je .errNotFound ;;§­ ç¥­¨¥ ebx ¯®«ã祭® ®¯ëâ­ë¬ ¯ãâñ¬.
cmp ebx,400h ;;ª ª ®­® ¡ã¤¥â à ¡®â âì á ¤à㣨¬¨ ¢¥àá¨ï¬¨
je .errNotSupp ;;¡¨¡«¨®â¥ª¨ - ­¥ ïá­®!
@@:
mov [hPlugin],eax
 
;get num of all files
; stdcall calcSizeArch,[hPlugin]
; push ebp
; stdcall [aReadFolder], [hPlugin]
; 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
; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[], void* addfile, void* adddir);
push ebp
stdcall [aGetFiles], [hPlugin], -1, 0, myAddFile, myAddDir
pop ebp
 
;jmp @f
; .str1 db '/LICENSE.txt',0
;@@:
 
;HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode);
;Žâªàëâì ä ©« filename.  à ¬¥âà mode § à¥§¥à¢¨à®¢ ­ ¨ ¢ ⥪ã饩 ¢¥àᨨ kfar ¢á¥£¤  à ¢¥­ 1.
; push ebp
; stdcall [aOpen], [hPlugin], .str1, O_READ
; pop ebp
 
; mov [hFile],eax
;unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
;—⥭¨¥ size ¡ ©â ¢ ¡ãä¥à buf ¨§ ä ©«  hFile, à ­¥¥ ®âªàë⮣® ç¥à¥§ open.
;size ªà â¥­ 512 ¡ ©â
;‚®§¢à é ¥¬®¥ §­ ç¥­¨¥: ç¨á«® ¯à®ç¨â ­­ëå ¡ ©â, -1 ¯à¨ ®è¨¡ª¥.
; push ebp
; stdcall [aRead], [hFile], copy_buf, SIZE_COPY_BUF
; pop ebp
;
; mcall 70, fsWrite
;void __stdcall close(HANDLE hFile);
push ebp
stdcall [aClose], [hFile]
mov [bWinChild],0
pop ebp
 
push ebp
stdcall [aClosePlugin], [hPlugin]
mov [bWinChild],0
 
mov [fsRunNotifyOK.param],strUnpackOk
mcall 70,fsRunNotifyOK
pop ebp
ret ;SUCCESS
 
 
.errNotFound:
; stdcall SimpleSayErr,strNotFound
mov [bWinChild],0
mov [fsRunNotifyOK.param],strUnpackFault
mcall 70,fsRunNotifyOK
ret
 
.errNotSupp:
mov eax,[fsNewDir.path]
mov [fsDelDir.path],eax
mcall 70, fsDelDir
 
mov [bWinChild],0
mov [fsRunNotifyOK.param],strUnpackFault
mcall 70,fsRunNotifyOK
ret
 
.errNullInp:
mov [redInput],1
mov [bWinChild],0
ret
endp
 
 
proc Exception param1:dword
stdcall SimpleSayErr,strErrorExc
ret
endp
 
proc debugInt3
dps ' ­¨ª !!!!!!!!!!!!!!!!!!!!!!!!!'
dnl
int3
ret
endp
 
 
proc calcSizeArch hPlugin:dword
locals
bdwk rb 560
endl
;int __stdcall ReadFolder(HANDLE hPlugin, unsigned dirinfo_start,
; unsigned dirinfo_size, void* dirdata);
int3
push ebp
lea eax,[bdwk]
stdcall [aReadFolder], [hPlugin],1,560,eax
pop ebp
 
ret
endp
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
 
;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, 111b+0C000000h
.wm_redraw:
mcall 12, 1
mcall 48, 3, sc, sizeof.system_colors
mov edx, [sc.work]
or edx, 0x33000000
mcall 0, <220,WIN_W>, <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
 
 
;-- DATA -------------------------------------------------------------------
 
 
 
sc system_colors
 
 
title db 'uNZ v0.11 - Unarchiver of Zip and 7z',0
bWinChild db 0 ;1 - ¤®ç¥à­¥¥ ®ª­® ¥áâì, £« ¢­®¥ ®ª­® ­¥ ¤®«¦­® ॠ£¨à®¢ âì
redInput db 0 ;1 - ¯®¤á¢¥â¨âì ªà á­ë¬ ­ ¤¯¨áì
 
if lang eq ru
strGo db ' á¯ ª®¢ âì',0
strInp db ' €à娢',0
strPath db 'ˆ§¢«¥çì ¢',0
strError db 'Žè¨¡ª ',0
strErrorExc db '¥®¯®§­ ­­ ï ®è¨¡ª ',0
strOk db 'OK',0
strGetPass db ' à®«ì',0
strCancel db 'Žâ¬¥­ ',0
strUnpackOk db "'“ᯥ譮 à á¯ ª®¢ ­®' -O",0
strUnpackFault db "'Žè¨¡ª  à á¯ ª®¢ª¨' -E",0
strNotSupport db "'¥¯®¤¤¥à¦¨¢ ¥¬ë© ä®à¬ â  à娢 ' -E",0
strNotFound db "'” ©« ­¥ ­ ©¤¥­' -E",0
else
strGo db 'Unpack',0
strInp db 'Archive',0
strPath db 'Extract to',0
strError db 'Error',0
strErrorExc db 'Unrecognized error',0
strOk db 'OK',0
strGetPass db 'Password',0
strCancel db 'Cancel',0
strUnpackOk db "'Unpacked successfuly' -O",0
strUnpackFault db "'Unpack failed' -E",0
strNotSupport db "'Archive format is not supported' -E",0
strNotFound db "'File not found' -E",0
end if
 
strNull db 0
strDots db '...',0
 
;--------
; int __stdcall SayErr(int num_strings, const char* strings[],
; int num_buttons, const char* buttons[]);
; int __stdcall DialogBox(DLGDATA* dlg);
 
forpassword rd 1
stateDlg dd 0 ;0 - in process, 1 - button ok, 2 - button cancel
errmess0 dd strErrorExc
 
 
kfar_info:
dd .size
dd version_dword
dd open
dd open2
dd read
dd -1 ; write: to be implemented
dd seek
dd tell
dd -1 ; flush: to be implemented
dd filesize
dd close
dd xpgalloc
dd xpgrealloc
dd pgfree
dd getfreemem
dd debugInt3;libini_alloc
dd debugInt3;libini_realloc
dd debugInt3;libini_free
dd debugInt3;menu
dd debugInt3;menu_centered_in
dd DialogBox;DialogBox
dd SayErr ;SayErr
dd debugInt3;Message
dd 0 ;cur_width
.size = $ - kfar_info
;--------
 
 
iFiles dd 0 ;ª®«¨ç¥á⢮ ¢ë£à㦠¥¬ëå ä ©«®¢
endPointer dd buffer
 
 
fsZip:
.cmd dd 5
dd 0
dd 0
.size dd 0
.buf dd bdvkPack
db 0
dd fInp
 
fsZipRead:
.cmd dd 0
dd 0
dd 0
.size dd 1024
.buf dd filedata_buffer
db 0
dd fInp
 
 
fsWrite:
.cmd dd 2 ;2 rewrite, 3 - write
.pos dd 0
.hpos dd 0
.size dd SIZE_COPY_BUF
.buf dd copy_buf
db 0
.path dd 0
 
 
fsNewDir:
.cmd dd 9
dd 0
dd 0
dd 0
dd 0
db 0
.path dd 0
 
fsDelDir:
.cmd dd 8
dd 0
dd 0
dd 0
dd 0
db 0
.path dd 0
 
 
 
fsRunNotifyOK:
.cmd dd 7
dd 0
.param dd strUnpackOk
.size dd 0
.buf dd 0
db '/sys/@notify',0
 
 
 
edtPack edit_box (WIN_W-100-60),100,10,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
255, fInp, mouse_dd,0,0,0
edtUnpPath edit_box (WIN_W-100-60),100,35,0FFFFFFh,0xff,0x80ff,0h,0x90000000,\
255, pathOut, mouse_dd,0,0,0
edtPassword edit_box 200,56,70,0FFFFFFh,0xff,0x80ff,0h,0x90000000,255,\
password, mouse_dd,0,0,0
endEdits:
 
;-------------------------------------------------------------------------------
OpenDialog_data:
.type dd 0 ;0-open, 1-save, 2-select folder
.procinfo dd RBProcInfo ;+4
.com_area_name dd communication_area_name ;+8
.com_area dd 0 ;+12
.opendir_pach dd temp_dir_pach ;+16
.dir_default_pach dd communication_area_default_pach ;+20
.start_path dd open_dialog_path ;+24
.draw_window dd winRedraw ;+28
.status dd 0 ;+32
.openfile_pach dd ODAreaPath; ;+36
.filename_area dd 0; ;+40
.filter_area dd Filter
.x:
.x_size dw 420 ;+48 ; Window X size
.x_start dw 100 ;+50 ; Window X position
.y:
.y_size dw 320 ;+52 ; Window y size
.y_start dw 100 ;+54 ; Window Y position
 
communication_area_name:
db 'FFFFFFFF_open_dialog',0
open_dialog_path:
db '/sys/File managers/opendial',0
 
communication_area_default_pach:
db '/sys',0
 
Filter dd 0
 
 
; int __stdcall ReadFolder(HANDLE hPlugin,
; unsigned dirinfo_start, unsigned dirinfo_size, void* dirdata);
; void __stdcall ClosePlugin(HANDLE hPlugin);
; bool __stdcall SetFolder(HANDLE hPlugin,
; const char* relative_path, const char* absolute_path);
; void __stdcall GetOpenPluginInfo(HANDLE hPlugin, OpenPluginInfo* info);
; void __stdcall GetFiles(HANDLE hPlugin, int NumItems, void* items[],
; void* addfile, void* adddir);
; bool __stdcall addfile(const char* name, void* bdfe_info, HANDLE hFile);
; bool __stdcall adddir(const char* name, void* bdfe_info);
; int __stdcall getattr(HANDLE hPlugin, const char* filename, void* info);
; HANDLE __stdcall open(HANDLE hPlugin, const char* filename, int mode);
; void __stdcall setpos(HANDLE hFile, __int64 pos);
; unsigned __stdcall read(HANDLE hFile, void* buf, unsigned size);
; void __stdcall close(HANDLE hFile);
IMPORTS:
library archiver, 'archiver.obj',\
box_lib ,'box_lib.obj',\
proc_lib,'proc_lib.obj'
 
import archiver,\
aPluginLoad , 'plugin_load',\
aOpenFilePlugin , 'OpenFilePlugin',\
aClosePlugin , 'ClosePlugin',\
aReadFolder , 'ReadFolder',\
aSetFolder , 'SetFolder',\
aGetFiles , 'GetFiles',\
aGetOpenPluginInfo , 'GetOpenPluginInfo',\
aGetattr , 'getattr',\
aOpen , 'open',\
aRead , 'read',\
aSetpos , 'setpos',\
aClose , 'close',\
aDeflateUnpack , 'deflate_unpack',\
aDeflateUnpack2 , 'deflate_unpack2'
 
import proc_lib,\
OpenDialog_Init ,'OpenDialog_init',\
OpenDialog_Start ,'OpenDialog_start'
import box_lib,\
edit_box_draw ,'edit_box',\
edit_box_key ,'edit_box_key',\
edit_box_mouse ,'edit_box_mouse'
 
 
IncludeIGlobals
 
;-- UDATA -----------------------------------------------------------------------------
init_end:
align 16
IncludeUGlobals
 
 
;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
pathOut rb 1024
files rd 256
password rb 256
 
fZipInfo rb 40
 
mouse_dd rd 1
RBProcInfo rb 1024
temp_dir_pach rb 1024
ODAreaPath rb 1024
 
 
 
;--------
 
copy_buf rb SIZE_COPY_BUF
 
execdata rb 1024
execdataend:
 
filedata_buffer_size = 1024
filedata_buffer rb filedata_buffer_size
 
CopyDestEditBuf rb 12+512+1
.length = $ - CopyDestEditBuf - 13
 
bdvkPack rb 560
 
;--------
 
buffer rb 4096 ;for string of file name or extract
params rb 4096
 
rb 1024
stackUnpack:
 
rb 1024
stackDlg:
 
rb 1024
stack_top:
 
end_mem: