Function at 0x401650
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, 0x37c
cmp dword [ecx], 1
mov eax, dword [ecx + 4]
jbe 0x4018b0
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 0x40189e
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov dword [esp], 0
call dword [sym.imp.advapi32.dll_OpenSCManagerW]
mov dword [0x406004], eax
sub esp, 0xc
test eax, eax
je 0x40189e
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 [0x406008], eax
sub esp, 0xc
test eax, eax
je 0x40189e
lea ebx, [ebp - 0x220]
mov dword [esp + 4], 0x104
xor esi, esi
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_GetSystemDirectoryW]
sub esp, 8
mov dword [esp + 4], str.drivers
mov dword [esp], ebx
call dword [sym.imp.ntoskrnl.exe_wcscat]
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_AddDllDirectory]
sub esp, 4
mov ebx, dword [esi*4 + 0x404250]
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_LoadLibraryW]
sub esp, 4
test eax, eax
je 0x4018c0
add esi, 1
cmp esi, 3
jne 0x40173a
lea eax, [ebp - 0x35c]
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 - 0x360]
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
je 0x4019c8
mov eax, dword [ebp - 0x35c]
mov dword [esp], 0
mov dword [esp + 4], eax
call dword [sym.imp.ntdll.dll_LdrUnlockLoaderLock]
sub esp, 8
test byte [0x403018], 8
jne 0x401c28
lea eax, [ebp - 0x358]
movdqu xmm0, xmmword [0x4042e0]
mov dword [ebp - 0x348], 0
mov dword [esp + 4], eax
mov eax, dword [0x406008]
mov ebx, dword [sym.imp.advapi32.dll_SetServiceStatus]
movups xmmword [ebp - 0x358], xmm0
mov dword [ebp - 0x344], 0
mov dword [ebp - 0x340], 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 [0x403018], 8
jne 0x401ae0
movdqu xmm0, xmmword [0x4042f0]
lea eax, [ebp - 0x358]
mov dword [ebp - 0x348], 0
mov dword [esp + 4], eax
mov eax, dword [0x406008]
movups xmmword [ebp - 0x358], xmm0
mov dword [ebp - 0x344], 0
mov dword [ebp - 0x340], 0
mov dword [esp], eax
call ebx
mov eax, dword [0x406004]
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 0x401676
test byte [0x403018], 2
je 0x401755
test ebx, ebx
je 0x402020
mov eax, ebx
shr eax, 0x10
je 0x401fb0
mov dword [esp + 4], 0xffffffff
mov dword [esp], ebx
call dword [sym.imp.kernel32.dll_IsBadStringPtrW]
mov edx, str._invalid_
sub esp, 8
test eax, eax
jne 0x401aaa
cmp word [ebx], 0
je 0x40206c
nop
lea esi, [esi]
mov edx, eax
lea eax, [eax + 1]
cmp word [ebx + edx*2 + 2], 0
jne 0x401910
mov eax, 0x224c
mov dword [ebp - 0x36c], esi
lea ecx, [ebp - 0x356]
mov word [ebp - 0x358], ax
lea eax, [ebp - 0x236]
mov dword [ebp - 0x368], edi
mov esi, eax
mov dword [ebp - 0x364], ebx
jmp 0x401985
cmp ax, 9
je 0x401f58
cmp ax, 0xa
jne 0x401ee6
mov eax, 0x6e5c
add ecx, 2
mov word [ecx - 2], ax
lea eax, [edx - 1]
cmp ecx, esi
ja 0x401a70
test edx, edx
jle 0x401a70
mov edx, eax
add dword [ebp - 0x364], 2
mov eax, dword [ebp - 0x364]
movzx eax, word [eax - 2]
cmp ax, 0xd
je 0x401ec8
jbe 0x401950
cmp ax, 0x22
je 0x401f40
cmp ax, 0x5c
jne 0x401ed9
mov ebx, 0x5c5c
add ecx, 2
mov word [ecx - 2], bx
jmp 0x401970
mov eax, dword [ebp - 0x360]
mov edx, dword [eax]
mov eax, dword [eax + 4]
mov dword [edx + 4], eax
mov dword [eax], edx
mov eax, dword [ebp - 0x360]
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 - 0x360]
mov dword [eax], ebx
mov ecx, dword [edx + 0x30]
mov eax, dword [ebp - 0x360]
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 - 0x360]
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
jmp 0x4017ad
mov edi, dword [ebp - 0x368]
mov esi, dword [ebp - 0x36c]
mov byte [ecx], 0x22
test eax, eax
jle 0x402085
mov edx, 0x2e2e
mov byte [ecx + 3], 0x2e
lea eax, [ecx + 4]
mov word [ecx + 1], dx
mov byte [eax], 0
lea eax, [ebp - 0x358]
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], 0x403018
mov dword [esp], 1
call sym._wine_dbg_log.constprop.0
jmp 0x401755
test edi, edi
je 0x402010
mov eax, edi
shr eax, 0x10
je 0x401f70
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 0x401bf4
cmp word [edi], 0
je 0x40202a
nop
mov edx, eax
lea eax, [eax + 1]
cmp word [edi + edx*2 + 2], 0
jne 0x401b20
mov eax, 0x224c
mov dword [ebp - 0x364], ebx
lea ecx, [ebp - 0x356]
mov word [ebp - 0x358], ax
jmp 0x401b83
cmp ax, 9
je 0x401da0
cmp ax, 0xa
jne 0x401e5e
mov eax, 0x6e5c
add ecx, 2
mov word [ecx - 2], ax
lea eax, [edx - 1]
test edx, edx
jle 0x401bc0
lea esi, [ebp - 0x236]
cmp ecx, esi
ja 0x401bc0
mov edx, eax
movzx eax, word [edi]
add edi, 2
cmp ax, 0xd
je 0x401d88
jbe 0x401b50
cmp ax, 0x22
je 0x401eb0
cmp ax, 0x5c
jne 0x401e51
mov ebx, 0x5c5c
add ecx, 2
mov word [ecx - 2], bx
jmp 0x401b70
mov byte [ecx], 0x22
mov ebx, dword [ebp - 0x364]
test eax, eax
jle 0x402043
mov edx, 0x2e2e
mov byte [ecx + 3], 0x2e
lea eax, [ecx + 4]
mov word [ecx + 1], dx
mov byte [eax], 0
lea eax, [ebp - 0x358]
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], 0x403018
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x401838
test edi, edi
je 0x402000
mov eax, edi
shr eax, 0x10
je 0x401f90
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 0x401d54
cmp word [edi], 0
je 0x40204b
lea esi, [esi]
lea edi, [edi]
mov edx, eax
lea eax, [eax + 1]
cmp word [edi + edx*2 + 2], 0
jne 0x401c70
mov ebx, 0x224c
mov dword [ebp - 0x368], edi
lea ecx, [ebp - 0x356]
lea esi, [ebp - 0x236]
mov word [ebp - 0x358], bx
mov dword [ebp - 0x364], edi
jmp 0x401cdd
cmp ax, 9
je 0x401db8
cmp ax, 0xa
jne 0x401dee
mov eax, 0x6e5c
add ecx, 2
mov word [ecx - 2], ax
nop
lea esi, [esi]
lea eax, [edx - 1]
cmp ecx, esi
ja 0x401d20
test edx, edx
jle 0x401d20
mov edx, eax
add dword [ebp - 0x364], 2
mov eax, dword [ebp - 0x364]
movzx eax, word [eax - 2]
cmp ax, 0xd
je 0x401dd0
jbe 0x401ca8
cmp ax, 0x22
je 0x401e40
cmp ax, 0x5c
jne 0x401de1
mov ebx, 0x5c5c
add ecx, 2
mov word [ecx - 2], bx
jmp 0x401cd0
mov byte [ecx], 0x22
mov edi, dword [ebp - 0x368]
test eax, eax
jle 0x402064
mov edx, 0x2e2e
mov byte [ecx + 3], 0x2e
lea eax, [ecx + 4]
mov word [ecx + 1], dx
mov byte [eax], 0
lea eax, [ebp - 0x358]
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], 0x403018
mov dword [esp], 3
call sym._wine_dbg_log.constprop.0
jmp 0x4017d4
mov eax, 0x725c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401b70
mov eax, reloc.ntoskrnl.exe_wine_enumerate_root_devices
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401b70
mov eax, reloc.ntoskrnl.exe_wine_enumerate_root_devices
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401cd0
mov eax, 0x725c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401cd0
lea edi, [eax - 0x20]
cmp di, 0x5e
jbe 0x401fe0
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 0x401cd0
mov edi, 0x225c
add ecx, 2
mov word [ecx - 2], di
jmp 0x401cd0
lea esi, [eax - 0x20]
cmp si, 0x5e
jbe 0x401fd0
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 0x401b70
mov esi, 0x225c
add ecx, 2
mov word [ecx - 2], si
jmp 0x401b70
mov eax, 0x725c
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401970
lea edi, [eax - 0x20]
cmp di, 0x5e
jbe 0x401ff0
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 0x401970
mov edi, 0x225c
add ecx, 2
mov word [ecx - 2], di
jmp 0x401970
mov eax, reloc.ntoskrnl.exe_wine_enumerate_root_devices
add ecx, 2
mov word [ecx - 2], ax
jmp 0x401970
movzx eax, di
mov dword [esp], str._04x
mov dword [esp + 4], eax
call sym._wine_dbg_sprintf.constprop.0
mov edx, eax
jmp 0x401bf4
movzx eax, di
mov dword [esp], str._04x
mov dword [esp + 4], eax
call sym._wine_dbg_sprintf.constprop.0
mov edx, eax
jmp 0x401d54
movzx ebx, bx
mov dword [esp], str._04x
mov dword [esp + 4], ebx
call sym._wine_dbg_sprintf.constprop.0
mov edx, eax
jmp 0x401aaa
mov byte [ecx], al
add ecx, 1
jmp 0x401b70
mov byte [ecx], al
add ecx, 1
jmp 0x401cd0
mov byte [ecx], al
add ecx, 1
jmp 0x401970
mov edx, str._null_
jmp 0x401d54
mov edx, str._null_
jmp 0x401bf4
mov edx, str._null_
jmp 0x401aaa
mov esi, 0x224c
mov byte [ebp - 0x356], 0x22
lea ecx, [ebp - 0x356]
mov word [ebp - 0x358], si
lea eax, [ecx + 1]
jmp 0x401be1
mov byte [ebp - 0x356], 0x22
mov ecx, 0x224c
mov word [ebp - 0x358], cx
lea ecx, [ebp - 0x356]
lea eax, [ecx + 1]
jmp 0x401d41
mov edx, 0x224c
mov byte [ebp - 0x356], 0x22
lea ecx, [ebp - 0x356]
mov word [ebp - 0x358], dx
lea eax, [ecx + 1]
jmp 0x401a97