Function at 0x401350
Capabilities:
Access peb ldr_data
Get common file path
Get process heap flags

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x35c
cmp dword [ebp + 8], 1
mov eax, dword [ebp + 0xc]
jbe 0x401680
mov edi, dword [eax + 4]
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], 0
call dword [sym.imp.kernel32.dll_CreateEventW]
mov dword [0x404108], eax
sub esp, 0x10
test eax, eax
je 0x401671
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov dword [esp], 0
call dword [sym.imp.advapi32.dll_OpenSCManagerW]
mov dword [0x4040e0], eax
sub esp, 0xc
test eax, eax
je 0x401671
mov dword [esp + 8], edi
mov dword [esp + 4], sym._service_handler_16
mov dword [esp], str.winedevice
call dword [sym.imp.advapi32.dll_RegisterServiceCtrlHandlerExW]
mov dword [0x404104], eax
sub esp, 0xc
test eax, eax
je 0x401671
lea ebx, [ebp - 0x214]
mov dword [esp + 4], 0x104
mov esi, str.C:windows_system32win32k.sys
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_GetSystemDirectoryW]
sub esp, 8
mov dword [esp], ebx
mov dword [esp + 4], str.drivers
call dword [sym.imp.ntoskrnl.exe_wcscat]
mov dword [esp], ebx
xor ebx, ebx
call dword [sym.imp.kernel32.dll_AddDllDirectory]
sub esp, 4
mov dword [esp], esi
call dword [sym.imp.kernel32.dll_LoadLibraryW]
sub esp, 4
test eax, eax
je 0x401690
inc ebx
cmp ebx, 3
je 0x401460
mov esi, dword [ebx*4 + 0x405380]
jmp 0x401435
lea eax, [ebp - 0x344]
mov dword [esp + 4], 0
mov dword [esp + 8], eax
mov dword [esp], 0
call dword [sym.imp.ntdll.dll_LdrLockLoaderLock]
sub esp, 0xc
mov dword [esp], str.C:windows_system32_ntoskrnl.exe
call dword [sym.imp.kernel32.dll_GetModuleHandleW]
lea edx, [ebp - 0x348]
sub esp, 4
mov dword [esp + 4], edx
mov dword [esp], eax
call dword [sym.imp.ntdll.dll_LdrFindEntryForAddress]
sub esp, 8
test eax, eax
jne 0x40154e
mov eax, dword [ebp - 0x348]
mov edx, dword [eax]
mov eax, dword [eax + 4]
mov dword [edx + 4], eax
mov dword [eax], edx
mov eax, dword [ebp - 0x348]
mov edx, dword fs:[0x18]
mov dword [eax], 0
mov dword [eax + 4], 0
mov eax, dword [edx + 0x30]
mov eax, dword [eax + 0xc]
mov ebx, dword [eax + 0xc]
mov eax, dword [ebp - 0x348]
mov dword [eax], ebx
mov ecx, dword [edx + 0x30]
mov eax, dword [ebp - 0x348]
mov ecx, dword [ecx + 0xc]
add ecx, 0xc
mov dword [eax + 4], ecx
mov dword [ebx + 4], eax
mov ecx, dword [edx + 0x30]
mov ecx, dword [ecx + 0xc]
mov dword [ecx + 0xc], eax
mov ecx, dword [eax + 8]
mov eax, dword [eax + 0xc]
mov dword [ecx + 4], eax
mov dword [eax], ecx
mov eax, dword [ebp - 0x348]
mov dword [eax + 8], 0
add eax, 8
mov dword [eax + 4], 0
mov ecx, dword [edx + 0x30]
mov ecx, dword [ecx + 0xc]
mov ebx, dword [ecx + 0x14]
mov dword [eax], ebx
mov ecx, dword [edx + 0x30]
mov ecx, dword [ecx + 0xc]
add ecx, 0x14
mov dword [eax + 4], ecx
mov dword [ebx + 4], eax
mov edx, dword [edx + 0x30]
mov edx, dword [edx + 0xc]
mov dword [edx + 0x14], eax
mov eax, dword [ebp - 0x344]
mov dword [esp], 0
mov dword [esp + 4], eax
call dword [sym.imp.ntdll.dll_LdrUnlockLoaderLock]
sub esp, 8
test byte [0x404010], 8
jne 0x401938
lea eax, [ebp - 0x340]
mov dword [ebp - 0x340], 0x30
mov ebx, dword [sym.imp.advapi32.dll_SetServiceStatus]
mov dword [esp + 4], eax
mov eax, dword [0x404104]
mov dword [ebp - 0x33c], 4
mov dword [ebp - 0x338], 5
mov dword [ebp - 0x334], 0
mov dword [ebp - 0x330], 0
mov dword [ebp - 0x32c], 0
mov dword [ebp - 0x328], 0
mov dword [esp], eax
call ebx
mov eax, dword [0x404108]
sub esp, 8
mov dword [esp], eax
call sym._wine_ntoskrnl_main_loop
test byte [0x404010], 8
jne 0x4017f0
mov dword [ebp - 0x340], 0x30
lea eax, [ebp - 0x340]
mov dword [esp + 4], eax
mov eax, dword [0x404104]
mov dword [ebp - 0x33c], 1
mov dword [ebp - 0x338], 0
mov dword [ebp - 0x334], 0
mov dword [ebp - 0x330], 0
mov dword [ebp - 0x32c], 0
mov dword [ebp - 0x328], 0
mov dword [esp], eax
call ebx
mov eax, dword [0x4040e0]
sub esp, 8
mov dword [esp], eax
call dword [sym.imp.advapi32.dll_CloseServiceHandle]
mov eax, dword [0x404108]
sub esp, 4
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_CloseHandle]
sub esp, 4
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret 8
mov edi, dword [eax]
jmp 0x40136c
test byte [0x404010], 2
je 0x401449
test esi, esi
je 0x401d30
mov eax, esi
shr eax, 0x10
je 0x401cc0
mov dword [esp + 4], 0xffffffff
mov dword [esp], esi
call dword [sym.imp.kernel32.dll_IsBadStringPtrW]
mov edx, str._invalid_
sub esp, 8
test eax, eax
jne 0x4017c2
cmp word [esi], 0
je 0x401d7c
lea esi, [esi]
nop
mov edx, eax
lea eax, [eax + 1]
cmp word [esi + edx*2 + 2], 0
jne 0x4016e0
mov eax, 0x224c
mov dword [ebp - 0x350], edi
lea ecx, [ebp - 0x33e]
mov word [ebp - 0x340], ax
lea eax, [ebp - 0x21e]
mov dword [ebp - 0x354], ebx
mov dword [ebp - 0x34c], eax
jmp 0x401751
cmp ax, 9
je 0x401c68
cmp ax, 0xa
jne 0x401bf6
mov eax, 0x6e5c
add ecx, 2
mov word [ecx - 2], ax
lea eax, [edx - 1]
cmp ecx, dword [ebp - 0x34c]
ja 0x401788
test edx, edx
jle 0x401788
mov edx, eax
movzx eax, word [esi]
add esi, 2
cmp ax, 0xd
je 0x401bd8
jbe 0x401720
cmp ax, 0x22
je 0x401c50
cmp ax, 0x5c
jne 0x401be9
mov ebx, 0x5c5c
add ecx, 2
mov word [ecx - 2], bx
jmp 0x401740
mov edi, dword [ebp - 0x350]
mov ebx, dword [ebp - 0x354]
mov byte [ecx], 0x22
test eax, eax
jle 0x401d95
mov edx, 0x2e2e
mov byte [ecx + 3], 0x2e
lea eax, [ecx + 4]
mov word [ecx + 1], dx
mov byte [eax], 0
lea eax, [ebp - 0x340]
mov dword [esp], eax
call sym.___wine_dbg_strdup
mov edx, eax
mov dword [esp + 0x10], edx
mov dword [esp + 0xc], str.Failed_to_load__s_n
mov dword [esp + 8], str.ServiceMain
mov dword [esp + 4], 0x404010
mov dword [esp], 1
call sym._wine_dbg_log.constprop.0
jmp 0x401449
test edi, edi
je 0x401d20
mov eax, edi
shr eax, 0x10
je 0x401c80
mov dword [esp + 4], 0xffffffff
mov dword [esp], edi
call dword [sym.imp.kernel32.dll_IsBadStringPtrW]
mov edx, str._invalid_
sub esp, 8
test eax, eax
jne 0x401904
cmp word [edi], 0
je 0x401d3a
nop
mov edx, eax
lea eax, [eax + 1]
cmp word [edi + edx*2 + 2], 0
jne 0x401830
mov eax, 0x224c
mov dword [ebp - 0x34c], ebx
lea ecx, [ebp - 0x33e]
mov word [ebp - 0x340], ax
jmp 0x401893
cmp ax, 9
je 0x401ab0
cmp ax, 0xa
jne 0x401b6e
mov eax, 0x6e5c
add ecx, 2
mov word [ecx - 2], ax
lea eax, [edx - 1]
test edx, edx
jle 0x4018d0
lea esi, [ebp - 0x21e]
cmp ecx, esi
ja 0x4018d0
mov edx, eax
movzx eax, word [edi]
add edi, 2
cmp ax, 0xd
je 0x401a98
jbe 0x401860
cmp ax, 0x22
je 0x401bc0
cmp ax, 0x5c
jne 0x401b61
mov ebx, 0x5c5c
add ecx, 2
mov word [ecx - 2], bx
jmp 0x401880
mov byte [ecx], 0x22
mov ebx, dword [ebp - 0x34c]
test eax, eax
jle 0x401d53
mov edx, 0x2e2e
mov byte [ecx + 3], 0x2e
lea eax, [ecx + 4]
mov word [ecx + 1], dx
mov byte [eax], 0
lea eax, [ebp - 0x340]
mov dword [esp], eax
call sym.___wine_dbg_strdup
mov edx, eax
mov dword [esp + 0x10], edx
mov dword [esp + 0xc], str.service_group__s_stopped_n
mov dword [esp + 8], str.ServiceMain
mov dword [esp + 4], 0x404010
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x4015f2
test edi, edi
je 0x401d10
mov eax, edi
shr eax, 0x10
je 0x401ca0
mov dword [esp + 4], 0xffffffff
mov dword [esp], edi
call dword [sym.imp.kernel32.dll_IsBadStringPtrW]
mov edx, str._invalid_
sub esp, 8
test eax, eax
jne 0x401a64
cmp word [edi], 0
je 0x401d5b
lea esi, [esi]
lea esi, [esi]
mov edx, eax
lea eax, [eax + 1]
cmp word [edi + edx*2 + 2], 0
jne 0x401980
mov ebx, 0x224c
lea eax, [ebp - 0x21e]
mov dword [ebp - 0x350], edi
lea ecx, [ebp - 0x33e]
mov dword [ebp - 0x34c], edi
mov edi, eax
mov word [ebp - 0x340], bx
jmp 0x4019ed
cmp ax, 9
je 0x401ac8
cmp ax, 0xa
jne 0x401afe
mov eax, 0x6e5c
add ecx, 2
mov word [ecx - 2], ax
lea esi, [esi]
nop
lea eax, [edx - 1]
cmp ecx, edi
ja 0x401a30
test edx, edx
jle 0x401a30
mov edx, eax
add dword [ebp - 0x34c], 2
mov eax, dword [ebp - 0x34c]
movzx eax, word [eax - 2]
cmp ax, 0xd
je 0x401ae0
jbe 0x4019b8
cmp ax, 0x22
je 0x401b50
cmp ax, 0x5c
jne 0x401af1
mov ebx, 0x5c5c
add ecx, 2
mov word [ecx - 2], bx
jmp 0x4019e0
mov byte [ecx], 0x22
mov edi, dword [ebp - 0x350]
test eax, eax
jle 0x401d74
mov edx, 0x2e2e
mov byte [ecx + 3], 0x2e
lea eax, [ecx + 4]
mov word [ecx + 1], dx
mov byte [eax], 0
lea eax, [ebp - 0x340]
mov dword [esp], eax
call sym.___wine_dbg_strdup
mov edx, eax
mov dword [esp + 0x10], edx
mov dword [esp + 0xc], str.starting_service_group__s_n
mov dword [esp + 8], str.ServiceMain
mov dword [esp + 4], 0x404010
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x401575
mov eax, reloc.advapi32.dll_RegisterServiceCtrlHandlerExW
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401880
mov eax, 0x745c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401880
mov eax, 0x745c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x4019e0
mov eax, reloc.advapi32.dll_RegisterServiceCtrlHandlerExW
add ecx, 2
mov word [ecx - 2], ax
jmp 0x4019e0
lea esi, [eax - 0x20]
cmp si, 0x5e
jbe 0x401cf0
mov esi, eax
mov byte [ecx], 0x5c
add ecx, 5
shr si, 0xc
movzx esi, si
movzx ebx, byte [esi + str.0123456789abcdef]
mov esi, eax
shr si, 8
and esi, 0xf
mov byte [ecx - 4], bl
movzx ebx, byte [esi + str.0123456789abcdef]
mov esi, eax
and eax, 0xf
shr si, 4
movzx eax, byte [eax + str.0123456789abcdef]
and esi, 0xf
mov byte [ecx - 3], bl
movzx ebx, byte [esi + str.0123456789abcdef]
mov byte [ecx - 1], al
mov byte [ecx - 2], bl
jmp 0x4019e0
mov esi, 0x225c
add ecx, 2
mov word [ecx - 2], si
jmp 0x4019e0
lea esi, [eax - 0x20]
cmp si, 0x5e
jbe 0x401ce0
mov esi, eax
mov byte [ecx], 0x5c
add ecx, 5
shr si, 0xc
movzx esi, si
movzx ebx, byte [esi + str.0123456789abcdef]
mov esi, eax
shr si, 8
and esi, 0xf
mov byte [ecx - 4], bl
movzx ebx, byte [esi + str.0123456789abcdef]
mov esi, eax
and eax, 0xf
shr si, 4
movzx eax, byte [eax + str.0123456789abcdef]
and esi, 0xf
mov byte [ecx - 3], bl
movzx ebx, byte [esi + str.0123456789abcdef]
mov byte [ecx - 1], al
mov byte [ecx - 2], bl
jmp 0x401880
mov esi, 0x225c
add ecx, 2
mov word [ecx - 2], si
jmp 0x401880
mov eax, reloc.advapi32.dll_RegisterServiceCtrlHandlerExW
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401740
lea edi, [eax - 0x20]
cmp di, 0x5e
jbe 0x401d00
mov edi, eax
mov byte [ecx], 0x5c
add ecx, 5
shr di, 0xc
movzx edi, di
movzx ebx, byte [edi + str.0123456789abcdef]
mov edi, eax
shr di, 8
and edi, 0xf
mov byte [ecx - 4], bl
movzx ebx, byte [edi + str.0123456789abcdef]
mov edi, eax
and eax, 0xf
shr di, 4
movzx eax, byte [eax + str.0123456789abcdef]
and edi, 0xf
mov byte [ecx - 3], bl
movzx ebx, byte [edi + str.0123456789abcdef]
mov byte [ecx - 1], al
mov byte [ecx - 2], bl
jmp 0x401740
mov edi, 0x225c
add ecx, 2
mov word [ecx - 2], di
jmp 0x401740
mov eax, 0x745c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401740
movzx eax, di
mov dword [esp], str._04x
mov dword [esp + 4], eax
call sym._wine_dbg_sprintf.constprop.0
mov edx, eax
jmp 0x401904
movzx eax, di
mov dword [esp], str._04x
mov dword [esp + 4], eax
call sym._wine_dbg_sprintf.constprop.0
mov edx, eax
jmp 0x401a64
movzx esi, si
mov dword [esp], str._04x
mov dword [esp + 4], esi
call sym._wine_dbg_sprintf.constprop.0
mov edx, eax
jmp 0x4017c2
mov byte [ecx], al
inc ecx
jmp 0x401880
mov byte [ecx], al
inc ecx
jmp 0x4019e0
mov byte [ecx], al
inc ecx
jmp 0x401740
mov edx, str._null_
jmp 0x401a64
mov edx, str._null_
jmp 0x401904
mov edx, str._null_
jmp 0x4017c2
mov esi, 0x224c
mov byte [ebp - 0x33e], 0x22
lea ecx, [ebp - 0x33e]
mov word [ebp - 0x340], si
lea eax, [ecx + 1]
jmp 0x4018f1
mov byte [ebp - 0x33e], 0x22
mov ecx, 0x224c
mov word [ebp - 0x340], cx
lea ecx, [ebp - 0x33e]
lea eax, [ecx + 1]
jmp 0x401a51
mov edx, 0x224c
mov byte [ebp - 0x33e], 0x22
lea ecx, [ebp - 0x33e]
mov word [ebp - 0x340], dx
lea eax, [ecx + 1]
jmp 0x4017af