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

Disassembly:
lea ecx, [esp + 4]
and esp, 0xfffffff0
push dword [ecx - 4]
push ebp
mov ebp, esp
push edi
push esi
push ebx
push ecx
sub esp, 0x378
cmp dword [ecx], 1
mov eax, dword [ecx + 4]
jbe 0x401a70
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 [section..bss], eax
sub esp, 0x10
test eax, eax
je 0x401a59
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov dword [esp], 0
call dword [sym.imp.advapi32.dll_OpenSCManagerW]
mov dword [0x407004], eax
sub esp, 0xc
test eax, eax
je 0x401a59
mov dword [esp + 8], edi
mov dword [esp + 4], sym._service_handler_16
mov dword [esp], section..data
call dword [sym.imp.advapi32.dll_RegisterServiceCtrlHandlerExW]
mov dword [0x407008], eax
sub esp, 0xc
test eax, eax
je 0x401a59
lea ebx, [ebp - 0x220]
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 0x401a80
add ebx, 1
cmp ebx, 3
je 0x401848
mov esi, dword [ebx*4 + 0x405250]
jmp 0x40181f
lea eax, [ebp - 0x350]
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 - 0x354]
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 0x401936
mov eax, dword [ebp - 0x354]
mov edx, dword [eax]
mov eax, dword [eax + 4]
mov dword [edx + 4], eax
mov dword [eax], edx
mov eax, dword [ebp - 0x354]
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 - 0x354]
mov dword [eax], ebx
mov ecx, dword [edx + 0x30]
mov eax, dword [ebp - 0x354]
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 - 0x354]
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 - 0x350]
mov dword [esp], 0
mov dword [esp + 4], eax
call dword [sym.imp.ntdll.dll_LdrUnlockLoaderLock]
sub esp, 8
test byte [0x404018], 8
jne 0x401d20
lea eax, [ebp - 0x34c]
mov dword [ebp - 0x34c], 0x30
mov ebx, dword [sym.imp.advapi32.dll_SetServiceStatus]
mov dword [esp + 4], eax
mov eax, dword [0x407008]
mov dword [ebp - 0x348], 4
mov dword [ebp - 0x344], 5
mov dword [ebp - 0x340], 0
mov dword [ebp - 0x33c], 0
mov dword [ebp - 0x338], 0
mov dword [ebp - 0x334], 0
mov dword [esp], eax
call ebx
mov eax, dword [section..bss]
sub esp, 8
mov dword [esp], eax
call sym._wine_ntoskrnl_main_loop
test byte [0x404018], 8
jne 0x401be0
mov dword [ebp - 0x34c], 0x30
lea eax, [ebp - 0x34c]
mov dword [esp + 4], eax
mov eax, dword [0x407008]
mov dword [ebp - 0x348], 1
mov dword [ebp - 0x344], 0
mov dword [ebp - 0x340], 0
mov dword [ebp - 0x33c], 0
mov dword [ebp - 0x338], 0
mov dword [ebp - 0x334], 0
mov dword [esp], eax
call ebx
mov eax, dword [0x407004]
sub esp, 8
mov dword [esp], eax
call dword [sym.imp.advapi32.dll_CloseServiceHandle]
mov eax, dword [section..bss]
sub esp, 4
mov dword [esp], eax
call dword [sym.imp.kernel32.dll_CloseHandle]
sub esp, 4
lea esp, [ebp - 0x10]
pop ecx
pop ebx
pop esi
pop edi
pop ebp
lea esp, [ecx - 4]
ret 8
mov edi, dword [eax]
jmp 0x401756
test byte [0x404018], 2
je 0x401833
test esi, esi
je 0x402110
mov eax, esi
shr eax, 0x10
je 0x4020a0
mov dword [esp + 4], 0xffffffff
mov dword [esp], esi
call dword [sym.imp.kernel32.dll_IsBadStringPtrW]
mov ecx, eax
sub esp, 8
mov eax, str._invalid_
test ecx, ecx
jne 0x401bb0
cmp word [esi], 0
je 0x40215c
lea esi, [esi]
mov edx, ecx
lea ecx, [ecx + 1]
cmp word [esi + edx*2 + 2], 0
jne 0x401ad0
mov eax, 0x224c
mov dword [ebp - 0x360], edi
lea ecx, [ebp - 0x34a]
mov word [ebp - 0x34c], ax
lea eax, [ebp - 0x22a]
mov dword [ebp - 0x364], ebx
mov dword [ebp - 0x35c], eax
jmp 0x401b41
cmp ax, 9
je 0x402048
cmp ax, 0xa
jne 0x401fd6
mov eax, 0x6e5c
add ecx, 2
mov word [ecx - 2], ax
lea eax, [edx - 1]
cmp ecx, dword [ebp - 0x35c]
ja 0x401b78
test edx, edx
jle 0x401b78
mov edx, eax
movzx eax, word [esi]
add esi, 2
cmp ax, 0xd
je 0x401fb8
jbe 0x401b10
cmp ax, 0x22
je 0x402030
cmp ax, 0x5c
jne 0x401fc9
mov ebx, 0x5c5c
add ecx, 2
mov word [ecx - 2], bx
jmp 0x401b30
mov edi, dword [ebp - 0x360]
mov ebx, dword [ebp - 0x364]
mov byte [ecx], 0x22
test eax, eax
jle 0x402175
mov edx, 0x2e2e
mov byte [ecx + 3], 0x2e
lea eax, [ecx + 4]
mov word [ecx + 1], dx
mov byte [eax], 0
lea eax, [ebp - 0x34c]
mov dword [esp], eax
call dbg.__wine_dbg_strdup
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.Failed_to_load__s_n
mov dword [esp + 8], str.ServiceMain
mov dword [esp + 4], 0x404018
mov dword [esp], 1
call sym._wine_dbg_log.constprop.0
jmp 0x401833
test edi, edi
je 0x402100
mov eax, edi
shr eax, 0x10
je 0x402060
mov dword [esp + 4], 0xffffffff
mov dword [esp], edi
call dword [sym.imp.kernel32.dll_IsBadStringPtrW]
mov ecx, eax
sub esp, 8
mov eax, str._invalid_
test ecx, ecx
jne 0x401cf2
cmp word [edi], 0
je 0x40211a
mov edx, ecx
lea ecx, [ecx + 1]
cmp word [edi + edx*2 + 2], 0
jne 0x401c20
mov eax, 0x224c
mov dword [ebp - 0x35c], ebx
lea ecx, [ebp - 0x34a]
mov word [ebp - 0x34c], ax
jmp 0x401c83
cmp ax, 9
je 0x401e88
cmp ax, 0xa
jne 0x401f4e
mov eax, 0x6e5c
add ecx, 2
mov word [ecx - 2], ax
lea eax, [edx - 1]
test edx, edx
jle 0x401cc0
lea esi, [ebp - 0x22a]
cmp ecx, esi
ja 0x401cc0
mov edx, eax
movzx eax, word [edi]
add edi, 2
cmp ax, 0xd
je 0x401e70
jbe 0x401c50
cmp ax, 0x22
je 0x401fa0
cmp ax, 0x5c
jne 0x401f41
mov ebx, 0x5c5c
add ecx, 2
mov word [ecx - 2], bx
jmp 0x401c70
mov byte [ecx], 0x22
mov ebx, dword [ebp - 0x35c]
test eax, eax
jle 0x402133
mov edx, 0x2e2e
mov byte [ecx + 3], 0x2e
lea eax, [ecx + 4]
mov word [ecx + 1], dx
mov byte [eax], 0
lea eax, [ebp - 0x34c]
mov dword [esp], eax
call dbg.__wine_dbg_strdup
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.service_group__s_stopped_n
mov dword [esp + 8], str.ServiceMain
mov dword [esp + 4], 0x404018
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x4019da
test edi, edi
je 0x4020f0
mov eax, edi
shr eax, 0x10
je 0x402080
mov dword [esp + 4], 0xffffffff
mov dword [esp], edi
call dword [sym.imp.kernel32.dll_IsBadStringPtrW]
mov ecx, eax
sub esp, 8
mov eax, str._invalid_
test ecx, ecx
jne 0x401e42
cmp word [edi], 0
je 0x40213b
mov edx, ecx
lea ecx, [ecx + 1]
cmp word [edi + edx*2 + 2], 0
jne 0x401d60
mov ebx, 0x224c
mov dword [ebp - 0x360], edi
lea ecx, [ebp - 0x34a]
lea esi, [ebp - 0x22a]
mov word [ebp - 0x34c], bx
mov dword [ebp - 0x35c], edi
jmp 0x401dcd
cmp ax, 9
je 0x401ea0
cmp ax, 0xa
jne 0x401ed6
mov eax, 0x6e5c
add ecx, 2
mov word [ecx - 2], ax
lea esi, [esi]
nop
lea eax, [edx - 1]
cmp ecx, esi
ja 0x401e10
test edx, edx
jle 0x401e10
mov edx, eax
add dword [ebp - 0x35c], 2
mov eax, dword [ebp - 0x35c]
movzx eax, word [eax - 2]
cmp ax, 0xd
je 0x401eb8
jbe 0x401d98
cmp ax, 0x22
je 0x401f30
cmp ax, 0x5c
jne 0x401ec9
mov ebx, 0x5c5c
add ecx, 2
mov word [ecx - 2], bx
jmp 0x401dc0
mov byte [ecx], 0x22
mov edi, dword [ebp - 0x360]
test eax, eax
jle 0x402154
mov edx, 0x2e2e
mov byte [ecx + 3], 0x2e
lea eax, [ecx + 4]
mov word [ecx + 1], dx
mov byte [eax], 0
lea eax, [ebp - 0x34c]
mov dword [esp], eax
call dbg.__wine_dbg_strdup
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], str.starting_service_group__s_n
mov dword [esp + 8], str.ServiceMain
mov dword [esp + 4], 0x404018
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x40195d
mov eax, 0x725c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401c70
mov eax, 0x745c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401c70
mov eax, 0x745c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401dc0
mov eax, 0x725c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401dc0
lea edi, [eax - 0x20]
cmp di, 0x5e
jbe 0x4020d0
mov edi, eax
mov byte [ecx], 0x5c
add ecx, 5
shr di, 0xc
movzx edi, di
movzx ebx, byte [edi + str.0123456789abcdefdevice_handler]
mov edi, eax
shr di, 8
and edi, 0xf
mov byte [ecx - 4], bl
movzx ebx, byte [edi + str.0123456789abcdefdevice_handler]
mov edi, eax
and eax, 0xf
shr di, 4
movzx eax, byte [eax + str.0123456789abcdefdevice_handler]
and edi, 0xf
mov byte [ecx - 3], bl
movzx ebx, byte [edi + str.0123456789abcdefdevice_handler]
mov byte [ecx - 1], al
mov byte [ecx - 2], bl
jmp 0x401dc0
mov edi, 0x225c
add ecx, 2
mov word [ecx - 2], di
jmp 0x401dc0
lea esi, [eax - 0x20]
cmp si, 0x5e
jbe 0x4020c0
mov esi, eax
mov byte [ecx], 0x5c
add ecx, 5
shr si, 0xc
movzx esi, si
movzx ebx, byte [esi + str.0123456789abcdefdevice_handler]
mov esi, eax
shr si, 8
and esi, 0xf
mov byte [ecx - 4], bl
movzx ebx, byte [esi + str.0123456789abcdefdevice_handler]
mov esi, eax
and eax, 0xf
shr si, 4
movzx eax, byte [eax + str.0123456789abcdefdevice_handler]
and esi, 0xf
mov byte [ecx - 3], bl
movzx ebx, byte [esi + str.0123456789abcdefdevice_handler]
mov byte [ecx - 1], al
mov byte [ecx - 2], bl
jmp 0x401c70
mov esi, 0x225c
add ecx, 2
mov word [ecx - 2], si
jmp 0x401c70
mov eax, 0x725c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401b30
lea edi, [eax - 0x20]
cmp di, 0x5e
jbe 0x4020e0
mov edi, eax
mov byte [ecx], 0x5c
add ecx, 5
shr di, 0xc
movzx edi, di
movzx ebx, byte [edi + str.0123456789abcdefdevice_handler]
mov edi, eax
shr di, 8
and edi, 0xf
mov byte [ecx - 4], bl
movzx ebx, byte [edi + str.0123456789abcdefdevice_handler]
mov edi, eax
and eax, 0xf
shr di, 4
movzx eax, byte [eax + str.0123456789abcdefdevice_handler]
and edi, 0xf
mov byte [ecx - 3], bl
movzx ebx, byte [edi + str.0123456789abcdefdevice_handler]
mov byte [ecx - 1], al
mov byte [ecx - 2], bl
jmp 0x401b30
mov edi, 0x225c
add ecx, 2
mov word [ecx - 2], di
jmp 0x401b30
mov eax, 0x745c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401b30
movzx eax, di
mov dword [esp], str._04x
mov dword [esp + 4], eax
call sym._wine_dbg_sprintf.constprop.0
jmp 0x401cf2
movzx eax, di
mov dword [esp], str._04x
mov dword [esp + 4], eax
call sym._wine_dbg_sprintf.constprop.0
jmp 0x401e42
movzx esi, si
mov dword [esp], str._04x
mov dword [esp + 4], esi
call sym._wine_dbg_sprintf.constprop.0
jmp 0x401bb0
mov byte [ecx], al
add ecx, 1
jmp 0x401c70
mov byte [ecx], al
add ecx, 1
jmp 0x401dc0
mov byte [ecx], al
add ecx, 1
jmp 0x401b30
mov eax, str._null_
jmp 0x401e42
mov eax, str._null_
jmp 0x401cf2
mov eax, str._null_
jmp 0x401bb0
mov esi, 0x224c
mov byte [ebp - 0x34a], 0x22
lea ecx, [ebp - 0x34a]
mov word [ebp - 0x34c], si
lea eax, [ecx + 1]
jmp 0x401ce1
mov byte [ebp - 0x34a], 0x22
mov ecx, 0x224c
mov word [ebp - 0x34c], cx
lea ecx, [ebp - 0x34a]
lea eax, [ecx + 1]
jmp 0x401e31
mov edx, 0x224c
mov byte [ebp - 0x34a], 0x22
lea ecx, [ebp - 0x34a]
mov word [ebp - 0x34c], dx
lea eax, [ecx + 1]
jmp 0x401b9f