2007-03-26 16:18:08 +04:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2006-07-01 19:55:47 +04:00
|
|
|
|
|
2007-07-27 17:52:03 +04:00
|
|
|
|
$Revision$
|
|
|
|
|
|
|
|
|
|
|
2006-06-18 20:42:03 +04:00
|
|
|
|
uglobal
|
|
|
|
|
cd_current_pointer_of_input dd 0
|
|
|
|
|
cd_current_pointer_of_input_2 dd 0
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cd_mem_location dd 0
|
|
|
|
|
cd_counter_block dd 0
|
|
|
|
|
IDE_Channel_1 db 0
|
|
|
|
|
IDE_Channel_2 db 0
|
2006-06-18 20:42:03 +04:00
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
reserve_cd:
|
|
|
|
|
|
|
|
|
|
cli
|
|
|
|
|
cmp [cd_status],0
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je reserve_ok2
|
2006-06-18 20:42:03 +04:00
|
|
|
|
|
|
|
|
|
sti
|
|
|
|
|
call change_task
|
2006-07-05 20:54:34 +04:00
|
|
|
|
jmp reserve_cd
|
2006-06-18 20:42:03 +04:00
|
|
|
|
|
|
|
|
|
reserve_ok2:
|
|
|
|
|
|
|
|
|
|
push eax
|
2007-02-28 11:52:06 +03:00
|
|
|
|
mov eax,[CURRENT_TASK]
|
2006-06-18 20:42:03 +04:00
|
|
|
|
shl eax,5
|
2007-02-28 11:52:06 +03:00
|
|
|
|
mov eax,[eax+CURRENT_TASK+TASKDATA.pid]
|
2006-06-18 20:42:03 +04:00
|
|
|
|
mov [cd_status],eax
|
|
|
|
|
pop eax
|
|
|
|
|
sti
|
|
|
|
|
ret
|
2006-07-05 20:54:34 +04:00
|
|
|
|
|
|
|
|
|
reserve_cd_channel:
|
|
|
|
|
cmp [ChannelNumber],1
|
|
|
|
|
jne .IDE_Channel_2
|
|
|
|
|
.IDE_Channel_1:
|
|
|
|
|
cli
|
|
|
|
|
cmp [IDE_Channel_1],0
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .reserve_ok_1
|
2006-07-05 20:54:34 +04:00
|
|
|
|
sti
|
|
|
|
|
call change_task
|
|
|
|
|
jmp .IDE_Channel_1
|
|
|
|
|
.IDE_Channel_2:
|
|
|
|
|
cli
|
|
|
|
|
cmp [IDE_Channel_2],0
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .reserve_ok_2
|
2006-07-05 20:54:34 +04:00
|
|
|
|
sti
|
|
|
|
|
call change_task
|
|
|
|
|
jmp .IDE_Channel_1
|
|
|
|
|
.reserve_ok_1:
|
|
|
|
|
mov [IDE_Channel_1],1
|
|
|
|
|
ret
|
|
|
|
|
.reserve_ok_2:
|
|
|
|
|
mov [IDE_Channel_2],1
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
free_cd_channel:
|
|
|
|
|
cmp [ChannelNumber],1
|
|
|
|
|
jne .IDE_Channel_2
|
|
|
|
|
.IDE_Channel_1:
|
2007-02-28 11:52:06 +03:00
|
|
|
|
mov [IDE_Channel_1],0
|
2006-07-05 20:54:34 +04:00
|
|
|
|
ret
|
|
|
|
|
.IDE_Channel_2:
|
|
|
|
|
mov [IDE_Channel_2],0
|
|
|
|
|
ret
|
2007-02-19 17:31:28 +03:00
|
|
|
|
|
2007-02-28 11:52:06 +03:00
|
|
|
|
uglobal
|
2006-06-18 20:42:03 +04:00
|
|
|
|
cd_status dd 0
|
2007-02-19 17:31:28 +03:00
|
|
|
|
endg
|
2006-06-18 20:42:03 +04:00
|
|
|
|
|
|
|
|
|
;----------------------------------------------------------------
|
|
|
|
|
;
|
|
|
|
|
; fs_CdRead - LFN variant for reading CD disk
|
|
|
|
|
;
|
|
|
|
|
; esi points to filename /dir1/dir2/.../dirn/file,0
|
|
|
|
|
; ebx pointer to 64-bit number = first wanted byte, 0+
|
|
|
|
|
; may be ebx=0 - start from first byte
|
|
|
|
|
; ecx number of bytes to read, 0+
|
|
|
|
|
; edx mem location to return data
|
|
|
|
|
;
|
|
|
|
|
; ret ebx = bytes read or 0xffffffff file not found
|
|
|
|
|
; eax = 0 ok read or other = errormsg
|
|
|
|
|
;
|
|
|
|
|
;--------------------------------------------------------------
|
|
|
|
|
fs_CdRead:
|
|
|
|
|
push edi
|
|
|
|
|
cmp byte [esi], 0
|
|
|
|
|
jnz @f
|
|
|
|
|
.noaccess:
|
|
|
|
|
pop edi
|
|
|
|
|
.noaccess_2:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
or ebx, -1
|
2006-06-18 20:42:03 +04:00
|
|
|
|
mov eax, ERROR_ACCESS_DENIED
|
|
|
|
|
ret
|
2007-02-28 11:52:06 +03:00
|
|
|
|
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.noaccess_3:
|
|
|
|
|
pop eax edx ecx edi
|
|
|
|
|
jmp .noaccess_2
|
|
|
|
|
|
|
|
|
|
@@:
|
|
|
|
|
call cd_find_lfn
|
|
|
|
|
jnc .found
|
|
|
|
|
pop edi
|
|
|
|
|
cmp [DevErrorCode],0
|
|
|
|
|
jne .noaccess_2
|
2007-07-23 00:52:21 +04:00
|
|
|
|
or ebx, -1
|
2006-06-18 20:42:03 +04:00
|
|
|
|
mov eax, ERROR_FILE_NOT_FOUND
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.found:
|
|
|
|
|
mov edi,[cd_current_pointer_of_input]
|
2007-07-23 00:52:21 +04:00
|
|
|
|
test byte [edi+25],10b ; do not allow read directories
|
2006-06-18 20:42:03 +04:00
|
|
|
|
jnz .noaccess
|
|
|
|
|
test ebx, ebx
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jz .l1
|
2006-06-18 20:42:03 +04:00
|
|
|
|
cmp dword [ebx+4], 0
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jz @f
|
|
|
|
|
xor ebx, ebx
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.reteof:
|
|
|
|
|
mov eax, 6 ; end of file
|
|
|
|
|
pop edi
|
|
|
|
|
ret
|
|
|
|
|
@@:
|
|
|
|
|
mov ebx, [ebx]
|
|
|
|
|
.l1:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
push ecx edx
|
|
|
|
|
push 0
|
|
|
|
|
mov eax, [edi+10] ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
sub eax, ebx
|
|
|
|
|
jb .eof
|
|
|
|
|
cmp eax, ecx
|
|
|
|
|
jae @f
|
|
|
|
|
mov ecx, eax
|
|
|
|
|
mov byte [esp], 6
|
2006-06-18 20:42:03 +04:00
|
|
|
|
@@:
|
|
|
|
|
mov eax,[edi+2]
|
|
|
|
|
mov [CDSectorAddress],eax
|
|
|
|
|
; now eax=cluster, ebx=position, ecx=count, edx=buffer for data
|
|
|
|
|
.new_sector:
|
|
|
|
|
test ecx, ecx
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jz .done
|
2006-06-18 20:42:03 +04:00
|
|
|
|
sub ebx, 2048
|
2006-09-19 17:16:31 +04:00
|
|
|
|
jae .next
|
2006-06-18 20:42:03 +04:00
|
|
|
|
add ebx, 2048
|
|
|
|
|
jnz .incomplete_sector
|
|
|
|
|
cmp ecx, 2048
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jb .incomplete_sector
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; we may read and memmove complete sector
|
|
|
|
|
mov [CDDataBuf_pointer],edx
|
2007-07-23 00:52:21 +04:00
|
|
|
|
call ReadCDWRetr ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2006-06-18 20:42:03 +04:00
|
|
|
|
cmp [DevErrorCode],0
|
|
|
|
|
jne .noaccess_3
|
|
|
|
|
add edx, 2048
|
|
|
|
|
sub ecx, 2048
|
2006-09-19 17:16:31 +04:00
|
|
|
|
.next:
|
|
|
|
|
inc dword [CDSectorAddress]
|
2006-06-18 20:42:03 +04:00
|
|
|
|
jmp .new_sector
|
|
|
|
|
.incomplete_sector:
|
|
|
|
|
; we must read and memmove incomplete sector
|
|
|
|
|
mov [CDDataBuf_pointer],CDDataBuf
|
2007-07-23 00:52:21 +04:00
|
|
|
|
call ReadCDWRetr ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2006-06-18 20:42:03 +04:00
|
|
|
|
cmp [DevErrorCode],0
|
2007-02-28 11:52:06 +03:00
|
|
|
|
jne .noaccess_3
|
2006-06-18 20:42:03 +04:00
|
|
|
|
push ecx
|
|
|
|
|
add ecx, ebx
|
|
|
|
|
cmp ecx, 2048
|
|
|
|
|
jbe @f
|
|
|
|
|
mov ecx, 2048
|
|
|
|
|
@@:
|
|
|
|
|
sub ecx, ebx
|
|
|
|
|
push edi esi ecx
|
|
|
|
|
mov edi,edx
|
2007-07-23 00:52:21 +04:00
|
|
|
|
lea esi, [CDDataBuf + ebx]
|
2006-06-18 20:42:03 +04:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
pop ecx esi edi
|
|
|
|
|
add edx, ecx
|
|
|
|
|
sub [esp], ecx
|
|
|
|
|
pop ecx
|
|
|
|
|
xor ebx, ebx
|
2006-09-19 17:16:31 +04:00
|
|
|
|
jmp .next
|
2007-02-28 11:52:06 +03:00
|
|
|
|
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.done:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov ebx, edx
|
|
|
|
|
pop eax edx ecx edi
|
|
|
|
|
sub ebx, edx
|
|
|
|
|
ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.eof:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov ebx, edx
|
|
|
|
|
pop eax edx ecx
|
|
|
|
|
sub ebx, edx
|
|
|
|
|
jmp .reteof
|
2006-06-18 20:42:03 +04:00
|
|
|
|
|
|
|
|
|
;----------------------------------------------------------------
|
|
|
|
|
;
|
|
|
|
|
; fs_CdReadFolder - LFN variant for reading CD disk folder
|
|
|
|
|
;
|
|
|
|
|
; esi points to filename /dir1/dir2/.../dirn/file,0
|
|
|
|
|
; ebx pointer to structure 32-bit number = first wanted block, 0+
|
|
|
|
|
; & flags (bitfields)
|
|
|
|
|
; flags: bit 0: 0=ANSI names, 1=UNICODE names
|
|
|
|
|
; ecx number of blocks to read, 0+
|
|
|
|
|
; edx mem location to return data
|
|
|
|
|
;
|
|
|
|
|
; ret ebx = blocks read or 0xffffffff folder not found
|
|
|
|
|
; eax = 0 ok read or other = errormsg
|
|
|
|
|
;
|
|
|
|
|
;--------------------------------------------------------------
|
|
|
|
|
fs_CdReadFolder:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
push edi
|
|
|
|
|
call cd_find_lfn
|
|
|
|
|
jnc .found
|
|
|
|
|
pop edi
|
|
|
|
|
cmp [DevErrorCode], 0
|
|
|
|
|
jne .noaccess_1
|
|
|
|
|
or ebx, -1
|
|
|
|
|
mov eax, ERROR_FILE_NOT_FOUND
|
|
|
|
|
ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.found:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov edi, [cd_current_pointer_of_input]
|
|
|
|
|
test byte [edi+25], 10b ; do not allow read directories
|
|
|
|
|
jnz .found_dir
|
|
|
|
|
pop edi
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.noaccess_1:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
or ebx, -1
|
|
|
|
|
mov eax, ERROR_ACCESS_DENIED
|
|
|
|
|
ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.found_dir:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov eax, [edi+2] ; eax=cluster
|
|
|
|
|
mov [CDSectorAddress], eax
|
|
|
|
|
mov eax, [edi+10] ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.doit:
|
|
|
|
|
; init header
|
2007-07-23 00:52:21 +04:00
|
|
|
|
push eax ecx
|
|
|
|
|
mov edi, edx
|
|
|
|
|
mov ecx, 32/4
|
|
|
|
|
xor eax, eax
|
|
|
|
|
rep stosd
|
|
|
|
|
pop ecx eax
|
|
|
|
|
mov byte [edx], 1 ; version
|
|
|
|
|
mov [cd_mem_location], edx
|
|
|
|
|
add [cd_mem_location], 32
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
;.mainloop:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov [cd_counter_block], dword 0
|
|
|
|
|
dec dword [CDSectorAddress]
|
|
|
|
|
push ecx
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.read_to_buffer:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
inc dword [CDSectorAddress]
|
|
|
|
|
mov [CDDataBuf_pointer], CDDataBuf
|
|
|
|
|
call ReadCDWRetr ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cmp [DevErrorCode], 0
|
|
|
|
|
jne .noaccess_1
|
|
|
|
|
call .get_names_from_buffer
|
|
|
|
|
sub eax,2048
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
2007-07-23 00:52:21 +04:00
|
|
|
|
ja .read_to_buffer
|
|
|
|
|
mov edi, [cd_counter_block]
|
|
|
|
|
mov [edx+8], edi
|
|
|
|
|
mov edi, [ebx]
|
|
|
|
|
sub [edx+4], edi
|
|
|
|
|
xor eax, eax
|
|
|
|
|
dec ecx
|
|
|
|
|
js @f
|
|
|
|
|
mov al, ERROR_END_OF_FILE
|
2007-02-19 17:31:28 +03:00
|
|
|
|
@@:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
pop ecx edi
|
|
|
|
|
mov ebx, [edx+4]
|
|
|
|
|
ret
|
2007-02-19 17:31:28 +03:00
|
|
|
|
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.get_names_from_buffer:
|
|
|
|
|
mov [cd_current_pointer_of_input_2],CDDataBuf
|
|
|
|
|
push eax esi edi edx
|
|
|
|
|
.get_names_from_buffer_1:
|
|
|
|
|
call cd_get_name
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jc .end_buffer
|
2006-06-18 20:42:03 +04:00
|
|
|
|
inc dword [cd_counter_block]
|
|
|
|
|
mov eax,[cd_counter_block]
|
|
|
|
|
cmp [ebx],eax
|
|
|
|
|
jae .get_names_from_buffer_1
|
|
|
|
|
test ecx, ecx
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jz .get_names_from_buffer_1
|
2006-06-18 20:42:03 +04:00
|
|
|
|
mov edi,[cd_counter_block]
|
2007-02-28 11:52:06 +03:00
|
|
|
|
mov [edx+4],edi
|
2006-06-18 20:42:03 +04:00
|
|
|
|
dec ecx
|
|
|
|
|
mov esi,ebp
|
|
|
|
|
mov edi,[cd_mem_location]
|
|
|
|
|
add edi,40
|
|
|
|
|
test dword [ebx+4], 1 ; 0=ANSI, 1=UNICODE
|
|
|
|
|
jnz .unicode
|
|
|
|
|
; jmp .unicode
|
|
|
|
|
.ansi:
|
|
|
|
|
cmp [cd_counter_block],2
|
|
|
|
|
jbe .ansi_parent_directory
|
|
|
|
|
cld
|
|
|
|
|
lodsw
|
|
|
|
|
xchg ah,al
|
|
|
|
|
call uni2ansi_char
|
|
|
|
|
cld
|
|
|
|
|
stosb
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2006-07-06 12:42:10 +04:00
|
|
|
|
mov ax,[esi]
|
|
|
|
|
cmp ax,word 3B00h ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ';'
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .cd_get_parameters_of_file_1
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
movzx eax,byte [ebp-33]
|
|
|
|
|
add eax,ebp
|
|
|
|
|
sub eax,34
|
|
|
|
|
cmp esi,eax
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .cd_get_parameters_of_file_1
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
movzx eax,byte [ebp-1]
|
|
|
|
|
add eax,ebp
|
|
|
|
|
cmp esi,eax
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jb .ansi
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.cd_get_parameters_of_file_1:
|
|
|
|
|
mov [edi],byte 0
|
2006-06-25 23:28:15 +04:00
|
|
|
|
call cd_get_parameters_of_file
|
2006-06-18 20:42:03 +04:00
|
|
|
|
add [cd_mem_location],304
|
|
|
|
|
jmp .get_names_from_buffer_1
|
|
|
|
|
|
|
|
|
|
.ansi_parent_directory:
|
|
|
|
|
cmp [cd_counter_block],2
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je @f
|
2006-06-18 20:42:03 +04:00
|
|
|
|
mov [edi],byte '.'
|
|
|
|
|
inc edi
|
|
|
|
|
jmp .cd_get_parameters_of_file_1
|
|
|
|
|
@@:
|
|
|
|
|
mov [edi],word '..'
|
|
|
|
|
add edi,2
|
|
|
|
|
jmp .cd_get_parameters_of_file_1
|
|
|
|
|
|
|
|
|
|
.unicode:
|
|
|
|
|
cmp [cd_counter_block],2
|
|
|
|
|
jbe .unicode_parent_directory
|
|
|
|
|
cld
|
|
|
|
|
movsw
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov ax,[esi]
|
|
|
|
|
cmp ax,word 3B00h ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ';'
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .cd_get_parameters_of_file_2
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
movzx eax,byte [ebp-33]
|
|
|
|
|
add eax,ebp
|
|
|
|
|
sub eax,34
|
|
|
|
|
cmp esi,eax
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .cd_get_parameters_of_file_2
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
movzx eax,byte [ebp-1]
|
|
|
|
|
add eax,ebp
|
|
|
|
|
cmp esi,eax
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jb .unicode
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.cd_get_parameters_of_file_2:
|
|
|
|
|
mov [edi],word 0
|
2006-06-25 23:28:15 +04:00
|
|
|
|
call cd_get_parameters_of_file
|
2006-06-18 20:42:03 +04:00
|
|
|
|
add [cd_mem_location],560
|
|
|
|
|
jmp .get_names_from_buffer_1
|
|
|
|
|
|
|
|
|
|
.unicode_parent_directory:
|
|
|
|
|
cmp [cd_counter_block],2
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je @f
|
2006-06-18 20:42:03 +04:00
|
|
|
|
mov [edi],word 2E00h ; '.'
|
|
|
|
|
add edi,2
|
|
|
|
|
jmp .cd_get_parameters_of_file_2
|
|
|
|
|
@@:
|
|
|
|
|
mov [edi],dword 2E002E00h ; '..'
|
|
|
|
|
add edi,4
|
|
|
|
|
jmp .cd_get_parameters_of_file_2
|
|
|
|
|
|
2006-06-25 23:28:15 +04:00
|
|
|
|
.end_buffer:
|
|
|
|
|
pop edx edi esi eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
cd_get_parameters_of_file:
|
2006-06-18 20:42:03 +04:00
|
|
|
|
mov edi,[cd_mem_location]
|
2006-06-25 23:28:15 +04:00
|
|
|
|
cd_get_parameters_of_file_1:
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
xor eax,eax
|
2007-06-07 17:34:43 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
inc eax
|
2006-06-18 20:42:03 +04:00
|
|
|
|
shl eax,1
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
|
|
|
|
test [ebp-8],byte 2
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jz .file
|
2007-06-07 17:34:43 +04:00
|
|
|
|
inc eax
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.file:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD> FAT, <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
shl eax,3
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>? (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
|
|
|
|
test [ebp-8],byte 1
|
2007-07-23 00:52:21 +04:00
|
|
|
|
jz .hidden
|
2007-06-07 17:34:43 +04:00
|
|
|
|
inc eax
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.hidden:
|
|
|
|
|
shl eax,1
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> CD
|
2007-06-07 17:34:43 +04:00
|
|
|
|
inc eax
|
2006-06-18 20:42:03 +04:00
|
|
|
|
mov [edi],eax
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
movzx eax,byte [ebp-12]
|
|
|
|
|
shl eax,8
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov al,[ebp-11]
|
|
|
|
|
shl eax,8
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov al,[ebp-10]
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov [edi+8],eax
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov [edi+16],eax
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov [edi+24],eax
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
movzx eax,byte [ebp-15]
|
|
|
|
|
add eax,1900
|
|
|
|
|
shl eax,8
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov al,[ebp-14]
|
|
|
|
|
shl eax,8
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov al,[ebp-13]
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov [edi+12],eax
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov [edi+20],eax
|
|
|
|
|
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov [edi+28],eax
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
xor eax,eax
|
|
|
|
|
test dword [ebx+4], 1 ; 0=ANSI, 1=UNICODE
|
|
|
|
|
jnz .unicode_1
|
|
|
|
|
mov [edi+4],eax
|
|
|
|
|
jmp @f
|
|
|
|
|
.unicode_1:
|
|
|
|
|
inc eax
|
|
|
|
|
mov [edi+4],eax
|
|
|
|
|
@@:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
xor eax,eax
|
|
|
|
|
mov [edi+32+4],eax
|
|
|
|
|
mov eax,[ebp-23]
|
|
|
|
|
mov [edi+32],eax
|
|
|
|
|
ret
|
|
|
|
|
|
2006-06-25 23:28:15 +04:00
|
|
|
|
;----------------------------------------------------------------
|
|
|
|
|
;
|
|
|
|
|
; fs_CdGetFileInfo - LFN variant for CD
|
|
|
|
|
; get file/directory attributes structure
|
2007-02-28 11:52:06 +03:00
|
|
|
|
;
|
2006-06-25 23:28:15 +04:00
|
|
|
|
;----------------------------------------------------------------
|
|
|
|
|
fs_CdGetFileInfo:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cmp byte [esi], 0
|
|
|
|
|
jnz @f
|
|
|
|
|
mov eax, 2
|
|
|
|
|
ret
|
2006-06-25 23:28:15 +04:00
|
|
|
|
@@:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
push edi
|
|
|
|
|
call cd_find_lfn
|
|
|
|
|
pushfd
|
|
|
|
|
cmp [DevErrorCode], 0
|
|
|
|
|
jz @f
|
|
|
|
|
popfd
|
|
|
|
|
pop edi
|
|
|
|
|
mov eax, 11
|
|
|
|
|
ret
|
2006-06-25 23:28:15 +04:00
|
|
|
|
@@:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
popfd
|
|
|
|
|
jnc @f
|
|
|
|
|
pop edi
|
|
|
|
|
mov eax, ERROR_FILE_NOT_FOUND
|
|
|
|
|
ret
|
2006-06-25 23:28:15 +04:00
|
|
|
|
@@:
|
|
|
|
|
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov edi, edx
|
|
|
|
|
push ebp
|
|
|
|
|
mov ebp, [cd_current_pointer_of_input]
|
|
|
|
|
add ebp, 33
|
|
|
|
|
call cd_get_parameters_of_file_1
|
|
|
|
|
pop ebp
|
|
|
|
|
and dword [edi+4], 0
|
|
|
|
|
pop edi
|
|
|
|
|
xor eax, eax
|
|
|
|
|
ret
|
2006-06-25 23:28:15 +04:00
|
|
|
|
|
2007-09-17 00:06:19 +04:00
|
|
|
|
;----------------------------------------------------------------
|
2006-06-18 20:42:03 +04:00
|
|
|
|
cd_find_lfn:
|
2008-02-26 02:34:27 +03:00
|
|
|
|
mov [cd_appl_data],0
|
2007-05-24 15:27:05 +04:00
|
|
|
|
; in: esi+ebp -> name
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; out: CF=1 - file not found
|
2008-02-26 02:34:27 +03:00
|
|
|
|
; else CF=0 and [cd_current_pointer_of_input] direntry
|
2007-07-23 00:52:21 +04:00
|
|
|
|
push eax esi
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; 16 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2008-02-26 02:34:27 +03:00
|
|
|
|
|
|
|
|
|
call WaitUnitReady
|
|
|
|
|
cmp [DevErrorCode],0
|
|
|
|
|
jne .access_denied
|
|
|
|
|
|
|
|
|
|
call prevent_medium_removal
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov [CDSectorAddress],dword 16
|
|
|
|
|
call ReadCDWRetr ;_1
|
|
|
|
|
cmp [DevErrorCode],0
|
|
|
|
|
jne .access_denied
|
|
|
|
|
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
call WaitUnitReady
|
|
|
|
|
cmp [DevErrorCode],0
|
|
|
|
|
jne .access_denied
|
|
|
|
|
call Read_TOC
|
|
|
|
|
mov ah,[CDDataBuf+4+4]
|
|
|
|
|
mov al,[CDDataBuf+4+5]
|
|
|
|
|
shl eax,16
|
|
|
|
|
mov ah,[CDDataBuf+4+6]
|
|
|
|
|
mov al,[CDDataBuf+4+7]
|
|
|
|
|
add eax,15
|
|
|
|
|
mov [CDSectorAddress],eax
|
|
|
|
|
; mov [CDSectorAddress],dword 15
|
|
|
|
|
mov [CDDataBuf_pointer],CDDataBuf
|
|
|
|
|
|
2007-07-23 00:52:21 +04:00
|
|
|
|
.start:
|
|
|
|
|
inc dword [CDSectorAddress]
|
2008-02-26 02:34:27 +03:00
|
|
|
|
call ReadCDWRetr ;_1
|
|
|
|
|
cmp [DevErrorCode],0
|
|
|
|
|
jne .access_denied
|
|
|
|
|
|
|
|
|
|
.start_check:
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cmp [CDDataBuf+1],dword 'CD00'
|
|
|
|
|
jne .access_denied
|
|
|
|
|
cmp [CDDataBuf+5],byte '1'
|
|
|
|
|
jne .access_denied
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cmp [CDDataBuf],byte 0xff
|
|
|
|
|
je .access_denied
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cmp [CDDataBuf],byte 0x2
|
|
|
|
|
jne .start
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cmp [CDDataBuf+6],byte 0x1
|
|
|
|
|
jne .start
|
2008-02-26 02:34:27 +03:00
|
|
|
|
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> root <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov eax,[CDDataBuf+0x9c+2] ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> root <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov [CDSectorAddress],eax
|
|
|
|
|
mov eax,[CDDataBuf+0x9c+10] ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> root <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cmp byte [esi], 0
|
|
|
|
|
jnz @f
|
|
|
|
|
mov [cd_current_pointer_of_input],CDDataBuf+0x9c
|
|
|
|
|
jmp .done
|
2006-06-18 20:42:03 +04:00
|
|
|
|
@@:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
.mainloop:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
dec dword [CDSectorAddress]
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.read_to_buffer:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
inc dword [CDSectorAddress]
|
|
|
|
|
mov [CDDataBuf_pointer],CDDataBuf
|
|
|
|
|
call ReadCDWRetr ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cmp [DevErrorCode],0
|
|
|
|
|
jne .access_denied
|
|
|
|
|
push ebp
|
|
|
|
|
call cd_find_name_in_buffer
|
|
|
|
|
pop ebp
|
|
|
|
|
jnc .found
|
|
|
|
|
sub eax,2048
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cmp eax,0
|
|
|
|
|
ja .read_to_buffer
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
.access_denied:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
pop esi eax
|
|
|
|
|
mov [cd_appl_data],1
|
|
|
|
|
stc
|
|
|
|
|
ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
.found:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cmp byte [esi-1], 0
|
|
|
|
|
jz .done
|
2007-05-24 15:27:05 +04:00
|
|
|
|
.nested:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov eax,[cd_current_pointer_of_input]
|
|
|
|
|
push dword [eax+2]
|
|
|
|
|
pop dword [CDSectorAddress] ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov eax,[eax+2+8] ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
jmp .mainloop
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
.done:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
test ebp, ebp
|
|
|
|
|
jz @f
|
|
|
|
|
mov esi, ebp
|
|
|
|
|
xor ebp, ebp
|
|
|
|
|
jmp .nested
|
2007-05-24 15:27:05 +04:00
|
|
|
|
@@:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
pop esi eax
|
|
|
|
|
mov [cd_appl_data],1
|
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-02-28 11:52:06 +03:00
|
|
|
|
|
2006-06-18 20:42:03 +04:00
|
|
|
|
cd_find_name_in_buffer:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov [cd_current_pointer_of_input_2],CDDataBuf
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.start:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
call cd_get_name
|
|
|
|
|
jc .not_found
|
|
|
|
|
call cd_compare_name
|
|
|
|
|
jc .start
|
2007-02-28 11:52:06 +03:00
|
|
|
|
.found:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
clc
|
|
|
|
|
ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.not_found:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
stc
|
|
|
|
|
ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
|
|
|
|
|
cd_get_name:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
push eax
|
|
|
|
|
mov ebp,[cd_current_pointer_of_input_2]
|
|
|
|
|
mov [cd_current_pointer_of_input],ebp
|
|
|
|
|
mov eax,[ebp]
|
|
|
|
|
cmp eax,0 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
|
|
|
|
je .next_sector
|
|
|
|
|
cmp ebp,CDDataBuf+2048 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
|
|
|
|
jae .next_sector
|
|
|
|
|
movzx eax, byte [ebp]
|
|
|
|
|
add [cd_current_pointer_of_input_2],eax ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
add ebp,33 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
pop eax
|
|
|
|
|
clc
|
|
|
|
|
ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.next_sector:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
pop eax
|
|
|
|
|
stc
|
|
|
|
|
ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
|
|
|
|
|
cd_compare_name:
|
|
|
|
|
; compares ASCIIZ-names, case-insensitive (cp866 encoding)
|
|
|
|
|
; in: esi->name, ebp->name
|
|
|
|
|
; out: if names match: ZF=1 and esi->next component of name
|
|
|
|
|
; else: ZF=0, esi is not changed
|
|
|
|
|
; destroys eax
|
2007-02-28 11:52:06 +03:00
|
|
|
|
push esi eax edi
|
2006-06-18 20:42:03 +04:00
|
|
|
|
mov edi,ebp
|
|
|
|
|
.loop:
|
|
|
|
|
cld
|
|
|
|
|
lodsb
|
2007-06-07 17:34:43 +04:00
|
|
|
|
push eax
|
2006-07-14 01:28:14 +04:00
|
|
|
|
call char_todown
|
2006-06-18 20:42:03 +04:00
|
|
|
|
call ansi2uni_char
|
|
|
|
|
xchg ah,al
|
|
|
|
|
scasw
|
2007-06-07 17:34:43 +04:00
|
|
|
|
pop eax
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .coincides
|
2006-07-14 01:28:14 +04:00
|
|
|
|
call char_toupper
|
2006-06-18 20:42:03 +04:00
|
|
|
|
call ansi2uni_char
|
|
|
|
|
xchg ah,al
|
|
|
|
|
sub edi,2
|
|
|
|
|
scasw
|
|
|
|
|
jne .name_not_coincide
|
|
|
|
|
.coincides:
|
|
|
|
|
cmp [esi],byte '/' ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .done
|
|
|
|
|
cmp [esi],byte 0 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
je .done
|
2006-06-18 20:42:03 +04:00
|
|
|
|
jmp .loop
|
|
|
|
|
.name_not_coincide:
|
|
|
|
|
pop edi eax esi
|
|
|
|
|
stc
|
|
|
|
|
ret
|
|
|
|
|
.done:
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cmp [edi],word 3B00h ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ';'
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .done_1
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
movzx eax,byte [ebp-33]
|
|
|
|
|
add eax,ebp
|
|
|
|
|
sub eax,34
|
|
|
|
|
cmp edi,eax
|
2007-07-23 00:52:21 +04:00
|
|
|
|
je .done_1
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
movzx eax,byte [ebp-1]
|
|
|
|
|
add eax,ebp
|
|
|
|
|
cmp edi,eax
|
|
|
|
|
jne .name_not_coincide
|
|
|
|
|
.done_1:
|
|
|
|
|
pop edi eax
|
|
|
|
|
add esp,4
|
|
|
|
|
inc esi
|
|
|
|
|
clc
|
|
|
|
|
ret
|
2007-02-28 11:52:06 +03:00
|
|
|
|
|
2006-06-18 20:42:03 +04:00
|
|
|
|
char_todown:
|
|
|
|
|
; convert character to uppercase, using cp866 encoding
|
|
|
|
|
; in: al=symbol
|
|
|
|
|
; out: al=converted symbol
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cmp al, 'A'
|
|
|
|
|
jb .ret
|
|
|
|
|
cmp al, 'Z'
|
|
|
|
|
jbe .az
|
|
|
|
|
cmp al, '<27>'
|
|
|
|
|
jb .ret
|
|
|
|
|
cmp al, '<27>'
|
|
|
|
|
jb .rus1
|
|
|
|
|
cmp al, '<27>'
|
|
|
|
|
ja .ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
; 0x90-0x9F -> 0xE0-0xEF
|
2007-07-23 00:52:21 +04:00
|
|
|
|
add al, '<27>'-'<27>'
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.ret:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
ret
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.rus1:
|
|
|
|
|
; 0x80-0x8F -> 0xA0-0xAF
|
|
|
|
|
.az:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
add al, 0x20
|
|
|
|
|
ret
|
2007-02-28 11:52:06 +03:00
|
|
|
|
|
2006-06-18 20:42:03 +04:00
|
|
|
|
uni2ansi_char:
|
|
|
|
|
; convert UNICODE character in al to ANSI character in ax, using cp866 encoding
|
|
|
|
|
; in: ax=UNICODE character
|
|
|
|
|
; out: al=converted ANSI character
|
2007-07-23 00:52:21 +04:00
|
|
|
|
cmp ax, 0x80
|
|
|
|
|
jb .ascii
|
|
|
|
|
cmp ax, 0x401
|
|
|
|
|
jz .yo1
|
|
|
|
|
cmp ax, 0x451
|
|
|
|
|
jz .yo2
|
|
|
|
|
cmp ax, 0x410
|
|
|
|
|
jb .unk
|
|
|
|
|
cmp ax, 0x440
|
|
|
|
|
jb .rus1
|
|
|
|
|
cmp ax, 0x450
|
|
|
|
|
jb .rus2
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.unk:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov al, '_'
|
|
|
|
|
jmp .doit
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.yo1:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov al, '<27>'
|
|
|
|
|
jmp .doit
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.yo2:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
mov al, '<27>'
|
|
|
|
|
jmp .doit
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.rus1:
|
|
|
|
|
; 0x410-0x43F -> 0x80-0xAF
|
2007-07-23 00:52:21 +04:00
|
|
|
|
add al, 0x70
|
|
|
|
|
jmp .doit
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.rus2:
|
|
|
|
|
; 0x440-0x44F -> 0xE0-0xEF
|
2007-07-23 00:52:21 +04:00
|
|
|
|
add al, 0xA0
|
2006-06-18 20:42:03 +04:00
|
|
|
|
.ascii:
|
|
|
|
|
.doit:
|
2007-07-23 00:52:21 +04:00
|
|
|
|
ret
|