Function at 0x40bdba
Capabilities:
Check if file exists
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x5c
mov ecx, dword [ebp + 0xc]
xor edx, edx
push ebx
push esi
push edi
mov edi, edx
mov dword [ebp - 0x2c], edx
mov dword [ebp - 0x1c], edx
mov dword [ebp - 8], edx
mov dword [ebp - 0x24], edx
mov dword [ebp - 0xc], edx
mov dword [ebp - 0x18], edx
mov ebx, edx
mov dword [ebp - 0x20], edx
mov dword [ebp - 0x48], edx
mov dword [ebp - 0x30], edx
mov dword [ebp - 0x14], edx
mov dword [ebp - 0x3c], edx
mov dword [ebp - 0x38], edx
mov dword [ebp - 4], edi
mov dword [ebp - 0x4c], edx
mov dword [ebp - 0x34], edx
test cl, 0x10
je 0x40be0f
push 3
pop eax
test cl, 0x40
je 0x40be0a
mov eax, edx
call fcn.0040d39e
test cl, 1
je 0x40be21
and ecx, 0xfffffff3
mov dword [ebp - 0x14], 1
mov dword [ebp + 0xc], ecx
push dword [ebp + 8]
lea eax, [ebp - 0x58]
call fcn.0040ce56
mov esi, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
test eax, eax
jne 0x40be43
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x40c62f
lea eax, [ebp - 0x3c]
push eax
xor esi, esi
inc esi
push esi
push 4
push 0x422360
call fcn.0040d5de
test eax, eax
jne 0x40be68
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x40c621
lea eax, [ebp - 0x38]
push eax
push dword [ebp - 0x3c]
call fcn.0040d498
test eax, eax
je 0x40be5b
and dword [ebp - 0x28], ebx
push 0x40303c
lea edi, [ebp - 0x58]
call fcn.0040deef
test eax, eax
je 0x40be8f
mov dword [ebp - 0x28], esi
xor esi, esi
push 0x40304c
lea edi, [ebp - 0x58]
mov dword [ebp + 8], esi
call fcn.0040deef
test eax, eax
je 0x40bea9
inc esi
mov dword [ebp + 8], esi
push 0x403058
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov edi, eax
mov dword [ebp - 8], edi
test edi, edi
jne 0x40becd
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
jmp 0x40c61e
push 0x403090
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 0x1c], eax
test eax, eax
je 0x40bec0
test byte [ebp + 0xc], 0x20
je 0x40bf01
xor edi, edi
inc edi
push 0x4030c8
push 3
mov dword [ebp - 0x10], edi
call fcn.0040d3c6
pop ecx
pop ecx
jmp 0x40bf8b
mov ecx, edi
cmp dword [ebp - 0x28], ebx
je 0x40bf59
push 1
call fcn.0040e330
test eax, eax
jne 0x40bf26
mov eax, 0xc1
push eax
push edi
mov ebx, eax
push 0x403128
jmp 0x40c614
push 0x4031a8
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov edi, eax
mov dword [ebp - 0x20], edi
test edi, edi
je 0x40bec0
push 1
mov ecx, edi
call fcn.0040e330
test eax, eax
je 0x40bf72
mov eax, dword [ebp - 8]
push 0
push edi
call fcn.0040cda2
mov edi, eax
jmp 0x40bf75
push 0
call fcn.0040e330
test eax, eax
je 0x40bf13
mov ecx, dword [ebp - 0x1c]
push 0
call fcn.0040e330
test eax, eax
jne 0x40bf7a
xor edi, edi
inc edi
mov dword [ebp - 0x10], edi
jmp 0x40bf8b
push 0
push dword [ebp - 0x1c]
mov eax, edi
call fcn.0040cda2
mov edi, eax
mov dword [ebp - 0x10], eax
push 0x4031d0
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 4], eax
test eax, eax
je 0x40bec0
push 0x4031f4
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 0x2c], eax
test eax, eax
je 0x40bec0
push eax
push dword [ebp - 4]
push 0x403218
push 2
call fcn.0040d3c6
add esp, 0x10
push 0
push dword [ebp - 0x14]
push esi
push esi
mov esi, dword [ebp - 0x2c]
push edi
push esi
push dword [ebp - 4]
call fcn.0040c77c
test eax, eax
jne 0x40c00a
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, dword [ebp - 4]
mov ebx, eax
push ebx
push esi
push edi
push 0x403260
push 4
call fcn.0040d3c6
add esp, 0x14
jmp 0x40c621
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
cmp dword [ebp - 0x28], ebx
jne 0x40c176
push 0x4032d4
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov edi, dword [ebp - 8]
mov dword [ebp - 0xc], eax
lea eax, [ebp - 0x58]
push eax
call fcn.0040d113
push 0x403308
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov edi, eax
cmp dword [ebp - 0xc], ebx
je 0x40c0bc
test edi, edi
je 0x40c0bc
push edi
call fcn.0040d191
push edi
mov esi, eax
call fcn.0040e154
push 1
mov dword [ebp - 0x44], eax
mov eax, dword [ebp - 8]
push edi
call fcn.0040cda2
test esi, esi
je 0x40c079
cmp dword [ebp - 0x44], 1
jne 0x40c0cc
test eax, eax
je 0x40c0cc
push dword [ebp - 0xc]
call fcn.0040f42a
test eax, eax
jne 0x40c09f
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
push eax
push 0x4033b8
push 3
call fcn.0040d3c6
add esp, 0xc
jmp 0x40c0d2
push edi
push dword [ebp - 8]
call fcn.0040cd0d
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x40c0d2
call esi
push eax
push 0x403440
jmp 0x40c093
push 0x403350
push 3
call fcn.0040d3c6
pop ecx
pop ecx
jmp 0x40c0d2
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
mov eax, dword [ebp - 0xc]
test eax, eax
je 0x40c0e9
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
test edi, edi
je 0x40c0fd
push edi
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
push dword [ebp - 4]
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
test eax, eax
je 0x40c116
and dword [ebp - 4], ebx
push 0x40366c
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
test byte [ebp + 0xc], 0x80
push 0
mov edi, eax
pop eax
setne al
xor ecx, ecx
push ecx
push 6
mov dword [ebp - 0xc], edi
inc eax
push eax
push ecx
push ecx
push 0xc0000000
push edi
mov dword [ebp - 0x50], eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x44], eax
cmp eax, 0xffffffff
jne 0x40c258
call esi
cmp eax, 0x50
jne 0x40c168
cmp dword [ebp - 0x50], 2
jne 0x40c323
call esi
push eax
push edi
push 0x4036a8
jmp 0x40c319
cmp dword [ebp - 0x14], ebx
jne 0x40c0fd
cmp dword [ebp + 8], ebx
je 0x40c1bf
mov eax, dword [ebp - 0x20]
test eax, eax
jne 0x40c1a0
push 0x4031a8
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 0x20], eax
test eax, eax
je 0x40bec0
push 0x4034d8
push 0
push eax
call fcn.0040d6b8
test eax, eax
jne 0x40c1bf
call esi
cmp eax, 2
je 0x40c1bf
call esi
jmp 0x40bec6
test edi, edi
mov edi, dword [ebp - 0x20]
je 0x40c1d3
push edi
push dword [ebp - 8]
call fcn.0040cd0d
test eax, eax
je 0x40c1b8
mov ecx, edi
call fcn.0040f14b
test eax, eax
jne 0x40c1f6
call esi
mov ebx, eax
push ebx
mov eax, edi
call fcn.0040b952
push ebx
push edi
push 0x403598
jmp 0x40c614
push 7
pop eax
call fcn.0040d2d9
test eax, eax
je 0x40c1b8
cmp dword [ebp + 8], ebx
je 0x40c22e
push 0x4034d8
push 1
push edi
call fcn.0040d6b8
test eax, eax
je 0x40c1b8
mov edi, dword [ebp - 0x1c]
push 0x4034d8
push 0
push edi
call fcn.0040d6b8
test eax, eax
jne 0x40c231
jmp 0x40c1b8
mov edi, dword [ebp - 0x1c]
mov ecx, edi
call fcn.0040eda2
test eax, eax
jne 0x40c0fd
call esi
mov ebx, eax
push ebx
mov eax, edi
call fcn.0040b952
push ebx
push edi
push 0x403608
jmp 0x40c614
push 0x10000
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edi, eax
test edi, edi
jne 0x40c287
mov edi, dword [ebp - 0xc]
push edi
push 0x403720
push 3
call fcn.0040d3c6
add esp, 0xc
jmp 0x40c2fc
push 0x10000
push 0
push edi
call sub.msvcrt.dll_memset
add esp, 0xc
push 0
lea eax, [ebp - 0x40]
push eax
push 0x10000
push edi
push dword [ebp - 0x44]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40c2c8
call esi
mov ecx, dword [ebp - 0xc]
push eax
push ecx
push 0x4036a8
push 3
call fcn.0040d3c6
add esp, 0x10
jmp 0x40c2e9
mov eax, 0x10000
cmp dword [ebp - 0x40], eax
je 0x40c2e9
mov ecx, dword [ebp - 0xc]
push eax
push dword [ebp - 0x40]
push ecx
push 0x4037a8
push 3
call fcn.0040d3c6
add esp, 0x14
push edi
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov edi, dword [ebp - 0xc]
push dword [ebp - 0x44]
call dword [sym.imp.ntdll.dll_NtClose]
mov ecx, edi
call fcn.0040f14b
test eax, eax
jne 0x40c323
call esi
push eax
push edi
push 0x403840
push 3
call fcn.0040d3c6
add esp, 0x10
cmp dword [ebp - 0x28], ebx
je 0x40c3bf
cmp dword [ebp - 0x14], ebx
jne 0x40c3a0
push 0x4038c0
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov edi, eax
push 0x4038ec
lea eax, [ebp - 0x58]
push eax
mov dword [ebp - 0x4c], edi
call fcn.0040dd2d
push 6
mov dword [ebp - 0x34], eax
pop eax
call fcn.0040d2d9
test eax, eax
jne 0x40c36c
call esi
cmp eax, 2
jne 0x40c1b8
mov edi, dword [ebp - 0x34]
push 6
pop eax
call fcn.0040d2d9
test eax, eax
jne 0x40c386
call esi
cmp eax, 2
jne 0x40c1b8
mov edi, dword [ebp - 0xc]
push 6
pop eax
call fcn.0040d2d9
test eax, eax
jne 0x40c3a0
call esi
cmp eax, 2
jne 0x40c1b8
mov edi, dword [ebp + 8]
test edi, edi
je 0x40c3c2
push 0x403920
push 0
push dword [ebp - 0x2c]
call fcn.0040d6b8
test eax, eax
jne 0x40c3c2
jmp 0x40c1b8
mov edi, dword [ebp + 8]
mov eax, dword [ebp + 0xc]
test al, 8
je 0x40c43e
push 0x403a2c
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 4], eax
test eax, eax
je 0x40c1b8
push 0x403a50
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 0x18], eax
test eax, eax
je 0x40c1b8
push eax
push dword [ebp - 4]
push 0x403a88
push 2
call fcn.0040d3c6
add esp, 0x10
push 0
push dword [ebp - 0x14]
push edi
push edi
mov edi, dword [ebp - 0x10]
push edi
push dword [ebp - 0x18]
push dword [ebp - 4]
call fcn.0040c77c
test eax, eax
jne 0x40c443
call esi
mov edi, dword [ebp - 4]
mov ebx, eax
push ebx
push dword [ebp - 0x18]
push edi
push 0x403ad0
jmp 0x40bffb
mov edi, dword [ebp - 0x10]
jmp 0x40c446
mov eax, dword [ebp + 0xc]
test al, 4
je 0x40c4c4
push 0x403b40
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 4], eax
test eax, eax
je 0x40c1b8
push 0x403b6c
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 0x18], eax
test eax, eax
je 0x40c1b8
push eax
push dword [ebp - 4]
push 0x403ba8
push 2
call fcn.0040d3c6
mov eax, dword [ebp + 8]
add esp, 0x10
push 0
push dword [ebp - 0x14]
push eax
push eax
push edi
push dword [ebp - 0x18]
mov edi, dword [ebp - 4]
push edi
call fcn.0040c77c
test eax, eax
jne 0x40c4c7
push edi
push 0x403bf8
push 3
call fcn.0040d3c6
add esp, 0xc
push 0
call dword [sym.imp.KERNEL32.dll_SetLastError]
jmp 0x40c4c7
mov edi, dword [ebp - 4]
cmp dword [ebp - 0x28], ebx
je 0x40c621
mov edi, dword [ebp - 0x2c]
push 6
pop eax
call fcn.0040d2d9
test eax, eax
je 0x40c1b8
cmp dword [ebp + 8], ebx
je 0x40c4fd
push 0x403920
push 1
push edi
call fcn.0040d6b8
test eax, eax
je 0x40c1b8
mov edi, 0x403d40
push edi
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 0x24], eax
test eax, eax
jne 0x40c523
call esi
mov ebx, eax
push ebx
push edi
push 0x403d78
jmp 0x40c614
push eax
call fcn.0040d191
test eax, eax
je 0x40c61e
push 0x403dd0
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov edi, eax
mov dword [ebp - 0x48], edi
test edi, edi
jne 0x40c554
call esi
mov ebx, eax
push ebx
push 0x403dd0
jmp 0x40c519
push 0x403df4
lea eax, [ebp - 0x58]
push eax
call fcn.0040dd2d
mov dword [ebp - 0x30], eax
test eax, eax
jne 0x40c575
call esi
mov ebx, eax
push ebx
push 0x403df4
jmp 0x40c519
push eax
call fcn.0040d191
test eax, eax
je 0x40c59a
mov ecx, dword [ebp - 0x30]
call fcn.0040eda2
test eax, eax
jne 0x40c59a
call esi
mov ebx, eax
push ebx
push dword [ebp - 0x30]
push 0x403e18
jmp 0x40c614
push edi
push dword [ebp - 0x24]
call fcn.0040cd0d
test eax, eax
jne 0x40c5c1
call esi
mov ebx, eax
push ebx
push edi
push dword [ebp - 0x24]
push 0x403e78
push 4
call fcn.0040d3c6
add esp, 0x14
jmp 0x40c61e
mov ecx, dword [ebp - 0x24]
call fcn.0040eda2
test eax, eax
jne 0x40c5dc
call esi
mov ebx, eax
push ebx
push dword [ebp - 0x24]
push 0x403ed0
jmp 0x40c614
push 6
pop eax
call fcn.0040d2d9
test eax, eax
jne 0x40c5f5
call esi
mov ebx, eax
push ebx
push edi
push 0x403f58
jmp 0x40c614
cmp dword [ebp + 8], ebx
je 0x40c61e
push 0x403fc0
push edi
call fcn.0040d901
test eax, eax
jne 0x40c61e
call esi
mov ebx, eax
push ebx
push edi
push 0x404038
push 4
call fcn.0040d3c6
add esp, 0x10
mov edi, dword [ebp - 4]
lea esi, [ebp - 0x58]
call fcn.0040dcf9
mov esi, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
cmp dword [0x4226f0], 0
je 0x40c650
and dword [0x4226f0], 0
and dword [0x4226f4], 0
mov dword [0x422748], 5
mov eax, dword [ebp - 0x38]
test eax, eax
je 0x40c65f
push 0
push eax
call fcn.0040d498
test edi, edi
je 0x40c672
push edi
xor edi, edi
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
jmp 0x40c674
xor edi, edi
mov eax, dword [ebp - 0x18]
test eax, eax
je 0x40c686
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x2c]
test eax, eax
je 0x40c698
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 8]
test eax, eax
je 0x40c6aa
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x1c]
test eax, eax
je 0x40c6bc
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x20]
test eax, eax
je 0x40c6ce
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x48]
test eax, eax
je 0x40c6e0
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x30]
test eax, eax
je 0x40c6f2
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x24]
test eax, eax
je 0x40c704
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x4c]
test eax, eax
je 0x40c716
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x34]
test eax, eax
je 0x40c728
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0xc]
test eax, eax
je 0x40c73a
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x38]
test eax, eax
je 0x40c74c
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [ebp - 0x3c]
test eax, eax
je 0x40c75e
push eax
push edi
call esi
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
test ebx, ebx
je 0x40c76d
push ebx
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
jmp 0x40c770
xor eax, eax
inc eax
pop edi
pop esi
pop ebx
leave
ret 8