Function at 0x40f640
Capabilities:
Access the windows event log

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x57d67d
mov eax, dword fs:[0]
push eax
sub esp, 0x18
push ebx
push esi
push edi
mov eax, dword [0x5e21c0]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov eax, dword [ebp + 8]
mov dword [ebp - 4], 0
cmp dword [eax - 0xc], 0
je 0x40f812
push 0x58ede8
push 0
mov dword [ebp - 0x1c], 0
call dword [sym.imp.ADVAPI32.dll_RegisterEventSourceW]
mov dword [ebp - 0x24], eax
test eax, eax
je 0x40f812
xor ebx, ebx
cmp dword [ebp + 0xc], ebx
setne bl
xor edi, edi
add ebx, 0x6d7
cmp dword [ebp + 0x10], edi
je 0x40f6b7
mov edi, 1
jmp 0x40f6c2
cmp dword [ebp + 0x14], edi
mov eax, 4
cmovne edi, eax
mov eax, dword [ebp + 8]
cmp dword [eax - 4], 1
jle 0x40f6d9
push dword [eax - 0xc]
lea ecx, [ebp + 8]
call fcn.00402560
mov eax, dword [ebp + 8]
mov dword [ebp - 0x1c], eax
lea eax, [ebp - 0x10]
push eax
push 1
push 8
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x14], 0
call dword [sym.imp.KERNEL32.dll_GetCurrentThread]
push eax
call dword [sym.imp.ADVAPI32.dll_OpenThreadToken]
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x40f737
call esi
cmp eax, 0x3f0
je 0x40f719
xor esi, esi
jmp 0x40f7f2
lea eax, [ebp - 0x10]
push eax
push 8
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
jne 0x40f737
xor esi, esi
jmp 0x40f7f2
lea eax, [ebp - 0x14]
push eax
push 0
push 0
push 1
push dword [ebp - 0x10]
call dword [sym.imp.ADVAPI32.dll_GetTokenInformation]
test eax, eax
je 0x40f755
xor esi, esi
jmp 0x40f7f2
call esi
cmp eax, 0x7a
je 0x40f763
xor esi, esi
jmp 0x40f7f2
mov esi, dword [ebp - 0x14]
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push esi
push 0
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
mov dword [ebp - 0x18], esi
test esi, esi
je 0x40f7f2
lea eax, [ebp - 0x14]
push eax
push dword [ebp - 0x14]
push esi
push 1
push dword [ebp - 0x10]
call dword [sym.imp.ADVAPI32.dll_GetTokenInformation]
test eax, eax
jne 0x40f79a
xor esi, esi
jmp 0x40f7f2
push dword [esi]
call dword [sym.imp.ADVAPI32.dll_GetLengthSid]
push eax
push 0
mov dword [ebp - 0x20], eax
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
test esi, esi
je 0x40f7f2
mov eax, dword [ebp - 0x18]
push dword [eax]
push esi
push dword [ebp - 0x20]
call dword [sym.imp.ADVAPI32.dll_CopySid]
test eax, eax
jne 0x40f7d2
xor esi, esi
jmp 0x40f7f2
mov eax, dword [ebp - 0x10]
test eax, eax
je 0x40f7e0
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp - 0x18]
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
push 0
lea eax, [ebp - 0x1c]
push eax
push 0
push 1
push esi
mov esi, dword [ebp - 0x24]
push ebx
push 0
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_ReportEventW]
push esi
call dword [sym.imp.ADVAPI32.dll_DeregisterEventSource]
mov edx, dword [ebp + 8]
or eax, 0xffffffff
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x40f82d
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret