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

View File

@ -43,21 +43,40 @@
; <EFBFBD>  ¢ë室¥: EAX - ¤«¨­  áâப¨ ¡¥§ ãç¥â  § ¢¥àè î饣®
; ­ã«¥¢®£® ¡ ©â 
;-----------------------------------------------------
proc _lstrlen lpStr:DWORD
push edi ecx
cld
mov edi,[lpStr]
xor ecx,ecx
dec ecx
xor eax,eax
repne scasb
not ecx
dec ecx
mov eax,ecx
pop ecx edi
ret
;proc _lstrlen lpStr:DWORD
; push edi ecx
;
; cld
; mov edi,[lpStr]
; xor ecx,ecx
; dec ecx
; xor eax,eax
; repne scasb
; not ecx
; dec ecx
; mov eax,ecx
;
; pop ecx edi
; 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
;-----------------------------------------------------