RDsave: bugfixes.

git-svn-id: svn://kolibrios.org@4290 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2013-11-25 06:35:17 +00:00
parent 3951e5fd59
commit 9fc5122eb8
2 changed files with 147 additions and 130 deletions

View File

@ -8,7 +8,7 @@
; Heavyiron 01.12.2013 - new logic ; Heavyiron 01.12.2013 - new logic
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
appname equ 'RDsave ' appname equ 'RDsave '
version equ '1.41' version equ '1.42'
debug equ no debug equ no
use32 ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à  use32 ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
@ -50,14 +50,13 @@ load_libraries l_libs_start,end_l_libs
test eax,eax test eax,eax
jz close jz close
stdcall dll.Init,[init_lib] stdcall dll.Init,[init_lib]
invoke ini_get_int,ini_file,asettings,aautoclose,0 invoke ini_get_int,ini_file,asettings,aautoclose,0
mov [autoclose],eax mov [autoclose],eax
invoke ini_get_str,ini_file,apath,apath,fname_buf,4096,path invoke ini_get_str,ini_file,apath,apath,fname_buf,4096,path
stdcall _lstrcpy,ini_path,fname_buf stdcall _lstrcpy,ini_path,fname_buf
stdcall _lstrcpy,filename_area,start_temp_file_name
stdcall _lstrcpy,filename_area,start_temp_file_name
mov eax,PARAMS mov eax,PARAMS
cmp byte[eax], 0 cmp byte[eax], 0
@ -72,13 +71,12 @@ stdcall _lstrcpy,filename_area,start_temp_file_name
.no_h: .no_h:
mov [param],1 mov [param],1
stdcall _lstrcpy,fname_buf,eax stdcall _lstrcpy,fname_buf,eax
xor eax,eax
mov ah,2 mov ah,2
jmp noclose jmp noclose
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
no_params: no_params:
stdcall _lstrcpy,check_dir,ini_path stdcall _lstrcpy,check_dir,ini_path
call check_path call check_path
test eax,eax test eax,eax
jz path_ok jz path_ok
@ -90,9 +88,8 @@ dps 'read_folder_error'
newline newline
end if end if
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
default_path:
stdcall _lstrcpy,fname_buf,communication_area_default_path stdcall _lstrcpy,fname_buf,communication_area_default_path
mov [hidden],0 mov [hidden],0
;OpenDialog initialisation ;OpenDialog initialisation
@ -102,9 +99,11 @@ stdcall _lstrcpy,fname_buf,communication_area_default_path
; prepare for PathShow ; prepare for PathShow
push dword PathShow_data_1 push dword PathShow_data_1
call [PathShow_prepare] call [PathShow_prepare]
mcall 40,0x00000027
call draw_window call draw_window
mov ah,3 mov ah,3
mov ecx,fname_buf
jmp noclose jmp noclose
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
path_ok: path_ok:
@ -138,13 +137,11 @@ still:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
button: button:
mcall 17 ; ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨ mcall 17 ; ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
dec ah
jz close
cmp ah,1 ; ª­®¯ª  á id=1("§ ªàëâì")? cmp ah,1 ; ª­®¯ª  á id=1("§ ªàëâì")?
jne noclose jne noclose
close: close:
or eax,-1 ; äã­ªæ¨ï -1: § ¢¥àè¨âì ¯à®£à ¬¬ã mcall -1 ; äã­ªæ¨ï -1: § ¢¥àè¨âì ¯à®£à ¬¬ã
mcall
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
key: key:
mcall 2 mcall 2
@ -191,44 +188,38 @@ not_fdd:
push dword PathShow_data_1 push dword PathShow_data_1
call [PathShow_prepare] call [PathShow_prepare]
call draw_window call draw_window
mov ecx,fname_buf
mov ah,2 mov ah,2
jmp noclose jmp noclose
doit: doit:
cmp [param],0 cmp [param],0
jne @f jne @f
call save_ini call save_ini
@@: @@:
cmp byte[ecx+1],'r' cmp byte[ecx+1],'r'
je @f
cmp byte[ecx+1],'R'
jne not_rd
@@:
mov edx,rdError
call print_err
cmp [param],1
je @f je @f
jmp still cmp byte[ecx+1],'R'
jne not_rd
@@: @@:
mov [param],0 mov edx,rdError
jmp no_params call print_err
jmp still
not_rd: not_rd:
cmp [hidden],0
jne @f
pusha
mov ecx,[sc.work_text]
or ecx,0xc0000088
mcall 4,<132,96>, ,label2, ,[sc.work]
popa
@@:
pop eax pop eax
mcall mcall
call check_for_error call check_for_error
cmp [param],1
je @f
jmp still jmp still
@@:
mov [param],0
jmp no_params
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
check_for_error: ;Ž¡à ¡®â稪 ®è¨¡®ª check_for_error: ;Ž¡à ¡®â稪 ®è¨¡®ª
stdcall _lstrcpy,check_dir,ok
stdcall _lstrcat,check_dir,fname_buf
mov edx,check_dir
test eax,eax test eax,eax
jz print_ok jz print_ok
cmp ebx,6 cmp ebx,6
@ -239,17 +230,18 @@ stdcall _lstrcat,check_dir,fname_buf
cmp eax, 11 cmp eax, 11
ja .unknown ja .unknown
mov edx, [errors+eax*4] mov edx, [errors+eax*4]
stdcall _lstrcpy,error_msg,error
stdcall _lstrcat,error_msg,edx stdcall _lstrcat,error_msg,edx
mov edx, error_msg mov edx, error_msg
jmp print_err jmp print_err
.unknown: .unknown:
mov edx, aUnknownError mov edx, aUnknownError
print_err: print_err:
pushad
stdcall _lstrlen,ini_path stdcall _lstrlen,ini_path
pusha
invoke ini_set_str,ini_file,apath,apath,ini_path,eax invoke ini_set_str,ini_file,apath,apath,ini_path,eax
stdcall _lstrcpy,fname_buf,ini_path popa
popad
cmp [hidden],1 cmp [hidden],1
je @f je @f
cmp [param],1 cmp [param],1
@ -258,8 +250,7 @@ print_err:
imul eax,6 imul eax,6
mov ebx,390 mov ebx,390
sub ebx,eax sub ebx,eax
sar ebx,1 shl ebx,15
shl ebx,16
add ebx,96 add ebx,96
mov ecx,[sc.work_text] mov ecx,[sc.work_text]
or ecx,0xc0880000 or ecx,0xc0880000
@ -268,64 +259,64 @@ print_err:
@@: @@:
mov dword [is_notify + 8], edx mov dword [is_notify + 8], edx
mcall 70, is_notify mcall 70, is_notify
ret mov [param],0
mov [hidden],0
stdcall _lstrcpy,fname_buf,ini_path
jmp no_params
print_ok: print_ok:
cmp [hidden],1 cmp [hidden],1
je @f je @f
cmp [param],1 cmp [param],1
je @f je @f
mov edx,ok
stdcall _lstrlen,edx stdcall _lstrlen,edx
imul eax,6 imul eax,6
mov ebx,390 mov ebx,390
sub ebx,eax sub ebx,eax
sar ebx,1 shl ebx,15
shl ebx,16
add ebx,96 add ebx,96
mov ecx,[sc.work_text] mov ecx,[sc.work_text]
or ecx,0xc0008800 or ecx,0xc0008800
mcall 4, , , , ,[sc.work] mcall 4, , , , ,[sc.work]
mcall 5,100 mcall 5,200
cmp [autoclose],1 cmp [autoclose],1
je close je close
ret ret
@@: @@:
stdcall _lstrcpy,check_dir,ok
stdcall _lstrcat,check_dir,fname_buf
mov edx,check_dir
mov dword [is_notify + 8], edx mov dword [is_notify + 8], edx
mcall 70, is_notify mcall 70, is_notify
mcall 5,100
jmp close jmp close
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
draw_PathShow: draw_PathShow:
pushad pusha
mcall 13,<15,280>,<32,16>,0xffffff mcall 13,<15,280>,<32,16>,0xffffff
push dword PathShow_data_1 push dword PathShow_data_1
call [PathShow_draw] call [PathShow_draw]
popad popa
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
save_ini: save_ini:
pushad pusha
stdcall _lstrlen,fname_buf stdcall _lstrlen,fname_buf
invoke ini_set_str,ini_file,apath,apath,fname_buf,eax invoke ini_set_str,ini_file,apath,apath,fname_buf,eax
invoke ini_set_int,ini_file,asettings,aautoclose,[autoclose] invoke ini_set_int,ini_file,asettings,aautoclose,[autoclose]
popad popa
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
check_path: check_path:
stdcall _lstrlen,check_dir stdcall _lstrlen,check_dir
mov edi,check_dir add eax,check_dir
add edi,eax
@@: @@:
mov byte [edi],0 dec eax
dec edi cmp byte [eax],'/'
cmp byte [edi],'/'
jne @b jne @b
mov byte [eax+1],0
if debug eq yes
dps 'read_folder_name: '
mov edx,check_dir
call debug_outstr
newline
end if
mcall 70,read_folder mcall 70,read_folder
ret ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@ -339,7 +330,7 @@ draw_window:
mcall 0,<200,400>,<200,130>, , ,title mcall 0,<200,400>,<200,130>, , ,title
;buttons ;buttons
mcall 8,<198,70>,<68,20>,2,[sc.work_button] mcall 8,<198,70>,<68,20>,1,[sc.work_button]
inc edx inc edx
mcall ,<125,70>, mcall ,<125,70>,
inc edx inc edx
@ -349,7 +340,7 @@ draw_window:
mov ecx,[sc.work_button_text] mov ecx,[sc.work_button_text]
or ecx,0x80000000 or ecx,0x80000000
mcall 4,<134,75>, ,save mcall 4,<134,75>, ,save
mcall ,<215,75>, ,cansel mcall ,<215,75>, ,cancel
mcall ,<315,36>, ,select mcall ,<315,36>, ,select
mov ecx,[sc.work] mov ecx,[sc.work]
@ -367,87 +358,91 @@ draw_window:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
if lang eq ru if lang eq ru
save db '‘®åà ­¨âì',0 save db '‘®åà ­¨âì',0
cansel db 'Žâ¬¥­ ',0 cancel db 'Žâ¬¥­ ',0
select db 'ˆ§¬¥­¨âì',0 select db 'ˆ§¬¥­¨âì',0
label1 db ' Ž¡à § ¡ã¤¥â á®åà ­¥­ ¢: ',0 label1 db ' Ž¡à § ¡ã¤¥â á®åà ­¥­ ¢: ',0
ok db 'RAM-¤¨áª á®åà ­¥­ ãᯥ譮 ¢ ',0 label2 db '‘®åà ­¥­¨¥ ®¡à § ...',0
error1 db '<27>¥ ®¯à¥¤¥«¥­  ¡ §  ¨/¨«¨ à §¤¥« ¦ñá⪮£® ¤¨áª ',0 ok db 'RAM-¤¨áª á®åà ­¥­ ãᯥ譮 ',0
error2 db '”ã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ­­®© ä ©«®¢®© á¨á⥬ë',0 error1 db '­¥ ®¯à¥¤¥«¥­  ¡ §  ¨/¨«¨ à §¤¥« ¦ñá⪮£® ¤¨áª ',0
error3 db '<27>¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬ ',0 error2 db 'äã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥âáï ¤«ï ¤ ­­®© ä ©«®¢®© á¨á⥬ë',0
error4 db '‘âà ­­®... Žè¨¡ª  4',0 error3 db '­¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬ ',0
error5 db '<27>¥áãé¥áâ¢ãî騩 ¯ãâì',0 error4 db 'áâà ­­®... Žè¨¡ª  4',0
error6 db '” ©« § ª®­ç¨«áï',0 error5 db '­¥áãé¥áâ¢ãî騩 ¯ãâì',0
error7 db '“ª § â¥«ì ¢­¥ ¯ ¬ï⨠¯à¨«®¦¥­¨ï',0 error6 db 'ä ©« § ª®­ç¨«áï',0
error8 db '„¨áª § ¯®«­¥­',0 error7 db '㪠§ â¥«ì ¢­¥ ¯ ¬ï⨠¯à¨«®¦¥­¨ï',0
error9 db '” ©«®¢ ï áâàãªâãà  à §àã襭 ',0 error8 db '¤¨áª § ¯®«­¥­',0
error10 db '„®áâ㯠§ ¯à¥éñ­',0 error9 db 'ä ©«®¢ ï áâàãªâãà  à §àã襭 ',0
error10 db '¤®áâ㯠§ ¯à¥éñ­',0
error11 db 'Žè¨¡ª  ãáâனá⢠',0 error11 db 'Žè¨¡ª  ãáâனá⢠',0
aUnknownError db '<27>¥¨§¢¥áâ­ ï ®è¨¡ª ',0 aUnknownError db '<27>¥¨§¢¥áâ­ ï ®è¨¡ª ',0
rdError db '<27>¥«ì§ï á®åà ­ïâì ®¡à § ¢ á ¬®£® ᥡï',0 rdError db '<27>¥«ì§ï á®åà ­ïâì ®¡à § ¢ á ¬®£® ᥡï',0
error_msg db 'Žè¨¡ª : ',0 error db 'Žè¨¡ª : ',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
else if lang eq et else if lang eq et
save db 'Salvesta',0 save db 'Salvesta',0
cansel db 'Cansel',0 cancel db 'Cancel',0
select db ' Valige',0 select db ' Valige',0
label1 db ' RAM-drive will be saved as: ',0 label1 db ' RAM-drive will be saved as: ',0
label2 db 'Saving in progress...',0
ok db 'RAM-ketas salvestatud edukalt ',0 ok db 'RAM-ketas salvestatud edukalt ',0
error1 db 'Hard disk base and/or partition not defined',0 error1 db 'hard disk base and/or partition not defined',0
error2 db 'The file system does not support this function',0 error2 db 'the file system does not support this function',0
error3 db 'Tundmatu failisüsteem',0 error3 db 'tundmatu failisüsteem',0
error4 db 'Strange... Error 4',0 error4 db 'strange... Error 4',0
error5 db 'Vigane teekond',0 error5 db 'vigane teekond',0
error6 db 'End of file',0 error6 db 'end of file',0
error7 db 'Pointer is outside of application memory',0 error7 db 'pointer is outside of application memory',0
error8 db 'Ketas täis',0 error8 db 'ketas täis',0
error9 db 'FAT tabel vigane',0 error9 db 'FAT tabel vigane',0
error10 db 'Juurdepääs keelatud',0 error10 db 'juurdepääs keelatud',0
error11 db 'Seadme viga',0 error11 db 'Seadme viga',0
aUnknownError db 'Tundmatu viga',0 aUnknownError db 'Tundmatu viga',0
rdError db "You can't save image on itself",0 rdError db "You can't save image on itself",0
error_msg db 'Viga: ',0 error db 'Viga: ',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
else if lang eq it else if lang eq it
save db ' Salva',0 save db ' Salva',0
cansel db 'Cansel',0 cancel db 'Cancel',0
select db 'Seleziona',0 select db 'Seleziona',0
label1 db ' RAM-drive will be saved as: ',0 label1 db ' RAM-drive will be saved as: ',0
label2 db 'Saving in progress...',0
ok db 'Il RAM-drivet e stato salvato ',0 ok db 'Il RAM-drivet e stato salvato ',0
error1 db 'Hard disk base and/or partition not defined',0 error1 db 'hard disk base and/or partition not defined',0
error2 db 'The file system does not support this function',0 error2 db 'the file system does not support this function',0
error3 db 'Filesystem sconosciuto',0 error3 db 'filesystem sconosciuto',0
error4 db 'Strange... Error 4',0 error4 db 'strange... Error 4',0
error5 db 'Percorso non valido',0 error5 db 'percorso non valido',0
error6 db 'End of file',0 error6 db 'end of file',0
error7 db 'Pointer is outside of application memory',0 error7 db 'pointer is outside of application memory',0
error8 db 'Disco pieno',0 error8 db 'disco pieno',0
error9 db 'Tabella FAT corrotta',0 error9 db 'tabella FAT corrotta',0
error10 db 'Accesso negato',0 error10 db 'accesso negato',0
error11 db 'Errore di device',0 error11 db 'Errore di device',0
aUnknownError db 'Errore sconosciuto',0 aUnknownError db 'Errore sconosciuto',0
rdError db "You can't save image on itself",0 rdError db "You can't save image on itself",0
error_msg db 'Errore: ',0 error db 'Errore: ',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
else else
save db ' Save',0 save db ' Save',0
cansel db 'Cansel',0 cancel db 'Cancel',0
select db ' Select',0 select db ' Select',0
label1 db ' RAM-drive will be saved as: ',0 label1 db ' RAM-drive will be saved as: ',0
ok db 'RAM-drive was saved successfully in ',0 label2 db 'Saving in progress...',0
error1 db 'Hard disk base and/or partition not defined',0 ok db 'RAM-drive was saved successfully ',0
error2 db 'The file system does not support this function',0 error1 db 'hard disk base and/or partition not defined',0
error3 db 'Unknown file system',0 error2 db 'the file system does not support this function',0
error4 db 'Strange... Error 4',0 error3 db 'unknown file system',0
error5 db 'Incorrect path',0 error4 db 'strange... Error 4',0
error6 db 'End of file',0 error5 db 'incorrect path',0
error7 db 'Pointer is outside of application memory',0 error6 db 'end of file',0
error8 db 'Disk is full',0 error7 db 'pointer is outside of application memory',0
error9 db 'File structure is destroyed',0 error8 db 'disk is full',0
error10 db 'Access denied',0 error9 db 'file structure is destroyed',0
error10 db 'access denied',0
error11 db 'Device error',0 error11 db 'Device error',0
aUnknownError db 'Unknown error',0 aUnknownError db 'Unknown error',0
rdError db "You can't save image on itself",0 rdError db "You can't save image on itself",0
error_msg db 'Error: ',0 error db 'Error: ',0
end if end if
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
errors: errors:
@ -657,6 +652,9 @@ sc system_colors
autoclose rd 1 autoclose rd 1
error_msg:
rb 1024
folder_data: folder_data:
rb 304*32+32 ; 9 Kb rb 304*32+32 ; 9 Kb
;--------------------------------------------------------------------- ;---------------------------------------------------------------------

