Function at 0x407840
Capabilities:
Resolve function by parsing pe exports
Set current directory
Terminate process

Disassembly:
sub esp, 0x40
mov eax, dword [0x6009e4]
xor eax, esp
mov dword [esp + 0x3c], eax
mov eax, dword [esp + 0x44]
push ebx
push ebp
push esi
push edi
mov edi, ecx
mov dword [esp + 0x14], eax
mov ebp, edx
mov dword [esp + 0x30], 0
mov dword [esp + 0x20], ebp
mov dword [esp + 0x24], 0
mov ebx, dword [edi + 0xc]
mov dword [esp + 0x1c], 0
test ebx, ebx
jne 0x407ae7
push ebx
push 0x6257a0
push 0x10000
push dword [eax + 4]
call dword [sym.imp.KERNEL32.dll_GetFullPathNameA]
mov edx, 0x6257a0
lea ecx, [esp + 0x2c]
mov ebx, eax
call fcn.004b3fd0
mov dword [esp + 0x34], eax
test eax, eax
jne 0x4078d6
push 0x6257a0
push str.ERROR_loading__s_n
call fcn.004010e0
add esp, 8
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x3c]
xor ecx, esp
call fcn.00584a28
add esp, 0x40
ret
lea eax, [esp + 0x28]
push eax
push 0
lea edx, [ebx + 1]
lea ecx, [ebp*4 + 4]
call fcn.004ae770
mov esi, dword [esp + 0x30]
add esp, 8
mov dword [esp + 0x18], eax
test esi, esi
jne 0x407901
xor eax, eax
xor ecx, ecx
jmp 0x407906
mov eax, dword [esi - 4]
mov ecx, eax
push eax
push 0x6257a0
push ecx
push esi
call fcn.00588598
mov eax, dword [esp + 0x28]
add esp, 0xc
mov edx, ebx
mov ecx, 0x6257a0
push 0x603478
mov dword [eax], esi
call fcn.004b3d00
add esp, 8
cmp eax, 0x10000
jae 0x407dcb
push 0x6257a0
mov byte [eax + 0x6257a0], 0
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
mov esi, 2
cmp ebp, esi
jle 0x407ae1
mov eax, dword [esp + 0x18]
add eax, 4
mov dword [esp + 0x28], eax
cmp dword [edi + 0x20], 0
jne 0x4079b6
mov edx, dword [esp + 0x14]
lea ebp, [esi*4]
push 0xb
push str.__script_db
push dword [edx + ebp]
call fcn.0058b9b0
add esp, 0xc
test eax, eax
jne 0x4079b6
lea ebx, [esi + 1]
cmp ebx, dword [esp + 0x20]
jge 0x4079b6
mov eax, dword [esp + 0x14]
mov ecx, dword [edi + 0x18]
mov edx, dword [eax + ebp + 4]
call fcn.00403550
mov ecx, eax
call fcn.004b7110
mov dword [edi + 0x20], eax
mov esi, ebx
jmp 0x407ad4
mov eax, dword [esp + 0x14]
lea ebp, [esi*4]
push 0xe
push str.__script_flags
push dword [eax + ebp]
call fcn.0058b9b0
add esp, 0xc
test eax, eax
jne 0x407a45
lea ebx, [esi + 1]
cmp ebx, dword [esp + 0x20]
jge 0x407a45
mov eax, dword [esp + 0x14]
mov eax, dword [eax + ebp + 4]
movzx eax, word [eax]
push eax
call dword [sym.imp.WS2_32.dll_ntohs]
mov ecx, 0x3078
cmp ax, cx
jne 0x407ad4
mov esi, dword [esp + 0x14]
mov eax, dword [esi + ebp + 4]
test eax, eax
je 0x407a1c
push 0x20
push eax
call fcn.0058cca6
add esp, 8
cmp eax, 0xa
jg 0x407a3e
lea ecx, [esp + 0x24]
push ecx
mov ecx, dword [esi + ebp + 4]
lea edx, [eax - 2]
add ecx, 2
call fcn.004acc00
push dword [esp + 0x24]
call dword [sym.imp.WS2_32.dll_ntohl]
mov dword [esp + 0x24], eax
mov esi, ebx
jmp 0x407ad4
mov eax, dword [esp + 0x14]
push 0x10
push str.__script_timeout
push dword [eax + ebp]
call fcn.0058b9b0
add esp, 0xc
test eax, eax
jne 0x407a80
lea ebx, [esi + 1]
cmp ebx, dword [esp + 0x20]
jge 0x407a80
mov eax, dword [esp + 0x14]
push dword [eax + ebp + 4]
call fcn.0058cc7c
add esp, 4
mov dword [esp + 0x30], eax
mov esi, ebx
jmp 0x407ad4
mov eax, dword [esp + 0x14]
push 0x10
push str.__script_connect
push dword [eax + ebp]
call fcn.0058b9b0
add esp, 0xc
test eax, eax
jne 0x407ac0
mov dword [esp + 0x1c], 1
cmp dword [edi + 0x20], eax
jne 0x407ad4
mov ecx, dword [edi + 0x18]
mov edx, 0x6034c0
call fcn.00403550
mov ecx, eax
call fcn.004b7110
mov dword [edi + 0x20], eax
jmp 0x407ad4
mov ecx, dword [esp + 0x28]
mov eax, dword [esp + 0x14]
mov eax, dword [eax + ebp]
mov dword [ecx], eax
add ecx, 4
mov dword [esp + 0x28], ecx
mov ebp, dword [esp + 0x20]
inc esi
cmp esi, ebp
jl 0x407965
mov ebx, dword [esp + 0x2c]
jmp 0x407b58
mov eax, dword [edi + 0x10]
lea esi, [ebp*4 + 4]
push esi
mov dword [esp + 0x38], eax
call fcn.0058d200
add esp, 4
mov dword [esp + 0x18], eax
test eax, eax
je 0x407dd0
push esi
push 0
push eax
call fcn.005869c0
mov eax, 1
add esp, 0xc
cmp ebp, eax
jle 0x407b48
mov eax, dword [esp + 0x18]
lea edx, [ebp - 1]
mov esi, dword [esp + 0x14]
sub esi, eax
lea ecx, [eax + 4]
lea eax, [edx + 1]
mov dword [esp + 0x2c], eax
mov eax, dword [esi + ecx]
lea ecx, [ecx + 4]
mov dword [ecx - 4], eax
sub edx, 1
jne 0x407b36
mov eax, dword [esp + 0x2c]
mov ecx, dword [esp + 0x18]
mov dword [ecx + eax*4], 0
mov eax, dword [edi + 0x18]
mov dword [ecx], eax
cmp dword [esp + 0x1c], 0
mov dword [edi + 0x2c], 1
je 0x407b6b
mov esi, dword [edi + 0x20]
jmp 0x407b6d
xor esi, esi
push 0x49ca80
push ecx
push 0x49ca20
mov edx, 0x49c910
mov ecx, 0x49c880
call fcn.0042fdb0
add esp, 0xc
test eax, eax
je 0x407e4f
mov ecx, dword [eax + 0x70]
test ecx, ecx
je 0x407e4f
xor eax, eax
mov edx, 0x406630
cmp dword [esp + 0x1c], eax
push edi
cmove eax, edx
mov edx, dword [esp + 0x28]
push eax
push dword [edi + 0x14]
push dword [edi + 0x18]
push esi
mov esi, dword [esp + 0x2c]
push esi
push dword [edi]
push dword [esp + 0x4c]
call fcn.0049d5c0
push edi
mov edx, 0x4076d0
mov dword [edi + 8], eax
mov ecx, eax
call fcn.00470b00
mov ecx, dword [edi + 8]
add esp, 0x24
cmp dword [esp + 0x1c], 0
je 0x407bf0
push edi
call fcn.004034d0
jmp 0x407cc4
mov eax, dword [ecx + 0x2c]
xor edx, edx
or edx, 0xfff90000
mov dword [esp + 0x3c], edx
mov esi, dword [eax + 0x78]
mov eax, dword [ecx + 0x44]
mov dword [esp + 0x30], eax
cmp eax, dword [ecx + 0x38]
jae 0x407e11
add eax, 8
mov dword [ecx + 0x44], eax
mov eax, dword [esp + 0x30]
mov dword [eax], esi
mov dword [eax + 4], edx
mov eax, 0xfff8
cmp word [esp + 0x3e], ax
jb 0x407c30
inc dword [esi + 4]
call fcn.00413d60
mov ecx, dword [edi + 8]
mov edx, dword [ecx + 0x44]
cmp edx, dword [ecx + 0x38]
jae 0x407e25
lea eax, [edx + 8]
mov dword [ecx + 0x44], eax
xor eax, eax
or eax, 0xfff60000
mov dword [edx], edi
mov dword [edx + 4], eax
mov edx, 0xfffffffe
mov ecx, dword [edi + 8]
push 0x6034c4
call fcn.0040f8b0
mov esi, dword [edi + 8]
add esp, 4
mov ecx, dword [esi + 0x44]
cmp ecx, dword [esi + 0x40]
je 0x407e39
add ecx, 0xfffffff8
mov dword [esi + 0x44], ecx
mov eax, dword [ecx + 4]
mov edx, dword [ecx]
mov dword [esp + 0x3c], eax
mov eax, 0xfff3
mov word [ecx + 6], ax
mov eax, 0xfff8
cmp word [esp + 0x3e], ax
jb 0x407cae
add dword [edx + 4], 0xffffffff
jne 0x407cae
push edx
push esi
call fcn.004317b0
add esp, 8
mov ecx, dword [edi + 8]
mov edx, str.meshDesktop
push 0x4076f0
call fcn.00456220
mov esi, dword [esp + 0x1c]
add esp, 4
cmp dword [edi + 0xc], 0
jne 0x407cd1
mov eax, dword [esi]
jmp 0x407cd6
mov eax, 0x6034e8
mov ecx, dword [edi + 8]
mov edx, ebx
push 0
push eax
push dword [esp + 0x3c]
call fcn.0049dc40
add esp, 0xc
test eax, eax
jne 0x407cfc
mov ecx, dword [edi + 8]
xor edx, edx
call fcn.0040df70
test eax, eax
je 0x407d4f
mov ecx, dword [edi + 8]
or edx, 0xffffffff
push 0
call fcn.00412820
mov esi, dword [edi + 8]
add esp, 4
mov ecx, dword [esi + 0x44]
cmp ecx, dword [esi + 0x40]
je 0x407e39
add ecx, 0xfffffff8
mov dword [esi + 0x44], ecx
mov eax, dword [ecx + 4]
mov edx, dword [ecx]
mov dword [esp + 0x3c], eax
mov eax, 0xfff3
mov word [ecx + 6], ax
mov eax, 0xfff8
cmp word [esp + 0x3e], ax
jb 0x407d4f
add dword [edx + 4], 0xffffffff
jne 0x407d4f
push edx
push esi
call fcn.004317b0
add esp, 8
push ebx
call fcn.0058bf82
add esp, 4
push dword [esp + 0x18]
call fcn.0058bf82
add esp, 4
cmp dword [esp + 0x1c], 0
je 0x4078c3
push 0x603524
call fcn.004010e0
add esp, 4
mov edx, ebp
mov ecx, edi
push 0
push dword [esp + 0x18]
call fcn.00406900
add esp, 8
test eax, eax
jne 0x4078c3
mov esi, dword [edi]
mov eax, dword [esi + 0x10]
mov dword [esi], 2
test eax, eax
jne 0x407dab
call dword [sym.imp.KERNEL32.dll_GetCurrentThread]
push esi
push eax
push 0x4aee50
call dword [sym.imp.KERNEL32.dll_QueueUserAPC]
mov ecx, dword [esp + 0x4c]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00584a28
add esp, 0x40
ret
call fcn.00584b5c
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0xfe
push 0x4c4
mov edx, 0x61c4e8
xor ecx, ecx
call fcn.004b47e0
add esp, 0xc
push 0x4c4
push 0x61c504
push 0x61c520
call fcn.004010e0
add esp, 0xc
push 0xfe
call fcn.00587d2d
push str.cannot_push_beyond_allocated_stack
push 0x3001039
mov edx, 0x604378
call fcn.0040d110
push str.cannot_push_beyond_allocated_stack
push 0x30010f5
mov edx, 0x604448
call fcn.0040d110
push 0x604640
push 0x300167f
mov edx, 0x604650
mov ecx, esi
call fcn.0040d110
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0xfe
push 0x70a
mov edx, 0x619d7c
xor ecx, ecx
call fcn.004b47e0
add esp, 0xc
push 0x70a
push 0x619dac
push 0x619ddc
call fcn.004010e0
add esp, 0xc
push 0xfe
call fcn.00587d2d
int3