Function at 0x40d9a0
Capabilities:
Access the windows event log

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x57ed1d
mov eax, dword fs:[0]
push eax
sub esp, 0x18
push ebx
push esi
push edi
mov eax, dword [0x5e3f80]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov esi, edx
mov edi, ecx
mov dword [ebp - 4], 0
mov eax, dword [ebp + 8]
cmp dword [eax - 0xc], 0
je 0x40db74
push 0x5c3ef0
push 0
mov dword [ebp - 0x1c], 0
call dword [sym.imp.ADVAPI32.dll_RegisterEventSourceW]
mov dword [ebp - 0x24], eax
test eax, eax
je 0x40db74
xor ebx, ebx
test edi, edi
setne bl
xor edi, edi
add ebx, 0x6d7
test esi, esi
je 0x40da19
mov edi, 1
jmp 0x40da24
cmp dword [ebp + 0xc], edi
mov eax, 4
cmovne edi, eax
mov eax, dword [ebp + 8]
cmp dword [eax - 4], 1
jle 0x40da3b
push dword [eax - 0xc]
lea ecx, [ebp + 8]
call fcn.00402ea0
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 0x40da99
call esi
cmp eax, 0x3f0
je 0x40da7b
xor esi, esi
jmp 0x40db54
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 0x40da99
xor esi, esi
jmp 0x40db54
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 0x40dab7
xor esi, esi
jmp 0x40db54
call esi
cmp eax, 0x7a
je 0x40dac5
xor esi, esi
jmp 0x40db54
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 0x40db54
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 0x40dafc
xor esi, esi
jmp 0x40db54
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 0x40db54
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 0x40db34
xor esi, esi
jmp 0x40db54
mov eax, dword [ebp - 0x10]
test eax, eax
je 0x40db42
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 0x40db8f
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