Function at 0x40ff20
Capabilities:
Query environment variable
Resolve dns
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x1d4
mov eax, dword [0x71a830]
xor eax, esp
mov dword [esp + 0x1d0], eax
mov ecx, dword [esp + 0x1dc]
mov eax, dword [esp + 0x1e8]
mov edx, dword [esp + 0x1f0]
push ebx
mov ebx, dword [esp + 0x1e8]
push ebp
push esi
mov esi, dword [esp + 0x1e4]
xor ebp, ebp
push edi
mov edi, dword [esp + 0x1f0]
mov dword [esp + 0x10], ecx
mov dword [esp + 0x30], edi
mov dword [esp + 0x24], ebx
mov dword [esp + 0x2c], eax
mov dword [esp + 0x14], edx
mov dword [esp + 0x34], ebp
mov dword [esp + 0x28], ebp
cmp dword [esi], ebp
je 0x40ff9d
mov eax, dword [str.HY000]
push eax
push 0x80a
push esi
call fcn.0040c440
add esp, 0xc
jmp 0x4109a8
mov eax, dword [esi + 0x328]
mov dword [esi + 0x3b0], 0x4ae430
mov dword [esi], ebp
mov dword [esi + 0x2dc], ebp
cmp eax, ebp
jne 0x40ffca
cmp dword [esi + 0x32c], ebp
je 0x410009
cmp eax, ebp
jne 0x40ffca
mov eax, 0x491774
mov ecx, dword [esi + 0x32c]
push ecx
push eax
lea edx, [esi + 0x2f8]
push edx
call fcn.0040ce30
mov eax, dword [esi + 0x328]
push eax
call sub.MSVCR90.dll_free
mov ecx, dword [esi + 0x32c]
push ecx
call sub.MSVCR90.dll_free
mov ecx, dword [esp + 0x24]
add esp, 0x14
mov dword [esi + 0x32c], ebp
mov dword [esi + 0x328], ebp
cmp ecx, ebp
je 0x410012
cmp byte [ecx], 0
jne 0x41001c
mov edx, dword [esi + 0x310]
mov dword [esp + 0x10], edx
mov ebp, 0x4911c7
test edi, edi
je 0x41002a
cmp byte [edi], 0
jne 0x41003c
mov eax, dword [esi + 0x314]
mov dword [esp + 0x30], eax
test eax, eax
jne 0x41003c
mov dword [esp + 0x30], ebp
test ebx, ebx
jne 0x410068
mov eax, dword [esi + 0x318]
mov dword [esp + 0x24], eax
test eax, eax
jne 0x410068
push str.MYSQL_PWD
call dword [sym.imp.MSVCR90.dll_getenv]
add esp, 4
mov dword [esp + 0x24], eax
test eax, eax
jne 0x410068
mov dword [esp + 0x24], ebp
mov eax, dword [esp + 0x2c]
test eax, eax
je 0x410075
cmp byte [eax], 0
jne 0x41007f
mov eax, dword [esi + 0x320]
mov dword [esp + 0x2c], eax
mov edi, dword [esp + 0x1fc]
test edi, edi
jne 0x410097
mov edi, dword [esi + 0x304]
mov dword [esp + 0x1fc], edi
cmp dword [esp + 0x14], 0
jne 0x4100a8
mov ecx, dword [esi + 0x31c]
mov dword [esp + 0x14], ecx
mov eax, dword [esi + 0x308]
mov dword [esi + 0x2ec], 2
mov ebx, 4
test eax, eax
je 0x4100c9
cmp eax, ebx
jne 0x410167
mov eax, dword [esp + 0x10]
test eax, eax
je 0x4100ff
mov ecx, str.localhost
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x4100f6
test dl, dl
je 0x4100f2
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x4100f6
add eax, 2
add ecx, 2
test dl, dl
jne 0x4100d6
xor eax, eax
jmp 0x4100fb
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
jne 0x410167
mov edx, dword [esi + 0x2f8]
push edx
push esi
push esi
call fcn.0040c760
add esp, 0xc
cmp eax, 0xffffffff
jne 0x41012c
cmp dword [esi + 0x308], ebx
je 0x410986
push esi
call fcn.0040c4c0
add esp, 4
jmp 0x410167
mov eax, dword [esi + 0x34c]
push eax
mov dword [esi + 0x308], ebx
mov edx, dword [str.Shared_memory:___.100s]
lea ecx, [esp + 0x90]
push edx
mov dword [esp + 0x18], eax
mov eax, ecx
push 0x153
push eax
mov dword [esp + 0x24], 0
mov dword [esp + 0x38], ecx
call fcn.00424c00
add esp, 0x10
cmp dword [esi], 0
jne 0x4104d3
mov ebp, 3
cmp dword [esi + 0x308], ebp
je 0x4101e2
mov ebx, dword [esp + 0x10]
test ebx, ebx
je 0x4101b9
mov ecx, 0x4938a4
mov eax, ebx
lea esp, [esp]
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x4101b0
test dl, dl
je 0x4101ac
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x4101b0
add eax, 2
add ecx, 2
test dl, dl
jne 0x410190
xor eax, eax
jmp 0x4101b5
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x4101e2
cmp byte [0x79ace4], 0
jne 0x4102bb
cmp dword [esp + 0x14], 0
jne 0x4101e2
test ebx, ebx
jne 0x4102bb
call fcn.0040cc90
test al, al
je 0x4102bb
mov eax, dword [esi + 0x2f8]
lea ecx, [esp + 0x14]
push ecx
lea edx, [esp + 0x14]
push edx
push eax
push esi
call fcn.0040c530
add esp, 0x10
cmp eax, 0xffffffff
jne 0x41028f
cmp dword [esi + 0x308], ebp
je 0x410986
mov eax, dword [esp + 0x10]
test eax, eax
je 0x41024d
mov ecx, 0x4938a4
mov edi, edi
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x410240
test dl, dl
je 0x41023c
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x410240
add eax, 2
add ecx, 2
test dl, dl
jne 0x410220
xor eax, eax
jmp 0x410245
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x410986
mov eax, dword [esp + 0x14]
test eax, eax
je 0x4102bb
mov ecx, str.MySQL
lea ebx, [ebx]
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x410280
test dl, dl
je 0x41027c
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x410280
add eax, 2
add ecx, 2
test dl, dl
jne 0x410260
xor eax, eax
jmp 0x410285
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x410986
jmp 0x4102bb
push eax
call fcn.00427a80
mov edx, dword [esp + 0x18]
push edx
mov dword [esi], eax
mov eax, dword [str.Named_pipe:___.32s]
push eax
lea ecx, [esp + 0x98]
push 0x153
push ecx
mov dword [esp + 0x3c], ecx
call fcn.00424c00
add esp, 0x14
cmp dword [esi], 0
jne 0x4104d3
mov eax, dword [esi + 0x308]
xor ecx, ecx
cmp eax, ecx
je 0x4102d9
cmp eax, 1
jne 0x4104c2
or ebp, 0xffffffff
or ebx, 0xffffffff
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x14], ecx
cmp edi, ecx
jne 0x4102f8
mov edx, dword [0x79a420]
mov dword [esp + 0x1fc], edx
mov edi, dword [esp + 0x10]
test edi, edi
jne 0x410309
mov edi, str.localhost
mov dword [esp + 0x10], edi
mov ecx, dword [str.__.100s_via_TCP_IP]
push edi
lea eax, [esp + 0x90]
push ecx
mov edx, eax
push 0x153
push edx
mov dword [esp + 0x38], eax
call fcn.00424c00
xor eax, eax
mov dword [esp + 0x60], eax
mov dword [esp + 0x64], eax
mov dword [esp + 0x68], eax
mov dword [esp + 0x5c], eax
mov dword [esp + 0x6c], eax
mov dword [esp + 0x70], eax
mov dword [esp + 0x74], eax
mov dword [esp + 0x78], eax
mov dword [esp + 0x60], eax
mov eax, dword [esp + 0x20c]
push eax
push 0x493ce0
lea ecx, [esp + 0x84]
push 0x20
push ecx
mov dword [esp + 0x74], 1
mov dword [esp + 0x78], 6
call fcn.00424c00
add esp, 0x20
lea edx, [esp + 0x20]
push edx
lea eax, [esp + 0x50]
push eax
lea ecx, [esp + 0x74]
push ecx
push edi
call dword [sym.imp.WS2_32.dll_getaddrinfo]
test eax, eax
je 0x4103c2
call dword [sym.imp.MSVCR90.dll__errno]
mov edx, dword [eax]
mov eax, dword [str.Unknown_MySQL_server_host___.100s___d_]
mov ecx, dword [str.HY000]
push edx
push edi
push eax
push ecx
push 0x7d5
push esi
call fcn.0040c4f0
add esp, 0x18
jmp 0x410986
mov edi, dword [esp + 0x20]
test edi, edi
je 0x41042f
lea ebx, [ebx]
mov edx, dword [edi + 0xc]
mov eax, dword [edi + 8]
mov ecx, dword [edi + 4]
push edx
push eax
push ecx
call dword [sym.imp.WS2_32.dll_socket]
mov ebp, eax
cmp ebp, 0xffffffff
jne 0x4103f5
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov dword [esp + 0x1c], eax
jmp 0x410424
mov edx, dword [esi + 0x2f8]
mov eax, dword [edi + 0x10]
mov ecx, dword [edi + 0x18]
push edx
push eax
push ecx
push ebp
call fcn.0040c420
mov ebx, eax
add esp, 0x10
test ebx, ebx
je 0x41042b
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push ebp
mov dword [esp + 0x20], eax
call dword [sym.imp.WS2_32.dll_closesocket]
mov edi, dword [edi + 0x1c]
test edi, edi
jne 0x4103d0
mov edi, dword [esp + 0x20]
push edi
call dword [sym.imp.WS2_32.dll_freeaddrinfo]
cmp ebp, 0xffffffff
jne 0x410460
mov edx, dword [esp + 0x1c]
mov eax, dword [str.Cant_create_TCP_IP_socket___d_]
mov ecx, dword [str.HY000]
push edx
push eax
push ecx
push 0x7d4
push esi
call fcn.0040c4f0
add esp, 0x14
jmp 0x410986
test ebx, ebx
je 0x41048f
mov edx, dword [esp + 0x1c]
mov eax, dword [esp + 0x10]
mov ecx, dword [str.Cant_connect_to_MySQL_server_on___.100s___d_]
push edx
mov edx, dword [str.HY000]
push eax
push ecx
push edx
push 0x7d3
push esi
call fcn.0040c4f0
add esp, 0x18
jmp 0x410986
push 2
push 1
push ebp
call fcn.00427a00
add esp, 0xc
mov dword [esi], eax
test eax, eax
jne 0x4104d3
mov eax, dword [str.HY000]
push eax
push 0x7ff
push esi
call fcn.0040c440
add esp, 0xc
push ebp
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x410986
mov ecx, dword [str.HY000]
push ecx
push 0x7ff
jmp 0x41097d
mov edx, dword [esi]
push edx
push esi
call fcn.0042b550
add esp, 8
test al, al
mov eax, dword [esi]
je 0x41050e
push eax
mov eax, dword [eax + 0x144]
call eax
mov dword [esi], 0
mov ecx, dword [str.HY000]
push ecx
push 0x7d8
push esi
call fcn.0040c440
add esp, 0x10
jmp 0x410986
mov edx, dword [eax + 0x15c]
push 1
push eax
call edx
mov eax, dword [esi + 0x2fc]
add esp, 8
test eax, eax
je 0x410530
push eax
push esi
call fcn.0042bc40
add esp, 8
mov eax, dword [esi + 0x300]
test eax, eax
je 0x410544
push eax
push esi
call fcn.0042bc70
add esp, 8
mov eax, dword [esi + 0x350]
test eax, eax
je 0x410551
mov dword [esi + 0x2c], eax
mov eax, dword [esi + 0x2f8]
mov dword [esi + 0x2e4], 0xa
test eax, eax
je 0x4105a6
mov ecx, dword [esi]
push eax
mov eax, dword [ecx + 0x17c]
push ecx
call eax
add esp, 8
test al, al
je 0x4105a6
call dword [sym.imp.MSVCR90.dll__errno]
mov ecx, dword [eax]
push ecx
push str.waiting_for_initial_communication_packet
mov edx, dword [str.Lost_connection_to_MySQL_server_at__s__system_error:__d]
mov eax, dword [str.HY000]
push edx
push eax
push 0x7dd
push esi
call fcn.0040c4f0
add esp, 0x18
jmp 0x410986
push esi
call fcn.0040f6a0
add esp, 4
cmp eax, 0xffffffff
jne 0x4105d1
cmp dword [esi + 0x58], 0x7dd
jne 0x410986
call dword [sym.imp.MSVCR90.dll__errno]
mov ecx, dword [eax]
push ecx
push str.reading_initial_communication_packet
jmp 0x410586
mov ecx, dword [esi + 0x10]
lea ebp, [ecx + eax]
movzx eax, byte [ecx]
mov dword [esp + 0x48], ebp
mov dword [esi + 0x2e4], eax
cmp eax, 0xa
je 0x41060d
mov ecx, dword [str.Protocol_mismatch__server_version___d__client_version___d]
mov edx, dword [str.HY000]
push 0xa
push eax
push ecx
push edx
push 0x7d7
push esi
call fcn.0040c4f0
add esp, 0x18
jmp 0x410986
inc ecx
push ecx
call fcn.00419dd0
mov ecx, dword [eax + 1]
mov edi, eax
add eax, 5
mov dword [esp + 0x20], eax
add eax, 9
lea edx, [eax + 1]
add esp, 4
mov dword [esi + 0x2d0], ecx
mov dword [esp + 0x44], 9
mov dword [esp + 0x3c], str.mysql_old_password
cmp ebp, edx
jb 0x41064c
movzx ecx, word [eax]
mov dword [esi + 0x2e0], ecx
lea ecx, [eax + 0x12]
mov dword [esp + 0x38], ecx
cmp ebp, ecx
jb 0x410694
movsx edx, byte [eax + 2]
mov dword [esi + 0x2f0], edx
movzx ecx, word [eax + 3]
mov dword [esi + 0x2ec], ecx
movzx edx, word [eax + 5]
shl edx, 0x10
or dword [esi + 0x2e0], edx
movsx eax, byte [eax + 7]
mov dword [esp + 0x34], eax
test eax, eax
jge 0x410694
mov eax, dword [str.HY000]
push eax
push 0x7eb
jmp 0x41097d
cmp byte [esi + 0x364], 0
je 0x4106c3
mov ecx, dword [esp + 0x24]
cmp byte [ecx], 0
je 0x4106c3
test dword [esi + 0x2e0], 0x8000
jne 0x4106c3
mov edx, dword [str.HY000]
push edx
push 0x801
jmp 0x41097d
push esi
call fcn.0040dd90
add esp, 4
test eax, eax
jne 0x410986
mov eax, dword [esp + 0x14]
test eax, eax
je 0x4106f0
lea edx, [eax + 1]
nop
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x4106e0
sub eax, edx
inc eax
mov dword [esp + 0x20], eax
jmp 0x4106f8
mov dword [esp + 0x20], 1
mov eax, dword [esp + 0x10]
lea edx, [eax + 1]
nop
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x410700
sub eax, edx
mov dword [esp + 0x40], eax
mov eax, dword [esp + 0x28]
lea ecx, [eax + 1]
mov dl, byte [eax]
inc eax
test dl, dl
jne 0x410714
sub edi, dword [esi + 0x10]
push 0
sub eax, ecx
inc edi
push edi
lea ecx, [esi + 0x280]
push ecx
mov ecx, dword [esp + 0x2c]
push ecx
lea edx, [esi + 0x27c]
push edx
mov edx, dword [esp + 0x54]
inc edx
push edx
lea ebp, [esi + 0x270]
push ebp
inc eax
push eax
lea ebx, [esi + 0x284]
push ebx
push 0
call fcn.0042d420
add esp, 0x28
test eax, eax
je 0x410972
mov eax, dword [esp + 0x30]
push 0
push eax
call fcn.0040aaf0
add esp, 8
mov dword [esi + 0x274], eax
test eax, eax
je 0x410972
mov ecx, dword [esp + 0x24]
push 0
push ecx
call fcn.0040aaf0
add esp, 8
mov dword [esi + 0x278], eax
test eax, eax
je 0x410972
mov edx, dword [esp + 0x28]
mov eax, dword [ebx]
push edx
push eax
call fcn.00410fe0
mov ecx, dword [esp + 0x18]
mov edx, dword [ebp]
push ecx
push edx
call fcn.00410fe0
mov eax, dword [esp + 0x24]
add esp, 0x10
test eax, eax
je 0x4107d1
push eax
mov eax, dword [esi + 0x27c]
push eax
call fcn.00410fe0
add esp, 8
jmp 0x4107db
mov dword [esi + 0x27c], 0
mov ecx, dword [esi + 0x10]
mov edx, dword [esi + 0x280]
inc ecx
push ecx
push edx
call fcn.00410fe0
mov eax, dword [esp + 0x204]
mov edi, dword [esp + 0x50]
mov dword [esi + 0x2d8], eax
mov eax, dword [esp + 0x40]
lea ecx, [eax + 0xd]
add esp, 8
cmp edi, ecx
jb 0x410849
mov edx, dword [esp + 0x1c]
push 8
lea ebx, [eax - 8]
push edx
push ebx
call dword [sym.imp.MSVCR90.dll_memmove]
add esp, 0xc
test dword [esi + 0x2e0], 0x80000
mov eax, ebx
je 0x41083e
mov edx, dword [esp + 0x34]
lea ecx, [eax + edx]
cmp ecx, edi
jbe 0x41085f
sub edi, eax
mov edx, edi
jmp 0x41085f
sub edi, eax
mov edx, edi
mov ecx, str.mysql_native_password
jmp 0x41085f
and dword [esi + 0x2e0], 0xffff7fff
mov edx, dword [esp + 0x44]
mov eax, dword [esp + 0x1c]
mov ecx, dword [esp + 0x3c]
mov edi, dword [esp + 0x204]
mov dword [esi + 0x2dc], edi
mov edi, dword [esp + 0x2c]
push edi
push ecx
push edx
push eax
push esi
call fcn.0040fc30
add esp, 0x14
test eax, eax
jne 0x410986
test byte [esi + 0x2dc], 0x20
je 0x410892
mov byte [esi + 0x50], 1
mov eax, dword [esp + 0x2c]
test eax, eax
je 0x4108ea
cmp dword [esi + 0x28c], 0
jne 0x4108ea
push eax
push esi
call fcn.0040e6a0
test eax, eax
je 0x4108ea
cmp dword [esi + 0x58], 0x7dd
jne 0x410986
call dword [sym.imp.MSVCR90.dll__errno]
mov eax, dword [eax]
mov ecx, dword [str.Lost_connection_to_MySQL_server_at__s__system_error:__d]
mov edx, dword [str.HY000]
push eax
push str.Setting_intital_database
push ecx
push edx
push 0x7dd
push esi
call fcn.0040c4f0
add esp, 0x18
jmp 0x410986
mov eax, dword [esi + 0x324]
test eax, eax
je 0x41096e
mov ebp, dword [eax]
mov eax, dword [eax + 4]
mov cl, byte [esi + 0x385]
lea ebx, [ebp + eax*4]
mov byte [esp + 0x1b], cl
mov byte [esi + 0x385], 0
cmp ebp, ebx
jae 0x410964
mov edx, dword [ebp]
mov eax, edx
lea edi, [eax + 1]
lea ebx, [ebx]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x410920
sub eax, edi
push eax
push edx
push esi
call fcn.0040e9e0
test eax, eax
jne 0x410986
cmp dword [esi + 0x294], 0
je 0x410951
push esi
call fcn.0040eb60
add esp, 4
test eax, eax
je 0x410986
push eax
call fcn.0040cce0
push esi
call fcn.00418ed0
test eax, eax
jg 0x410986
je 0x410935
add ebp, 4
cmp ebp, ebx
jb 0x410912
mov dl, byte [esp + 0x1b]
mov byte [esi + 0x385], dl
mov eax, esi
jmp 0x4109aa
mov eax, dword [str.HY000]
push eax
push 0x7d8
push esi
call fcn.0040c440
add esp, 0xc
push esi
call fcn.0040f530
add esp, 4
call fcn.0040e830
test dword [esp + 0x204], 0x80000000
jne 0x4109a8
mov eax, esi
call fcn.0040e710
xor eax, eax
mov ecx, dword [esp + 0x1e0]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0046e712
add esp, 0x1d4
ret 0x20