Function at 0x10001040
Capabilities:
Acquire debug privileges
Check if file exists
Enumerate process modules
Enumerate processes
Get common file path
Get file attributes
Get process image filename

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0xa7c
mov eax, dword [0x10011080]
xor eax, esp
mov dword [esp + 0xa78], eax
push ebx
push esi
push edi
xor ebx, ebx
push 0x228
lea eax, [esp + 0x28]
push ebx
push eax
mov dword [esp + 0x24], ebx
mov dword [esp + 0x2c], ebx
call fcn.1000a780
add esp, 0xc
push 0x206
lea edx, [esp + 0x266]
xor ecx, ecx
push ebx
push edx
mov word [esp + 0x26c], cx
call fcn.1000a780
add esp, 0xc
push 0x206
lea ecx, [esp + 0x87e]
xor eax, eax
push ebx
push ecx
mov word [esp + 0x884], ax
call fcn.1000a780
add esp, 0xc
push 0x206
lea eax, [esp + 0x676]
xor edx, edx
push ebx
push eax
mov word [esp + 0x67c], dx
call fcn.1000a780
add esp, 0xc
lea ecx, [esp + 0x14]
push ecx
push 0x28
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
je 0x10001145
lea edx, [esp + 0x254]
push edx
push str.SeDebugPrivilege
push ebx
mov dword [esp + 0x25c], 1
mov dword [esp + 0x268], 2
call dword [sym.imp.ADVAPI32.dll_LookupPrivilegeValueW]
mov ecx, dword [esp + 0x14]
push ebx
push ebx
push 0x10
lea eax, [esp + 0x25c]
push eax
push ebx
push ecx
call dword [sym.imp.ADVAPI32.dll_AdjustTokenPrivileges]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, dword [esp + 0x14]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebx
push 2
call dword [sym.imp.KERNEL32.dll_CreateToolhelp32Snapshot]
mov esi, eax
mov dword [esp + 0x14], esi
cmp esi, 0xffffffff
je 0x1000136a
push ebx
push 0x1a
lea eax, [esp + 0x470]
push eax
push ebx
mov dword [esp + 0x30], 0x22c
call dword [sym.imp.SHELL32.dll_SHGetSpecialFolderPathW]
lea ecx, [esp + 0x468]
push ecx
mov edx, ecx
push str._sTelegram_DesktopTelegram.exe
push edx
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0xc
lea eax, [esp + 0x20]
push eax
push esi
mov byte [esp + 0x1b], 1
call dword [sym.imp.KERNEL32.dll_Process32FirstW]
test eax, eax
je 0x100012d9
mov edi, dword [sym.imp.PSAPI.DLL_EnumProcessModules]
nop
mov ecx, dword [esp + 0x28]
push ecx
push ebx
push 0x410
call dword [sym.imp.KERNEL32.dll_OpenProcess]
mov esi, eax
cmp esi, ebx
je 0x100012b7
mov eax, dword [esp + 0x28]
cmp eax, ebx
je 0x100012b0
cmp eax, 4
je 0x100012b0
cmp eax, 8
je 0x100012b0
lea edx, [esp + 0x1c]
push edx
push 4
lea eax, [esp + 0x20]
push eax
push esi
call edi
push 0x104
lea ecx, [esp + 0x674]
push ecx
push esi
call dword [sym.imp.PSAPI.DLL_GetProcessImageFileNameW]
lea edx, [esp + 0x260]
test eax, eax
jne 0x10001225
push 0x1000f154
push edx
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
jmp 0x10001231
lea ecx, [esp + 0x670]
call fcn.10001550
push 0x208
lea eax, [esp + 0x87c]
push ebx
push eax
call fcn.1000a780
lea ecx, [esp + 0x884]
add esp, 0xc
push ecx
mov ecx, esi
call fcn.10001380
add esp, 4
test eax, eax
je 0x100012b0
push str.Telegram.exe
lea edx, [esp + 0x264]
push edx
call dword [sym.imp.KERNEL32.dll_lstrlenW]
lea eax, [esp + eax*2 + 0x24c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcmpW]
test eax, eax
jne 0x100012b0
lea ecx, [esp + 0x260]
push ecx
call fcn.100016d0
add esp, 4
lea edx, [esp + 0x260]
push edx
lea eax, [esp + 0x46c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcmpW]
test eax, eax
jne 0x100012b0
mov byte [esp + 0x13], bl
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edx, dword [esp + 0x14]
lea ecx, [esp + 0x20]
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_Process32NextW]
test eax, eax
jne 0x100011b0
mov esi, dword [esp + 0x14]
cmp byte [esp + 0x13], bl
je 0x100012fc
lea eax, [esp + 0x468]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x100012fc
lea ecx, [esp + 0x468]
push ecx
call fcn.100016d0
add esp, 4
lea edx, [esp + 0x14]
push edx
push 0x28
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
je 0x10001363
lea eax, [esp + 0x254]
push eax
push str.SeDebugPrivilege
push ebx
mov dword [esp + 0x25c], 1
mov dword [esp + 0x268], ebx
call dword [sym.imp.ADVAPI32.dll_LookupPrivilegeValueW]
mov edx, dword [esp + 0x14]
push ebx
push ebx
push 0x10
lea ecx, [esp + 0x25c]
push ecx
push ebx
push edx
call dword [sym.imp.ADVAPI32.dll_AdjustTokenPrivileges]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov eax, dword [esp + 0x14]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [esp + 0xa84]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.10006817
mov esp, ebp
pop ebp
ret