Function at 0x512660
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
lea esi, [ebp - 0x4c]
mov edi, ecx
sub esp, 0x7c
mov dword [esp], ecx
mov ecx, esi
call fcn.0050fe40
lea ecx, [ebp - 0x3c]
sub esp, 4
mov dword [ebp - 0x58], 0xc
mov dword [esp], esi
mov dword [ebp - 0x54], 0
mov dword [ebp - 0x50], 0
call fcn.00628750
lea ecx, [ebp - 0x3c]
sub esp, 4
call fcn.00665e50
lea edx, [ebp - 0x58]
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], pe_nt_image_headers32
mov dword [esp + 0x10], 1
mov dword [esp + 8], 1
mov dword [esp + 0xc], edx
mov dword [esp + 4], 0xc0000000
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
mov eax, dword [ebp - 0x3c]
sub esp, 0x1c
mov edx, dword [eax]
test edx, edx
je 0x5127d3
cmp edx, 0xffffffff
je 0x512702
lock sub dword [eax], 1
mov eax, dword [ebp - 0x3c]
je 0x5127d3
cmp ebx, 0xffffffff
je 0x5127f4
lea ecx, [ebp - 0x5c]
mov dword [edi + 4], ebx
mov dword [esp], edi
call fcn.00629af0
mov eax, dword [ebp - 0x5c]
lea edi, [ebp - 0x3c]
sub esp, 4
mov dword [esp + 0x10], 0
mov dword [ebp - 0x3c], 0
mov dword [esp + 0xc], edi
mov edx, dword [eax + 4]
mov dword [esp + 8], edx
add eax, dword [eax + 0xc]
mov dword [esp], ebx
mov dword [esp + 4], eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
sub esp, 0x14
test eax, eax
jne 0x512890
mov ebx, 3
mov edx, dword [ebp - 0x5c]
mov eax, dword [edx]
test eax, eax
je 0x512773
cmp eax, 0xffffffff
je 0x51278b
lock sub dword [edx], 1
mov edx, dword [ebp - 0x5c]
jne 0x51278b
mov dword [esp + 8], 4
mov dword [esp + 4], 1
mov dword [esp], edx
call fcn.004a4c50
mov eax, dword [ebp - 0x48]
mov edx, dword [eax]
test edx, edx
je 0x5128b0
cmp edx, 0xffffffff
je 0x5127aa
lock sub dword [eax], 1
mov eax, dword [ebp - 0x48]
je 0x5128b0
mov eax, dword [ebp - 0x4c]
mov edx, dword [eax]
test edx, edx
je 0x5128d5
cmp edx, 0xffffffff
je 0x5127c9
lock sub dword [eax], 1
mov eax, dword [ebp - 0x4c]
je 0x5128d5
lea esp, [ebp - 0xc]
mov eax, ebx
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp + 8], 4
mov dword [esp + 4], 2
mov dword [esp], eax
call fcn.004a4c50
cmp ebx, 0xffffffff
jne 0x51270b
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x20
je 0x51290c
ja 0x512900
cmp eax, 5
jne 0x512916
lea ecx, [ebp - 0x5c]
mov dword [esp], esi
call fcn.00628750
lea ecx, [ebp - 0x5c]
sub esp, 4
call fcn.00665e50
lea edi, [ebp - 0x3c]
mov dword [esp + 4], 0
mov dword [esp], eax
mov dword [esp + 8], edi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesExW]
xor ebx, ebx
sub esp, 0xc
test eax, eax
mov eax, dword [ebp - 0x5c]
sete bl
add ebx, 1
mov edx, dword [eax]
test edx, edx
je 0x512870
cmp edx, 0xffffffff
je 0x51278b
lock sub dword [eax], 1
mov eax, dword [ebp - 0x5c]
jne 0x51278b
lea esi, [esi]
mov dword [esp + 8], 4
mov dword [esp + 4], 2
mov dword [esp], eax
call fcn.004a4c50
jmp 0x51278b
mov dword [esp], ebx
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
sub esp, 4
xor ebx, ebx
test eax, eax
jne 0x51275c
jmp 0x512757
mov dword [esp], eax
mov dword [esp + 8], 4
mov dword [esp + 4], 2
call fcn.004a4c50
mov eax, dword [ebp - 0x4c]
mov edx, dword [eax]
test edx, edx
jne 0x5127b7
mov dword [esp], eax
mov dword [esp + 8], 4
mov dword [esp + 4], 2
call fcn.004a4c50
lea esp, [ebp - 0xc]
mov eax, ebx
pop ebx
pop esi
pop edi
pop ebp
ret
cmp eax, 0x50
je 0x51290c
cmp eax, 0xb7
jne 0x512916
mov ebx, 1
jmp 0x51278b
mov dword [esp + 8], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 0xc], 0
mov dword [esp + 4], str.Got_unexpected_locking_error__llu
mov dword [ebp - 0x3c], 2
mov dword [esp], eax
mov dword [ebp - 0x38], 0
mov dword [ebp - 0x34], 0
mov dword [ebp - 0x30], 0
mov dword [ebp - 0x2c], 0x751e70
call fcn.0072013c
mov ebx, 3
jmp 0x51278b