Function at 0x40cf80
Capabilities:
Get session user name
Get user security identifier

Disassembly:
sub esp, 0x40
push ebx
push ebp
push esi
push edi
xor ebx, ebx
mov eax, 0x400
push 0x800
mov dword [esp + 0x28], ebx
mov dword [esp + 0x2c], eax
xor ebp, ebp
mov dword [esp + 0x30], eax
mov dword [esp + 0x3c], eax
mov dword [esp + 0x1c], ebx
mov dword [esp + 0x14], ebx
mov dword [esp + 0x18], ebx
mov dword [esp + 0x20], ebx
xor edi, edi
mov dword [esp + 0x24], ebx
call sub.MFC42u.DLL_operatornew
mov esi, eax
add esp, 4
cmp esi, ebx
mov dword [esp + 0x34], esi
je 0x40d249
lea eax, [esp + 0x38]
push eax
push esi
call dword [sym.imp.ADVAPI32.dll_GetUserNameW]
test eax, eax
je 0x40d1f9
mov ecx, dword [esp + 0x2c]
mov ebx, dword [sym.imp.MSVCRT.dll_malloc]
push ecx
call ebx
mov ebp, eax
add esp, 4
test ebp, ebp
je 0x40d1f7
mov edx, dword [esp + 0x28]
lea eax, [edx + edx]
push eax
call sub.MFC42u.DLL_operatornew
add esp, 4
mov dword [esp + 0x24], eax
test eax, eax
je 0x40d1f7
lea ecx, [esp + 0x3c]
lea edx, [esp + 0x28]
push ecx
push edx
lea ecx, [esp + 0x34]
push eax
push ecx
push ebp
push esi
push edi
call dword [sym.imp.ADVAPI32.dll_LookupAccountNameW]
test eax, eax
je 0x40d1f7
mov eax, dword [esp + 0x54]
mov esi, dword [sym.imp.ADVAPI32.dll_GetFileSecurityW]
lea edx, [esp + 0x10]
push edx
push edi
push edi
push 4
push eax
call esi
test eax, eax
jne 0x40d1f3
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x7a
jne 0x40d1f3
mov ecx, dword [esp + 0x10]
push ecx
call ebx
add esp, 4
mov dword [esp + 0x18], eax
test eax, eax
je 0x40d1f3
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x18]
lea edx, [esp + 0x10]
push edx
mov edx, dword [esp + 0x58]
push eax
push ecx
push 4
push edx
call esi
test eax, eax
je 0x40d1f3
mov eax, dword [esp + 0x10]
push eax
call ebx
add esp, 4
mov dword [esp + 0x14], eax
test eax, eax
je 0x40d1f3
mov ecx, eax
push 1
push ecx
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x40d1f3
lea edx, [esp + 0x40]
lea eax, [esp + 0x1c]
push edx
mov edx, dword [esp + 0x1c]
lea ecx, [esp + 0x34]
push eax
push ecx
push edx
call dword [sym.imp.ADVAPI32.dll_GetSecurityDescriptorDacl]
test eax, eax
je 0x40d1f3
mov eax, dword [esp + 0x30]
xor ecx, ecx
cmp eax, ecx
mov dword [esp + 0x44], ecx
mov dword [esp + 0x4c], ecx
mov dword [esp + 0x48], 8
je 0x40d124
mov eax, dword [esp + 0x1c]
cmp eax, ecx
je 0x40d124
push 2
lea ecx, [esp + 0x48]
push 0xc
push ecx
push eax
call dword [sym.imp.ADVAPI32.dll_GetAclInformation]
test eax, eax
je 0x40d1f3
push ebp
call dword [sym.imp.ADVAPI32.dll_GetLengthSid]
mov edx, dword [esp + 0x48]
lea esi, [eax + edx + 8]
push esi
call ebx
mov edi, eax
add esp, 4
test edi, edi
je 0x40d1f3
push 2
push esi
push edi
call dword [sym.imp.ADVAPI32.dll_InitializeAcl]
test eax, eax
je 0x40d1f3
mov eax, dword [esp + 0x30]
test eax, eax
je 0x40d1ba
mov eax, dword [esp + 0x44]
test eax, eax
je 0x40d1ba
xor ebx, ebx
test eax, eax
jbe 0x40d1ba
mov esi, dword [sym.imp.ADVAPI32.dll_AddAce]
mov ecx, dword [esp + 0x1c]
lea eax, [esp + 0x20]
push eax
push ebx
push ecx
call dword [sym.imp.ADVAPI32.dll_GetAce]
test eax, eax
je 0x40d1f3
mov eax, dword [esp + 0x20]
test eax, eax
je 0x40d19e
mov ecx, dword [eax + 4]
or ecx, 0x501f0000
mov dword [eax + 4], ecx
mov eax, dword [esp + 0x20]
xor edx, edx
mov dx, word [eax + 2]
push edx
push eax
push 0xffffffffffffffff
push 2
push edi
call esi
test eax, eax
je 0x40d1f3
mov eax, dword [esp + 0x44]
inc ebx
cmp ebx, eax
jb 0x40d171
push ebp
push 0x101f0000
push 2
push edi
call dword [sym.imp.ADVAPI32.dll_AddAccessAllowedAce]
test eax, eax
je 0x40d1f3
mov eax, dword [esp + 0x14]
push 0
push edi
push 1
push eax
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
test eax, eax
je 0x40d1f3
mov ecx, dword [esp + 0x14]
mov edx, dword [esp + 0x54]
push ecx
push 4
push edx
call dword [sym.imp.ADVAPI32.dll_SetFileSecurityW]
mov esi, dword [esp + 0x34]
xor ebx, ebx
push esi
call sub.MFC42u.DLL_operatordelete
mov esi, dword [sym.imp.MSVCRT.dll_free]
add esp, 4
cmp ebp, ebx
je 0x40d212
push ebp
call esi
add esp, 4
mov eax, dword [esp + 0x24]
test eax, eax
je 0x40d223
push eax
call sub.MFC42u.DLL_operatordelete
add esp, 4
mov eax, dword [esp + 0x18]
test eax, eax
je 0x40d231
push eax
call esi
add esp, 4
mov eax, dword [esp + 0x14]
test eax, eax
je 0x40d23f
push eax
call esi
add esp, 4
test edi, edi
je 0x40d249
push edi
call esi
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x40
ret 4