Function at 0x40d420
Capabilities:
Write file on windows

Disassembly:
push 0xffffffffffffffff
push 0x4540b8
mov eax, dword fs:[0]
push eax
sub esp, 0x38
push ebx
push ebp
push esi
push edi
mov eax, dword [0x46fb88]
xor eax, esp
push eax
lea eax, [esp + 0x4c]
mov dword fs:[0], eax
mov esi, ecx
call fcn.0041b558
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x40d463
push 0x80004005
call fcn.00401150
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [esp + 0x20], eax
push 0
lea ecx, [esp + 0x24]
push ecx
mov ecx, esi
mov dword [esp + 0x5c], 0
call fcn.0040cf80
mov edi, dword [esp + 0x20]
push 0
push 0x80
push 4
push 0
push 1
push 0x40000000
push edi
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [esp + 0x1c], eax
cmp eax, 0xffffffff
jne 0x40d4f2
push 0xa
mov ecx, esi
call fcn.0040c300
lea eax, [edi - 0x10]
mov dword [esp + 0x54], 0xffffffff
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x40d4dc
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
xor eax, eax
mov ecx, dword [esp + 0x4c]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x44
ret
mov dword [esp + 0x18], 0x1388
mov ecx, dword [esp + 0x18]
mov edx, dword [esi + 0x350]
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
xor ebx, ebx
lea ecx, [esi + 0x358]
mov dword [esp + 0x30], ebx
mov edi, ebx
mov ebp, ebx
call fcn.00405f80
cmp dword [esi + 0x384], ebx
je 0x40d552
lea eax, [esp + 0x3c]
push eax
lea ecx, [esi + 0x378]
call fcn.0040c580
mov ecx, dword [eax + 4]
mov ebx, dword [eax]
mov edi, dword [eax + 8]
mov ebp, dword [eax + 0xc]
mov dword [esp + 0x30], ecx
mov dword [esp + 0x18], 1
jmp 0x40d55a
mov dword [esp + 0x18], 0x1388
mov edx, dword [esi + 0x358]
mov eax, dword [edx + 0x14]
lea ecx, [esi + 0x358]
call eax
test ebp, ebp
ja 0x40d57d
cmp byte [esi + 0x260], 0
je 0x40d4fa
jmp 0x40d636
mov eax, dword [esp + 0x1c]
push 0
movzx ebx, bl
push 0
lea ecx, [ebx + ebx*2]
push edi
lea edx, [esi + ecx*4 + 0x290]
push eax
mov dword [esp + 0x34], edx
mov dword [esp + 0x24], 0
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, edi
je 0x40d5b4
mov dword [esp + 0x14], str.ERR:_d_
jmp 0x40d5ed
mov edx, dword [esp + 0x30]
mov edi, dword [esp + 0x1c]
push 0
lea ecx, [esp + 0x2c]
push ecx
push ebp
push edx
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40d5da
mov dword [esp + 0x14], str.ERR:_d__
jmp 0x40d5ed
push edi
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
test eax, eax
jne 0x40d5ed
mov dword [esp + 0x14], 0x45ab18
mov eax, dword [esp + 0x30]
push eax
call fcn.0041acd3
add esp, 4
cmp dword [esp + 0x14], 0
jne 0x40d62d
mov eax, dword [esp + 0x24]
add dword [eax + 4], ebp
mov ecx, dword [eax + 4]
cmp ecx, dword [eax + 8]
jl 0x40d4fa
push ebx
mov ecx, esi
call fcn.0040c500
mov ecx, esi
call fcn.0040c3c0
test eax, eax
je 0x40d4fa
jmp 0x40d636
push 0xa
mov ecx, esi
call fcn.0040c300
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x40d645
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x20]
add eax, 0xfffffff0
mov dword [esp + 0x54], 0xffffffff
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40d66d
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, 1
mov ecx, dword [esp + 0x4c]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x44
ret