Function at 0x46fde0
Capabilities:
Compare security identifiers
Get user security identifier
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x54
push ebp
xor ebp, ebp
test byte [0x4b99b8], 1
push esi
mov esi, dword [sym.imp.KERNEL32.dll_GetProcAddress]
push edi
mov edi, dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
mov dword [esp + 0x10], ebp
mov dword [esp + 0x20], ebp
mov dword [esp + 0x14], ebp
mov dword [esp + 0x28], ebp
mov dword [esp + 0x18], ebp
mov dword [esp + 0x30], ebp
mov dword [esp + 0x1c], ebp
jne 0x46fe34
or dword [0x4b99b8], 1
push str.SetSecurityDescriptorControl
push 0x493fa0
call edi
push eax
call esi
mov dword [0x4b99b4], eax
test byte [0x4b99b8], 2
jne 0x46fe58
or dword [0x4b99b8], 2
push 0x493fbc
push 0x493fd4
call edi
push eax
call esi
mov dword [0x4b99b0], eax
mov esi, dword [esp + 0x68]
mov edi, dword [sym.imp.ADVAPI32.dll_LookupAccountNameW]
lea eax, [esp + 0x34]
push eax
lea ecx, [esp + 0x14]
push ecx
push ebp
lea edx, [esp + 0x2c]
push edx
push ebp
push esi
push ebp
call edi
mov eax, dword [esp + 0x20]
cmp eax, ebp
jbe 0x4701bc
cmp dword [esp + 0x10], ebp
jbe 0x4701bc
push ebx
push eax
call fcn.00476c60
mov ebx, eax
mov eax, dword [esp + 0x18]
xor ecx, ecx
mov edx, 2
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.00476c60
mov dword [esp + 0x38], eax
mov eax, dword [esp + 0x2c]
push eax
push 0
push ebx
call fcn.00477820
mov ecx, dword [esp + 0x28]
mov eax, dword [esp + 0x44]
lea edx, [ecx + ecx]
push edx
push 0
push eax
call fcn.00477820
mov eax, dword [esp + 0x50]
add esp, 0x20
lea ecx, [esp + 0x38]
push ecx
lea edx, [esp + 0x18]
push edx
push eax
lea ecx, [esp + 0x30]
push ecx
push ebx
push esi
push 0
call edi
test eax, eax
je 0x4701b8
mov eax, dword [esp + 0x68]
mov esi, dword [sym.imp.ADVAPI32.dll_GetFileSecurityW]
lea edx, [esp + 0x18]
push edx
push 0
push 0
push 4
push eax
call esi
mov eax, dword [esp + 0x18]
test eax, eax
jbe 0x4701b8
push eax
call fcn.00476c60
mov ecx, dword [esp + 0x1c]
push ecx
mov edi, eax
push 0
push edi
mov dword [esp + 0x20], edi
call fcn.00477820
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x78]
add esp, 0x10
lea edx, [esp + 0x18]
push edx
push eax
push edi
push 4
push ecx
call esi
test eax, eax
je 0x470174
push 1
lea edx, [esp + 0x54]
push edx
call dword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x470174
lea eax, [esp + 0x40]
push eax
lea ecx, [esp + 0x30]
push ecx
lea edx, [esp + 0x30]
push edx
push edi
call dword [sym.imp.ADVAPI32.dll_GetSecurityDescriptorDacl]
test eax, eax
je 0x470174
mov eax, dword [esp + 0x2c]
xor edi, edi
mov dword [esp + 0x44], edi
mov dword [esp + 0x4c], edi
mov dword [esp + 0x48], 8
cmp eax, edi
jne 0x46ffa9
mov dword [esp + 0x28], edi
jmp 0x46ffc9
cmp dword [esp + 0x28], edi
je 0x46ffc9
push 2
push 0xc
lea ecx, [esp + 0x4c]
push ecx
push eax
call dword [sym.imp.ADVAPI32.dll_GetAclInformation]
test eax, eax
je 0x470170
xor edi, edi
push ebx
call dword [sym.imp.ADVAPI32.dll_GetLengthSid]
mov edx, dword [esp + 0x48]
lea esi, [eax + edx + 8]
push esi
call fcn.00476c60
push esi
mov ebp, eax
push edi
push ebp
call fcn.00477820
add esp, 0x10
push 2
push esi
push ebp
call dword [sym.imp.ADVAPI32.dll_InitializeAcl]
test eax, eax
je 0x470170
cmp dword [esp + 0x28], 0
mov edi, dword [sym.imp.ADVAPI32.dll_AddAce]
je 0x47006c
mov eax, dword [esp + 0x44]
test eax, eax
je 0x47006c
xor esi, esi
test eax, eax
jbe 0x470070
jmp 0x470020
mov ecx, dword [esp + 0x2c]
lea eax, [esp + 0x1c]
push eax
push esi
push ecx
call dword [sym.imp.ADVAPI32.dll_GetAce]
test eax, eax
je 0x470070
mov eax, dword [esp + 0x1c]
test byte [eax + 1], 0x10
jne 0x470070
add eax, 8
push eax
push ebx
call dword [sym.imp.ADVAPI32.dll_EqualSid]
test eax, eax
jne 0x470063
mov eax, dword [esp + 0x1c]
movzx edx, word [eax + 2]
push edx
push eax
push 0xffffffffffffffff
push 2
push ebp
call edi
test eax, eax
je 0x470070
inc esi
cmp esi, dword [esp + 0x44]
jb 0x470020
jmp 0x470070
mov esi, dword [esp + 0x34]
mov eax, dword [0x4b99b0]
push ebx
test eax, eax
je 0x470088
mov ecx, dword [esp + 0x74]
push ecx
push 3
push 2
push ebp
call eax
jmp 0x470096
mov edx, dword [esp + 0x74]
push edx
push 2
push ebp
call dword [sym.imp.ADVAPI32.dll_AddAccessAllowedAce]
test eax, eax
je 0x470170
cmp dword [esp + 0x28], 0
je 0x4700e2
mov eax, dword [esp + 0x44]
test eax, eax
je 0x4700e2
cmp esi, eax
jae 0x4700e2
mov ecx, dword [esp + 0x2c]
lea eax, [esp + 0x1c]
push eax
push esi
push ecx
call dword [sym.imp.ADVAPI32.dll_GetAce]
test eax, eax
je 0x4700e2
mov eax, dword [esp + 0x1c]
movzx edx, word [eax + 2]
push edx
push eax
push 0xffffffffffffffff
push 2
push ebp
call edi
test eax, eax
je 0x4700e2
inc esi
cmp esi, dword [esp + 0x44]
jb 0x4700b1
push 0
push ebp
push 1
lea eax, [esp + 0x5c]
push eax
call dword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
test eax, eax
je 0x470170
xor eax, eax
cmp dword [0x4b99b4], eax
je 0x470152
lea ecx, [esp + 0x3c]
push ecx
lea edx, [esp + 0x38]
mov dword [esp + 0x38], eax
mov dword [esp + 0x40], eax
mov eax, dword [esp + 0x14]
push edx
push eax
call dword [sym.imp.ADVAPI32.dll_GetSecurityDescriptorControl]
test eax, eax
je 0x470170
mov eax, dword [esp + 0x34]
test eax, 0x400
je 0x470133
mov eax, 0x500
jmp 0x47013f
test eax, 0x1000
je 0x470152
mov eax, 0x1000
mov ecx, eax
push ecx
push eax
lea ecx, [esp + 0x58]
push ecx
call dword [0x4b99b4]
test eax, eax
je 0x470170
mov eax, dword [esp + 0x68]
lea edx, [esp + 0x50]
push edx
push 4
push eax
call dword [sym.imp.ADVAPI32.dll_SetFileSecurityW]
test eax, eax
je 0x470170
mov dword [esp + 0x20], 1
mov edi, dword [esp + 0x10]
test ebx, ebx
je 0x470181
push ebx
call fcn.00478198
add esp, 4
mov eax, dword [esp + 0x30]
pop ebx
test eax, eax
je 0x470193
push eax
call fcn.00478198
add esp, 4
test edi, edi
je 0x4701a0
push edi
call fcn.00478198
add esp, 4
test ebp, ebp
je 0x4701ad
push ebp
call fcn.00478198
add esp, 4
mov eax, dword [esp + 0x1c]
pop edi
pop esi
pop ebp
add esp, 0x54
ret
mov edi, ebp
jmp 0x470174
pop edi
pop esi
mov eax, ebp
pop ebp
add esp, 0x54
ret