Function at 0x407ae1
Capabilities:
Compare security identifiers
Get session user name
Get user security identifier
Set registry value

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x600
push ebx
lea eax, [ebp - 0x18]
push eax
xor ebx, ebx
push 0xe0100
push ebx
push dword [ebp + 0xc]
mov dword [ebp - 0x1c], ebx
push dword [ebp + 8]
mov dword [ebp - 8], ebx
mov dword [ebp - 0x18], ebx
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
test eax, eax
je 0x407b17
xor eax, eax
jmp 0x407e00
push esi
lea eax, [ebp - 0x24]
push eax
lea eax, [ebp - 0x180]
mov esi, 0x80
push eax
mov dword [ebp - 0x24], esi
call dword [sym.imp.ADVAPI32.dll_GetUserNameA]
test eax, eax
je 0x407df3
lea eax, [ebp - 0x34]
push eax
lea eax, [ebp - 0x28]
push eax
lea eax, [ebp - 0x200]
push eax
lea eax, [ebp - 0x20]
push eax
lea eax, [ebp - 0x80]
push eax
lea eax, [ebp - 0x180]
push eax
push ebx
mov dword [ebp - 0x20], 0x44
mov dword [ebp - 0x28], esi
call dword [sym.imp.ADVAPI32.dll_LookupAccountNameA]
test eax, eax
je 0x407df3
lea eax, [ebp - 0x2c]
push eax
lea eax, [ebp - 0x600]
push eax
push 5
push dword [ebp - 0x18]
mov dword [ebp - 0x2c], 0x400
call dword [sym.imp.ADVAPI32.dll_RegGetKeySecurity]
test eax, eax
jne 0x407df3
push edi
lea eax, [ebp - 0x38]
push eax
lea eax, [ebp - 0xc]
push eax
lea eax, [ebp - 0x600]
push eax
call dword [sym.imp.ADVAPI32.dll_GetSecurityDescriptorOwner]
test eax, eax
je 0x407c04
push dword [ebp - 0xc]
lea eax, [ebp - 0x80]
push eax
call dword [sym.imp.ADVAPI32.dll_EqualSid]
test eax, eax
jne 0x407c04
xor edi, edi
push 0x14
inc edi
push 0x40
mov dword [ebp - 8], edi
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov esi, eax
cmp esi, ebx
je 0x407c04
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x407bfd
push ebx
lea eax, [ebp - 0x80]
push eax
push esi
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorOwner]
test eax, eax
je 0x407bfd
push esi
push edi
push dword [ebp - 0x18]
call dword [sym.imp.ADVAPI32.dll_RegSetKeySecurity]
push esi
call dword [sym.imp.KERNEL32.dll_LocalFree]
lea eax, [ebp - 0x30]
push eax
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x3c]
push eax
lea eax, [ebp - 0x600]
push eax
mov dword [ebp - 0x14], ebx
call dword [sym.imp.ADVAPI32.dll_GetSecurityDescriptorDacl]
test eax, eax
je 0x407df2
mov eax, dword [ebp - 0x1c]
cmp eax, ebx
je 0x407df2
xor ecx, ecx
xor edi, edi
mov dword [ebp - 4], ebx
cmp cx, word [eax + 4]
jae 0x407df2
lea ecx, [ebp - 0x10]
push ecx
push dword [ebp - 4]
push eax
call dword [sym.imp.ADVAPI32.dll_GetAce]
test eax, eax
je 0x407d12
mov eax, dword [ebp - 0x10]
add eax, 8
xor esi, esi
mov dword [ebp - 0xc], eax
cmp edi, ebx
jle 0x407c9b
push dword [ebp - 0xc]
push dword [ebp + esi*4 - 0x100]
call dword [sym.imp.ADVAPI32.dll_EqualSid]
test eax, eax
jne 0x407c82
inc esi
cmp esi, edi
jl 0x407c69
cmp esi, edi
jge 0x407c9b
push dword [ebp - 4]
push dword [ebp - 0x1c]
call dword [sym.imp.ADVAPI32.dll_DeleteAce]
mov dword [ebp - 0x14], 1
jmp 0x407d15
cmp edi, 0x20
jge 0x407cab
mov eax, dword [ebp - 0xc]
mov dword [ebp + edi*4 - 0x100], eax
inc edi
push dword [ebp - 0xc]
lea eax, [ebp - 0x80]
push eax
call dword [sym.imp.ADVAPI32.dll_EqualSid]
mov ecx, dword [ebp - 0x10]
test eax, eax
je 0x407cd2
mov eax, dword [ebp + 0x10]
neg eax
sbb eax, eax
and eax, 0x10006
add eax, 0xe0039
jmp 0x407cd7
mov eax, 0x20000
cmp dword [ecx + 4], eax
je 0x407ce9
mov dword [ecx + 4], eax
mov ecx, dword [ebp - 0x10]
mov dword [ebp - 0x14], 1
cmp byte [ecx], bl
jne 0x407cf3
test byte [ecx + 1], 0x10
je 0x407d12
mov byte [ecx], bl
mov eax, dword [ebp - 0xc]
cmp dword [eax + 8], ebx
mov ecx, dword [ebp - 0x10]
sete al
mov dword [ebp - 0x14], 1
lea eax, [eax*8 + 2]
mov byte [ecx + 1], al
inc dword [ebp - 4]
mov eax, dword [ebp - 0x1c]
movzx ecx, word [eax + 4]
cmp dword [ebp - 4], ecx
jb 0x407c44
cmp dword [ebp - 0x14], ebx
je 0x407df2
cmp byte [0x412240], bl
je 0x407da6
cmp dword [0x412d58], ebx
je 0x407da6
lea eax, [ebp - 8]
push eax
push 0x103
push ebx
push dword [ebp + 0xc]
mov dword [ebp - 8], ebx
push dword [ebp + 8]
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
test eax, eax
jne 0x407da6
mov ecx, 0x412240
mov eax, ecx
lea esi, [eax + 1]
mov dl, byte [eax]
inc eax
cmp dl, bl
jne 0x407d65
sub eax, esi
inc eax
push eax
push ecx
push 2
push ebx
push 0xb7
push 0xa9
push 0xa
push 0x4106f0
push 0x412390
call fcn.0040254d
add esp, 0x14
push eax
push dword [ebp - 8]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExA]
test eax, eax
jne 0x407da6
mov dword [0x412d58], ebx
xor edi, edi
push 0x14
inc edi
push 0x40
mov dword [ebp - 8], edi
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov esi, eax
cmp esi, ebx
je 0x407df2
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x407deb
push ebx
push dword [ebp - 0x1c]
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
test eax, eax
je 0x407deb
push esi
push 4
push dword [ebp - 0x18]
call dword [sym.imp.ADVAPI32.dll_RegSetKeySecurity]
test eax, eax
jne 0x407deb
mov dword [ebp - 8], edi
push esi
call dword [sym.imp.KERNEL32.dll_LocalFree]
pop edi
push dword [ebp - 0x18]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov eax, dword [ebp - 8]
pop esi
pop ebx
leave
ret