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

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
sub esp, 0x21c
mov eax, dword [0x4162bc]
mov eax, dword [eax]
test eax, eax
je 0x409541
mov esi, dword [0x421074]
test esi, esi
je 0x409541
mov ecx, dword [esi + 0xc]
cmp ecx, dword [eax + 4]
jne 0x409541
mov eax, dword [esi]
mov dword [0x421074], eax
call dword [sym.imp.kernel32.dll_GetEnvironmentStringsW]
test eax, eax
mov dword [ebp - 0x14], esi
mov dword [ebp - 0x18], eax
je 0x409323
mov edi, eax
cmp word [eax], 0
je 0x409327
xor ebx, ebx
mov eax, edi
nop dword [eax + eax]
xor ecx, ecx
nop word cs:[eax + eax]
cmp word [eax + ecx + 2], 0
lea ecx, [ecx + 2]
jne 0x409300
sar ecx, 1
lea edx, [ebx + ecx]
add ebx, ecx
inc ebx
lea eax, [edi + edx*2]
add eax, 2
cmp word [edi + edx*2 + 2], 0
jne 0x4092f0
jmp 0x409329
xor esi, esi
jmp 0x409382
xor ebx, ebx
lea eax, [ebx*2 + 2]
push eax
push 0
call dword [sym.imp.kernel32.dll_LocalAlloc]
test eax, eax
je 0x409355
mov esi, eax
lea eax, [ebx + ebx]
push eax
push edi
push esi
call sym._memcpy
add esp, 0xc
mov word [esi + ebx*2], 0
jmp 0x409382
xor esi, esi
test byte [0x41d010], 2
je 0x409382
sub esp, 0x10
mov dword [esp + 0xc], str.out_of_memory_n
mov dword [esp + 8], str.WCMD_dupenv
mov dword [esp], 1
call sym._wine_dbg_log_1
add esp, 0x10
cmp word [esi], 0
je 0x4093ee
xor ebx, ebx
mov edi, esi
mov dword [ebp - 0x10], esi
jmp 0x4093b9
sar esi, 1
lea eax, [ebx + esi]
add ebx, esi
inc ebx
mov esi, dword [ebp - 0x10]
lea edi, [esi + eax*2]
add edi, 2
cmp word [esi + eax*2 + 2], 0
je 0x4093ee
xor esi, esi
nop dword [eax + eax]
cmp word [edi + esi + 2], 0
lea esi, [esi + 2]
jne 0x4093c0
lea eax, [edi + 2]
push 0x3d
push eax
call dword [sym.imp.ucrtbase.dll_wcschr]
add esp, 8
test eax, eax
je 0x4093a0
mov word [eax], 0
push 0
push edi
call dword [sym.imp.kernel32.dll_SetEnvironmentVariableW]
jmp 0x4093a0
push esi
call dword [sym.imp.kernel32.dll_LocalFree]
push dword [ebp - 0x18]
call dword [sym.imp.kernel32.dll_FreeEnvironmentStringsW]
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax + 8]
mov dword [ebp - 0x10], ecx
mov eax, dword [eax + 0x10]
mov ecx, dword [0x418744]
mov dword [ecx], eax
test byte [0x41d010], 8
je 0x409441
sub esp, 0x14
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], 3
call sym._wine_dbg_log_1
add esp, 0x14
mov eax, dword [ebp - 0x10]
cmp word [eax], 0
je 0x4094b2
xor edi, edi
mov esi, dword [ebp - 0x10]
jmp 0x409479
sar ebx, 1
lea eax, [edi + ebx]
add edi, ebx
inc edi
mov ecx, dword [ebp - 0x10]
lea esi, [ecx + eax*2]
add esi, 2
cmp word [ecx + eax*2 + 2], 0
je 0x4094b2
xor ebx, ebx
nop dword [eax + eax]
cmp word [esi + ebx + 2], 0
lea ebx, [ebx + 2]
jne 0x409480
lea eax, [esi + 2]
push 0x3d
push eax
call dword [sym.imp.ucrtbase.dll_wcschr]
add esp, 8
test eax, eax
je 0x409460
mov ecx, eax
add ecx, 2
mov word [eax], 0
push ecx
push esi
call dword [sym.imp.kernel32.dll_SetEnvironmentVariableW]
jmp 0x409460
mov ebx, dword [ebp - 0x14]
movzx eax, word [ebx + 4]
push eax
call dword [sym.imp.user32.dll_IsCharAlphaW]
test eax, eax
je 0x409533
movzx eax, word [ebx + 4]
lea edi, [ebp - 0x20]
push eax
push 0x417a04
push edi
call dword [sym.imp.user32.dll_wsprintfW]
add esp, 0xc
lea esi, [ebp - 0x228]
push 0x104
push esi
push edi
call dword [sym.imp.kernel32.dll_GetEnvironmentVariableW]
test eax, eax
je 0x409533
test byte [0x41d010], 8
je 0x40952c
lea ecx, [ebp - 0x228]
call dbg.wine_dbgstr_wn
sub esp, 0x14
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], 3
call sym._wine_dbg_log_1
add esp, 0x14
push esi
call dword [sym.imp.kernel32.dll_SetCurrentDirectoryW]
mov esi, dword [sym.imp.kernel32.dll_LocalFree]
push dword [ebp - 0x10]
call esi
push ebx
call esi
add esp, 0x21c
pop esi
pop edi
pop ebx
pop ebp
ret