Function at 0x405a80
Capabilities:
Access pe header
Check if file exists
Get file attributes
Set file attributes
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x428fbf
mov eax, dword fs:[0]
push eax
sub esp, 0x30
push ebx
push esi
push edi
mov eax, dword [0x438040]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 0x38], edx
mov edi, ecx
mov dword [ebp - 0x20], edi
xor eax, eax
lea ecx, [ebp - 0x14]
mov edx, edi
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x34], eax
call fcn.00403680
mov dword [ebp - 4], 0
or ebx, 0xffffffff
mov esi, dword [ebp - 0x14]
cmp dword [esi - 0xc], 0
je 0x405b45
cmp dword [esi - 4], 1
jle 0x405ae9
push dword [esi - 0xc]
lea ecx, [ebp - 0x14]
call fcn.0040d5f0
mov esi, dword [ebp - 0x14]
push esi
call dword [sym.imp.ntdll.dll_RtlImageNtHeader]
mov ecx, eax
mov dword [ebp - 0x24], ecx
test ecx, ecx
jne 0x405b09
push edi
push 0x431468
call fcn.0040cf10
add esp, 8
jmp 0x405b45
movzx eax, word [ecx + 0x14]
mov edx, dword [sym.imp.ntdll.dll_RtlImageRvaToVa]
add eax, ecx
mov edi, dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
mov dword [ebp - 0x3c], eax
mov byte [ebp - 0xd], 0
mov eax, dword [eax - 0x60]
test eax, eax
je 0x405d7b
push 0
push eax
push esi
push ecx
call edx
test eax, eax
jne 0x405b7a
push str.Error:_IMAGE_DIRECTORY_ENTRY_IMPORT
call fcn.0040cf10
add esp, 4
mov edi, 0xd
mov dword [ebp - 4], 0xffffffff
add esi, 0xfffffff0
lock xadd dword [esi + 0xc], ebx
dec ebx
test ebx, ebx
jg 0x405b66
mov ecx, dword [esi]
push esi
mov edx, dword [ecx]
call dword [edx + 4]
mov eax, edi
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
add eax, 0xc
mov dword [ebp - 0x30], eax
mov eax, dword [eax]
test eax, eax
je 0x405d72
nop word [eax + eax]
push 0
push eax
push esi
push dword [ebp - 0x24]
call dword [sym.imp.ntdll.dll_RtlImageRvaToVa]
mov ebx, eax
test ebx, ebx
je 0x405d5c
call fcn.0040db30
mov ecx, eax
test ecx, ecx
je 0x406112
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x28], eax
mov byte [ebp - 4], 1
call fcn.0040db30
mov ecx, eax
test ecx, ecx
je 0x406112
mov eax, dword [ecx]
call dword [eax + 0xc]
mov dword [ebp - 0x34], eax
lea esi, [eax + 0x10]
mov dword [ebp - 0x1c], esi
mov byte [ebp - 4], 2
test ebx, 0xffff0000
jne 0x405c08
movzx edi, bx
mov ecx, edi
call fcn.0040d010
test eax, eax
je 0x405c6b
push edi
push eax
lea ecx, [ebp - 0x1c]
call fcn.0040d1a0
jmp 0x405c68
push 0
push 0
push 0xffffffffffffffff
push ebx
push 0
push 3
call edi
lea edi, [eax - 1]
test edi, edi
jle 0x405c60
mov eax, dword [ebp - 0x34]
mov ecx, 1
sub ecx, dword [eax + 0xc]
mov eax, dword [eax + 8]
sub eax, edi
or eax, ecx
jge 0x405c3c
push edi
lea ecx, [ebp - 0x1c]
call fcn.0040d840
mov esi, dword [ebp - 0x1c]
mov eax, dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
push edi
push esi
push 0xffffffffffffffff
push ebx
push 0
push 3
call eax
cmp edi, dword [esi - 8]
jg 0x406108
xor eax, eax
mov dword [esi - 0xc], edi
mov word [esi + edi*2], ax
jmp 0x405c6b
lea ecx, [ebp - 0x1c]
call fcn.0040d8a0
mov esi, dword [ebp - 0x1c]
mov ecx, dword [ebp - 0x38]
mov byte [ebp - 4], 3
mov eax, dword [ebp - 0x18]
or eax, 1
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x34], eax
lea eax, [ebp - 0x28]
push eax
push esi
call fcn.0040e560
mov edi, dword [ebp - 0x28]
add esp, 8
test eax, eax
je 0x405c9c
cmp dword [edi - 0xc], 0
mov byte [ebp - 0xe], 1
jne 0x405ca0
mov byte [ebp - 0xe], 0
mov dword [ebp - 4], 1
mov eax, dword [ebp - 0x18]
test al, 1
je 0x405ccc
and eax, 0xfffffffe
add esi, 0xfffffff0
mov dword [ebp - 0x18], eax
or eax, 0xffffffff
lock xadd dword [esi + 0xc], eax
dec eax
test eax, eax
jg 0x405ccc
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
cmp byte [ebp - 0xe], 0
je 0x405d33
push edi
lea ecx, [ebp - 0x2c]
call fcn.0040a770
mov ecx, ebx
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x405ce0
mov eax, dword [ebp - 0x2c]
sub ecx, edx
cmp ecx, dword [eax - 0xc]
jb 0x405d9d
push eax
push ebx
push 0x431830
call fcn.0040cf10
mov esi, dword [ebp - 0x2c]
mov eax, dword [esi - 0xc]
inc eax
push eax
push esi
push ebx
call fcn.00410070
or ebx, 0xffffffff
mov byte [ebp - 0xd], 1
add esp, 0x18
add esi, 0xfffffff0
mov eax, ebx
lock xadd dword [esi + 0xc], eax
dec eax
test eax, eax
jg 0x405d36
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
jmp 0x405d36
or ebx, 0xffffffff
mov byte [ebp - 4], 0
add edi, 0xfffffff0
mov eax, ebx
lock xadd dword [edi + 0xc], eax
dec eax
test eax, eax
jg 0x405d51
mov ecx, dword [edi]
push edi
mov eax, dword [ecx]
call dword [eax + 4]
mov esi, dword [ebp - 0x14]
mov edi, dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
jmp 0x405d5f
or ebx, 0xffffffff
mov eax, dword [ebp - 0x30]
add eax, 0x14
mov dword [ebp - 0x30], eax
mov eax, dword [eax]
test eax, eax
jne 0x405b90
mov ecx, dword [ebp - 0x24]
mov edx, dword [sym.imp.ntdll.dll_RtlImageRvaToVa]
mov eax, dword [ebp - 0x3c]
mov eax, dword [eax]
test eax, eax
je 0x405fd6
push 0
push eax
push esi
push ecx
call edx
test eax, eax
jne 0x405dda
push str.Error:_IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT
jmp 0x405b3d
or ebx, 0xffffffff
lea edx, [eax - 0x10]
mov eax, ebx
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x405db7
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov eax, ebx
mov byte [ebp - 4], 0
add edi, 0xfffffff0
lock xadd dword [edi + 0xc], eax
dec eax
test eax, eax
jg 0x405dd2
mov ecx, dword [edi]
push edi
mov eax, dword [ecx]
call dword [eax + 4]
mov esi, dword [ebp - 0x14]
jmp 0x405b45
add eax, 4
mov dword [ebp - 0x28], eax
mov eax, dword [eax]
test eax, eax
je 0x405fd6
nop word [eax + eax]
push 0
push eax
push esi
push dword [ebp - 0x24]
call dword [sym.imp.ntdll.dll_RtlImageRvaToVa]
mov ebx, eax
test ebx, ebx
je 0x405fce
call fcn.0040db30
mov ecx, eax
test ecx, ecx
je 0x406112
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x30], eax
mov byte [ebp - 4], 4
call fcn.0040db30
mov ecx, eax
test ecx, ecx
je 0x406112
mov eax, dword [ecx]
call dword [eax + 0xc]
mov dword [ebp - 0x34], eax
lea esi, [eax + 0x10]
mov dword [ebp - 0x1c], esi
mov byte [ebp - 4], 5
test ebx, 0xffff0000
jne 0x405e68
movzx edi, bx
mov ecx, edi
call fcn.0040d010
test eax, eax
je 0x405ecb
push edi
push eax
lea ecx, [ebp - 0x1c]
call fcn.0040d1a0
jmp 0x405ec8
push 0
push 0
push 0xffffffffffffffff
push ebx
push 0
push 3
call edi
lea edi, [eax - 1]
test edi, edi
jle 0x405ec0
mov eax, dword [ebp - 0x34]
mov ecx, 1
sub ecx, dword [eax + 0xc]
mov eax, dword [eax + 8]
sub eax, edi
or eax, ecx
jge 0x405e9c
push edi
lea ecx, [ebp - 0x1c]
call fcn.0040d840
mov esi, dword [ebp - 0x1c]
mov eax, dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
push edi
push esi
push 0xffffffffffffffff
push ebx
push 0
push 3
call eax
cmp edi, dword [esi - 8]
jg 0x406108
xor eax, eax
mov dword [esi - 0xc], edi
mov word [esi + edi*2], ax
jmp 0x405ecb
lea ecx, [ebp - 0x1c]
call fcn.0040d8a0
mov esi, dword [ebp - 0x1c]
mov ecx, dword [ebp - 0x38]
mov byte [ebp - 4], 6
mov eax, dword [ebp - 0x18]
or eax, 2
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x34], eax
lea eax, [ebp - 0x30]
push eax
push esi
call fcn.0040e560
mov edi, dword [ebp - 0x30]
add esp, 8
test eax, eax
je 0x405efc
cmp dword [edi - 0xc], 0
mov byte [ebp - 0xe], 1
jne 0x405f00
mov byte [ebp - 0xe], 0
mov dword [ebp - 4], 4
mov eax, dword [ebp - 0x18]
test al, 2
je 0x405f2c
and eax, 0xfffffffd
add esi, 0xfffffff0
mov dword [ebp - 0x18], eax
or eax, 0xffffffff
lock xadd dword [esi + 0xc], eax
dec eax
test eax, eax
jg 0x405f2c
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
cmp byte [ebp - 0xe], 0
je 0x405f93
push edi
lea ecx, [ebp - 0x2c]
call fcn.0040a770
mov ecx, ebx
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x405f40
mov eax, dword [ebp - 0x2c]
sub ecx, edx
cmp ecx, dword [eax - 0xc]
jb 0x405d9d
push eax
push ebx
push 0x431830
call fcn.0040cf10
mov esi, dword [ebp - 0x2c]
mov eax, dword [esi - 0xc]
inc eax
push eax
push esi
push ebx
call fcn.00410070
or ebx, 0xffffffff
mov byte [ebp - 0xd], 1
add esp, 0x18
add esi, 0xfffffff0
mov eax, ebx
lock xadd dword [esi + 0xc], eax
dec eax
test eax, eax
jg 0x405f96
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
jmp 0x405f96
or ebx, 0xffffffff
mov byte [ebp - 4], 0
add edi, 0xfffffff0
mov eax, ebx
lock xadd dword [edi + 0xc], eax
dec eax
test eax, eax
jg 0x405fb1
mov ecx, dword [edi]
push edi
mov eax, dword [ecx]
call dword [eax + 4]
mov edi, dword [ebp - 0x28]
mov esi, dword [ebp - 0x14]
add edi, 0x20
mov dword [ebp - 0x28], edi
mov eax, dword [edi]
test eax, eax
je 0x405fd6
mov edi, dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
jmp 0x405df0
or ebx, 0xffffffff
jmp 0x405b45
cmp byte [ebp - 0xd], 0
je 0x4060f1
mov ecx, dword [ebp - 0x3c]
mov edi, dword [esi - 0xc]
mov eax, dword [ecx - 0x48]
test eax, eax
je 0x40601b
cmp edi, eax
jae 0x405ffb
push 0x4318bc
jmp 0x405b3d
push dword [ebp - 0x20]
mov edi, eax
mov dword [ecx - 0x44], 0
push 0x4318e8
mov dword [ecx - 0x48], 0
call fcn.0040cf10
add esp, 8
mov edx, edi
mov ecx, esi
call fcn.00406120
mov dword [ebp - 0x3c], edi
mov edi, dword [ebp - 0x20]
push edi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
mov ebx, eax
cmp ebx, 0xffffffff
je 0x40604a
test bl, 1
je 0x40604a
mov ecx, ebx
and ecx, 0xfffffffe
push ecx
push edi
call dword [sym.imp.KERNEL32.dll_SetFileAttributesW]
xor edi, edi
push edi
push 0x2000080
push 2
push edi
push edi
push 0x40000000
push dword [ebp - 0x20]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x38], eax
cmp eax, 0xffffffff
je 0x40609b
push edi
lea ecx, [ebp - 0x3c]
push ecx
push dword [ebp - 0x3c]
push esi
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x406090
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
mov edi, 0x65b
cmovne edi, eax
push dword [ebp - 0x38]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x4060ab
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
mov edi, 0x65b
cmovne edi, eax
cmp ebx, 0xffffffff
je 0x4060bd
push ebx
mov ebx, dword [ebp - 0x20]
push ebx
call dword [sym.imp.KERNEL32.dll_SetFileAttributesW]
jmp 0x4060c0
mov ebx, dword [ebp - 0x20]
test edi, edi
je 0x4060db
push edi
push ebx
push str.Error
call fcn.0040cf10
add esp, 0xc
or ebx, 0xffffffff
jmp 0x405b4a
push ebx
push 0x431958
call fcn.0040cf10
add esp, 8
or ebx, 0xffffffff
jmp 0x405b4a
push dword [ebp - 0x20]
push 0x431978
call fcn.0040cf10
add esp, 8
xor edi, edi
jmp 0x405b4a
push 0x80070057
call fcn.0040d910
push 0x80004005
call fcn.0040d910
int3