Function at 0x405936
Capabilities:
Write clipboard data

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1c
mov eax, dword [0x43ca60]
push ebx
push esi
push edi
mov edi, dword [eax]
xor ebx, ebx
push 8
pop edx
mov dword [ebp - 0xc], ebx
mov dword [ebp - 4], ebx
mov dword [ebp - 0x1c], edx
mov dword [ebp - 8], ebx
mov dword [ebp - 0x14], edi
cmp edi, 0x28
jae 0x405974
movzx esi, word [eax + 0xa]
cmp esi, edx
jg 0x4059c1
inc ebx
mov ecx, esi
shl ebx, cl
mov dword [ebp - 0x10], ebx
imul ebx, ebx, 3
jmp 0x4059c1
mov ecx, dword [eax + 0x20]
movzx esi, word [eax + 0xe]
mov dword [ebp - 0x10], ecx
test ecx, ecx
je 0x405986
mov ebx, ecx
jmp 0x405991
xor ebx, ebx
cmp esi, edx
jg 0x405994
inc ebx
mov ecx, esi
shl ebx, cl
shl ebx, 2
cmp dword [eax + 0x10], 3
mov ecx, dword [eax + 0x14]
mov dword [ebp - 4], ecx
jne 0x4059ab
cmp edi, 0x34
jae 0x4059ab
add edi, 0xc
mov dword [ebp - 0x14], edi
cmp edi, 0x7c
jne 0x4059c1
mov eax, dword [eax + 0x74]
mov dword [ebp - 0x1c], 0x11
test eax, eax
jbe 0x4059c1
mov dword [ebp - 0xc], eax
cmp esi, 1
je 0x4059f2
cmp esi, 4
jg 0x4059cf
push 4
jmp 0x4059de
cmp esi, edx
jg 0x4059d7
mov esi, edx
jmp 0x4059f2
cmp esi, 0x10
jg 0x4059e1
push 0x10
pop esi
jmp 0x4059f2
xor eax, eax
cmp esi, 0x18
setg al
lea eax, [eax*8 + 0x18]
mov esi, eax
mov eax, dword [0x43ca64]
mov ecx, dword [eax + 4]
mov dword [0x43ca90], ecx
mov eax, dword [eax + 8]
push 0x43b8a0
mov dword [0x43ca94], eax
call fcn.0041ace7
mov eax, dword [0x43ca90]
imul eax, esi
add eax, 0x1f
shr eax, 3
and eax, 0x1ffffffc
imul eax, dword [0x43ca94]
cmp dword [ebp - 4], 0
je 0x405a37
cmp eax, dword [ebp - 4]
jbe 0x405a3a
mov dword [ebp - 4], eax
mov eax, dword [ebp - 4]
add eax, edi
add eax, dword [ebp - 0xc]
add eax, ebx
push eax
push 2
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [ebp - 0x18], eax
test eax, eax
je 0x405b9a
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov esi, eax
test esi, esi
jne 0x405a73
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_GlobalFree]
jmp 0x405b93
push edi
push dword [0x43ca60]
push esi
call fcn.004223c0
add esp, 0xc
cmp edi, 0x28
jb 0x405a8e
mov eax, dword [ebp - 4]
mov dword [esi + 0x14], eax
test ebx, ebx
je 0x405acc
mov eax, dword [0x43ca54]
test eax, eax
je 0x405acc
mov ecx, dword [0x43ca60]
mov edi, dword [ecx]
add edi, esi
push edi
push dword [ebp - 0x10]
push 0
push eax
call dword [sym.imp.GDI32.dll_GetPaletteEntries]
mov ecx, dword [ebp - 0x10]
test ecx, ecx
jle 0x405ac9
mov al, byte [edi]
mov dl, byte [edi + 2]
mov byte [edi], dl
mov byte [edi + 2], al
add edi, 4
dec ecx
jne 0x405ab9
mov edi, dword [ebp - 0x14]
push dword [ebp - 4]
lea eax, [esi + edi]
push dword [0x43ca58]
add eax, ebx
push eax
call fcn.004223c0
add esp, 0xc
cmp edi, 0x7c
jne 0x405b4c
and dword [esi + 0x70], 0
cmp dword [ebp - 0xc], 0
je 0x405b4c
mov eax, dword [ebp - 4]
push dword [ebp - 0xc]
lea edi, [eax + ebx + 0x7c]
mov dword [esi + 0x70], edi
mov eax, dword [0x43ca60]
lea eax, [eax + ebx + 0x7c]
push eax
mov eax, dword [ebp - 4]
add eax, esi
lea eax, [eax + ebx + 0x7c]
push eax
call fcn.004223c0
add esp, 0xc
push edi
push 2
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [ebp - 8], eax
test eax, eax
je 0x405b4c
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
push edi
mov ebx, eax
push esi
push ebx
call fcn.004223c0
and dword [ebx + 0x70], 0
add esp, 0xc
push dword [ebp - 8]
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
push dword [ebp + 8]
call fcn.00416cec
call dword [sym.imp.USER32.dll_EmptyClipboard]
push dword [ebp - 0x18]
mov esi, dword [sym.imp.USER32.dll_SetClipboardData]
push dword [ebp - 0x1c]
call esi
cmp dword [ebp - 8], 0
je 0x405b7e
push dword [ebp - 8]
push 8
call esi
call dword [sym.imp.USER32.dll_CloseClipboard]
push str.CPTXClip
push 0x20000000
call fcn.00417cf8
pop edi
pop esi
pop ebx
leave
ret 4
push str.Clipboard_error
jmp 0x405b89