Function at 0x51b020
Capabilities:
Get session user name

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5a15f6
mov eax, dword fs:[0]
push eax
sub esp, 0x65c
mov eax, dword [0x60a070]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, ecx
lea eax, [ebp - 0x668]
xor bl, bl
push eax
push str.S_1_5_18
call dword [sym.imp.ADVAPI32.dll_ConvertStringSidToSidW]
lea eax, [ebp - 0x664]
mov dword [ebp - 0x644], 0x101
push eax
lea eax, [ebp - 0x644]
push eax
lea eax, [ebp - 0x628]
push eax
lea eax, [ebp - 0x644]
push eax
lea eax, [ebp - 0x218]
push eax
push dword [ebp - 0x668]
push 0
call dword [sym.imp.ADVAPI32.dll_LookupAccountSidW]
test eax, eax
jne 0x51b152
test edi, edi
je 0x51b0c8
mov esi, dword [edi]
call dword [sym.imp.KERNEL32.DLL_GetLastError]
push eax
push str.IsSystemProcess:_LookupAccountSid_Error__u_n
push str.ProcessUtils
push 0x5c0ec0
push 0x32
push edi
jmp 0x51b139
cmp dword [0x615408], 0
je 0x51b10f
call dword [sym.imp.KERNEL32.DLL_GetLastError]
push eax
push str.IsSystemProcess:_LookupAccountSid_Error__u_n
push 0x5c0ec0
push 0x5c0ec0
push str.ProcessUtils
push str.OOBEUtils
push 0x32
call dword [0x615408]
add esp, 0x1c
push dword [ebp - 0x668]
call dword [sym.imp.KERNEL32.DLL_LocalFree]
xor al, al
jmp 0x51b3cd
mov esi, dword [0x61540c]
test esi, esi
je 0x51b13f
mov esi, dword [esi]
call dword [sym.imp.KERNEL32.DLL_GetLastError]
push eax
push str.IsSystemProcess:_LookupAccountSid_Error__u_n
push str.ProcessUtils
push 0x5c0ec0
push 0x32
push dword [0x61540c]
call dword [esi + 0x34]
add esp, 0x18
push dword [ebp - 0x668]
call dword [sym.imp.KERNEL32.DLL_LocalFree]
xor al, al
jmp 0x51b3cd
lea eax, [ebp - 0x660]
mov dword [ebp - 0x660], 0x101
push eax
lea eax, [ebp - 0x420]
push eax
call dword [sym.imp.ADVAPI32.dll_GetUserNameW]
test eax, eax
jne 0x51b201
test edi, edi
je 0x51b199
mov esi, dword [edi]
call dword [sym.imp.KERNEL32.DLL_GetLastError]
push eax
push str.IsSystemProcess:_GetUserName_Error__u_n
push str.ProcessUtils
push 0x5c0ec0
push 0x32
push edi
jmp 0x51b139
cmp dword [0x615408], 0
je 0x51b1e0
call dword [sym.imp.KERNEL32.DLL_GetLastError]
push eax
push str.IsSystemProcess:_GetUserName_Error__u_n
push 0x5c0ec0
push 0x5c0ec0
push str.ProcessUtils
push str.OOBEUtils
push 0x32
call dword [0x615408]
add esp, 0x1c
push dword [ebp - 0x668]
call dword [sym.imp.KERNEL32.DLL_LocalFree]
xor al, al
jmp 0x51b3cd
mov esi, dword [0x61540c]
test esi, esi
je 0x51b13f
mov esi, dword [esi]
call dword [sym.imp.KERNEL32.DLL_GetLastError]
push eax
push str.IsSystemProcess:_GetUserName_Error__u_n
jmp 0x51b127
lea eax, [ebp - 0x218]
push eax
lea ecx, [ebp - 0x65c]
call fcn.00413890
lea eax, [ebp - 0x420]
mov dword [ebp - 4], 0
push eax
lea ecx, [ebp - 0x640]
call fcn.00413890
mov byte [ebp - 4], 1
test edi, edi
je 0x51b277
cmp dword [ebp - 0x62c], 8
lea edx, [ebp - 0x640]
mov ecx, dword [edi]
lea eax, [ebp - 0x65c]
cmovae edx, dword [ebp - 0x640]
cmp dword [ebp - 0x648], 8
push edx
cmovae eax, dword [ebp - 0x65c]
push eax
push str.IsSystemProcess:_user_name_from_SYSTEM_sid___s__current_user_name___s
push str.ProcessUtils
push 0x5c0ec0
push 0xa
push edi
jmp 0x51b315
mov edx, dword [0x615408]
test edx, edx
je 0x51b2cd
cmp dword [ebp - 0x62c], 8
lea ecx, [ebp - 0x640]
lea eax, [ebp - 0x65c]
cmovae ecx, dword [ebp - 0x640]
cmp dword [ebp - 0x648], 8
push ecx
cmovae eax, dword [ebp - 0x65c]
push eax
push str.IsSystemProcess:_user_name_from_SYSTEM_sid___s__current_user_name___s
push 0x5c0ec0
push 0x5c0ec0
push str.ProcessUtils
push str.OOBEUtils
push 0xa
call edx
add esp, 0x20
jmp 0x51b31b
mov esi, dword [0x61540c]
test esi, esi
je 0x51b31b
cmp dword [ebp - 0x62c], 8
lea edx, [ebp - 0x640]
mov ecx, dword [esi]
lea eax, [ebp - 0x65c]
cmovae edx, dword [ebp - 0x640]
cmp dword [ebp - 0x648], 8
push edx
cmovae eax, dword [ebp - 0x65c]
push eax
push str.IsSystemProcess:_user_name_from_SYSTEM_sid___s__current_user_name___s
push str.ProcessUtils
push 0x5c0ec0
push 0xa
push esi
call dword [ecx + 0x34]
add esp, 0x1c
cmp dword [ebp - 0x62c], 8
lea ecx, [ebp - 0x640]
push dword [ebp - 0x630]
cmovae ecx, dword [ebp - 0x640]
lea eax, [ebp - 0x65c]
cmp dword [ebp - 0x648], 8
push ecx
cmovae eax, dword [ebp - 0x65c]
push dword [ebp - 0x64c]
push eax
call fcn.0041dd20
add esp, 0x10
movzx ebx, bl
test eax, eax
mov ecx, 1
cmove ebx, ecx
push dword [ebp - 0x668]
call dword [sym.imp.KERNEL32.DLL_LocalFree]
mov eax, dword [ebp - 0x62c]
cmp eax, 8
jb 0x51b390
inc eax
lea ecx, [ebp - 0x640]
push eax
push dword [ebp - 0x640]
call fcn.00414580
mov ecx, dword [ebp - 0x648]
xor eax, eax
mov dword [ebp - 0x62c], 7
mov dword [ebp - 0x630], 0
mov word [ebp - 0x640], ax
cmp ecx, 8
jb 0x51b3cb
inc ecx
push ecx
push dword [ebp - 0x65c]
lea ecx, [ebp - 0x65c]
call fcn.00414580
mov al, bl
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0055eeb4
mov esp, ebp
pop ebp
ret