Function at 0x401f40
Capabilities:
Compiled with py2exe
Extract resource via kernel32 functions
Query environment variable

Disassembly:
sub esp, 0x408
mov eax, dword [0x408004]
xor eax, esp
mov dword [esp + 0x404], eax
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push ebp
push esi
push edi
push 0x608
push 0x4097a0
push 0
call ebx
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x401f86
call esi
mov edx, str.Retrieving_module_name
mov ecx, eax
call fcn.00401d60
jmp 0x402005
mov ecx, 0x4097a0
lea edx, [ecx + 2]
nop
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x401f90
sub ecx, edx
sar ecx, 1
cmp ecx, 4
jbe 0x401fc4
push 4
push 0x4083c0
push 0x4097a0
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_wcsncmp]
add esp, 0xc
test eax, eax
jne 0x401fc4
mov eax, 1
jmp 0x401fc6
xor eax, eax
test eax, eax
mov edx, 0x4097a8
mov ecx, 0x4097a0
cmovne ecx, edx
mov edx, 0x408f60
sub edx, ecx
nop dword [eax]
movzx eax, word [ecx]
lea ecx, [ecx + 2]
mov word [edx + ecx - 2], ax
test ax, ax
jne 0x401fe0
push 0x5c
push 0x408f60
call dword [sym.imp.VCRUNTIME140.dll_wcsrchr]
add esp, 8
xor ecx, ecx
mov word [eax], cx
mov ebp, dword [sym.imp.KERNEL32.dll_FindResourceA]
push str.PYTHONSCRIPT
push 1
push 0
call ebp
mov edi, 0x400
test eax, eax
jne 0x402044
call esi
mov edx, str.Could_not_locate_script_resource:
mov ecx, eax
call fcn.00401d60
mov esi, dword [sym.imp.KERNEL32.dll_lstrlenA]
mov ebx, dword [sym.imp.USER32.dll_MessageBoxA]
mov ebp, dword [sym.imp.USER32.dll_GetFocus]
jmp 0x4020de
push eax
push 0
call dword [sym.imp.KERNEL32.dll_LoadResource]
test eax, eax
jne 0x40205a
call esi
mov edx, str.Could_not_load_script_resource:
jmp 0x402026
push eax
call dword [sym.imp.KERNEL32.dll_LockResource]
mov edx, eax
mov dword [0x408f48], edx
mov dword [0x409da8], edx
test edx, edx
jne 0x40207c
call esi
mov edx, str.Could_not_lock_script_resource:
jmp 0x402026
cmp dword [edx], 0x78563412
lea esi, [edx + 0x10]
mov eax, dword [edx + 0xc]
mov dword [0x408f44], eax
mov dword [0x408f48], esi
je 0x40214d
mov esi, dword [sym.imp.KERNEL32.dll_lstrlenA]
lea eax, [esp + 0x14]
push eax
mov byte [esp + 0x18], 0
call esi
mov ecx, edi
sub ecx, eax
push str.Bug:_Invalid_script_resource
push ecx
lea ecx, [esp + 0x1c]
add eax, ecx
push eax
call fcn.00401010
mov ebp, dword [sym.imp.USER32.dll_GetFocus]
lea eax, [esp + 0x20]
add esp, 0xc
push 0x10
push 0
push eax
call ebp
mov ebx, dword [sym.imp.USER32.dll_MessageBoxA]
push eax
call ebx
push 0
push 0
lea eax, [esp + 0x18]
push eax
push 0x400
push 0xffffffffffffffff
push 0
push 0x1100
call dword [sym.imp.KERNEL32.dll_FormatMessageA]
push 0x400
push dword [esp + 0x14]
lea eax, [esp + 0x1c]
push eax
call dword [sym.imp.api_ms_win_crt_string_l1_1_0.dll_strncpy]
add esp, 0xc
push dword [esp + 0x10]
call dword [sym.imp.KERNEL32.dll_LocalFree]
lea eax, [esp + 0x14]
push eax
call esi
sub edi, eax
lea ecx, [esp + 0x14]
push str.FATAL_ERROR:_Could_not_locate_script
add eax, ecx
push edi
push eax
call fcn.00401010
add esp, 0xc
lea eax, [esp + 0x14]
push 0x10
push 0
push eax
call ebp
push eax
call ebx
jmp 0x4024cb
mov ecx, esi
lea edi, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x402152
sub ecx, edi
lea eax, [edx + 0x11]
add eax, ecx
cmp byte [esi], 0
mov dword [0x408f48], eax
je 0x402189
push esi
push 0x408f60
push str._s_S
push 0x608
push 0x409180
call fcn.00401050
add esp, 0x14
jmp 0x402197
push 0x608
push 0x409180
push 0
call ebx
push 2
push 0
push 0x409180
call dword [sym.imp.KERNEL32.dll_LoadLibraryExW]
push 0x408238
mov edi, eax
push 1
push edi
call ebp
mov ebx, eax
test ebx, ebx
je 0x402203
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_LoadResource]
push ebx
push edi
mov esi, eax
call dword [sym.imp.KERNEL32.dll_SizeofResource]
push esi
mov ebx, eax
call dword [sym.imp.KERNEL32.dll_LockResource]
test eax, eax
je 0x4021fc
push 0
sub esp, 0x14
mov edx, ebx
mov ecx, eax
call fcn.00403000
add esp, 0x18
test eax, eax
je 0x4021fc
mov edx, eax
mov ecx, 0x408228
call fcn.00403fc0
mov ebp, dword [eax]
jmp 0x402210
push 0x408228
jmp 0x402208
push 0x408218
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov ebp, eax
push edi
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
test ebp, ebp
jne 0x402225
mov edx, str.FATAL_ERROR:_Could_not_load_python_library
jmp 0x4024c3
mov edx, 0x40869c
mov dword [0x408ed0], ebp
mov ecx, ebp
call fcn.004040b0
mov eax, dword [eax]
mov dword [sym.run_w_py3.6_win32.exe_PyExc_SystemError], eax
test eax, eax
je 0x4024be
mov edx, 0x408688
mov ecx, ebp
call fcn.004040b0
mov eax, dword [eax]
mov dword [sym.run_w_py3.6_win32.exe_PyExc_ImportError], eax
test eax, eax
je 0x4024be
mov edx, 0x40862c
mov ecx, ebp
call fcn.004040b0
mov eax, dword [eax]
mov dword [sym.run_w_py3.6_win32.exe_PyExc_RuntimeError], eax
test eax, eax
je 0x4024be
mov eax, dword [0x409da8]
cmp dword [eax + 8], 0
je 0x40231c
mov ebx, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
push 0x8000
push 0
call ebx
mov edi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__fileno]
push eax
call edi
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__setmode]
add esp, 8
push eax
call esi
add esp, 8
push 0x8000
push 1
call ebx
push eax
call edi
add esp, 8
push eax
call esi
add esp, 8
push 0
push 4
push 0
push 0
call ebx
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_setvbuf]
add esp, 4
push eax
call esi
add esp, 0x10
push 0
push 4
push 0
push 1
call ebx
add esp, 4
push eax
call esi
add esp, 0x10
push 0
push 4
push 0
push 2
call ebx
add esp, 4
push eax
call esi
add esp, 0x10
mov edx, 0x4082dc
mov ecx, ebp
call fcn.004040b0
test eax, eax
je 0x40231c
mov dword [eax], 1
mov edx, 0x4082cc
mov ecx, ebp
call fcn.004040b0
test eax, eax
je 0x402332
mov dword [eax], 1
mov edx, 0x4082bc
mov ecx, ebp
call fcn.004040b0
test eax, eax
je 0x402348
mov dword [eax], 1
mov edx, 0x4082a0
mov ecx, ebp
call fcn.004040b0
test eax, eax
je 0x40235e
mov dword [eax], 1
mov edx, 0x408288
mov ecx, ebp
call fcn.004040b0
test eax, eax
je 0x402374
mov dword [eax], 1
mov edx, 0x408278
mov ecx, ebp
call fcn.004040b0
test eax, eax
je 0x40238f
mov ecx, dword [0x409da8]
mov ecx, dword [ecx + 4]
mov dword [eax], ecx
mov edx, 0x408268
mov ecx, ebp
call fcn.004040b0
mov esi, eax
test esi, esi
je 0x4023d0
mov edi, dword [sym.imp.api_ms_win_crt_environment_l1_1_0.dll_getenv]
push str.PY2EXE_VERBOSE
call edi
add esp, 4
test eax, eax
je 0x4023ca
push 0x408248
call edi
push eax
call dword [sym.imp.api_ms_win_crt_convert_l1_1_0.dll_atoi]
add esp, 8
mov dword [esi], eax
jmp 0x4023d0
mov dword [esi], 0
mov eax, dword [0x408e80]
test eax, eax
jne 0x4023ee
mov ecx, dword [0x408ed0]
mov edx, 0x4088c8
call fcn.004040b0
mov dword [0x408e80], eax
push 0x404820
push str._memimporter
call eax
mov eax, dword [0x408ec4]
add esp, 8
test eax, eax
jne 0x40241b
mov ecx, dword [0x408ed0]
mov edx, 0x40896c
call fcn.004040b0
mov dword [0x408ec4], eax
push 0x4097a0
call eax
mov eax, dword [0x408ee4]
add esp, 4
test eax, eax
jne 0x402443
mov ecx, dword [0x408ed0]
mov edx, 0x4089c4
call fcn.004040b0
mov dword [0x408ee4], eax
push 0x409180
call eax
mov eax, dword [0x408eec]
add esp, 4
test eax, eax
jne 0x40246b
mov ecx, dword [0x408ed0]
mov edx, 0x4089a8
call fcn.004040b0
mov dword [0x408eec], eax
call eax
mov eax, dword [0x408ecc]
test eax, eax
jne 0x40248b
mov ecx, dword [0x408ed0]
mov edx, 0x4087c0
call fcn.004040b0
mov dword [0x408ecc], eax
push str.windows_exe
call eax
mov esi, eax
add esp, 4
test esi, esi
je 0x4024ba
push esi
push 0x40817c
call sym.run_w_py3.6_win32.exe_PySys_SetObject
add esp, 8
add dword [esi], 0xffffffff
jne 0x4024ba
mov eax, dword [esi + 4]
push esi
mov eax, dword [eax + 0x18]
call eax
add esp, 4
xor eax, eax
jmp 0x4024ce
mov edx, str.FATAL_ERROR:_Failed_to_load_some_Python_symbols
or ecx, 0xffffffff
call fcn.00401d60
or eax, 0xffffffff
mov ecx, dword [esp + 0x414]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00401083
add esp, 0x408
ret