Function at 0x401e5e
Capabilities:
Check if file exists
Get file attributes
Get file size
Query environment variable
Set environment variable
Set file attributes

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffff7fc
pushal
mov dword [ebp - 0x804], 0
mov byte [0x406bc5], 0
push 0x400
push 0x4063ac
push dword [ebp + 8]
call sub.kernel32.dll_ExpandEnvironmentStringsA
mov esi, 0x4063ac
jmp 0x401eae
lodsb al, byte [esi]
cmp al, 0x25
jne 0x401eae
push 0x4063ac
call fcn.00404900
push eax
push 0x4063ac
call sub.kernel32.dll_lstrcpyA
jmp 0x401eb3
cmp byte [esi], 0
jne 0x401e92
push 0x4063ac
call sub.kernel32.dll_GetFileAttributesA
mov dword [0x406bac], eax
test eax, 1
je 0x401ed7
xor eax, 1
push eax
push 0x4063ac
call sub.kernel32.dll_SetFileAttributesA
push 0x4063ac
call fcn.00401d27
push 0
push 0x82
push 3
push 0
push 2
push 0xc0000000
push 0x4063ac
call sub.kernel32.dll_CreateFileA
cmp eax, 0xffffffff
jne 0x402081
cmp byte [0x406feb], 0
jne 0x40207c
push 0x4063ac
call sub.kernel32.dll_GetFileAttributesA
cmp eax, 0xffffffff
jne 0x401ff4
push 0x4063ac
call fcn.00404900
cmp word [eax], 0x2e2a
je 0x401f74
cmp word [eax], 0
je 0x401f74
push 0x400
push 0x407810
push 0x10
push dword [0x406342]
call sub.user32.dll_LoadStringA
push 0x34
push 0x4063ac
push 0x407810
push dword [0x406346]
call sub.user32.dll_MessageBoxA
cmp eax, 6
jne 0x40207c
lea esi, [ebp - 0x400]
mov edi, 0x4063ac
cmp byte [edi + 1], 0x3a
jne 0x401f8d
push edi
call fcn.00404900
mov edi, eax
push edi
push esi
call sub.kernel32.dll_lstrcpyA
push esi
call sub.kernel32.dll_lstrlenA
cmp eax, 0
jbe 0x401fa0
inc eax
push esi
push eax
add esi, eax
push edi
push esi
call sub.kernel32.dll_lstrcpyA
pop eax
add esi, eax
push 0x2e
push str.Exe
push esi
call sub.kernel32.dll_RtlMoveMemory
pop esi
lea ebx, [ebp - 0x800]
push 0x4063ac
push ebx
call sub.kernel32.dll_lstrcpyA
push ebx
call fcn.00401c90
push dword [0x406346]
push ebx
push esi
push 0x4063ac
call fcn.004048a0
cmp eax, 1
jne 0x401fef
jmp 0x401eb3
jmp 0x40207c
test dword [ebp + 0x10], 2
je 0x402044
cmp byte [0x406bc5], 0
jne 0x40207c
push 0x4063ac
call fcn.00401e0c
cmp eax, 1
jne 0x402042
mov byte [0x406bc5], 1
push 0x400
push 0x407c10
push 0x11
push dword [0x406342]
call sub.user32.dll_LoadStringA
push 0x407c10
call fcn.00401ce6
jmp 0x401eb3
jmp 0x40207c
push 0x400
push 0x408010
push 0x12
push dword [0x406342]
call sub.user32.dll_LoadStringA
push 0x34
push 0x4063ac
push 0x408010
push dword [0x406346]
call sub.user32.dll_MessageBoxA
cmp eax, 6
jne 0x40207c
jmp 0x401eb3
jmp 0x40216a
mov dword [0x406bb0], eax
push 0x400
push 0x408410
push 0x13
push dword [0x406342]
call sub.user32.dll_LoadStringA
push 0x408410
call fcn.00401ce6
push 0x4063ac
call fcn.00401ce6
push 0
push dword [0x406bb0]
call sub.kernel32.dll_GetFileSize
mov dword [0x406bb4], eax
cmp dword [ebp + 0xc], 0
jne 0x4020cc
mov dword [ebp + 0xc], eax
test dword [ebp + 0x10], 4
je 0x4020ee
add eax, 0x237
add eax, dword [0x406320]
push 0x100
push eax
call fcn.00404940
mov dword [ebp + 0xc], eax
push dword [ebp + 0xc]
pop dword [0x406bc0]
push 0
push dword [0x406bc0]
push 0
push 4
push 0
push dword [0x406bb0]
call sub.kernel32.dll_CreateFileMappingA
or eax, eax
jne 0x402137
push 0x400
push 0x408810
push 0x14
push dword [0x406342]
call sub.user32.dll_LoadStringA
push 0x408810
call fcn.00401ce6
jmp 0x40216a
mov dword [0x406bbc], eax
push 0
push 0
push 0
push 2
push eax
call sub.kernel32.dll_MapViewOfFile
or eax, eax
jne 0x402150
jmp 0x402114
mov dword [0x406bb8], eax
mov dword [ebp - 0x804], eax
push 0x4063ac
push str.dup2_last_file
call sub.kernel32.dll_SetEnvironmentVariableA
popal
mov eax, dword [ebp - 0x804]
leave
ret 0xc