Function at 0x403120
Capabilities:
Get session user name
Get token privileges
Query environment variable

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x80
push ebx
push esi
mov esi, dword [ebp + 0xc]
xor ebx, ebx
cmp esi, ebx
push edi
jne 0x40314c
push 0x57
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
lea esp, [ebp - 0x8c]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 8]
cmp eax, ebx
je 0x403163
mov edx, esi
sub edx, eax
mov cl, byte [eax]
mov byte [edx + eax], cl
inc eax
test cl, cl
jne 0x403157
jmp 0x403166
mov byte [esi], 0
test byte [ebp + 0x10], 2
je 0x4031d7
mov edi, esi
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
mov ax, word [0x4315f0]
mov word [edi - 1], ax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
call dword [sym.imp.USER32.dll_GetThreadDesktop]
mov edx, eax
mov edi, esi
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov eax, 0x103
sub eax, ecx
lea ecx, [ebp + 0xc]
push ecx
mov dword [ebp + 0xc], eax
push eax
mov edi, esi
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
add ecx, esi
push ecx
push 2
push edx
call dword [sym.imp.USER32.dll_GetUserObjectInformationA]
test eax, eax
jne 0x4031d7
mov edx, dword [ebp + 0xc]
push edx
push str.Win9x
push esi
call fcn.0040c338
add esp, 0xc
test byte [ebp + 0x10], 1
je 0x403287
lea eax, [ebp + 8]
mov dword [ebp + 8], ebx
push eax
push 8
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
je 0x403287
mov edi, esi
or ecx, 0xffffffff
xor eax, eax
mov edx, 0x104
repne scasb al, byte es:[edi]
not ecx
dec ecx
sub edx, ecx
cmp edx, 9
jbe 0x403287
mov ecx, dword [ebp + 8]
lea eax, [ebp + 0xc]
push eax
push ebx
push ebx
push 0xa
push ecx
mov dword [ebp + 0xc], ebx
call dword [sym.imp.ADVAPI32.dll_GetTokenInformation]
test eax, eax
jne 0x403287
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x7a
jne 0x403287
mov ebx, dword [ebp + 0xc]
mov eax, ebx
add eax, 3
and al, 0xfc
call fcn.0040c400
mov eax, dword [ebp + 8]
lea edx, [ebp + 0xc]
mov edi, esp
push edx
push ebx
push edi
push 0xa
push eax
call dword [sym.imp.ADVAPI32.dll_GetTokenInformation]
test eax, eax
je 0x403287
mov ecx, dword [edi + 8]
mov edx, dword [edi + 0xc]
push ecx
mov edi, esi
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
push edx
add ecx, esi
push str.__08x_08x
push ecx
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
test byte [ebp + 0x10], 4
je 0x40331a
mov ecx, 0xf
xor eax, eax
lea edi, [ebp - 0x3f]
mov byte [ebp - 0x40], 0
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0xf
xor eax, eax
lea edi, [ebp - 0x7f]
mov byte [ebp - 0x80], 0
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
lea eax, [ebp + 0x10]
lea ecx, [ebp - 0x40]
push eax
push ecx
mov dword [ebp + 0x10], 0x40
call dword [sym.imp.ADVAPI32.dll_GetUserNameA]
test eax, eax
je 0x40331a
lea edx, [ebp - 0x80]
push 0x40
push edx
push str.USERDOMAIN
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
mov edx, eax
mov edi, esi
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
mov eax, dword [ebp + 0x10]
not ecx
lea edx, [edx + eax + 3]
dec ecx
mov eax, 0x104
sub eax, ecx
cmp eax, edx
jbe 0x40331a
lea edx, [ebp - 0x40]
lea eax, [ebp - 0x80]
push edx
push eax
add ecx, esi
push str.__s__s
push ecx
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
mov eax, esi
lea esp, [ebp - 0x8c]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret