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

Disassembly:
push ebp
mov ebp, esp
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 0x407ada
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]
test eax, eax
je 0x407ada
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]
test eax, eax
je 0x407ada
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
test eax, eax
je 0x407969
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]
test eax, eax
jne 0x407969
push 0x14
push 0x40
mov dword [ebp - 0x18], edi
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov esi, eax
cmp esi, ebx
je 0x407969
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x407962
push ebx
lea eax, [ebp - 0x7c]
push eax
push esi
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorOwner]
test eax, eax
je 0x407962
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 0x407ad9
mov eax, dword [ebp - 0x10]
cmp eax, ebx
je 0x407ad9
and dword [ebp - 4], ebx
xor ecx, ecx
cmp cx, word [eax + 4]
jae 0x407ad9
lea ecx, [ebp - 8]
push ecx
push dword [ebp - 4]
push eax
call dword [sym.imp.ADVAPI32.dll_GetAce]
test eax, eax
je 0x407a76
mov eax, dword [ebp - 8]
add eax, 8
xor esi, esi
mov dword [ebp - 0xc], eax
test ebx, ebx
jle 0x4079fa
push dword [ebp - 0xc]
push dword [ebp + esi*4 - 0xfc]
call dword [sym.imp.ADVAPI32.dll_EqualSid]
test eax, eax
jne 0x4079e5
inc esi
cmp esi, ebx
jl 0x4079cc
cmp esi, ebx
jge 0x4079fa
push dword [ebp - 4]
push dword [ebp - 0x10]
call dword [sym.imp.ADVAPI32.dll_DeleteAce]
mov dword [ebp - 0x14], edi
jmp 0x407a79
cmp ebx, 0x20
jge 0x407a0a
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]
test eax, eax
je 0x407a31
mov eax, dword [ebp + 0xc]
neg eax
sbb eax, eax
and eax, 0x90046
add eax, 0x1601b9
jmp 0x407a36
mov eax, 0x1200a8
cmp dword [ecx + 4], eax
je 0x407a44
mov dword [ecx + 4], eax
mov ecx, dword [ebp - 8]
mov dword [ebp - 0x14], edi
cmp byte [ecx], 0
jne 0x407a4f
test byte [ecx + 1], 0x10
je 0x407a76
mov byte [ecx], 0
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 8]
test eax, eax
jne 0x407a65
mov eax, dword [ebp - 8]
mov byte [eax + 1], 0xb
jmp 0x407a73
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 0x4079a7
cmp dword [ebp - 0x14], 0
je 0x407ad9
push 0x14
push 0x40
mov dword [ebp - 0x18], edi
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov esi, eax
test esi, esi
je 0x407ad9
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x407ad2
push 0
push dword [ebp - 0x10]
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
test eax, eax
je 0x407ad2
push esi
push 4
push dword [ebp + 8]
call dword [sym.imp.ADVAPI32.dll_SetFileSecurityA]
test eax, eax
je 0x407ad2
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