Function at 0x40e510
Capabilities:
Connect pipe
Read pipe
Write pipe

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0xc88
mov eax, dword [0x4910e8]
test eax, eax
push esi
mov esi, dword [ebp + 8]
push edi
mov byte [esp + 0xb], 0
je 0x40e53d
push esi
push str.WinMainClient_WtsStateProcessing_is_called_with_state__u
call fcn.0040a4a0
add esp, 8
xor eax, eax
mov ecx, 0x188
lea edi, [esp + 0x50]
rep stosd dword es:[edi], eax
lea eax, [esi - 1]
cmp eax, 7
ja case.0x40e556.3
jmp dword [eax*4 + 0x40e8e8]
mov ecx, 0x492840
call fcn.00415810
cmp dword [0x492098], 8
jb case.0x40e556.3
call fcn.00409900
jmp 0x40e6ac
cmp esi, 8
jne 0x40e58d
mov ecx, 0x49f400
call fcn.00415810
mov ecx, dword [0x4920d8]
test ecx, ecx
je 0x40e59c
call fcn.00417870
cmp esi, 8
jne 0x40e5ae
call fcn.0044f100
test eax, eax
je case.0x40e556.3
xor eax, eax
mov ecx, 0x188
lea edi, [esp + 0x670]
rep stosd dword es:[edi], eax
mov eax, dword [0x492164]
mov dword [esp + 0x680], eax
xor eax, eax
push eax
mov ecx, 0xb
mov dword [esp + 0x67c], ecx
lea edi, [esp + 0x28]
rep stosd dword es:[edi], eax
lea ecx, [esp + 0x24]
push ecx
push 0x2c
lea edx, [esp + 0x30]
push edx
push 0x620
lea eax, [esp + 0x684]
push eax
push str..pipeExtEventPipe_Service
mov dword [esp + 0x68c], 0x8001
mov dword [esp + 0x690], 0x620
call dword [sym.imp.KERNEL32.dll_CallNamedPipeA]
test eax, eax
je 0x40e623
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp esi, 1
jne 0x40e637
mov dword [0x492178], 0
call fcn.0040e2c0
mov eax, dword [0x492178]
test eax, eax
jne 0x40e65c
cmp esi, 8
jne 0x40e65c
test dword [0x49209c], 0x8000000
je 0x40e65c
mov ecx, dword [0x4910f4]
call fcn.004371d0
cmp dword [0x492098], 8
jb case.0x40e556.3
cmp esi, 1
jne 0x40e673
call fcn.00409900
xor ecx, ecx
mov dword [esp + 0xc], ecx
mov dword [esp + 0x10], ecx
mov dword [esp + 0x14], ecx
lea edx, [esp + 0xc]
mov dword [esp + 0x18], ecx
push edx
mov dword [esp + 0x20], ecx
mov dword [esp + 0x10], 7
call fcn.0044af00
mov eax, dword [0x492098]
add esp, 4
cmp eax, 8
jb case.0x40e556.3
mov eax, dword [0x492078]
test eax, eax
je case.0x40e556.3
mov byte [esp + 0xb], 1
jmp case.0x40e556.3
mov ecx, 0x492840
call fcn.00415830
cmp esi, 2
mov dword [0x49f638], esi
je 0x40e6fa
cmp esi, 6
je 0x40e6fa
mov ecx, 0x49f400
call fcn.00415830
mov ecx, dword [0x4920d8]
test ecx, ecx
je 0x40e724
push 0
call fcn.004178b0
jmp 0x40e724
mov ecx, dword [0x4920d8]
test ecx, ecx
mov dword [0x492178], 1
je 0x40e715
push 1
call fcn.004178b0
mov ecx, dword [0x4920b8]
test ecx, ecx
je 0x40e724
call fcn.00401fd0
cmp esi, 7
jne 0x40e76a
call fcn.0044f100
test eax, eax
je 0x40e76a
mov eax, dword [0x492164]
mov dword [esp + 0x60], eax
xor eax, eax
push 1
mov ecx, 0xb
lea edi, [esp + 0x28]
rep stosd dword es:[edi], eax
lea ecx, [esp + 0x24]
push ecx
push 0x2c
lea edx, [esp + 0x30]
push edx
push 0x620
lea eax, [esp + 0x64]
mov dword [esp + 0x6c], 0xd
push eax
jmp 0x40e7b0
mov ecx, dword [0x4920d8]
test ecx, ecx
je 0x40e779
call fcn.004176f0
mov ecx, dword [0x492164]
push 1
mov dword [esp + 0x64], ecx
xor eax, eax
lea edx, [esp + 0x24]
push edx
mov ecx, 0xb
lea edi, [esp + 0x2c]
rep stosd dword es:[edi], eax
push 0x2c
lea eax, [esp + 0x30]
push eax
push 0x620
lea ecx, [esp + 0x64]
mov dword [esp + 0x6c], 0xc
push ecx
push str..pipeExtEventPipe_Service
mov dword [esp + 0x70], 0x620
mov dword [esp + 0x6c], 0x8001
call dword [sym.imp.KERNEL32.dll_CallNamedPipeA]
test eax, eax
je 0x40e7d5
call dword [sym.imp.KERNEL32.dll_GetLastError]
call fcn.00429330
mov al, byte [esp + 0xb]
test al, al
mov dword [0x49f638], esi
je 0x40e8c8
mov eax, dword [0x4a17ac]
test eax, eax
je 0x40e8c8
xor edx, edx
mov dword [esp + 0x10], edx
xor eax, eax
mov dword [esp + 0x14], edx
mov ecx, 0x188
lea edi, [esp + 0x670]
rep stosd dword es:[edi], eax
mov dword [esp + 0x18], edx
push edx
mov ecx, 0xb
lea edi, [esp + 0x28]
rep stosd dword es:[edi], eax
mov eax, dword [0x492164]
lea ecx, [esp + 0x28]
mov dword [esp + 0x20], edx
push ecx
lea edx, [esp + 0x678]
push edx
push str..pipeExtEventPipe_Service
mov dword [esp + 0x1c], 0
mov dword [esp + 0x688], 0x3f
mov dword [esp + 0x690], eax
call fcn.004095e0
add esp, 0x10
test eax, eax
jne 0x40e87f
test dword [0x4910e8], 0x10000
je 0x40e8a7
push str.PowerXpressSwitch:_get_defer_switch_from_global_service_fails__n
call fcn.0040a4a0
add esp, 4
jmp 0x40e8a7
mov eax, dword [esp + 0x30]
mov ecx, dword [esp + 0x34]
mov edx, dword [esp + 0x38]
mov dword [esp + 0xc], eax
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x10], ecx
mov ecx, dword [esp + 0x40]
mov dword [esp + 0x14], edx
mov dword [esp + 0x18], eax
mov dword [esp + 0x1c], ecx
mov eax, dword [esp + 0x10]
cmp eax, 2
je 0x40e8b5
cmp eax, 1
jne 0x40e8e1
lea edx, [esp + 0xc]
push edx
call fcn.00442690
add esp, 4
pop edi
pop esi
mov esp, ebp
pop ebp
ret
test dword [0x4910e8], 0x10000
je 0x40e8e1
push str.Not_ready_to_switch_yet__will_switch_later_when_iGPU_driver_initialized__n
call fcn.0040a4a0
add esp, 4
pop edi
pop esi
mov esp, ebp
pop ebp
ret