Function at 0x408510
Capabilities:
Access peb ldr_data

Disassembly:
push 0xffffffffffffffff
push 0x412da4
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
push ecx
push ebx
mov ebx, dword [esp + 0x20]
push edi
mov edi, ecx
test bh, 4
jne 0x408597
mov ecx, dword [esp + 0x1c]
lea eax, [esp + 0x24]
push eax
push ecx
mov ecx, edi
mov dword [esp + 0x2c], 0
call fcn.00408e60
test eax, eax
je 0x408582
mov edx, dword [esp + 0x2c]
mov ecx, dword [esp + 0x28]
push edx
mov edx, dword [esp + 0x24]
or bh, 4
push ecx
mov ecx, dword [esp + 0x2c]
push ebx
push edx
push ecx
mov ecx, eax
call fcn.00408510
pop edi
pop ebx
mov ecx, dword [esp + 4]
mov dword fs:[0], ecx
add esp, 0x10
ret 0x14
pop edi
xor eax, eax
pop ebx
mov ecx, dword [esp + 4]
mov dword fs:[0], ecx
add esp, 0x10
ret 0x14
push ebp
push esi
mov esi, dword [esp + 0x30]
test esi, esi
jne 0x4085af
mov dword [esp + 0x2c], 0xd00
mov ebx, dword [esp + 0x2c]
jmp 0x4085bb
test bh, 1
jne 0x4085bb
or bh, 1
mov dword [esp + 0x2c], ebx
test bl, 0x10
je 0x4085e1
mov eax, dword [0x41ae40]
push esi
push eax
mov ecx, 0x41ae38
call sub.MFC42.DLL_CPtrArray::SetAtGrow
mov edx, dword [esp + 0x24]
push 1
push esi
push edx
lea ecx, [edi + 0x1c]
call sub.MFC42.DLL_CPtrArray::InsertAt
mov eax, dword [esp + 0x24]
or ebx, 0xffffffff
cmp eax, ebx
jne 0x4085fa
mov eax, dword [edi + 4]
push eax
call dword [sym.imp.USER32.dll_GetMenuItemCount]
mov dword [esp + 0x24], eax
push 0x28
call sub.MFC42.DLL_operatornew
add esp, 4
mov dword [esp + 0x10], eax
test eax, eax
mov dword [esp + 0x1c], 0
je 0x40861f
mov ecx, eax
call fcn.004055f0
mov esi, eax
jmp 0x408621
xor esi, esi
mov ecx, dword [esp + 0x24]
push 1
push esi
push ecx
lea ecx, [edi + 8]
mov dword [esp + 0x28], ebx
call sub.MFC42.DLL_CPtrArray::InsertAt
mov edx, dword [esp + 0x28]
mov ecx, esi
push edx
call fcn.00405700
mov ebx, dword [esp + 0x34]
lea ebp, [esi + 0x18]
test ebx, ebx
mov dword [esi + 0x1c], ebx
mov dword [ebp], 0xffffffff
jl 0x408701
mov eax, dword [esp + 0x30]
push ebp
push ebx
push eax
mov ecx, edi
mov dword [ebp], 0
call fcn.00408c10
mov ecx, dword [esi + 0x20]
test ecx, ecx
je 0x40867d
call sub.MFC42.DLL_CImageList::DeleteImageList
jmp 0x4086ad
push 8
call sub.MFC42.DLL_operatornew
add esp, 4
mov dword [esp + 0x28], eax
test eax, eax
mov dword [esp + 0x1c], 1
je 0x4086a0
mov ecx, eax
call sub.MFC42.DLL_CImageList::CImageList
jmp 0x4086a2
xor eax, eax
mov dword [esp + 0x1c], 0xffffffff
mov dword [esi + 0x20], eax
mov ecx, dword [edi + 0x34]
mov edx, dword [edi + 0x30]
push 1
push 1
push 0xff
push ecx
mov ecx, dword [esi + 0x20]
push edx
call sub.MFC42.DLL_CImageList::Create
mov eax, dword [esi + 0x20]
push ebx
push eax
mov ecx, edi
call fcn.00409b70
test eax, eax
jne 0x408701
mov ecx, dword [esi + 0x20]
call sub.MFC42.DLL_CImageList::DeleteImageList
mov ecx, dword [esi + 0x20]
test ecx, ecx
je 0x4086ec
mov edx, dword [ecx]
push 1
call dword [edx + 4]
mov dword [esi + 0x20], 0
mov dword [esi + 0x1c], 0xffffffff
mov dword [ebp], 0xffffffff
mov ecx, dword [esp + 0x30]
mov eax, dword [esp + 0x2c]
push esi
push ecx
mov dword [esi + 0xc], eax
push eax
mov eax, dword [esp + 0x30]
mov dword [esi + 0x10], ecx
mov ecx, dword [edi + 4]
push eax
push ecx
call dword [sym.imp.USER32.dll_InsertMenuA]
mov ecx, dword [esp + 0x14]
pop esi
pop ebp
pop edi
pop ebx
mov dword fs:[0], ecx
add esp, 0x10
ret 0x14