Function at 0x40c570
Capabilities:
Query environment variable
Set current directory
Set environment variable

Disassembly:
mov eax, dword [0x4231c8]
test eax, eax
je 0x40c780
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x238
mov ecx, dword [0x434584]
mov dword [ebp - 0x228], ecx
test ecx, ecx
je 0x40c5a1
mov eax, dword [eax + 4]
cmp dword [ecx + 0xc], eax
je 0x40c5b0
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [ecx]
mov dword [0x434584], eax
call dword [sym.imp.kernel32.dll_GetEnvironmentStringsW]
mov dword [ebp - 0x22c], eax
test eax, eax
je sym._WCMD_endlocal.cold
call sym._WCMD_dupenv.part.0
cmp word [eax], 0
mov dword [ebp - 0x220], eax
je 0x40c65b
mov edx, dword [sym.imp.ucrtbase.dll_wcschr]
mov edi, dword [ebp - 0x220]
xor esi, esi
xor eax, eax
mov dword [ebp - 0x224], edx
lea esi, [esi]
mov ebx, edi
lea esi, [esi]
add ebx, 2
cmp word [ebx], 0
jne 0x40c600
mov ecx, dword [ebp - 0x220]
sub ebx, edi
mov dword [esp + 4], 0x3d
sar ebx, 1
lea eax, [ecx + eax*2 + 2]
inc ebx
mov dword [esp], eax
mov eax, dword [ebp - 0x224]
call eax
test eax, eax
je 0x40c648
xor ecx, ecx
mov word [eax], cx
mov dword [esp + 4], 0
mov dword [esp], edi
call dword [sym.imp.kernel32.dll_SetEnvironmentVariableW]
sub esp, 8
mov edx, dword [ebp - 0x220]
add esi, ebx
mov eax, esi
lea edi, [edx + esi*2]
cmp word [edi], 0
jne 0x40c5f8
mov eax, dword [ebp - 0x220]
mov dword [esp], eax
mov eax, dword [sym.imp.kernel32.dll_LocalFree]
mov dword [ebp - 0x230], eax
call eax
mov eax, dword [ebp - 0x22c]
sub esp, 4
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_FreeEnvironmentStringsW]
mov eax, dword [ebp - 0x228]
sub esp, 4
mov edx, dword [eax + 8]
mov eax, dword [eax + 0x10]
mov dword [ebp - 0x220], edx
mov dword [0x42332c], eax
test byte [0x423010], 8
jne 0x40c781
mov eax, dword [ebp - 0x220]
cmp word [eax], 0
je 0x40c733
mov edx, dword [sym.imp.ucrtbase.dll_wcschr]
mov edi, dword [ebp - 0x220]
xor esi, esi
xor eax, eax
mov dword [ebp - 0x224], edx
lea esi, [esi]
mov ebx, edi
lea esi, [esi]
add ebx, 2
cmp word [ebx], 0
jne 0x40c6d8
mov ecx, dword [ebp - 0x220]
sub ebx, edi
mov dword [esp + 4], 0x3d
sar ebx, 1
lea eax, [ecx + eax*2 + 2]
inc ebx
mov dword [esp], eax
mov eax, dword [ebp - 0x224]
call eax
test eax, eax
je 0x40c720
xor edx, edx
add eax, 2
mov word [eax - 2], dx
mov dword [esp + 4], eax
mov dword [esp], edi
call dword [sym.imp.kernel32.dll_SetEnvironmentVariableW]
sub esp, 8
mov edx, dword [ebp - 0x220]
add esi, ebx
mov eax, esi
lea edi, [edx + esi*2]
cmp word [edi], 0
jne 0x40c6d0
mov eax, dword [ebp - 0x228]
movzx eax, word [eax + 4]
mov dword [esp], eax
call dword [sym.imp.user32.dll_IsCharAlphaW]
sub esp, 4
test eax, eax
jne 0x40c7ae
mov eax, dword [ebp - 0x220]
mov esi, dword [ebp - 0x230]
mov dword [esp], eax
call esi
mov eax, dword [ebp - 0x228]
sub esp, 4
mov dword [esp], eax
call esi
sub esp, 4
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
ret
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.Delayed_expansion_now__d_n
mov dword [esp + 8], str.WCMD_endlocal
mov dword [esp + 4], 0x423010
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0_1
jmp 0x40c6aa
mov eax, dword [ebp - 0x228]
lea edx, [ebp - 0x21c]
lea ebx, [ebp - 0x214]
movzx eax, word [eax + 4]
mov dword [esp], edx
mov dword [esp + 4], 0x4366a0
mov dword [esp + 8], eax
call dword [sym.imp.user32.dll_wsprintfW]
lea edx, [ebp - 0x21c]
mov dword [esp + 4], ebx
mov dword [esp + 8], 0x104
mov dword [esp], edx
call dword [sym.imp.kernel32.dll_GetEnvironmentVariableW]
sub esp, 0xc
test eax, eax
je 0x40c74d
test byte [0x423010], 8
jne 0x40c819
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_SetCurrentDirectoryW]
sub esp, 4
jmp 0x40c74d
mov eax, ebx
shr eax, 0x10
je 0x40c870
mov dword [esp + 4], 0xffffffff
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_IsBadStringPtrW]
mov edx, eax
sub esp, 8
mov eax, 0x4350cb
test edx, edx
jne 0x40c846
mov eax, ebx
call sym._wine_dbgstr_wn.part.0.constprop.0
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.Resetting_cwd_to__s_n
mov dword [esp + 8], str.WCMD_endlocal
mov dword [esp + 4], 0x423010
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0_1
jmp 0x40c808
movzx eax, bx
mov dword [esp], 0x4350be
mov dword [esp + 4], eax
call sym._wine_dbg_sprintf.constprop.0_1
jmp 0x40c846