Function at 0x4010c0
Capabilities:
Get user security identifier

Disassembly:
sub esp, 0x14
push edi
mov edi, dword [esp + 0x24]
test edi, edi
jne 0x4010e9
lea edi, [esp + 8]
mov eax, edi
push eax
call fcn.00401000
add esp, 4
test eax, eax
je 0x4010e9
mov eax, 1
pop edi
add esp, 0x14
ret
push ebx
mov ebx, dword [esp + 0x20]
mov eax, ebx
mov dword [esp + 0x18], ebx
lea edx, [eax + 2]
mov cx, word [eax]
add eax, 2
test cx, cx
jne 0x4010f7
sub eax, edx
sar eax, 1
lea ecx, [eax + eax]
push esi
mov word [esp + 0x18], cx
mov edx, dword [esp + 0x18]
add edx, 2
lea eax, [esp + 0x2c]
push eax
mov eax, dword [edi]
lea ecx, [esp + 0x10]
push ecx
mov word [esp + 0x22], dx
lea edx, [esp + 0x20]
push edx
push 1
push eax
call sub.ADVAPI32.dll_LsaLookupNames
lea ecx, [esp + 0x10]
mov esi, eax
cmp edi, ecx
jne 0x401148
mov edx, dword [esp + 0x10]
push edx
call sub.ADVAPI32.dll_LsaClose
test esi, esi
je 0x401193
mov eax, dword [esp + 0xc]
push eax
call sub.ADVAPI32.dll_LsaFreeMemory
mov ecx, dword [esp + 0x2c]
push ecx
call sub.ADVAPI32.dll_LsaFreeMemory
push esi
call sub.ADVAPI32.dll_LsaNtStatusToWinError
push eax
call fcn.00404fa0
add esp, 4
push eax
push ebx
push 0x40000207
call fcn.00412306
add eax, 0x40
push eax
call fcn.00405150
add esp, 0x10
pop esi
pop ebx
mov eax, 3
pop edi
add esp, 0x14
ret
mov ecx, dword [esp + 0x2c]
mov eax, dword [ecx]
cmp eax, 1
je 0x4011da
cmp eax, 5
je 0x4011da
mov edx, dword [esp + 0xc]
push edx
call sub.ADVAPI32.dll_LsaFreeMemory
mov eax, dword [esp + 0x2c]
push eax
call sub.ADVAPI32.dll_LsaFreeMemory
push ebx
push 0x4000022f
call fcn.00412306
add eax, 0x40
push eax
call fcn.00405150
add esp, 0xc
pop esi
pop ebx
mov eax, 4
pop edi
add esp, 0x14
ret
mov eax, dword [ecx + 8]
mov edx, dword [esp + 0xc]
lea ecx, [eax + eax*2]
mov eax, dword [edx + 4]
lea esi, [eax + ecx*4]
mov dword [esp + 0x14], esi
test esi, esi
je 0x40139d
mov ecx, dword [esi + 8]
push ecx
call dword [sym.imp.ADVAPI32.dll_IsValidSid]
test eax, eax
je 0x40139d
mov edx, dword [esi + 8]
push ebp
push edx
call dword [sym.imp.ADVAPI32.dll_GetSidSubAuthorityCount]
mov edi, eax
mov al, byte [edi]
inc al
movzx ecx, al
push ecx
call dword [sym.imp.ADVAPI32.dll_GetSidLengthRequired]
mov ebx, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
push 8
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebp, dword [esp + 0x2c]
mov dword [ebp], eax
test eax, eax
jne 0x401281
mov edx, dword [esp + 0x10]
push edx
call sub.ADVAPI32.dll_LsaFreeMemory
mov eax, dword [esp + 0x30]
push eax
call sub.ADVAPI32.dll_LsaFreeMemory
push str.grant_logon_as_service
push 0x41d40c
push 0xc00001fa
call fcn.00412306
add eax, 0x40
push eax
call fcn.00405150
add esp, 0x10
pop ebp
pop esi
pop ebx
mov eax, 6
pop edi
add esp, 0x14
ret
mov cl, byte [edi]
mov eax, dword [esi + 8]
inc cl
movzx edx, cl
push edx
push eax
call dword [sym.imp.ADVAPI32.dll_GetSidIdentifierAuthority]
mov ecx, dword [ebp]
push eax
push ecx
call dword [sym.imp.ADVAPI32.dll_InitializeSid]
test eax, eax
jne 0x4012ff
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, dword [ebp]
push edx
push 0
mov esi, eax
call ebx
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [esp + 0x10]
push eax
call sub.ADVAPI32.dll_LsaFreeMemory
mov ecx, dword [esp + 0x30]
push ecx
call sub.ADVAPI32.dll_LsaFreeMemory
push esi
call fcn.00404fa0
mov edx, dword [esp + 0x2c]
add esp, 4
push eax
push edx
push 0x40000208
call fcn.00412306
add eax, 0x40
push eax
call fcn.00405150
add esp, 0x10
pop ebp
pop esi
pop ebx
mov eax, 7
pop edi
add esp, 0x14
ret
xor bl, bl
jmp 0x401307
mov ebp, dword [esp + 0x2c]
mov eax, dword [ebp]
movzx esi, bl
push esi
push eax
call dword [sym.imp.ADVAPI32.dll_GetSidSubAuthority]
mov ebp, eax
cmp bl, byte [edi]
jae 0x401331
mov ecx, dword [esp + 0x18]
mov edx, dword [ecx + 8]
push esi
push edx
call dword [sym.imp.ADVAPI32.dll_GetSidSubAuthority]
mov eax, dword [eax]
mov dword [ebp], eax
jmp 0x40133b
mov ecx, dword [esp + 0x30]
mov edx, dword [ecx + 4]
mov dword [ebp], edx
inc bl
cmp bl, byte [edi]
jbe 0x401303
mov eax, dword [esp + 0x30]
xor esi, esi
cmp dword [eax], 5
jne 0x40137f
mov ecx, dword [esp + 0x2c]
mov edx, dword [ecx]
push edx
call fcn.00401070
add esp, 4
test eax, eax
jne 0x40137f
mov eax, dword [esp + 0x28]
push eax
push 0x4000022f
call fcn.00412306
add eax, 0x40
push eax
call fcn.00405150
add esp, 0xc
mov esi, 8
mov ecx, dword [esp + 0x10]
push ecx
call sub.ADVAPI32.dll_LsaFreeMemory
mov edx, dword [esp + 0x30]
push edx
call sub.ADVAPI32.dll_LsaFreeMemory
pop ebp
mov eax, esi
pop esi
pop ebx
pop edi
add esp, 0x14
ret
mov eax, dword [esp + 0xc]
push eax
call sub.ADVAPI32.dll_LsaFreeMemory
mov ecx, dword [esp + 0x2c]
push ecx
call sub.ADVAPI32.dll_LsaFreeMemory
push ebx
push 0x4000022f
call fcn.00412306
add eax, 0x40
push eax
call fcn.00405150
add esp, 0xc
pop esi
pop ebx
mov eax, 5
pop edi
add esp, 0x14
ret