fixed sysfn 30 broken in rev. 1304

git-svn-id: svn://kolibrios.org@1305 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2009-12-02 22:55:22 +00:00
parent ad63ea7013
commit dceaa5fee0

View File

@ -971,9 +971,9 @@ sys_current_directory:
; mov esi, [esi+APPDATA.cur_dir] ; mov esi, [esi+APPDATA.cur_dir]
; mov edx, esi ; mov edx, esi
;get lenght string of appdata.cur_dir ;get length string of appdata.cur_dir
; mov eax, [current_slot] mov eax, [current_slot]
; mov edi, [eax+APPDATA.cur_dir] mov edi, [eax+APPDATA.cur_dir]
dec ebx dec ebx
jz .set jz .set
@ -984,9 +984,6 @@ sys_current_directory:
; sysfunction 30.2: [for app] eax=30,ebx=2,ecx->buffer,edx=len ; sysfunction 30.2: [for app] eax=30,ebx=2,ecx->buffer,edx=len
; for our code: ebx->buffer,ecx=len ; for our code: ebx->buffer,ecx=len
max_cur_dir equ 0x1000 max_cur_dir equ 0x1000
;get lenght string of appdata.cur_dir
mov eax, [current_slot]
mov edi, [eax+APPDATA.cur_dir]
mov ebx,edi mov ebx,edi
@ -997,25 +994,27 @@ max_cur_dir equ 0x1000
mov ecx,max_cur_dir mov ecx,max_cur_dir
repne scasb ;find zerro at and string repne scasb ;find zerro at and string
jcxz .error ;ecx=0 and destination buffer is too small. jnz .error ; no zero in cur_dir: internal error, should not happen
sub edi,ebx ;lenght for copy sub edi,ebx ;lenght for copy
inc edi inc edi
mov [esp+32+8],edi ;return in eax mov [esp+32+8],edi ;return in eax
cmp edx,edi ;edi must have more than 2 (for / and 0x0) cmp edx, edi
;sourse string jbe @f
mov edx, edi
@@:
;source string
pop esi pop esi
;destination string ;destination string
pop edi pop edi
jb .ret cmp edx, 1
jbe .ret
mov al,'/' ;start string with '/' mov al,'/' ;start string with '/'
stosb stosb
mov ecx,edx mov ecx,edx
rep movsb ;copy string rep movsb ;copy string
xor eax,eax
mov byte [edi],al ;set zerro
.ret: ret .ret: ret
.error: add esp,8 .error: add esp,8