Function at 0xd97809
Capabilities:
Compare security identifiers
Get session user name
Get user security identifier

Disassembly:
push ebp
push esp
pop ebp
sub esp, 0x5fc
push ebx
push esi
lea eax, [ebp - 0x20]
push eax
lea eax, [ebp - 0x17c]
xor ebx, ebx
mov esi, 0x80
push eax
mov dword [ebp - 0x18], ebx
mov dword [ebp - 0x10], ebx
mov dword [ebp - 0x20], esi
call dword [sym.imp.ADVAPI32.dll_GetUserNameA]
test eax, eax
je 0xd97a8e
lea eax, [ebp - 0x34]
push eax
lea eax, [ebp - 0x24]
push eax
lea eax, [ebp - 0x1fc]
push eax
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x7c]
push eax
lea eax, [ebp - 0x17c]
push eax
push ebx
mov dword [ebp - 0x1c], 0x44
mov dword [ebp - 0x24], esi
call dword [sym.imp.ADVAPI32.dll_LookupAccountNameA]
or eax, eax
je 0xd97a8e
lea eax, [ebp - 0x7c]
push eax
call dword [sym.imp.ADVAPI32.dll_GetLengthSid]
mov dword [ebp - 0x1c], eax
lea ecx, [ebp - 0x28]
push ecx
mov eax, 0x400
push eax
mov dword [ebp - 0x28], eax
lea eax, [ebp - 0x5fc]
push eax
push 5
push dword [ebp + 8]
call dword [sym.imp.ADVAPI32.dll_GetFileSecurityA]
or eax, eax
je 0xd97a8e
push edi
lea eax, [ebp - 0x2c]
push eax
lea eax, [ebp - 0xc]
push eax
lea eax, [ebp - 0x5fc]
push eax
call dword [sym.imp.ADVAPI32.dll_GetSecurityDescriptorOwner]
xor edi, edi
inc edi
or eax, eax
je 0xd9791d
push dword [ebp - 0xc]
lea eax, [ebp - 0x7c]
push eax
mov dword [ebp - 0x20], esi
mov dword [ebp - 0x24], esi
call dword [sym.imp.ADVAPI32.dll_EqualSid]
or eax, eax
jne 0xd9791d
push 0x14
push 0x40
mov dword [ebp - 0x18], edi
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov esi, eax
cmp esi, ebx
je 0xd9791d
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
or eax, eax
je 0xd97916
push ebx
lea eax, [ebp - 0x7c]
push eax
push esi
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorOwner]
or eax, eax
je 0xd97916
push esi
push edi
push dword [ebp + 8]
call dword [sym.imp.ADVAPI32.dll_SetFileSecurityA]
push esi
call dword [sym.imp.KERNEL32.dll_LocalFree]
lea eax, [ebp - 0x30]
push eax
lea eax, [ebp - 0x10]
push eax
lea eax, [ebp - 0x38]
push eax
lea eax, [ebp - 0x5fc]
push eax
mov dword [ebp - 0x14], ebx
call dword [sym.imp.ADVAPI32.dll_GetSecurityDescriptorDacl]
test eax, eax
je 0xd97a8d
mov eax, dword [ebp - 0x10]
cmp eax, ebx
je 0xd97a8d
and dword [ebp - 4], ebx
xor ecx, ecx
cmp cx, word [eax + 4]
jae 0xd97a8d
lea ecx, [ebp - 8]
push ecx
push dword [ebp - 4]
push eax
call dword [sym.imp.ADVAPI32.dll_GetAce]
or eax, eax
je 0xd97a2a
mov eax, dword [ebp - 8]
add eax, 8
xor esi, esi
mov dword [ebp - 0xc], eax
or ebx, ebx
jle 0xd979ae
push dword [ebp - 0xc]
push dword [ebp + esi*4 - 0xfc]
call dword [sym.imp.ADVAPI32.dll_EqualSid]
or eax, eax
jne 0xd97999
inc esi
cmp esi, ebx
jl 0xd97980
cmp esi, ebx
jge 0xd979ae
push dword [ebp - 4]
push dword [ebp - 0x10]
call dword [sym.imp.ADVAPI32.dll_DeleteAce]
mov dword [ebp - 0x14], edi
jmp 0xd97a2d
cmp ebx, 0x20
jge 0xd979be
mov eax, dword [ebp - 0xc]
mov dword [ebp + ebx*4 - 0xfc], eax
inc ebx
push dword [ebp - 0xc]
lea eax, [ebp - 0x7c]
push eax
call dword [sym.imp.ADVAPI32.dll_EqualSid]
mov ecx, dword [ebp - 8]
or eax, eax
je 0xd979e5
mov eax, dword [ebp + 0xc]
neg eax
sbb eax, eax
and eax, 0x90046
add eax, 0x1601b9
jmp 0xd979ea
mov eax, 0x1200a8
cmp dword [ecx + 4], eax
je 0xd979f8
mov dword [ecx + 4], eax
mov ecx, dword [ebp - 8]
mov dword [ebp - 0x14], edi
cmp byte [ecx], 0
jne 0xd97a03
test byte [ecx + 1], 0x10
je 0xd97a2a
mov byte [ecx], 0
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 8]
or eax, eax
jne 0xd97a19
mov eax, dword [ebp - 8]
mov byte [eax + 1], 0xb
jmp 0xd97a27
mov ecx, dword [ebp - 8]
cmp eax, 0x50
setb al
add al, 2
mov byte [ecx + 1], al
mov dword [ebp - 0x14], edi
inc dword [ebp - 4]
mov eax, dword [ebp - 0x10]
movzx ecx, word [eax + 4]
cmp dword [ebp - 4], ecx
jb 0xd9795b
cmp dword [ebp - 0x14], 0
je 0xd97a8d
push 0x14
push 0x40
mov dword [ebp - 0x18], edi
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
push eax
pop esi
test esi, esi
je 0xd97a8d
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
or eax, eax
je 0xd97a86
push 0
push dword [ebp - 0x10]
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
or eax, eax
je 0xd97a86
push esi
push 4
push dword [ebp + 8]
call dword [sym.imp.ADVAPI32.dll_SetFileSecurityA]
test eax, eax
je 0xd97a86
mov dword [ebp - 0x18], edi
push esi
call dword [sym.imp.KERNEL32.dll_LocalFree]
pop edi
mov eax, dword [ebp - 0x18]
pop esi
pop ebx
leave
ret