Function at 0x401540
Capabilities:
Check if file exists
Create process on windows
Create process suspended
Delete file
Get common file path
Get file attributes
Resolve function by parsing pe exports
Write and execute a file
Write file on windows

Disassembly:
push ebp
push edi
push esi
push ebx
xor ebx, ebx
sub esp, 0x17c
cmp dword [esp + 0x194], 1
jle 0x40158a
mov eax, dword [esp + 0x190]
mov ecx, dword [esp + 0x194]
lea edi, [eax + 4]
lea esi, [eax + ecx*4]
lea esi, [esi]
mov eax, dword [edi]
mov dword [esp], eax
call sub.msvcrt.dll_wcslen
test eax, eax
lea edx, [eax + ebx + 1]
cmovg ebx, edx
add edi, 4
cmp esi, edi
jne 0x401570
call dword [sym.imp.KERNEL32.dll_GetTickCount]
lea esi, [esp + 0xb4]
mov edi, dword [sym.imp.USER32.dll_wsprintfW]
mov dword [esp + 4], str.__08lx
mov dword [esp + 8], eax
mov dword [esp], esi
call edi
lea eax, [esp + 0x120]
mov dword [esp + 8], esi
mov dword [esp + 4], str.sh_data_upd_s
mov dword [esp], eax
call edi
mov dword [esp], esi
call sub.msvcrt.dll_wcslen
mov dword [esp + 0x40], eax
lea eax, [esp + 0x120]
mov dword [esp], eax
call sub.msvcrt.dll_wcslen
mov dword [esp + 0x4c], eax
mov eax, dword [str.___sh_name]
mov dword [esp + 0x9c], eax
mov eax, dword [0x52a02e]
mov dword [esp + 0xa0], eax
mov eax, dword [0x52a032]
mov dword [esp + 0xa4], eax
mov eax, dword [0x52a036]
mov dword [esp + 0xa8], eax
mov eax, dword [0x52a03a]
mov dword [esp + 0xac], eax
mov eax, dword [0x52a03e]
mov dword [esp + 0xb0], eax
lea eax, [esp + 0x9c]
mov dword [esp], eax
call sub.msvcrt.dll_wcslen
mov dword [esp + 0x50], eax
mov eax, dword [str.dmrk_upd]
mov dword [esp + 0x8a], eax
mov eax, dword [0x52a046]
mov dword [esp + 0x8e], eax
mov eax, dword [0x52a04a]
mov dword [esp + 0x92], eax
mov eax, dword [0x52a04e]
mov dword [esp + 0x96], eax
movzx eax, word [0x52a052]
mov word [esp + 0x9a], ax
mov eax, dword [str..exe]
mov dword [esp + 0x6e], eax
mov eax, dword [0x52a058]
mov dword [esp + 0x72], eax
movzx eax, word [0x52a05c]
mov word [esp + 0x76], ax
lea eax, [esp + 0x8a]
mov dword [esp], eax
call sub.msvcrt.dll_wcslen
mov edi, eax
lea eax, [esp + 0x6e]
mov dword [esp], eax
call sub.msvcrt.dll_wcslen
mov dword [esp + 4], 0
mov ebp, dword [sym.imp.KERNEL32.dll_GetTempPathW]
mov dword [esp + 0x48], eax
mov dword [esp], 0
call ebp
sub esp, 8
mov dword [esp + 0x38], eax
cmp eax, 1
jle 0x401736
mov eax, dword [esp + 0x40]
add eax, edi
add eax, dword [esp + 0x48]
mov dword [esp + 0x54], eax
add eax, dword [esp + 0x38]
mov dword [esp + 0x58], eax
cmp eax, 0x3ffffffe
ja 0x401d72
add eax, eax
mov dword [esp], eax
call fcn.004133d0
mov ecx, dword [esp + 0x38]
mov dword [esp + 0x44], eax
mov dword [esp], ecx
mov dword [esp + 4], eax
call ebp
sub esp, 8
mov ebp, eax
cmp dword [esp + 0x38], eax
setg cl
test eax, eax
setg al
and cl, al
mov byte [esp + 0x3f], cl
jne 0x401750
mov byte [esp + 0x3f], 0
movzx eax, byte [esp + 0x3f]
add esp, 0x17c
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [esp + 0x44]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
sub esp, 4
cmp eax, 0xffffffff
je 0x401cd2
test al, 0x10
mov eax, dword [esp + 0x54]
je 0x401a40
add eax, ebp
mov dword [esp + 0x5c], eax
test edi, edi
jle 0x4017a0
mov eax, dword [esp + 0x44]
lea ecx, [edi + edi]
mov dword [esp + 8], ecx
lea ecx, [esp + 0x8a]
lea eax, [eax + ebp*2]
mov dword [esp + 4], ecx
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [esp + 0x40]
test eax, eax
jle 0x4017c9
mov ecx, dword [esp + 0x44]
lea eax, [ebp + edi]
mov dword [esp + 4], esi
lea eax, [ecx + eax*2]
mov ecx, dword [esp + 0x40]
mov dword [esp], eax
add ecx, ecx
mov dword [esp + 8], ecx
call sub.msvcrt.dll_memcpy
mov eax, dword [esp + 0x48]
test eax, eax
jle 0x4017fa
mov eax, dword [esp + 0x44]
lea edx, [ebp + edi]
add edx, dword [esp + 0x40]
lea edx, [eax + edx*2]
mov eax, dword [esp + 0x48]
mov dword [esp], edx
add eax, eax
mov dword [esp + 8], eax
lea eax, [esp + 0x6e]
mov dword [esp + 4], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [esp + 0x44]
mov ecx, dword [esp + 0x5c]
xor ebp, ebp
mov word [eax + ecx*2], bp
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], pe_nt_image_headers32
mov dword [esp + 0x10], 2
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 0x40000000
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
sub esp, 0x1c
mov ebp, eax
cmp eax, 0xffffffff
je 0x401736
mov edi, 0x529a04
lea eax, [esp + 0xdc]
mov dword [esp], ebp
sub edi, 0x415004
mov dword [esp + 0x10], 0
mov dword [esp + 0xdc], 0
mov dword [esp + 0xc], eax
mov dword [esp + 8], edi
mov dword [esp + 4], 0x415004
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [sym.imp.KERNEL32.dll_CloseHandle]
sub esp, 0x14
mov esi, dword [esp + 0xdc]
mov dword [esp], ebp
mov dword [esp + 0x5c], eax
call eax
sub esp, 4
cmp esi, edi
jne 0x401736
lea edx, [esp + 0xe0]
xor eax, eax
mov ecx, 0x10
mov dword [esp + 0x78], 0
mov edi, edx
mov dword [esp + 0x7c], 0
rep stosd dword es:[edi], eax
mov eax, dword [esp + 0x38]
mov dword [esp + 0xdc], 0x44
mov dword [esp + 0x80], 0
mov dword [esp + 0x84], 0
add eax, ebx
add eax, dword [esp + 0x54]
add eax, dword [esp + 0x50]
add eax, dword [esp + 0x4c]
cmp eax, 0x3ffffffe
ja 0x401d72
add eax, eax
mov dword [esp], eax
call fcn.004133d0
mov esi, dword [esp + 0x58]
mov ebp, eax
cmp esi, 1
jle 0x401d69
lea eax, [esi + esi - 2]
mov dword [esp], ebp
sub esi, 1
mov dword [esp + 8], eax
mov eax, dword [esp + 0x44]
mov dword [esp + 4], eax
call sub.msvcrt.dll_memcpy
lea edx, [ebp + esi*2]
test ebx, ebx
je 0x401a50
mov eax, dword [esp + 0x190]
mov ecx, dword [esp + 0x194]
lea ebx, [eax + 4]
lea eax, [eax + ecx*4]
mov dword [esp + 0x38], eax
cmp ecx, 1
jg 0x40197f
jmp 0x401a50
add ebx, 4
cmp ebx, dword [esp + 0x38]
je 0x401a50
mov eax, dword [ebx]
lea edi, [esi + esi]
mov dword [esp], eax
call sub.msvcrt.dll_wcslen
lea edx, [ebp + edi]
test eax, eax
jle 0x401972
lea ecx, [esi + 1]
mov esi, 0x20
mov dword [esp + 0x48], ecx
mov ecx, dword [ebx]
mov word [edx], si
lea esi, [ebp + edi + 6]
lea edx, [ebp + edi + 2]
cmp ecx, esi
mov dword [esp + 0x40], edx
lea esi, [ecx + 4]
setae dl
cmp dword [esp + 0x40], esi
mov dword [esp + 0x54], ecx
mov edi, edx
setae dl
mov esi, edx
or esi, edi
lea edi, [eax - 1]
cmp edi, 4
seta dl
mov edi, edx
mov edx, esi
mov ecx, edi
test dl, cl
je 0x401ce1
mov ecx, dword [esp + 0x54]
mov edx, dword [esp + 0x40]
mov esi, ecx
or esi, edx
and esi, 3
jne 0x401ce1
mov edi, eax
mov dword [esp + 0x40], eax
mov esi, ecx
shr edi, 1
lea edi, [edx + edi*4]
mov eax, dword [esi]
add edx, 4
add esi, 4
mov dword [edx - 4], eax
cmp edi, edx
jne 0x401a03
mov eax, dword [esp + 0x40]
mov edi, ecx
mov ecx, dword [esp + 0x48]
mov edx, eax
and edx, 0xfffffffe
lea esi, [edx + ecx]
cmp edx, eax
je 0x401a31
movzx edx, word [edi + edx*2]
mov word [ebp + esi*2], dx
mov esi, dword [esp + 0x48]
add esi, eax
lea edx, [ebp + esi*2]
jmp 0x401972
mov dword [esp + 0x5c], eax
xor ebp, ebp
jmp 0x40177b
mov edi, dword [esp + 0x50]
test edi, edi
jle 0x401a80
mov ebx, dword [esp + 0x50]
lea eax, [ebp + esi*2]
lea ecx, [esp + 0x9c]
mov dword [esp + 4], ecx
lea edx, [ebx + ebx]
mov dword [esp], eax
add esi, ebx
mov dword [esp + 8], edx
call sub.msvcrt.dll_memcpy
lea edx, [ebp + esi*2]
mov ecx, dword [esp + 0x4c]
test ecx, ecx
jle 0x401ab0
mov ebx, dword [esp + 0x4c]
lea eax, [ebp + esi*2]
lea ecx, [esp + 0x120]
mov dword [esp + 4], ecx
lea edx, [ebx + ebx]
mov dword [esp], eax
add esi, ebx
mov dword [esp + 8], edx
call sub.msvcrt.dll_memcpy
lea edx, [ebp + esi*2]
xor eax, eax
mov word [edx], ax
lea eax, [esp + 0x120]
mov dword [esp + 0x14], eax
mov dword [esp + 0x10], 0x57973
mov dword [esp + 0xc], 0
mov dword [esp + 8], 4
mov dword [esp + 4], 0
mov dword [esp], 0xffffffff
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
sub esp, 0x18
mov ebx, eax
mov dword [esp + 0x38], eax
test eax, eax
je 0x401d06
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
je 0x401d0d
mov dword [esp], ebx
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 2
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
sub esp, 0x14
mov ebx, eax
test eax, eax
je 0x401736
mov dword [eax], 0x147
lea edi, [ebx + 0x40]
mov edx, dword [0x52a0e0]
mov esi, 0x52a0e0
mov dword [eax + 4], 0xb
and edi, 0xfffffffc
mov dword [eax + 8], 0x24
mov dword [eax + 0xc], 0xba
mov dword [eax + 0x10], 0x5787d
mov dword [eax + 0x14], 0x2144df1c
mov eax, dword [0x52a1a0]
mov dword [ebx + 0x3c], edx
mov edx, dword [0x52a196]
mov dword [ebx + 0x18], eax
mov eax, dword [0x52a1a4]
mov dword [ebx + 0xf2], edx
mov dword [ebx + 0x1c], eax
mov eax, dword [0x52a1a8]
mov dword [ebx + 0x20], eax
mov eax, dword [0x52a1ac]
mov dword [ebx + 0x24], eax
mov eax, dword [0x52a1b0]
mov dword [ebx + 0x28], eax
mov eax, dword [str.__DMRK_]
mov dword [ebx + 0x2c], eax
mov eax, dword [str.1_v_f9_br]
mov dword [ebx + 0x30], eax
mov eax, dword [0x52a1bc]
mov dword [ebx + 0x34], eax
mov eax, dword [0x52a1c0]
mov dword [ebx + 0x38], eax
lea eax, [ebx + 0x3c]
sub eax, edi
sub esi, eax
lea ecx, [eax + 0xba]
lea eax, [ebx + 0xf6]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov dword [esp + 8], 0x5787d
mov dword [esp + 4], str.TypFirmwareSECTPACK_DMRK_LZMA_SECT_F1e_
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
lea eax, [esp + 0x78]
mov dword [esp + 0x1c], 0
mov dword [esp + 0x24], eax
lea eax, [esp + 0xdc]
mov dword [esp + 0x20], eax
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], ebp
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CreateProcessW]
sub esp, 0x28
test eax, eax
jne 0x401d17
mov byte [esp + 0x3f], 0
mov eax, dword [esp + 0x78]
mov esi, dword [esp + 0x5c]
mov dword [esp], eax
call esi
sub esp, 4
mov eax, dword [esp + 0x7c]
mov dword [esp], eax
call esi
sub esp, 4
mov dword [esp], ebx
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
sub esp, 4
mov eax, dword [esp + 0x38]
mov dword [esp], eax
mov eax, dword [esp + 0x5c]
call eax
sub esp, 4
mov ebx, dword [esp + 0x44]
mov dword [esp], ebx
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
sub esp, 4
mov dword [esp], ebp
call fcn.004133a0
mov dword [esp], ebx
call fcn.004133a0
movzx eax, byte [esp + 0x3f]
add esp, 0x17c
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [esp + 0x54]
xor ebp, ebp
mov dword [esp + 0x5c], eax
jmp 0x40177b
mov ecx, dword [esp + 0x54]
mov edx, dword [esp + 0x40]
lea esi, [ecx + eax*2]
lea esi, [esi]
movzx edi, word [ecx]
add ecx, 2
add edx, 2
mov word [edx - 2], di
cmp esi, ecx
jne 0x401cf0
jmp 0x401a31
mov byte [esp + 0x3f], 0
jmp 0x401ca2
mov byte [esp + 0x3f], 0
jmp 0x401c92
mov eax, dword [esp + 0x78]
mov dword [esp + 4], 0xffffffff
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
sub esp, 8
lea eax, [esp + 0x68]
mov dword [esp + 0x68], 0
mov dword [esp + 4], eax
mov eax, dword [esp + 0x78]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_GetExitCodeProcess]
sub esp, 8
test eax, eax
je 0x401c65
mov eax, dword [esp + 0x198]
mov edx, dword [esp + 0x68]
mov dword [eax], edx
jmp 0x401c6a
mov edx, eax
xor esi, esi
jmp 0x401948
call fcn.00413980
mov esi, esi
lea edi, [edi]