forked from KolibriOS/kolibrios
preparation
git-svn-id: svn://kolibrios.org@6792 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
94e30f2af4
commit
f9f1eb0d75
@ -899,7 +899,7 @@ coff_get_align:
|
||||
ret
|
||||
|
||||
align 4
|
||||
proc load_library stdcall, file_name:dword
|
||||
proc load_library stdcall, file_name:dword, encoding:dword
|
||||
locals
|
||||
fullname dd ?
|
||||
fileinfo rb 40
|
||||
@ -910,8 +910,12 @@ proc load_library stdcall, file_name:dword
|
||||
; resolve file name
|
||||
stdcall kernel_alloc, maxPathLength
|
||||
mov [fullname], eax
|
||||
mov ebx, [file_name]
|
||||
stdcall get_full_file_name, eax, maxPathLength
|
||||
mov edi, eax
|
||||
mov esi, [file_name]
|
||||
mov eax, [encoding]
|
||||
push ebp
|
||||
call getFullPath
|
||||
pop ebp
|
||||
test eax, eax
|
||||
jz .fail
|
||||
; scan for required DLL in list of already loaded for this process,
|
||||
|
@ -1101,13 +1101,11 @@ align 4
|
||||
f68:
|
||||
cmp ebx, 4
|
||||
jbe sys_sheduler
|
||||
|
||||
cmp ebx, 11
|
||||
jb undefined_syscall
|
||||
|
||||
cmp ebx, 27
|
||||
ja undefined_syscall
|
||||
|
||||
xor eax, eax
|
||||
jmp dword [f68call+ebx*4-11*4]
|
||||
.11:
|
||||
call init_heap
|
||||
@ -1143,7 +1141,7 @@ f68:
|
||||
.19:
|
||||
cmp ecx, OS_BASE
|
||||
jae .fail
|
||||
stdcall load_library, ecx
|
||||
stdcall load_library, ecx, eax
|
||||
mov [esp+SYSCALL_STACK._eax], eax
|
||||
ret
|
||||
.20:
|
||||
@ -1155,26 +1153,21 @@ f68:
|
||||
.21:
|
||||
cmp ecx, OS_BASE
|
||||
jae .fail
|
||||
|
||||
cmp edx, OS_BASE
|
||||
jae .fail
|
||||
|
||||
stdcall load_pe_driver, ecx, edx
|
||||
mov [esp+SYSCALL_STACK._eax], eax
|
||||
ret
|
||||
.22:
|
||||
cmp ecx, OS_BASE
|
||||
jae .fail
|
||||
|
||||
stdcall shmem_open, ecx, edx, esi
|
||||
mov [esp+SYSCALL_STACK._edx], edx
|
||||
mov [esp+SYSCALL_STACK._eax], eax
|
||||
ret
|
||||
|
||||
.23:
|
||||
cmp ecx, OS_BASE
|
||||
jae .fail
|
||||
|
||||
stdcall shmem_close, ecx
|
||||
mov [esp+SYSCALL_STACK._eax], eax
|
||||
ret
|
||||
@ -1195,27 +1188,22 @@ f68:
|
||||
bts [eax+APPDATA.except_mask], ecx
|
||||
@@:
|
||||
ret
|
||||
|
||||
.26:
|
||||
stdcall user_unmap, ecx, edx, esi
|
||||
mov [esp+SYSCALL_STACK._eax], eax
|
||||
ret
|
||||
|
||||
.27:
|
||||
cmp ecx, OS_BASE
|
||||
jae .fail
|
||||
|
||||
stdcall load_file_umode, ecx
|
||||
mov [esp+SYSCALL_STACK._edx], edx
|
||||
mov [esp+SYSCALL_STACK._eax], eax
|
||||
ret
|
||||
|
||||
.fail:
|
||||
xor eax, eax
|
||||
mov [esp+SYSCALL_STACK._eax], eax
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
f68call: ; keep this table closer to main code
|
||||
|
||||
|
@ -66,11 +66,19 @@ _strnlen:
|
||||
fs_execute_from_sysdir:
|
||||
xor ebx, ebx
|
||||
fs_execute_from_sysdir_param:
|
||||
stdcall kernel_alloc, maxPathLength
|
||||
push eax ebx
|
||||
mov esi, ebp
|
||||
mov edi, eax
|
||||
xor eax, eax
|
||||
call getFullPath
|
||||
pop ecx ebx
|
||||
xor edx, edx
|
||||
proc fs_execute
|
||||
; ebx - cmdline
|
||||
; edx - flags
|
||||
; ebp - full filename
|
||||
; edx = flags
|
||||
; ecx -> cmdline
|
||||
; ebx -> absolute file path
|
||||
; eax = string length
|
||||
locals
|
||||
cmdline rd 1
|
||||
flags rd 1
|
||||
@ -91,16 +99,13 @@ proc fs_execute
|
||||
endl
|
||||
|
||||
mov [flags], edx
|
||||
mov [cmdline], ebx
|
||||
stdcall kernel_alloc, maxPathLength
|
||||
mov [path_string], eax
|
||||
mov ebx, [ebp]
|
||||
stdcall get_full_file_name, eax, maxPathLength
|
||||
mov [cmdline], ecx
|
||||
mov [path_string], ebx
|
||||
mov [filename_size], eax
|
||||
mov esi, -ERROR_FILE_NOT_FOUND
|
||||
test eax, eax
|
||||
jz .err_file
|
||||
|
||||
stdcall load_file, [path_string]
|
||||
mov esi, -ERROR_FILE_NOT_FOUND
|
||||
stdcall load_file, ebx
|
||||
test eax, eax
|
||||
jz .err_file
|
||||
|
||||
@ -141,7 +146,6 @@ proc fs_execute
|
||||
jz @f
|
||||
stosb
|
||||
loop @b
|
||||
|
||||
@@:
|
||||
mov edi, [cmdline]
|
||||
xor eax, eax
|
||||
@ -169,10 +173,6 @@ proc fs_execute
|
||||
lea edx, [ebx+APPDATA.list]
|
||||
lea ecx, [eax+PROC.thr_list]
|
||||
list_add_tail edx, ecx
|
||||
mov edi, [path_string]
|
||||
mov ecx, maxPathLength
|
||||
call _strnlen
|
||||
mov [filename_size], eax
|
||||
mov eax, [cmdline_size]
|
||||
add eax, sizeof.APP_HDR
|
||||
stdcall kernel_alloc, eax
|
||||
|
@ -40,17 +40,6 @@ file_system_lfn_protected:
|
||||
|
||||
file_system_lfn:
|
||||
; in: ebx -> parameter structure
|
||||
; operation codes:
|
||||
; 0 = read file
|
||||
; 1 = read folder
|
||||
; 2 = create/rewrite file
|
||||
; 3 = write/append to file
|
||||
; 4 = set file end
|
||||
; 5 = get file info
|
||||
; 6 = set file info
|
||||
; start application
|
||||
; 8 = delete file/folder
|
||||
; 9 = create folder
|
||||
lea ebp, [ebx+20]
|
||||
cmp byte [ebp], 0
|
||||
jnz @f
|
||||
@ -69,23 +58,25 @@ file_system_lfn:
|
||||
cmp word [ebp+3], 0
|
||||
jz .rootdir
|
||||
@@:
|
||||
stdcall kernel_alloc, maxPathLength
|
||||
push eax ebx
|
||||
xchg eax, edi
|
||||
mov esi, ebp
|
||||
xor eax, eax
|
||||
call getFullPath
|
||||
pop ebx ebp
|
||||
test eax, eax
|
||||
jz .notfound
|
||||
cmp dword[ebx], 7 ; start application
|
||||
jnz @f
|
||||
mov edx, [ebx+4]
|
||||
mov ebx, [ebx+8]
|
||||
call fs_execute ; ebp, ebx, edx
|
||||
mov ecx, [ebx+8]
|
||||
mov ebx, ebp
|
||||
call fs_execute
|
||||
mov [image_of_eax], eax
|
||||
ret
|
||||
|
||||
@@:
|
||||
stdcall kernel_alloc, maxPathLength
|
||||
push ebx
|
||||
mov ebx, ebp
|
||||
mov ebp, eax
|
||||
stdcall get_full_file_name, eax, maxPathLength
|
||||
pop ebx
|
||||
test eax, eax
|
||||
jz .notfound
|
||||
lea esi, [ebp+2]
|
||||
mov ax, [esi]
|
||||
or ax, 2020h
|
||||
@ -491,40 +482,42 @@ sys_current_directory: ; sysfunction 30
|
||||
ret
|
||||
|
||||
.set:
|
||||
pop eax
|
||||
push maxPathLength
|
||||
push edi
|
||||
push eax
|
||||
mov ebx, ecx
|
||||
get_full_file_name:
|
||||
; in: ebx -> file name, [esp+4] -> destination, [esp+8] = max length
|
||||
; out: UTF-8 string, eax=0 -> out of length
|
||||
push ebp ebx
|
||||
cmp byte [ebx], 0
|
||||
jz .set_relative
|
||||
mov esi, ebx
|
||||
cmp byte [ebx], 4
|
||||
jnc @f
|
||||
inc esi
|
||||
@@:
|
||||
cmp byte [esi], '/'
|
||||
jnz .set_relative
|
||||
inc esi
|
||||
mov esi, ecx
|
||||
xor eax, eax
|
||||
getFullPath:
|
||||
; in: esi -> file path, eax = string encoding, edi -> destination
|
||||
; out: UTF-8 string (with marker), eax = length, 0 -> error
|
||||
test eax, eax
|
||||
jnz @f
|
||||
cmp byte [esi], 4
|
||||
jnc @f
|
||||
mov ebx, esi
|
||||
inc esi
|
||||
cmp byte [esi], '/'
|
||||
jnz .start
|
||||
inc esi
|
||||
cmp byte [esi], 0
|
||||
jz @f
|
||||
lodsb
|
||||
@@:
|
||||
cmp byte [ebx], 2
|
||||
cmp byte [esi], '/'
|
||||
jnz .relative
|
||||
cmp eax, 2
|
||||
jnz @f
|
||||
cmp word [esi], '/'
|
||||
jnz .relative
|
||||
inc esi
|
||||
inc esi
|
||||
jmp .start
|
||||
|
||||
@@:
|
||||
inc esi
|
||||
cmp byte [esi], 4
|
||||
jnc .start
|
||||
lodsb
|
||||
cmp byte [esi], '/'
|
||||
jnz .start
|
||||
inc esi
|
||||
.start:
|
||||
push eax edi
|
||||
call process_replace_file_name
|
||||
mov edi, [esp+12]
|
||||
mov ecx, [esp+16]
|
||||
mov edi, [esp]
|
||||
mov ecx, maxPathLength
|
||||
mov al, 3
|
||||
mov ah, '/'
|
||||
stosw
|
||||
@ -540,9 +533,9 @@ get_full_file_name:
|
||||
mov esi, ebp
|
||||
dec edi
|
||||
.absolute:
|
||||
cmp byte [ebx], 2
|
||||
cmp byte [esp+4], 2
|
||||
jz .utf16
|
||||
cmp byte [ebx], 3
|
||||
cmp byte [esp+4], 3
|
||||
jz .utf8
|
||||
call cp866toUTF8_string
|
||||
jns .end
|
||||
@ -562,31 +555,29 @@ get_full_file_name:
|
||||
jns .end
|
||||
.fail:
|
||||
mov byte [edi], 0
|
||||
pop eax eax
|
||||
xor eax, eax
|
||||
pop ebx ebp
|
||||
ret 8
|
||||
ret
|
||||
|
||||
.set_relative:
|
||||
.relative:
|
||||
push eax edi
|
||||
mov ebx, esi
|
||||
mov edi, [current_slot]
|
||||
mov edi, [edi+APPDATA.cur_dir]
|
||||
mov edx, edi
|
||||
mov ecx, [esp+16]
|
||||
mov ecx, maxPathLength
|
||||
xor eax, eax
|
||||
repnz scasb
|
||||
mov esi, edi
|
||||
dec esi
|
||||
mov edi, [esp+12]
|
||||
mov edi, [esp]
|
||||
jecxz .fail
|
||||
cmp byte [ebx], 0
|
||||
jz .set_ok
|
||||
cmp byte [ebx], 4
|
||||
jnc @f
|
||||
inc ebx
|
||||
@@:
|
||||
dec esi
|
||||
cmp edx, edi ; is destination equal to cur_dir?
|
||||
mov edi, esi
|
||||
jz @f
|
||||
mov edi, [esp+12]
|
||||
mov edi, [esp]
|
||||
mov ecx, esi
|
||||
sub ecx, edx
|
||||
mov esi, edx
|
||||
@ -597,9 +588,8 @@ get_full_file_name:
|
||||
inc edi
|
||||
mov esi, ebx
|
||||
mov ecx, edx
|
||||
add ecx, [esp+16]
|
||||
add ecx, maxPathLength
|
||||
sub ecx, edi
|
||||
mov ebx, [esp]
|
||||
jmp .absolute
|
||||
|
||||
.set_ok:
|
||||
@ -609,15 +599,16 @@ get_full_file_name:
|
||||
sub ecx, edx
|
||||
mov esi, edx
|
||||
rep movsb
|
||||
mov byte [edi], 0
|
||||
@@:
|
||||
mov al, 1
|
||||
pop ebx ebp
|
||||
ret 8
|
||||
pop eax
|
||||
sub edi, eax
|
||||
pop eax
|
||||
mov eax, edi
|
||||
ret
|
||||
|
||||
.end:
|
||||
or ecx, -1
|
||||
mov edi, [esp+12]
|
||||
mov edi, [esp]
|
||||
xor eax, eax
|
||||
push edi
|
||||
repnz scasb
|
||||
@ -641,7 +632,7 @@ get_full_file_name:
|
||||
jnz @f
|
||||
mov edx, ecx
|
||||
mov ecx, edi
|
||||
sub ecx, [esp+12]
|
||||
sub ecx, [esp]
|
||||
sub ecx, 2
|
||||
jc .fail
|
||||
sub edi, 2
|
||||
|
Loading…
Reference in New Issue
Block a user