Function at 0x406640
Capabilities:
Check mutex on windows

Disassembly:
mov eax, dword [esp + 8]
mov ecx, dword [esp + 0x10]
mov edx, eax
sub esp, 0x158
sub edx, 2
je 0x406683
sub edx, 2
je 0x406666
sub edx, 4
jne 0x406688
mov eax, 5
jmp 0x406688
mov eax, dword [esp + 0x164]
test eax, eax
je 0x40667c
test ecx, ecx
jbe 0x40667c
mov eax, 6
jmp 0x406688
mov eax, 4
jmp 0x406688
mov eax, 2
mov edx, dword [esp + 0x15c]
push ebx
push ebp
push esi
mov esi, dword [edx]
push edi
cmp esi, 2
jne 0x4067ba
xor esi, esi
mov word [esp + 0x12], ax
cmp ecx, esi
mov dword [esp + 0x1c], esi
mov byte [esp + 0x10], 0x40
mov byte [esp + 0x11], 1
mov word [esp + 0x14], si
mov eax, 8
je 0x4066c3
mov eax, ecx
mov ebp, dword [esp + 0x10]
mov esi, dword [esp + 0x174]
movzx ax, al
mov word [esp + 0x16], ax
mov ebx, dword [esp + 0x14]
mov eax, ecx
lea edi, [esp + 0x68]
shr ecx, 2
mov dword [esp + 0x60], ebp
mov dword [esp + 0x64], ebx
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
mov eax, dword [esp + 0x16]
and ecx, 3
mov edx, dword [edx + 4]
rep movsb byte es:[edi], byte [esi]
mov esi, dword [esp + 0x180]
mov edi, dword [esp + 0x17c]
push 0
and eax, 0xffff
mov ecx, dword [esi]
push esi
push ecx
add eax, 8
push edi
lea ecx, [esp + 0x70]
push eax
push ecx
push 0x220028
push edx
call dword [sym.imp.KERNEL32.dll_DeviceIoControl]
test eax, eax
jne 0x4068ce
mov eax, dword [esp + 0x174]
test eax, eax
jne 0x406742
lea eax, [esp + 0x20]
lea ecx, [esp + 0x1c]
push ecx
push eax
push ebx
mov ebx, dword [esp + 0x178]
push ebp
mov edx, dword [ebx + 4]
push edx
call fcn.00407560
add esp, 0x14
test eax, eax
jne 0x40676f
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x158
ret
mov edx, dword [ebx + 4]
xor eax, eax
mov word [esp + 0x14], ax
mov word [esp + 0x12], ax
mov word [esp + 0x16], 0xff
mov eax, dword [esp + 0x14]
mov byte [esp + 0x10], 0xc0
mov byte [esp + 0x11], 1
mov ecx, dword [esp + 0x10]
push esi
push edi
push eax
push ecx
push edx
call fcn.004075f0
add esp, 0x14
test eax, eax
jne 0x4068ce
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x158
ret
xor edx, edx
mov byte [esp + 0x10], 0x40
cmp ecx, edx
mov dword [esp + 0x1c], edx
mov byte [esp + 0x11], 1
mov word [esp + 0x14], dx
mov word [esp + 0x12], ax
jne 0x4067dd
mov ecx, 8
xor ax, ax
mov al, cl
mov word [esp + 0x16], ax
mov eax, dword [0x43d6d4]
cmp eax, edx
jne 0x406814
push 0x43a070
push edx
push edx
call dword [sym.imp.KERNEL32.dll_CreateMutexA]
test eax, eax
mov dword [0x43d6d4], eax
jne 0x406814
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x158
ret
push 0xffffffffffffffff
push eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
je 0x406836
cmp eax, 0x80
je 0x406836
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x158
ret
mov eax, dword [esp + 0x174]
test eax, eax
jne 0x406845
lea eax, [esp + 0x20]
mov esi, dword [esp + 0x16c]
mov edx, dword [esp + 0x14]
lea ecx, [esp + 0x1c]
push ecx
mov ecx, dword [esi + 4]
push eax
mov eax, dword [esp + 0x18]
push edx
push eax
push ecx
call fcn.00407690
add esp, 0x14
test eax, eax
jne 0x406887
mov edx, dword [0x43d6d4]
push edx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x158
ret
mov eax, dword [esp + 0x180]
mov ecx, dword [esp + 0x17c]
mov edx, dword [esi + 4]
push eax
push ecx
push edx
call fcn.004077a0
add esp, 0xc
test eax, eax
jne 0x4068c1
mov eax, dword [0x43d6d4]
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x158
ret
mov ecx, dword [0x43d6d4]
push ecx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x158
ret