Function at 0x40a670
Capabilities:
Manipulate console buffer
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0xdc
mov esi, dword [ebp + 8]
mov ebx, dword [ebp + 0xc]
test byte [ebp + 0x10], 8
jne 0x40a690
test ebx, ebx
je 0x40a8b2
mov edi, esi
mov dword [esp], 0x419cb0
call sub.KERNEL32.dll_EnterCriticalSection
push eax
mov eax, dword [0x419cf0]
cmp ax, word [0x419cf4]
je 0x40a8bc
mov ax, word [0x419cf2]
cmp ax, word [0x419cf6]
je 0x40a8bc
lea eax, [ebp - 0x30]
mov dword [esp + 4], eax
lea eax, [ebp - 0x2c]
mov dword [esp], eax
call fcn.0040ac00
lea eax, [ebp - 0x28]
mov dword [esp + 0xc], eax
lea eax, [ebp - 0x24]
mov dword [esp + 8], eax
lea eax, [ebp - 0x20]
mov dword [esp + 4], eax
lea eax, [ebp - 0x1c]
mov dword [esp], eax
call fcn.0040ac38
lea eax, [ebp - 0x78]
mov dword [ebp - 0x9c], eax
mov dword [ebp - 0x98], 0x40a4b0
mov dword [ebp - 0x94], 0x40a414
mov edx, dword [ebp - 0x1c]
mov dword [ebp - 0x90], edx
mov eax, dword [ebp - 0x20]
mov ecx, dword [ebp - 0x2c]
add ecx, eax
dec ecx
mov dword [ebp - 0x8c], ecx
add edx, dword [ebp - 0x24]
dec edx
mov dword [ebp - 0x88], edx
add eax, dword [ebp - 0x30]
dec eax
mov dword [ebp - 0x84], eax
mov dword [esp], 0
call fcn.0040b254
mov ecx, dword [ebp - 0x1c]
mov edx, dword [ebp - 0x20]
mov edi, dword [ebp - 0x24]
mov dword [ebp - 0xbc], edi
mov edi, dword [ebp - 0x28]
add edi, edx
dec edi
mov dword [ebp - 0xac], edi
cmp edx, dword [ebp - 0x8c]
je 0x40a910
mov dword [ebp - 0xb0], 1
mov dword [ebp - 0x5c], eax
mov dword [ebp - 0x78], ecx
mov dword [ebp - 0x74], edx
mov edx, dword [ebp - 0xbc]
lea eax, [edx + ecx - 1]
mov dword [ebp - 0x70], eax
mov edi, dword [ebp - 0xac]
mov dword [ebp - 0x6c], edi
mov eax, dword [ebp - 0xb0]
mov dword [ebp - 0x58], eax
mov dword [esp], 0
call fcn.0040b254
lea edx, [ebp - 0x52]
mov dword [esp + 4], edx
mov dword [esp], eax
call sub.KERNEL32.dll_GetConsoleScreenBufferInfo
sub esp, 8
test eax, eax
jne 0x40a938
mov eax, dword [ebp - 0x90]
mov dword [ebp - 0x80], eax
mov eax, dword [ebp - 0x8c]
mov dword [ebp - 0x7c], eax
mov dword [ebp - 0x68], 0x50
mov dword [ebp - 0x64], 0x19
mov word [ebp - 0x60], 7
mov edi, dword [0x419cfc]
test edi, edi
jne 0x40a998
lea edi, [ebp - 0x9c]
mov dword [esp + 0xc], 1
mov dword [esp + 8], ebx
mov dword [esp + 4], esi
mov dword [esp], edi
call fcn.0040acf8
mov eax, dword [ebp - 0x80]
mov ebx, dword [ebp - 0x90]
cmp eax, ebx
je 0x40a964
mov edx, dword [ebp - 0x7c]
mov ecx, dword [ebp - 0x84]
cmp ecx, 0xffffffff
je 0x40a870
cmp edx, ecx
jle 0x40a870
sub edx, ecx
mov dword [esp + 0x14], edx
mov dword [esp + 0x10], ecx
mov eax, dword [ebp - 0x88]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x8c]
mov dword [esp + 8], eax
mov dword [esp + 4], ebx
mov dword [esp], edi
call dword [ebp - 0x98]
mov eax, dword [ebp - 0x80]
mov edx, dword [ebp - 0x7c]
shl edx, 0x10
movzx eax, ax
or eax, edx
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x5c]
mov dword [esp], eax
call sub.KERNEL32.dll_SetConsoleCursorPosition
sub esp, 8
mov eax, dword [ebp - 0x8c]
cmp eax, dword [ebp - 0x20]
je 0x40a8a0
mov ebx, dword [ebp - 0x58]
test ebx, ebx
je 0x40aa00
call fcn.0040b094
mov dword [esp], 0x419cb0
call sub.KERNEL32.dll_LeaveCriticalSection
push ecx
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
leave
ret
test ebx, ebx
je 0x40a8a5
lea esi, [ebp - 0x34]
jmp 0x40a8d1
mov eax, dword [ebp - 0x34]
sub ebx, eax
je 0x40a8a5
add edi, eax
mov dword [esp], 0
call fcn.0040b254
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], esi
mov dword [esp + 8], ebx
mov dword [esp + 4], edi
mov dword [esp], eax
call sub.KERNEL32.dll_WriteFile
sub esp, 0x14
dec eax
je 0x40a8c8
mov dword [esp], 0x419cb0
call sub.KERNEL32.dll_LeaveCriticalSection
push ecx
jmp 0x40a8b2
mov edi, dword [ebp - 0xac]
cmp edi, dword [ebp - 0x84]
setne byte [ebp - 0xb0]
movzx edi, byte [ebp - 0xb0]
mov dword [ebp - 0xb0], edi
jmp 0x40a77c
movsx eax, word [ebp - 0x4e]
mov dword [ebp - 0x80], eax
movsx eax, word [ebp - 0x4c]
mov dword [ebp - 0x7c], eax
movsx eax, word [ebp - 0x52]
mov dword [ebp - 0x68], eax
movsx eax, word [ebp - 0x50]
mov dword [ebp - 0x64], eax
mov ax, word [ebp - 0x4a]
mov word [ebp - 0x60], ax
jmp 0x40a7f0
mov edx, dword [ebp - 0x7c]
mov ecx, dword [ebp - 0x84]
lea esi, [ecx + 1]
cmp edx, esi
jne 0x40a836
mov dword [0x419cfc], 1
mov eax, dword [ebp - 0x88]
mov dword [ebp - 0x80], eax
mov edx, ecx
mov dword [ebp - 0x7c], ecx
jmp 0x40a870
mov dword [0x419cfc], 0
mov edx, dword [ebp - 0x7c]
inc edx
mov dword [ebp - 0x7c], edx
mov ecx, dword [ebp - 0x90]
mov dword [ebp - 0x80], ecx
mov eax, dword [ebp - 0x84]
cmp eax, 0xffffffff
je 0x40a7fe
cmp edx, eax
jle 0x40a7fe
sub edx, eax
mov dword [esp + 0x14], edx
mov dword [esp + 0x10], eax
mov eax, dword [ebp - 0x88]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x8c]
mov dword [esp + 8], eax
mov dword [esp + 4], ecx
lea edi, [ebp - 0x9c]
mov dword [esp], edi
call dword [ebp - 0x98]
jmp 0x40a804
mov edx, dword [ebp - 0x90]
mov word [ebp - 0x3c], dx
mov word [ebp - 0x3a], ax
mov eax, dword [ebp - 0x88]
mov word [ebp - 0x38], ax
mov eax, dword [ebp - 0x84]
mov word [ebp - 0x36], ax
lea eax, [ebp - 0x3c]
mov dword [esp + 8], eax
mov dword [esp + 4], 1
mov eax, dword [ebp - 0x5c]
mov dword [esp], eax
call sub.KERNEL32.dll_SetConsoleWindowInfo
sub esp, 0xc
jmp 0x40a8a0