Function at 0x407040
Capabilities:
Create directory
Hide graphical window
Initialize winsock library
Read .ini file

Disassembly:
push ebx
mov ebx, esp
sub esp, 8
and esp, 0xfffffff0
add esp, 4
push ebp
mov ebp, dword [ebx + 4]
mov dword [esp + 4], ebp
mov ebp, esp
sub esp, 0x354
mov eax, dword [0x442008]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebx + 8]
push esi
push edi
mov dword [ebp - 0x32c], eax
jmp 0x407083
push 1
call dword [sym.imp.KERNEL32.dll_SetErrorMode]
push 0x415ce0
call dword [sym.imp.KERNEL32.dll_SetUnhandledExceptionFilter]
mov edi, dword [ebp - 0x32c]
mov esi, dword [sym.imp.USER32.dll_LoadStringA]
push 0x64
push 0x511708
push 0x67
push edi
mov dword [0x511704], eax
call esi
push 0x64
push 0x5116a0
push 0x6d
push edi
call esi
mov esi, dword [sym.imp.USER32.dll_LoadImageA]
push 0
push 0x40
push 0x40
push 1
push 0x6b
push edi
mov dword [ebp - 0x40], 0x30
mov dword [ebp - 0x3c], 3
mov dword [ebp - 0x38], 0x4075a0
mov dword [ebp - 0x34], 0
mov dword [ebp - 0x30], 0
mov dword [ebp - 0x2c], edi
call esi
push 0x7f00
push 0
mov dword [ebp - 0x28], eax
call dword [sym.imp.USER32.dll_LoadCursorA]
push 0
push 0x20
push 0x20
push 1
push 0x6c
push edi
mov dword [ebp - 0x24], eax
mov dword [ebp - 0x20], 6
mov dword [ebp - 0x1c], 0x6d
mov dword [ebp - 0x18], 0x5116a0
call esi
mov dword [ebp - 0x14], eax
lea eax, [ebp - 0x40]
push eax
call dword [sym.imp.USER32.dll_RegisterClassExA]
push 0
push edi
push 0
push 0
push 0
push bind
push 0
push bind
push 0xcf0000
push 0x511708
push 0x5116a0
push 0
mov dword [0x51169c], edi
call dword [sym.imp.USER32.dll_CreateWindowExA]
mov esi, eax
test esi, esi
je 0x407576
push 1
push esi
mov dword [0x511698], esi
call dword [sym.imp.USER32.dll_ShowWindow]
push esi
call dword [sym.imp.USER32.dll_UpdateWindow]
push 0
push 0x43b068
call dword [sym.imp.KERNEL32.dll_CreateDirectoryA]
sub esp, 8
call fcn.00414cb0
push str.Initializing...
push 0xff
push 0x442a08
call fcn.00415470
add esp, 0xc
push str.21:55:31
push str.May_17_2024
push 0x43b094
push str.Data_Server_version:__s_Compiled_at:__s__s
push 0x442a08
call fcn.004152c0
mov esi, dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringA]
add esp, 0x14
push str..DataServer.ini
push 0x20
push 0x511678
push 0x43b22f
push str.CustomerName
push str.DataServerInfo
call esi
push str..DataServer.ini
push 0x24
push 0x511654
push 0x43b22f
push str.CustomerHardwareId
push str.DataServerInfo
call esi
push str.KG_Free
lea ecx, [ebp - 0x198]
call fcn.004025e0
mov edx, 0x511678
lea ecx, [edx + 1]
mov al, byte [edx]
inc edx
test al, al
jne 0x407231
mov esi, dword [ebp - 0x188]
sub edx, ecx
cmp dword [ebp - 0x184], 0x10
lea ecx, [ebp - 0x198]
cmovae ecx, dword [ebp - 0x198]
cmp esi, edx
jne 0x4072d0
mov edx, 0x511678
sub esi, 4
jb 0x407273
mov eax, dword [ecx]
cmp eax, dword [edx]
jne 0x407278
add ecx, 4
add edx, 4
sub esi, 4
jae 0x407262
cmp esi, 0xfffffffc
je 0x4072ac
mov al, byte [ecx]
cmp al, byte [edx]
jne 0x4072a5
cmp esi, 0xfffffffd
je 0x4072ac
mov al, byte [ecx + 1]
cmp al, byte [edx + 1]
jne 0x4072a5
cmp esi, 0xfffffffe
je 0x4072ac
mov al, byte [ecx + 2]
cmp al, byte [edx + 2]
jne 0x4072a5
cmp esi, 0xffffffff
je 0x4072ac
mov al, byte [ecx + 3]
cmp al, byte [edx + 3]
je 0x4072ac
sbb eax, eax
or eax, 1
jmp 0x4072ae
xor eax, eax
test eax, eax
jne 0x4072d0
push 0x511678
push str.DataServer_Login_Free:__s
push 0xffff
push 0x442a08
call fcn.00415470
add esp, 0x10
jmp 0x4072dc
push 3
mov ecx, 0x447610
call fcn.004163e0
lea eax, [ebp - 0x328]
push eax
push 0x202
call dword [sym.imp.WS2_32.dll_WSAStartup]
test eax, eax
jne 0x407423
mov esi, dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringA]
lea eax, [ebp - 0x30]
push str..DataServer.ini
push 0x20
push eax
xorps xmm0, xmm0
push 0x43b22f
push str.DataServerODBC
push str.DataServerInfo
movaps xmmword [ebp - 0x30], xmm0
movaps xmmword [ebp - 0x20], xmm0
movaps xmmword [ebp - 0x80], xmm0
movaps xmmword [ebp - 0x70], xmm0
movaps xmmword [ebp - 0x60], xmm0
movaps xmmword [ebp - 0x50], xmm0
call esi
push str..DataServer.ini
push 0x20
lea eax, [ebp - 0x80]
push eax
push 0x43b22f
push str.DataServerUSER
push str.DataServerInfo
call esi
push str..DataServer.ini
push 0x20
lea eax, [ebp - 0x60]
push eax
push 0x43b22f
push str.DataServerPASS
push str.DataServerInfo
call esi
mov esi, dword [sym.imp.KERNEL32.dll_GetPrivateProfileIntA]
push str..DataServer.ini
push 0xda98
push str.DataServerPort
push str.DataServerInfo
call esi
push str..DataServer.ini
push 0
push str.AdvancedLog
movzx eax, ax
push str.DataServerInfo
mov dword [ebp - 0x32c], eax
call esi
mov dword [0x511650], eax
mov ecx, 0x447690
lea eax, [ebp - 0x60]
push eax
lea eax, [ebp - 0x80]
push eax
lea eax, [ebp - 0x30]
push eax
call fcn.00416cd0
test al, al
jne 0x4073db
push str.Could_not_connect_to_database
push 0xff
push 0x442a08
call fcn.00415470
add esp, 0xc
jmp 0x407441
push dword [ebp - 0x32c]
mov ecx, 0x5105e8
call fcn.00417cc0
test al, al
jne 0x4073fb
mov ecx, 0x447690
call fcn.00416d60
jmp 0x407441
push ecx
call fcn.00401660
push ecx
call fcn.004027a0
push 0
push 0x3e8
push 0x64
push dword [0x511698]
call dword [sym.imp.USER32.dll_SetTimer]
call fcn.004136d0
jmp 0x407441
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
push str.WSAStartup___failed_with_error:__d
push 0xff
push 0x442a08
call fcn.00415470
add esp, 0x10
push 0x510628
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov esi, dword [0x510650]
push 0x510628
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push esi
push 0x43b094
lea eax, [ebp - 0x180]
push str.__s__KG_DataServer__QueueSize_:__d_
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
lea eax, [ebp - 0x180]
push eax
push dword [0x511698]
call dword [sym.imp.USER32.dll_SetWindowTextA]
push 0
push 0x7d0
push 0x65
push dword [0x511698]
call dword [sym.imp.USER32.dll_SetTimer]
push 0x6d
push edi
call dword [sym.imp.USER32.dll_LoadAcceleratorsA]
mov esi, dword [sym.imp.USER32.dll_GetMessageA]
push 0
push 0
mov dword [ebp - 0x32c], eax
lea eax, [ebp - 0x348]
push 0
push eax
call esi
test eax, eax
je 0x407516
mov edi, dword [sym.imp.USER32.dll_TranslateMessage]
nop
lea eax, [ebp - 0x348]
push eax
push dword [ebp - 0x32c]
push dword [ebp - 0x348]
call dword [sym.imp.USER32.dll_TranslateAcceleratorA]
test eax, eax
jne 0x407503
lea eax, [ebp - 0x348]
push eax
call edi
lea eax, [ebp - 0x348]
push eax
call dword [sym.imp.USER32.dll_DispatchMessageA]
push 0
push 0
push 0
lea eax, [ebp - 0x348]
push eax
call esi
test eax, eax
jne 0x4074d0
push dword [0x511704]
call dword [sym.imp.KERNEL32.dll_SetUnhandledExceptionFilter]
jmp 0x407534
mov eax, dword [ebp - 0x184]
mov esi, dword [ebp - 0x340]
cmp eax, 0x10
jb 0x407572
mov edx, dword [ebp - 0x198]
lea ecx, [eax + 1]
mov eax, edx
cmp ecx, 0x1000
jb 0x407568
mov edx, dword [edx - 4]
add ecx, 0x23
sub eax, edx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x40758d
push ecx
push edx
call fcn.00419b82
add esp, 8
mov eax, esi
jmp 0x407578
xor eax, eax
mov ecx, dword [ebp - 4]
pop edi
xor ecx, ebp
pop esi
call fcn.004198d7
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret 0x10
call fcn.0041d532
int3