Fix for r. 1275 - to use the CLI command is not a good solution. Much better to use a mutex!

git-svn-id: svn://kolibrios.org@2486 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-03-21 11:48:46 +00:00
parent 3bd1f7b7ce
commit b4268eda9f

View File

@ -437,10 +437,25 @@ proc load_file stdcall, file_name:dword
jz .cleanup
mov [file2], eax
pushfd
cli
push eax
.wait_lock:
cmp [unpack_mutex], 0
je .get_lock
call change_task
jmp .wait_lock
.get_lock:
mov eax, 1
xchg eax, [unpack_mutex]
test eax, eax
jnz .wait_lock
pop eax
stdcall unpack, [file], eax
popfd
mov [unpack_mutex], 0
stdcall kernel_free, [file]
mov eax, [file2]
mov ebx, [file_size]
@ -470,6 +485,11 @@ proc load_file stdcall, file_name:dword
ret
endp
iglobal
align 4
unpack_mutex dd 0
endg
align 4
proc get_proc_ex stdcall, proc_name:dword, imports:dword