Function at 0x40573b
Capabilities:
Query environment variable
Read .ini file
Set environment variable

Disassembly:
push 0x87c
mov eax, 0x446e0a
call fcn.0040f6fe
mov ebx, ecx
push 0xa000
push 0x4789f0
push 0x457ce8
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
xor esi, esi
xor eax, eax
mov dword [ebp - 0x848], esi
mov dword [ebp - 0x844], esi
mov dword [ebp - 0x848], esi
mov dword [ebp - 0x844], 7
mov word [ebp - 0x858], ax
mov dword [ebp - 4], esi
push str.Kernel32.dll
call dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
push str.AddDllDirectory
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
push 0x208
lea eax, [ebp - 0x228]
push esi
push eax
call fcn.0042a960
add esp, 0xc
lea eax, [ebp - 0x228]
push 0x104
push eax
push dword [ebx]
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea eax, [ebp - 0x228]
push 0x5c
push eax
call fcn.004292cc
pop ecx
pop ecx
test eax, eax
je 0x405805
xor ecx, ecx
lea edi, [ebp - 0x228]
mov word [eax + 2], cx
sub edi, 2
mov ax, word [edi + 2]
add edi, 2
cmp ax, si
jne 0x4057ee
mov esi, str.dll_
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
xor esi, esi
push 0x208
lea eax, [ebp - 0x430]
push esi
push eax
call fcn.0042a960
add esp, 0xc
lea eax, [ebp - 0x430]
push 0x104
push eax
push dword [ebx]
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
lea eax, [ebp - 0x430]
push 0x2e
push eax
call fcn.004292cc
pop ecx
pop ecx
test eax, eax
je 0x405a3b
mov esi, str..ini
mov edi, eax
xor ebx, ebx
movsd dword es:[edi], dword [esi]
movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
mov esi, ebx
push 0x208
lea eax, [ebp - 0x638]
push ebx
push eax
call fcn.0042a960
add esp, 0xc
mov dword [ebp - 0x860], ebx
xor eax, eax
mov dword [ebp - 0x85c], ebx
lea ecx, [ebp - 0x870]
mov dword [ebp - 0x860], ebx
mov dword [ebp - 0x85c], 7
push str.path
mov word [ebp - 0x870], ax
call fcn.0040269f
mov byte [ebp - 4], 1
xor eax, eax
lea edi, [ebp - 0x20]
inc esi
stosd dword es:[edi], eax
push esi
push 0x457f70
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
lea eax, [ebp - 0x20]
push eax
call fcn.004031e5
lea eax, [ebp - 0x20]
push eax
lea edx, [ebp - 0x870]
lea ecx, [ebp - 0x888]
call fcn.00406abd
add esp, 0x10
mov byte [ebp - 4], 2
lea ecx, [ebp - 0x870]
push eax
call fcn.00402492
mov byte [ebp - 4], 1
lea ecx, [ebp - 0x888]
call fcn.00402671
cmp dword [ebp - 0x85c], 8
lea ecx, [ebp - 0x430]
push ecx
mov edi, 0x104
lea ecx, [ebp - 0x638]
push edi
push ecx
lea eax, [ebp - 0x870]
cmovae eax, dword [ebp - 0x870]
push 0x457b00
push eax
push 0x457d44
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringW]
test eax, eax
je 0x405979
push 0x208
lea eax, [ebp - 0x840]
push ebx
push eax
call fcn.0042a960
add esp, 0xc
lea eax, [ebp - 0x840]
push ebx
push eax
push edi
lea eax, [ebp - 0x638]
push eax
call dword [sym.imp.KERNEL32.dll_GetFullPathNameW]
push 0x457d4c
lea eax, [ebp - 0x840]
push eax
lea ecx, [ebp - 0x858]
call fcn.00402e54
mov ecx, eax
call fcn.00402e54
mov byte [ebp - 4], bl
lea ecx, [ebp - 0x870]
call fcn.00402671
cmp esi, 0xff
jl 0x405855
mov esi, 0x4789f0
lea edx, [ebp - 0x858]
push esi
lea ecx, [ebp - 0x888]
call fcn.00406abd
pop ecx
mov byte [ebp - 4], 3
lea ecx, [ebp - 0x858]
push eax
call fcn.00402492
mov byte [ebp - 4], bl
lea ecx, [ebp - 0x888]
call fcn.00402671
mov eax, 0xa000
cmp dword [ebp - 0x848], eax
jbe 0x405a08
push eax
push ebx
lea eax, [ebp - 0x888]
push eax
lea ecx, [ebp - 0x858]
call fcn.004023f8
mov byte [ebp - 4], 4
lea ecx, [ebp - 0x858]
push eax
call fcn.00402492
mov byte [ebp - 4], bl
lea ecx, [ebp - 0x888]
call fcn.00402671
cmp dword [ebp - 0x844], 8
lea ecx, [ebp - 0x858]
mov edx, esi
cmovae ecx, dword [ebp - 0x858]
sub edx, ecx
movzx eax, word [ecx]
mov word [edx + ecx], ax
lea ecx, [ecx + 2]
test ax, ax
jne 0x405a20
push esi
push 0x457ce8
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x858]
call fcn.00402671
call fcn.0040f6a8
ret