View File

@ -43,21 +43,40 @@
; <EFBFBD>  ¢ë室¥: EAX - ¤«¨­  áâப¨ ¡¥§ ãç¥â  § ¢¥àè î饣® ; <EFBFBD>  ¢ë室¥: EAX - ¤«¨­  áâப¨ ¡¥§ ãç¥â  § ¢¥àè î饣®
; ­ã«¥¢®£® ¡ ©â  ; ­ã«¥¢®£® ¡ ©â 
;----------------------------------------------------- ;-----------------------------------------------------
proc _lstrlen lpStr:DWORD ;proc _lstrlen lpStr:DWORD
push edi ecx ; push edi ecx
;
cld ; cld
mov edi,[lpStr] ; mov edi,[lpStr]
xor ecx,ecx ; xor ecx,ecx
dec ecx ; dec ecx
xor eax,eax ; xor eax,eax
repne scasb ; repne scasb
not ecx ; not ecx
dec ecx ; dec ecx
mov eax,ecx ; mov eax,ecx
;
pop ecx edi ; pop ecx edi
ret ; ret
;endp
;-----------------------------------------------------
; ”ã­ªæ¨ï ¯®«ã祭¨ï ¤«¨­ë áâப¨
;-----------------------------------------------------
; lpStr - 㪠§ â¥«ì ­  áâபã ASCIIZ
; <EFBFBD>  ¢ë室¥: EAX - ¤«¨­  áâப¨ ¡¥§ ãç¥â  § ¢¥àè î饣®
; ­ã«¥¢®£® ¡ ©â 
;-----------------------------------------------------
proc _lstrlen lpStr:DWORD
push ebx
mov ebx,[lpStr]
xor eax,eax
@@: cmp byte[ebx+eax],0
je @f
inc eax
jmp @b
@@: pop ebx
ret
endp endp
;----------------------------------------------------- ;-----------------------------------------------------