Function at 0x401e40
Capabilities:
Accept command line arguments
Access peb ldr_data
Check for peb beingdebugged flag
Create process on windows
Get file size
Get kernel32 base address
Get process heap flags
Query environment variable
Read file on windows

Disassembly:
lea ecx, [esp + 4]
and esp, 0xfffffff8
push dword [ecx - 4]
push ebp
mov ebp, esp
push edi
push esi
lea edi, [ebp - 0x66c]
push ebx
push ecx
sub esp, 0x6e8
mov eax, dword [ecx + 8]
mov ecx, 0x11
mov byte [ebp - 0x695], 3
mov dword [ebp - 0x6ac], eax
xor eax, eax
rep stosd dword es:[edi], eax
lea eax, [ebp - 0x695]
mov dword [esp], 1
mov dword [esp + 4], eax
mov eax, dword [sym.imp.ucrtbase.dll__write]
mov dword [esp + 8], 1
mov dword [ebp - 0x6a0], eax
call eax
xor ecx, ecx
lea eax, [ebp - 0x628]
mov dword [esp + 8], 0x104
mov word [ebp - 0x628], cx
mov dword [esp + 4], eax
mov dword [esp], str.PROTON_ORIG_LAUNCHER_NAME
call dword [sym.imp.kernel32.dll_GetEnvironmentVariableW]
mov dword [ebp - 0x690], eax
dec eax
sub esp, 0xc
cmp eax, 0x103
jbe 0x402150
lea eax, [ebp - 0x628]
lea ebx, [ebp - 0x420]
mov dword [esp + 4], eax
mov eax, dword [sym.imp.ucrtbase.dll_wcscpy]
mov dword [esp], ebx
mov dword [ebp - 0x6b0], eax
call eax
mov dword [esp], ebx
mov dword [esp + 4], str.BattleyeBELauncher.ini
call dword [sym.imp.ucrtbase.dll_wcscat]
mov dword [esp], ebx
mov esi, dword [sym.imp.kernel32.dll_CreateFileW]
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], pe_nt_image_headers32
mov dword [esp + 0x10], 3
mov dword [esp + 0xc], 0
mov dword [esp + 8], 1
mov dword [esp + 4], 0x80000000
call esi
sub esp, 0x1c
mov ebx, eax
cmp eax, 0xffffffff
je 0x4020c0
lea eax, [ebp - 0x688]
mov dword [esp], ebx
mov dword [esp + 4], eax
call dword [sym.imp.kernel32.dll_GetFileSizeEx]
sub esp, 8
test eax, eax
je 0x401f81
mov eax, dword [ebp - 0x684]
mov dword [ebp - 0x69c], eax
test eax, eax
je 0x402000
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_CloseHandle]
sub esp, 4
test byte [section..data], 2
je 0x401fba
mov dword [esp + 0xc], str.Failed._n
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call sym._wine_dbg_log.constprop.0
lea eax, [ebp - 0x695]
mov byte [ebp - 0x695], 4
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x6a0]
mov dword [esp + 8], 1
mov dword [esp], 1
call eax
mov dword [ebp - 0x69c], 0
mov eax, dword [ebp - 0x69c]
lea esp, [ebp - 0x10]
pop ecx
pop ebx
pop esi
pop edi
pop ebp
lea esp, [ecx - 4]
ret 0x10
mov edx, dword [ebp - 0x688]
mov dword [esp + 4], 0
mov eax, dword fs:[0x18]
mov dword [esp + 8], edx
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
mov eax, dword [sym.imp.kernel32.dll_HeapAlloc]
mov dword [ebp - 0x6b8], eax
call eax
sub esp, 0xc
mov dword [ebp - 0x6b4], eax
mov edi, eax
lea eax, [ebp - 0x690]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x688]
mov dword [esp + 0x10], 0
mov dword [esp + 8], eax
mov dword [esp + 4], edi
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_ReadFile]
sub esp, 0x14
test eax, eax
je 0x40207b
mov eax, dword [ebp - 0x690]
cmp dword [ebp - 0x688], eax
je 0x4021e0
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_CloseHandle]
mov esi, dword [ebp - 0x6b4]
sub esp, 4
mov dword [esp + 8], esi
mov dword [esp + 4], 0
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapFree]
sub esp, 0xc
jmp 0x401f8d
xor eax, eax
mov dword [esp + 0x18], 0
mov word [ebp - 0x628], ax
mov dword [esp + 0x14], pe_nt_image_headers32
mov dword [esp + 0x10], 3
mov dword [esp + 0xc], 0
mov dword [esp + 8], 1
mov dword [esp + 4], 0x80000000
mov dword [esp], str.BattleyeBELauncher.ini
call esi
sub esp, 0x1c
mov ebx, eax
cmp eax, 0xffffffff
jne 0x401f53
test byte [section..data], 2
je 0x401fba
mov dword [esp + 0xc], str.BELauncher.ini_not_found._n
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call sym._wine_dbg_log.constprop.0
jmp 0x401f8d
test byte [section..data], 8
jne 0x4021a8
lea eax, [ebp - 0x628]
lea esi, [ebp - 0x628]
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_wcslen]
lea eax, [ebp + eax*2 - 0x628]
cmp eax, esi
jne 0x402191
jmp 0x402600
sub eax, 2
lea edx, [ebp - 0x628]
cmp eax, edx
je 0x402600
cmp word [eax], 0x5c
jne 0x402180
add eax, 2
xor edx, edx
mov word [eax], dx
jmp 0x401ed9
lea eax, [ebp - 0x628]
call sym._wine_dbgstr_wn.constprop.0
mov dword [esp + 0xc], str.PROTON_ORIG_LAUNCHER_NAME__s._n
mov dword [esp + 0x10], eax
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x402159
mov eax, dword [sym.imp.kernel32.dll_CloseHandle]
mov dword [esp], ebx
xor ebx, ebx
mov dword [ebp - 0x6d0], eax
call eax
mov edx, dword [ebp - 0x6b4]
mov dword [ebp - 0x6a4], 0
mov dword [ebp - 0x6a8], 0
sub esp, 4
jmp 0x402220
cmp byte [eax], 0
lea edx, [eax + 1]
je 0x40229d
mov ecx, 9
mov esi, edx
lea eax, [edx + 9]
mov edi, str.32BitExe
repe cmpsb byte [esi], byte es:[edi]
mov esi, edx
mov edi, str.64BitExe
seta cl
sbb cl, 0
test cl, cl
mov ecx, 9
cmove ebx, eax
repe cmpsb byte [esi], byte es:[edi]
mov esi, edx
mov edi, str.BEArg
seta cl
sbb cl, 0
test cl, cl
mov ecx, 6
cmovne eax, dword [ebp - 0x6a8]
repe cmpsb byte [esi], byte es:[edi]
lea ecx, [edx + 6]
mov dword [esp + 4], 0xa
mov dword [ebp - 0x6a8], eax
mov dword [esp], edx
seta al
sbb al, 0
test al, al
cmovne ecx, dword [ebp - 0x6a4]
mov dword [ebp - 0x6a4], ecx
call dword [sym.imp.ucrtbase.dll_strchr]
test eax, eax
jne 0x402218
xor eax, eax
mov word [ebp - 0x218], ax
lea eax, [ebp - 0x694]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x6ac]
mov dword [esp], eax
call dword [sym.imp.shcore.dll_CommandLineToArgvW]
sub esp, 8
mov esi, eax
test eax, eax
je 0x402306
mov edi, dword [ebp - 0x694]
test edi, edi
jle 0x402306
xor edi, edi
lea esi, [esi]
mov dword [esp + 4], str._exe
mov eax, dword [esi + edi*4]
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_wcscmp]
test eax, eax
mov eax, dword [ebp - 0x694]
jne 0x402301
lea edx, [eax - 1]
cmp edx, edi
jg 0x402967
inc edi
cmp edi, eax
jl 0x4022d8
mov dword [ebp - 0x6bc], 0
cmp word [ebp - 0x218], 0
je 0x402620
mov eax, dword [sym.imp.kernel32.dll_MultiByteToWideChar]
xor ebx, ebx
lea edi, [ebp - 0x218]
mov dword [ebp - 0x6c4], eax
mov eax, dword [ebp - 0x6a4]
test eax, eax
je 0x40294e
mov dword [esp + 4], 0xd
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_strchr]
test eax, eax
je 0x402357
mov byte [eax], 0
mov eax, dword [ebp - 0x6a4]
mov dword [esp + 4], 0xa
mov dword [esp], eax
call dword [sym.imp.ucrtbase.dll_strchr]
test eax, eax
je 0x402375
mov byte [eax], 0
mov eax, dword [ebp - 0x6a4]
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x6c4]
mov dword [esp + 0xc], 0xffffffff
mov dword [esp + 4], 0
mov dword [esp], 0
call eax
mov dword [ebp - 0x6c8], eax
add eax, 2
sub esp, 0x18
mov dword [ebp - 0x6cc], eax
test byte [section..data], 8
jne 0x402921
lea eax, [ebp - 0x695]
mov dword [esp + 8], 1
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x6a0]
mov dword [esp], 1
mov byte [ebp - 0x695], 9
call eax
mov dword [esp], edi
call dword [sym.imp.shlwapi.dll_PathIsRelativeW]
sub esp, 4
test eax, eax
jne 0x4028ef
mov eax, dword [ebp - 0x6bc]
mov ebx, dword [sym.imp.ucrtbase.dll_wcslen]
xor esi, esi
mov dword [ebp - 0x6a8], eax
mov dword [ebp - 0x6b4], ebx
mov dword [ebp - 0x6c0], eax
mov eax, dword [ebp - 0x6ac]
mov ebx, dword [ebp - 0x6b4]
mov dword [esp], eax
call ebx
add eax, dword [ebp - 0x6cc]
add eax, dword [ebp - 0x6a8]
mov dword [esp + 4], 0
add eax, eax
mov ecx, dword [ebp - 0x6b8]
mov edx, dword fs:[0x18]
mov dword [esp + 8], eax
mov eax, dword [edx + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call ecx
lea ecx, [ebp - 0x628]
sub esp, 0xc
mov ebx, eax
mov dword [esp + 8], esi
add esi, ebx
mov dword [esp + 4], ecx
mov dword [esp], eax
call sym._memcpy
mov ecx, dword [ebp - 0x6bc]
mov dword [esp], esi
mov dword [esp + 4], edi
add ecx, ecx
mov dword [esp + 8], ecx
call sym._memcpy
mov edx, dword [ebp - 0x6a8]
mov ecx, 0x20
mov esi, dword [ebp - 0x6ac]
mov word [ebx + edx*2], cx
mov ecx, dword [ebp - 0x6c0]
mov dword [esp + 4], esi
lea eax, [ebx + ecx*2 + 2]
mov dword [esp], eax
mov eax, dword [ebp - 0x6b0]
call eax
mov dword [esp], esi
mov eax, dword [ebp - 0x6b4]
call eax
mov edx, dword [ebp - 0x6a8]
lea eax, [edx + eax + 1]
mov edx, 0x20
mov word [ebx + eax*2], dx
mov eax, dword [ebp - 0x6b4]
mov dword [esp], esi
call eax
mov ecx, dword [ebp - 0x6c0]
mov esi, dword [ebp - 0x6c8]
mov dword [esp + 0xc], 0xffffffff
mov dword [esp + 4], 0
lea eax, [ecx + eax + 2]
mov dword [esp + 0x14], esi
lea eax, [ebx + eax*2]
mov dword [esp], 0
mov dword [esp + 0x10], eax
mov eax, dword [ebp - 0x6a4]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x6c4]
call eax
sub esp, 0x18
test eax, eax
je 0x4028c9
test byte [section..data], 8
jne 0x4027f7
lea eax, [ebp - 0x67c]
mov dword [esp + 0x1c], 0
mov dword [esp + 0x24], eax
lea eax, [ebp - 0x66c]
mov dword [esp + 0x20], eax
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], 0x10
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], ebx
mov dword [esp], 0
call dword [sym.imp.kernel32.dll_CreateProcessW]
sub esp, 0x28
test eax, eax
jne 0x4027a0
test byte [section..data], 2
jne 0x402994
lea eax, [ebp - 0x695]
mov byte [ebp - 0x695], 0xa
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x6a0]
mov dword [esp + 8], 1
mov dword [esp], 1
call eax
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x34]
mov dword [ebp - 0x69c], eax
jmp 0x401fec
cmp word [ebp - 0x628], 0x5c
lea eax, [ebp - 0x628]
jne 0x40219a
jmp 0x402197
mov esi, dword [ebp - 0x6a8]
test esi, esi
je 0x402730
lea eax, [ebp - 0x68c]
mov dword [esp], 0xffffffff
mov dword [esp + 4], eax
call dword [sym.imp.kernel32.dll_IsWow64Process]
sub esp, 8
test eax, eax
je 0x402730
mov ecx, dword [ebp - 0x68c]
test ecx, ecx
je 0x402730
mov ebx, dword [ebp - 0x6a8]
lea esi, [esi]
mov dword [esp + 4], 0xd
mov dword [esp], ebx
call dword [sym.imp.ucrtbase.dll_strchr]
test eax, eax
je 0x402680
mov byte [eax], 0
mov dword [esp + 4], 0xa
mov dword [esp], ebx
call dword [sym.imp.ucrtbase.dll_strchr]
test eax, eax
je 0x402698
mov byte [eax], 0
mov eax, dword [sym.imp.kernel32.dll_MultiByteToWideChar]
lea edi, [ebp - 0x218]
mov dword [esp + 8], ebx
mov dword [esp + 0x14], 0x104
mov dword [esp + 0x10], edi
mov dword [esp + 0xc], 0xffffffff
mov dword [esp + 4], 0
mov dword [esp], 0
mov dword [ebp - 0x6c4], eax
call eax
lea edx, [eax - 1]
sub esp, 0x18
mov dword [ebp - 0x6bc], edx
test eax, eax
jne 0x402331
test byte [section..data], 2
je 0x401fba
mov eax, ebx
call sym._wine_dbgstr_an.constprop.0
mov dword [esp + 0xc], str.Failed_to_convert_game_exe__s._n
mov dword [esp + 0x10], eax
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call sym._wine_dbg_log.constprop.0
jmp 0x401f8d
test ebx, ebx
jne 0x402668
mov edi, dword [ebp - 0x6b4]
mov dword [esp + 4], 0
mov eax, dword fs:[0x18]
mov dword [esp + 8], edi
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapFree]
sub esp, 0xc
test byte [section..data], 2
je 0x401fba
mov dword [esp + 0xc], str.Failed_to_find_game_executable_name_from_BattlEye_config._n
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call sym._wine_dbg_log.constprop.0
jmp 0x401f8d
mov dword [esp + 8], ebx
mov dword [esp + 4], 0
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x30]
mov eax, dword [eax + 0x18]
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_HeapFree]
mov eax, dword [ebp - 0x67c]
sub esp, 0xc
mov dword [esp + 4], 0xffffffff
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_WaitForSingleObject]
mov eax, dword [ebp - 0x67c]
sub esp, 8
mov dword [esp], eax
mov eax, dword [ebp - 0x6d0]
call eax
sub esp, 4
jmp 0x401fec
mov eax, dword [ebp - 0x6ac]
call sym._wine_dbgstr_wn.constprop.0
mov esi, eax
mov eax, edi
call sym._wine_dbgstr_wn.constprop.0
mov dword [esp + 0x14], esi
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.game_exe__s__cmdline__s._n
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
test byte [section..data], 8
je 0x402554
mov eax, dword [ebp - 0x6a4]
call sym._wine_dbgstr_an.constprop.0
mov esi, eax
lea eax, [ebp - 0x628]
call sym._wine_dbgstr_wn.constprop.0
mov dword [esp + 0x14], esi
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.path__s__be_arg__s._n
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
test byte [section..data], 8
je 0x402554
mov eax, ebx
call sym._wine_dbgstr_wn.constprop.0
mov dword [esp + 0xc], str.launch_cmd__s._n
mov dword [esp + 0x10], eax
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x402554
mov eax, dword [ebp - 0x6ac]
mov dword [esp], eax
mov eax, dword [ebp - 0x6b4]
call eax
mov esi, dword [ebp - 0x6a8]
xor edx, edx
lea eax, [esi + eax + 1]
mov word [ebx + eax*2], dx
jmp 0x402547
lea eax, [ebp - 0x628]
mov dword [esp], eax
mov eax, dword [sym.imp.ucrtbase.dll_wcslen]
mov dword [ebp - 0x6b4], eax
call eax
mov ebx, dword [ebp - 0x6bc]
lea esi, [eax + eax]
add ebx, eax
mov dword [ebp - 0x6c0], ebx
mov dword [ebp - 0x6a8], ebx
jmp 0x402429
mov dword [esp + 0x10], ebx
mov dword [esp + 0xc], str.Launching_game_executable__s_for_BattlEye._n
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x4023cd
mov dword [ebp - 0x6cc], 3
mov dword [ebp - 0x6c8], 1
jmp 0x4023c0
mov eax, dword [esi + edi*4 + 4]
lea edi, [ebp - 0x218]
mov dword [esp], edi
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x6b0]
call eax
mov dword [esp], edi
call dword [sym.imp.ucrtbase.dll_wcslen]
mov dword [ebp - 0x6bc], eax
jmp 0x402310
mov dword [esp + 0xc], str.CreateProcessW_failed._n
mov dword [esp + 8], str.wWinMain
mov dword [esp + 4], 0x404000
mov dword [esp], 1
call sym._wine_dbg_log.constprop.0
jmp 0x4025c1