ext2. fix bug in hdReadFolder cycle

git-svn-id: svn://kolibrios.org@1398 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbanoff 2010-02-08 20:43:55 +00:00
parent 0aa07aa06e
commit 778b83a98b

View File

@ -424,15 +424,36 @@ ext2_HdReadFolder:
cmp [eax + EXT2_DIR_STRUC.inode], 0 ; if (inode = 0) => not used cmp [eax + EXT2_DIR_STRUC.inode], 0 ; if (inode = 0) => not used
jz @F jz @F
inc [EXT2_files_in_folder] inc [EXT2_files_in_folder]
dec ecx
@@: @@:
movzx ebx, [eax+EXT2_DIR_STRUC.rec_len] movzx ebx, [eax+EXT2_DIR_STRUC.rec_len]
add eax, ebx ; к следующей записи add eax, ebx ; к следующей записи
cmp eax, [EXT2_end_block] ; проверяем "конец" cmp eax, [EXT2_end_block] ; проверяем "конец"
jae .end_block_find_wanted jb .find_wanted_start
loop .find_wanted_cycle
.find_wanted_end:
.end_block_find_wanted: ;вылетили из цикла find_wanted
mov ebx, [ext2_data.count_block_in_block]
sub [EXT2_counter_blocks], ebx
jz .end_dir
;получаем новый блок
inc esi
push ecx
mov ecx, esi
call ext2_get_inode_block
mov eax, ecx
mov ebx, [ext2_data.ext2_save_block]
call ext2_get_block
pop ecx
dec ecx
mov eax, ebx
add ebx, [ext2_data.block_size]
mov [EXT2_end_block], ebx
jmp .find_wanted_start
.find_wanted_end:
mov ecx, edi mov ecx, edi
.wanted_start: ; ищем first_wanted+count .wanted_start: ; ищем first_wanted+count
jecxz .find_wanted_cycle ; ecx=0 => огромный цикл до конца папки jecxz .find_wanted_cycle ; ecx=0 => огромный цикл до конца папки
cmp [eax + EXT2_DIR_STRUC.inode], 0 ; if (inode = 0) => not used cmp [eax + EXT2_DIR_STRUC.inode], 0 ; if (inode = 0) => not used
@ -470,7 +491,6 @@ ext2_HdReadFolder:
lea edi, [edx + 40] lea edi, [edx + 40]
lea esi, [eax + EXT2_DIR_STRUC.name] lea esi, [eax + EXT2_DIR_STRUC.name]
call utf8toansi_str call utf8toansi_str
;rep movsb
pop esi ecx eax pop esi ecx eax
and byte [edi], 0 and byte [edi], 0
@ -502,25 +522,9 @@ ext2_HdReadFolder:
mov [EXT2_end_block], ebx mov [EXT2_end_block], ebx
jmp .wanted_start jmp .wanted_start
.end_block_find_wanted: ;вылетили из цикла find_wanted .wanted_end:
mov ebx, [ext2_data.count_block_in_block]
sub [EXT2_counter_blocks], ebx
jz .end_dir
;получаем новый блок
inc esi
push ecx
mov ecx, esi
call ext2_get_inode_block
mov eax, ecx
mov ebx, [ext2_data.ext2_save_block]
call ext2_get_block
pop ecx
dec ecx dec ecx
mov eax, ebx jmp .find_wanted_cycle
add ebx, [ext2_data.block_size]
mov [EXT2_end_block], ebx
jmp .find_wanted_start
.end_dir: .end_dir:
pop edx pop edx