2006-01-03 10:43:31 +01:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; ;
|
|
|
|
|
; FILE COPY - system module for copy ;
|
|
|
|
|
; files.Prog for SYS X-TREE BROWSER v22 ;
|
|
|
|
|
; ;
|
|
|
|
|
; Create by Pavlushin Evgeni waptap@mail.ru ;
|
|
|
|
|
; homepage www.deck4.narod.ru ;
|
|
|
|
|
; ;
|
|
|
|
|
; On base SYSTREE FILE COPIER 1.02 ;
|
|
|
|
|
; Ivan Poddubny ivan-yar@bk.ru ;
|
2024-06-07 11:39:27 +02:00
|
|
|
|
; ;
|
2006-01-03 10:43:31 +01:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ண<EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>筠<EFBFBD> <20><> 㦥 <20><><EFBFBD> <20><><EFBFBD> ࠡ<>⠥<EFBFBD>
|
|
|
|
|
use32
|
|
|
|
|
org 0x0
|
|
|
|
|
|
|
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
|
dd 0x01 ; header version
|
|
|
|
|
dd START ; start of code
|
|
|
|
|
dd I_END ; size of image
|
2006-08-24 14:33:31 +02:00
|
|
|
|
dd 0x10000 ; memory for app
|
2006-01-03 10:43:31 +01:00
|
|
|
|
dd 0x10000 ; esp
|
|
|
|
|
dd param_area , 0x0 ; I_Param , I_Icon
|
|
|
|
|
|
2024-06-07 11:39:27 +02:00
|
|
|
|
include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US.
|
|
|
|
|
include '..\..\..\macros.inc' ; very useful stuff for MeOS
|
2006-01-03 10:43:31 +01:00
|
|
|
|
include 'ascl.inc'
|
|
|
|
|
|
2024-06-07 11:39:27 +02:00
|
|
|
|
START: ; start of execution
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
; <20><>ࠬ<EFBFBD><E0A0AC><EFBFBD><EFBFBD>:
|
2006-08-24 14:33:31 +02:00
|
|
|
|
; db n1 = <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>筨<EFBFBD><E7ADA8>
|
|
|
|
|
; times n1 db ? = <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>筨<EFBFBD><E7ADA8>
|
|
|
|
|
; db n2 = <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><F1ACADA8>
|
|
|
|
|
; times n2 db ? = <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><F1ACADA8>
|
|
|
|
|
; db 0
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
;get param
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov eax, 15
|
|
|
|
|
lea esi, [param_area+1]
|
|
|
|
|
movzx ecx, byte [esi-1]
|
|
|
|
|
jecxz err_exit
|
|
|
|
|
mov edi, source
|
|
|
|
|
rep movsb
|
|
|
|
|
mov byte [edi], 0
|
|
|
|
|
inc eax
|
|
|
|
|
movzx ecx, byte [esi]
|
|
|
|
|
inc esi
|
|
|
|
|
jecxz err_exit
|
|
|
|
|
mov edi, destination
|
|
|
|
|
rep movsb
|
|
|
|
|
mov byte [edi], 0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
call copy_file
|
|
|
|
|
|
|
|
|
|
dexit:
|
|
|
|
|
wtevent red,key,button
|
|
|
|
|
jmp dexit
|
|
|
|
|
red:
|
|
|
|
|
call draw_window
|
|
|
|
|
jmp dexit
|
|
|
|
|
key:
|
|
|
|
|
button:
|
|
|
|
|
|
|
|
|
|
exit:
|
|
|
|
|
close
|
|
|
|
|
|
|
|
|
|
err_exit:
|
|
|
|
|
push eax
|
|
|
|
|
call draw_window
|
|
|
|
|
pop eax
|
2006-08-24 14:33:31 +02:00
|
|
|
|
; jmp copy_error
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
; print message now
|
|
|
|
|
copy_error:
|
2006-08-24 14:33:31 +02:00
|
|
|
|
imul ebp, eax, 43
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
mov eax,4
|
|
|
|
|
mov ebx,20*65536+70
|
|
|
|
|
mov ecx,0x10ff0000
|
2006-08-24 14:33:31 +02:00
|
|
|
|
lea edx,[errors+ebp]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov esi,43 ;[errors+edi*8+4]
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
jmp dexit
|
|
|
|
|
|
|
|
|
|
;closep:
|
|
|
|
|
; or eax,-1 ; close program
|
2007-05-10 15:48:35 +02:00
|
|
|
|
; mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;====================================================
|
|
|
|
|
; copy_file
|
|
|
|
|
; This piece of code copies src file to dst file,
|
|
|
|
|
; then it pass the control to copy_error routine,
|
|
|
|
|
; which returns to the main cycle of the app.
|
|
|
|
|
; It's NOT a function! It's reached by direct jump
|
|
|
|
|
; from the button handler.
|
|
|
|
|
;====================================================
|
|
|
|
|
copy_file:
|
|
|
|
|
; at first we must get the size of the source file
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov dword [source_attr+32], 0
|
|
|
|
|
mov eax, 70
|
|
|
|
|
mov ebx, source_attr_info
|
|
|
|
|
int 0x40
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
; now eax contains error code
|
|
|
|
|
; and ebx contains file size in bytes
|
|
|
|
|
test eax,eax ; check if eax is equal to zero (success)
|
|
|
|
|
je .ok_getsize ; eax = 0 => continue
|
|
|
|
|
cmp eax,6
|
|
|
|
|
jna @f
|
|
|
|
|
mov eax,7 ; if error code is above 6, it will be 7
|
|
|
|
|
@@:
|
|
|
|
|
cmp eax,5 ; file might be copied successfully altrough
|
|
|
|
|
; the system reports an error 5
|
|
|
|
|
jne copy_error ; print error code now
|
|
|
|
|
.ok_getsize:
|
|
|
|
|
|
|
|
|
|
; allocate memory
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov ebx,[source_attr+32]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
push ebx ; save file size
|
2006-08-24 14:33:31 +02:00
|
|
|
|
lea ecx,[ebx+0x10000] ; size of memory needed = 0x10000+filesize
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax,64 ; func 64
|
|
|
|
|
mov ebx,1 ; resize application memory
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
pop ebx ; restore filesize
|
|
|
|
|
|
|
|
|
|
; check if alloc function failed
|
|
|
|
|
test eax,eax ; non-zero value means error
|
|
|
|
|
je .ok_memory
|
|
|
|
|
mov eax,5 ; error 5 - out of memory
|
|
|
|
|
jmp copy_error ; print error code now
|
|
|
|
|
.ok_memory:
|
|
|
|
|
|
|
|
|
|
; save number of blocks to source_info
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov [source_info.bytes], ebx
|
2006-01-03 10:43:31 +01:00
|
|
|
|
; read the source file
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov eax,70
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,source_info
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-08-24 14:33:31 +02:00
|
|
|
|
; ebx = number of read bytes = file size
|
2006-01-03 10:43:31 +01:00
|
|
|
|
; save loaded file
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov [dest_info.bytes],ebx ; file size in bytes
|
|
|
|
|
mov eax,70
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,dest_info
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
; check if 58 function failed
|
|
|
|
|
test eax,eax
|
|
|
|
|
je .ok_write
|
|
|
|
|
add eax,7 ; error number += 7
|
|
|
|
|
cmp eax,6+7
|
|
|
|
|
jna copy_error
|
|
|
|
|
mov eax,7+7
|
|
|
|
|
jmp copy_error
|
|
|
|
|
.ok_write:
|
|
|
|
|
|
|
|
|
|
; return to the initial amount of memory
|
|
|
|
|
mov eax,64
|
|
|
|
|
mov ebx,1
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov ecx,0x10000
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
xor eax,eax ; eax = message number (0-OK)
|
2006-08-24 14:33:31 +02:00
|
|
|
|
jmp copy_error
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; *********************************************
|
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
|
|
|
|
; *********************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
|
|
|
|
|
mov eax,12 ; function 12:tell os about windowdraw
|
|
|
|
|
mov ebx,1 ; 1, start of draw
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
; DRAW WINDOW
|
|
|
|
|
xor eax,eax ; function 0 : define and draw window
|
|
|
|
|
mov ebx,160*65536+415 ; [x start] *65536 + [x size]
|
2007-05-17 04:22:27 +02:00
|
|
|
|
mov ecx,160*65536+90 ; [y start] *65536 + [y size]
|
2007-06-22 22:24:06 +02:00
|
|
|
|
mov edx,0x14DDDDDD ; color of work area RRGGBB
|
2007-05-17 04:22:27 +02:00
|
|
|
|
mov edi,labelt ; WINDOW LABEL
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2024-06-07 11:39:27 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax,8
|
|
|
|
|
mov ebx,105*65536+290
|
|
|
|
|
mov ecx,33*65536+12
|
|
|
|
|
mov edx,4
|
|
|
|
|
mov esi,0xEBEBEB
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,105*65536+290
|
|
|
|
|
mov ecx,49*65536+12
|
|
|
|
|
mov edx,5
|
|
|
|
|
mov esi,0xEBEBEB
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
mov esi,source
|
|
|
|
|
mov edi,text+14
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov ecx,47
|
2006-01-03 10:43:31 +01:00
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
|
|
mov esi,destination
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov edi,text+62+14
|
|
|
|
|
mov ecx,47
|
2006-01-03 10:43:31 +01:00
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
|
|
mov ebx,25*65536+36 ; print filenames
|
|
|
|
|
xor ecx,ecx
|
|
|
|
|
mov edx,text
|
2006-08-24 14:33:31 +02:00
|
|
|
|
mov esi,62
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov eax,4
|
2007-05-17 04:22:27 +02:00
|
|
|
|
newline:
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
add ebx,16
|
2006-08-24 14:33:31 +02:00
|
|
|
|
add edx,62
|
2006-01-03 10:43:31 +01:00
|
|
|
|
cmp [edx],byte 'x'
|
|
|
|
|
jnz newline
|
|
|
|
|
|
|
|
|
|
mov eax,12 ; function 12:tell os about windowdraw
|
|
|
|
|
mov ebx,2 ; 2, end of draw
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
addr dd 0x0
|
|
|
|
|
ya dd 0x0
|
|
|
|
|
temp dd 0
|
|
|
|
|
|
2024-06-03 01:34:02 +02:00
|
|
|
|
if lang eq ru_RU
|
2006-01-03 10:43:31 +01:00
|
|
|
|
text:
|
|
|
|
|
db ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: |<7C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD>⨭<EFBFBD>, <20><><EFBFBD> <20><>᪢<EFBFBD> , 1 <20><><EFBFBD><EFBFBD> '
|
|
|
|
|
db ' <20><><EFBFBD><EFBFBD>: | <20><><EFBFBD><EFBFBD><EFBFBD>設 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, waptap@mail.ru '
|
|
|
|
|
db ' '
|
|
|
|
|
db 'x' ; <- END MARKER, DONT DELETE
|
2007-05-17 04:22:27 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
labelt:
|
2007-05-17 04:22:27 +02:00
|
|
|
|
db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>',0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
errors:
|
|
|
|
|
db "䠩<> <><E1AAAE><EFBFBD><E0AEA2> <20>ᯥ譮 "
|
|
|
|
|
db "(<28>⥭<EFBFBD><E2A5AD>) <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> "
|
|
|
|
|
db "(<28>⥭<EFBFBD><E2A5AD>) 䠩<><E4A0A9><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ন<EFBFBD><E0A6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
db "(<28>⥭<EFBFBD><E2A5AD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⭠<EFBFBD> 䠩<><E4A0A9><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD> "
|
|
|
|
|
db "(<28>⥭<EFBFBD><E2A5AD>) <20><> <20><><EFBFBD><EFBFBD><EFBFBD> ࠧ<><E0A0A7><EFBFBD> <20><> "
|
|
|
|
|
db "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>筮 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "
|
|
|
|
|
db "(<28>⥭<EFBFBD><E2A5AD>) <20><><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9> "
|
|
|
|
|
db "(<28>⥭<EFBFBD><E2A5AD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⭠<EFBFBD> <20>訡<EFBFBD><E8A8A1> "
|
|
|
|
|
db "(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><> <20><><EFBFBD><EFBFBD><EFBFBD> ࠧ<><E0A0A7><EFBFBD> <20><> "
|
|
|
|
|
db "(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) 䠩<><E4A0A9><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ন<EFBFBD><E0A6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
db "(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⭠<EFBFBD> 䠩<><E4A0A9><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD> "
|
|
|
|
|
db "(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><> <20><><EFBFBD><EFBFBD><EFBFBD> ࠧ<><E0A0A7><EFBFBD> <20><> "
|
|
|
|
|
db "oh shit! "
|
|
|
|
|
db "(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) 䠩<> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "
|
|
|
|
|
db "(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⭠<EFBFBD> <20>訡<EFBFBD><E8A8A1> "
|
|
|
|
|
db "<22><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>筨<EFBFBD><E7ADA8> <20> <20>ਥ<EFBFBD><E0A8A5><EFBFBD><EFBFBD><EFBFBD> <20><> 㪠<><E3AAA0><EFBFBD><EFBFBD>!!! "
|
|
|
|
|
db "<22><><EFBFBD><EFBFBD> <20> <20>ਥ<EFBFBD><E0A8A5><EFBFBD><EFBFBD><EFBFBD> <20><> 㪠<><E3AAA0><EFBFBD>!!! "
|
2024-06-07 11:39:27 +02:00
|
|
|
|
|
|
|
|
|
else ; Default to en_US
|
2006-08-24 14:33:31 +02:00
|
|
|
|
text:
|
|
|
|
|
db 'SOURCE: | '
|
|
|
|
|
db 'DESTINATION: | '
|
|
|
|
|
db ' '
|
2024-06-07 11:39:27 +02:00
|
|
|
|
db 'x' ; <- END MARKER, DO NOT DELETE
|
2006-08-24 14:33:31 +02:00
|
|
|
|
labelt:
|
|
|
|
|
db 'SYSTREE FILE COPIER'
|
|
|
|
|
labellen:
|
|
|
|
|
|
|
|
|
|
errors:
|
|
|
|
|
db "Success! "
|
|
|
|
|
db "(read) no hd base or partition defined "
|
|
|
|
|
db "(read) unsupported file system "
|
|
|
|
|
db "(read) unknown file system "
|
|
|
|
|
db "(read) hd partition not defined "
|
|
|
|
|
db "out of memory "
|
|
|
|
|
db "(read) end of file "
|
|
|
|
|
db "(read) unknown error "
|
|
|
|
|
db "(write) no hd base or partition defined "
|
|
|
|
|
db "(write) unsupported file system "
|
|
|
|
|
db "(write) unknown file system "
|
|
|
|
|
db "(write) hd partition not defined "
|
|
|
|
|
db "oh shit! "
|
|
|
|
|
db "(write) file not found "
|
|
|
|
|
db "(write) unknown error "
|
|
|
|
|
db "Path to source is not given!!! "
|
|
|
|
|
db "Path to destination is not given!!! "
|
2024-06-07 11:39:27 +02:00
|
|
|
|
|
2006-08-24 14:33:31 +02:00
|
|
|
|
end if
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
;0123456789012345678901234567890123456789012
|
2006-08-24 14:33:31 +02:00
|
|
|
|
|
|
|
|
|
source_attr_info:
|
|
|
|
|
dd 5
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
dd source_attr
|
|
|
|
|
db 0
|
|
|
|
|
dd source
|
|
|
|
|
|
|
|
|
|
source_info:
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0 ; start from 1st byte
|
|
|
|
|
dd 0
|
|
|
|
|
.bytes dd ?
|
|
|
|
|
dd 0x10000
|
|
|
|
|
db 0
|
|
|
|
|
dd source
|
|
|
|
|
|
|
|
|
|
dest_info: ; DESTINATION FILEINFO
|
|
|
|
|
dd 2
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
.bytes dd ?
|
|
|
|
|
dd 0x10000
|
|
|
|
|
|
|
|
|
|
I_END:
|
|
|
|
|
|
|
|
|
|
destination:
|
|
|
|
|
rb 256
|
|
|
|
|
source:
|
|
|
|
|
rb 256
|
|
|
|
|
source_attr:
|
|
|
|
|
rb 40
|
|
|
|
|
|
|
|
|
|
param_area rb 256
|