Function at 0x404040
Capabilities:
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x28
push ebx
mov ebx, ecx
push ebp
push esi
mov eax, dword [ebx + 0x78]
push edi
mov edi, dword [esp + 0x3c]
push 0x47d
cdq
idiv edi
mov dword [esp + 0x1c], eax
mov eax, dword [ebx + 0x7c]
cdq
idiv edi
mov dword [esp + 0x20], eax
call sub.MFC42u.DLL_CWnd::GetDlgItem
mov edx, dword [eax + 0x20]
lea ecx, [esp + 0x28]
push ecx
push edx
call dword [sym.imp.USER32.dll_GetWindowRect]
lea eax, [esp + 0x20]
push eax
call fcn.0042cdd0
mov ecx, dword [esp + 0x24]
mov edx, dword [esp + 0x20]
or eax, 0xffffffff
push ecx
mov dword [esp + 0x14], eax
mov dword [esp + 0x40], eax
lea eax, [esp + 0x2c]
push edx
push eax
call dword [sym.imp.USER32.dll_PtInRect]
test eax, eax
je 0x4040d4
mov eax, dword [esp + 0x20]
mov ebp, dword [esp + 0x28]
mov esi, dword [ebx + 0x78]
sub eax, ebp
add eax, esi
mov ecx, dword [ebx + 0x7c]
cdq
idiv edi
mov edx, dword [esp + 0x2c]
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x24]
sub eax, edx
add eax, ecx
cdq
idiv edi
mov dword [esp + 0x3c], eax
mov eax, dword [ebx + 0xb0]
lea edi, [ebx + 0xb0]
test eax, eax
je 0x4040f4
push eax
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
mov dword [edi], 0
mov edx, edi
xor ecx, ecx
mov ebp, dword [esp + 0x40]
mov dword [edx], ecx
mov dword [edx + 4], ecx
mov dword [edx + 8], ecx
mov dword [edx + 0xc], ecx
mov eax, dword [ebx + 0xa8]
imul eax, ebp
mov ecx, ebp
mov dword [ebx + 0xb8], eax
imul ecx, dword [ebx + 0xac]
shl eax, 2
mov dword [ebx + 0xb4], eax
imul eax, ecx
push eax
mov dword [ebx + 0xbc], ecx
call dword [sym.imp.MSVCRT.dll_malloc]
mov edx, dword [ebx + 0xa0]
mov dword [edi], eax
add esp, 4
mov edi, eax
cmp ebp, 1
mov dword [esp + 0x40], edi
jne 0x4041aa
mov eax, dword [ebx + 0xac]
mov dword [esp + 0x14], 0
test eax, eax
jle 0x40421d
mov ecx, dword [ebx + 0xa8]
mov esi, edx
shl ecx, 2
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov edi, dword [esp + 0x40]
mov eax, dword [ebx + 0xb4]
mov ecx, dword [ebx + 0xa4]
add edi, eax
mov eax, dword [esp + 0x14]
add edx, ecx
mov ecx, dword [ebx + 0xac]
inc eax
cmp eax, ecx
mov dword [esp + 0x40], edi
mov dword [esp + 0x14], eax
jl 0x404164
jmp 0x40421d
mov ecx, dword [ebx + 0xbc]
xor eax, eax
test ecx, ecx
mov dword [esp + 0x40], eax
jle 0x40421d
jmp 0x4041c0
mov eax, dword [esp + 0x40]
mov edi, eax
mov esi, dword [ebx + 0xb0]
cdq
imul edi, dword [ebx + 0xb4]
idiv ebp
mov edx, dword [ebx + 0xa0]
add edi, esi
xor esi, esi
mov ecx, eax
mov eax, dword [ebx + 0xb8]
imul ecx, dword [ebx + 0xa4]
add ecx, edx
test eax, eax
jle 0x40420a
mov eax, esi
add edi, 4
cdq
idiv ebp
inc esi
mov edx, dword [ecx + eax*4]
mov dword [edi - 4], edx
mov eax, dword [ebx + 0xb8]
cmp esi, eax
jl 0x4041f1
mov eax, dword [esp + 0x40]
mov ecx, dword [ebx + 0xbc]
inc eax
cmp eax, ecx
mov dword [esp + 0x40], eax
jl 0x4041bc
mov eax, dword [esp + 0x10]
test eax, eax
jl 0x40429d
mov ecx, dword [esp + 0x3c]
test ecx, ecx
jl 0x40429d
mov edi, dword [ebx + 0xa8]
cmp eax, edi
jge 0x40429d
mov esi, dword [ebx + 0xac]
mov eax, ecx
cmp eax, esi
jge 0x40429d
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x28]
sub eax, ecx
mov ecx, dword [esp + 0x10]
cdq
idiv ebp
sub ecx, eax
mov dword [ebx + 0x78], ecx
js 0x40425f
cmp ecx, edi
jl 0x404266
mov dword [ebx + 0x78], 0
mov eax, ebp
mov edi, dword [esp + 0x2c]
imul eax, dword [ebx + 0x78]
mov dword [ebx + 0x78], eax
mov eax, dword [esp + 0x24]
sub eax, edi
mov ecx, dword [esp + 0x3c]
cdq
idiv ebp
sub ecx, eax
mov dword [ebx + 0x7c], ecx
js 0x40428b
cmp ecx, esi
jl 0x404292
mov dword [ebx + 0x7c], 0
mov ecx, ebp
imul ecx, dword [ebx + 0x7c]
mov dword [ebx + 0x7c], ecx
jmp 0x4042b1
mov eax, dword [esp + 0x18]
imul eax, ebp
mov dword [ebx + 0x78], eax
mov eax, dword [esp + 0x1c]
imul eax, ebp
mov dword [ebx + 0x7c], eax
mov ecx, dword [ebx + 0x78]
xor eax, eax
cmp ecx, eax
jge 0x4042bd
mov dword [ebx + 0x78], eax
cmp dword [ebx + 0x7c], eax
jge 0x4042c5
mov dword [ebx + 0x7c], eax
mov edx, dword [esp + 0x30]
mov esi, dword [esp + 0x28]
mov ecx, dword [ebx + 0xb8]
sub edx, esi
cmp ecx, edx
jge 0x4042dc
mov dword [ebx + 0x78], eax
mov ecx, dword [esp + 0x34]
mov esi, dword [esp + 0x2c]
mov edx, dword [ebx + 0xbc]
sub ecx, esi
cmp edx, ecx
jge 0x4042f3
mov dword [ebx + 0x7c], eax
cmp dword [esp + 0x44], eax
je 0x404300
mov ecx, ebx
call fcn.00404320
mov ecx, ebx
call fcn.00402d20
pop edi
mov dword [ebx + 0x74], ebp
pop esi
pop ebp
pop ebx
add esp, 0x28
ret 0xc