Function at 0x413a60
Capabilities:
Manipulate console buffer

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff0
sub esp, 0x108
mov eax, dword [0x456d10]
xor eax, esp
mov dword [esp + 0x104], eax
cmp dword [0x45af74], 0
mov eax, dword [ebp + 0xc]
push esi
push edi
mov edi, dword [ebp + 8]
mov esi, edx
mov dword [esp + 0x24], esi
mov dword [esp + 0x40], ecx
mov dword [esp + 0x38], edi
mov dword [esp + 0x44], eax
mov dword [esp + 0x18], 1
mov byte [esp + 0xf], 0
je 0x413ab9
push edi
push esi
push 0x45ae60
call fcn.0041c5b0
add esp, 0xc
push edi
push str.Enter_WriteToConsole_with__d_chars_n
push 1
call fcn.0041a380
xor ecx, ecx
add esp, 0xc
mov eax, edi
mov edx, 2
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.00427138
add esp, 4
mov dword [esp + 0x20], eax
push edi
push eax
push edi
push esi
push 0
call dword [sym.imp.KERNEL32.dll_GetConsoleCP]
push eax
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
xor esi, esi
mov edi, eax
cmp byte [0x47bb29], 0
mov dword [esp + 0x30], edi
mov dword [esp + 0x10], esi
je 0x413b2d
cmp byte [0x47bb28], 0
je 0x413b2d
push 0x450984
call fcn.004046f0
add esp, 4
mov byte [0x47bb28], 0
test edi, edi
je 0x414447
mov edi, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
jmp 0x413b40
lea eax, [esp + 0xa8]
push eax
push 0xfffffffffffffff6
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
lea eax, [esp + 0xb4]
push eax
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
xor al, al
cmp dword [0x457e9c], 0
mov dword [esp + 8], eax
je 0x413bf4
cmp dword [esp + 0x18], 0
je 0x413bb4
test byte [0x45a93c], 6
je 0x413bb4
push str.Waiting_for_mutex_n
push 2
call fcn.0041a380
push str.WriteToConsole_got_OutputMutex_n
push 2
call fcn.0041a380
mov eax, dword [esp + 0x18]
add esp, 0x10
mov dword [esp + 0x18], 0
cmp byte [0x47bb29], 0
mov ecx, 1
movzx eax, al
cmovne eax, ecx
mov dword [esp + 8], eax
lea eax, [esp + 0x58]
push eax
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
movzx eax, word [esp + 0x5e]
mov word [0x47b996], ax
movzx eax, word [esp + 0x5c]
mov word [0x47b994], ax
mov eax, dword [esp + 0x20]
lea ecx, [esp + 0x10]
push ecx
push eax
lea edx, [esp + 0x44]
movzx esi, word [eax + esi*2]
lea ecx, [esp + 0xc0]
call fcn.00413260
mov cx, word [esp + 0xca]
add esp, 8
movzx eax, cx
cmp eax, dword [0x45a6fc]
jne 0x413cc6
xorps xmm0, xmm0
mov dword [esp + 0x90], 0
movdqa xmmword [esp + 0x80], xmm0
push ecx
movdqa xmmword [esp + 0x74], xmm0
lea ecx, [esp + 0x74]
mov dword [esp + 0x8c], 0
mov dword [esp + 0x90], 0
movdqa xmmword [esp + 0x74], xmm0
mov dword [esp + 0x84], 0
mov word [esp + 0x88], 0
call fcn.004069f0
test al, al
je 0x413ca2
cmp byte [0x45a953], 0
push ecx
lea ecx, [esp + 0x74]
jne 0x413c9d
call fcn.004067d0
jmp 0x413ca2
call fcn.00406930
cmp dword [esp + 0x88], 0
je 0x413cbe
call edi
push dword [esp + 0x88]
push 0
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov cx, word [esp + 0xc2]
test byte [0x45a93c], 6
je 0x413f6f
cmp dword [0x47b770], 0
jle 0x413f76
cmp byte [0x47bb34], 0
mov dl, byte [0x47bb1c]
jne 0x413cf3
test dl, dl
je 0x413cfe
mov eax, 1
mov dword [esp + 8], eax
jmp 0x413d02
mov eax, dword [esp + 8]
cmp esi, 0x1b
jne 0x413d79
cmp cx, 0x2d
jne 0x413d49
xor eax, eax
cmp byte [0x47bb29], al
setne al
lea eax, [eax*4 + 0x68]
push eax
push str.e_4_c
call fcn.004046f0
mov cx, word [esp + 0xca]
add esp, 8
cmp byte [0x47bb29], 0
mov dl, byte [0x47bb1c]
sete byte [0x47bb29]
cmp cx, 0x76
je 0x413d55
cmp cx, 0x78
jne 0x413d5c
mov byte [0x47bb34], 1
cmp cx, 0x71
je 0x413d68
cmp cx, 0x73
jne 0x413d70
mov dl, 1
mov byte [0x47bb1c], dl
mov eax, 1
mov dword [esp + 8], eax
cmp cx, 0x2e
je 0x413d85
cmp cx, 8
jne 0x413d8b
mov al, 1
mov dword [esp + 8], eax
cmp cx, 0xd
je 0x413d97
cmp cx, 0x1b
jne 0x413dd2
push 0x4509c8
call fcn.004046f0
mov eax, dword [esp + 0xc]
xor edx, edx
mov cx, word [esp + 0xc6]
add esp, 4
cmp cx, 0xd
movzx eax, al
mov byte [esp + 0xf], 1
cmove eax, edx
mov byte [0x47bb29], 0
mov dl, byte [0x47bb1c]
mov dword [esp + 8], eax
cmp byte [0x47bb34], 0
je 0x413dee
cmp cx, 0xd
je 0x413de7
cmp cx, 0x1b
jne 0x413dee
mov byte [0x47bb34], 0
test dl, dl
je 0x413e06
movzx eax, dl
xor edx, edx
cmp esi, 0x1b
cmovne eax, edx
mov byte [0x47bb1c], al
mov eax, dword [esp + 8]
cmp cx, 9
jne 0x413e33
cmp byte [0x47bb29], 0
mov byte [esp + 8], 0
je 0x413e27
push 0x4509c8
call fcn.004046f0
add esp, 4
mov byte [0x47bb28], 1
jmp 0x413f6f
test al, al
je 0x413f6f
cmp dword [0x47b770], 0
jle 0x413f76
mov eax, dword [0x45a95c]
imul eax, dword [0x45a940]
shl eax, 2
push eax
push 8
call edi
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ecx, eax
mov dword [0x46b214], ecx
test ecx, ecx
je 0x413f6f
mov eax, dword [0x45a95c]
imul eax, dword [0x45a940]
shl eax, 2
push eax
push ecx
push str.allocated_oInputScreen__0x_08x____d_bytes__before_key_press_n
push 3
call fcn.0041a380
mov esi, dword [0x45a940]
xor eax, eax
mov edx, dword [0x45a95c]
mov dword [0x46b210], eax
mov dword [esp + 0x5c], eax
lea eax, [esi - 1]
mov word [esp + 0x24], si
mov word [esp + 0x60], ax
lea ecx, [edx - 1]
cwde
push eax
push 0
movsx eax, cx
push eax
push 0
push 0
push 0
movsx eax, dx
push eax
movsx eax, si
push eax
push dword [0x46b214]
mov word [esp + 0x4a], dx
push str.before_ReadConsoleOutput_before_key_press_0x_08x__d__d__d__d___d__d__d__d__n
push 3
mov word [esp + 0x8e], cx
call fcn.0041a380
mov edi, dword [sym.imp.KERNEL32.dll_GetStdHandle]
lea eax, [esp + 0x88]
add esp, 0x3c
push eax
push dword [0x46b210]
push dword [esp + 0x1c]
push 0xfffffffffffffff5
call edi
mov edx, dword [0x46b214]
mov ecx, eax
call fcn.00413860
add esp, 0xc
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push esi
push str.after_ReadConsoleOutput_before_key_press__b_d___rc___d__0x_08x___n
push 3
call fcn.0041a380
add esp, 0x14
lea eax, [esp + 0x58]
push eax
push 0xfffffffffffffff5
call edi
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
push eax
push str.after_GetConsoleScreenBufferInfo_before_key_press_b_d__n
push 3
call fcn.0041a380
movzx eax, word [esp + 0x68]
add esp, 0xc
mov word [esp + 0x1c], ax
movzx eax, word [esp + 0x5e]
mov word [esp + 0x1e], ax
cmp dword [0x47b770], 0
push 0xffffffffffffffff
push dword [0x45af80]
setg byte [esp + 0x3c]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [esp + 8]
mov edi, dword [esp + 0x34]
mov esi, dword [esp + 0x10]
test al, al
jne 0x413fc9
cmp byte [esp + 0xf], 0
je 0x413fc9
mov eax, dword [esp + 0x24]
mov edx, dword [0x45a93c]
mov cl, byte [eax + esi]
test dl, 4
je 0x413fc1
push edi
call fcn.00412d50
add esp, 4
mov dword [esp + 0x18], eax
jmp 0x413fc9
mov dword [esp + 0x18], 0
lea eax, [esp + 0xac]
push eax
push dword [esp + 0x40]
lea eax, [esp + 0xc0]
push eax
push dword [esp + 0x4c]
call dword [sym.imp.KERNEL32.dll_WriteConsoleInputW]
test byte [0x45a93c], 6
je 0x4143f5
cmp dword [0x47b770], 0
jle 0x4143f5
cmp byte [esp + 8], 0
je 0x414387
mov eax, dword [0x45a95c]
imul eax, dword [0x45a940]
mov edi, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
shl eax, 2
push eax
push 8
call edi
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [0x46b320], eax
test eax, eax
je 0x414348
mov ecx, dword [0x45a95c]
imul ecx, dword [0x45a940]
shl ecx, 2
push ecx
push eax
push str.allocated_nInputScreen__0x_08x____d_bytes__after_key_press_n
push 3
call fcn.0041a380
mov esi, dword [0x45a940]
xor eax, eax
mov edx, dword [0x45a95c]
mov dword [0x46b210], eax
mov dword [esp + 0x5c], eax
lea eax, [esi - 1]
mov word [esp + 0x24], si
mov word [esp + 0x60], ax
lea ecx, [edx - 1]
cwde
push eax
push 0
movsx eax, cx
push eax
push 0
push 0
push 0
movsx eax, dx
push eax
movsx eax, si
push eax
push dword [0x46b320]
mov word [esp + 0x4a], dx
push str.before_ReadConsoleOutput_after_key_press_0x_08x__d__d__d__d___d__d__d__d__n
push 3
mov word [esp + 0x8e], cx
call fcn.0041a380
add esp, 0x3c
lea eax, [esp + 0x4c]
push eax
push dword [0x46b210]
push dword [esp + 0x1c]
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov edx, dword [0x46b320]
mov ecx, eax
call fcn.00413860
add esp, 0xc
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push esi
push str.after_ReadConsoleOutput_after_key_press__b_d___rc___d__0x_08x___n
push 3
call fcn.0041a380
add esp, 0x14
lea eax, [esp + 0x58]
push eax
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleScreenBufferInfo]
push eax
push str.after_GetConsoleScreenBufferInfo_after_key_press__b_d__n
push 3
call fcn.0041a380
movsx eax, word [esp + 0x70]
add esp, 0xc
movsx ecx, word [esp + 0x68]
sub ecx, eax
inc ecx
push ecx
push str.lastline___d_after_key_press_n
push 3
mov dword [esp + 0x54], ecx
call fcn.0041a380
mov ecx, dword [0x45a95c]
add esp, 0xc
imul ecx, dword [0x45a940]
mov eax, ecx
shl eax, 4
add eax, ecx
push eax
push 8
call edi
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov esi, eax
mov dword [esp + 8], esi
test esi, esi
je 0x414314
mov edx, dword [0x45a95c]
imul edx, dword [0x45a940]
mov ecx, edx
shl ecx, 4
add ecx, edx
push ecx
push esi
push str.allocated_oldbuf__0x_08d____d_bytes__after_key_press_n
push 3
call fcn.0041a380
push str.before_InputCompareScreens_after_key_press_n
push 3
mov dword [esp + 0x44], esi
call fcn.0041a380
mov ecx, dword [0x45a95c]
lea edx, [esp + 0x34]
mov eax, dword [0x45a940]
add esp, 0x18
mov esi, dword [esp + 0x1c]
mov edi, ecx
imul edi, eax
push dword [esp + 0x5c]
push edx
lea edx, [esp + 0x50]
push edx
push ecx
push ecx
push eax
push edi
mov edx, edi
lea ecx, [esp + 0x48]
sub esp, 8
shl edx, 4
add edx, edi
call fcn.00416100
add esp, 0x24
push str.after_InputCompareScreens_after_key_press_n
push 3
call fcn.0041a380
mov edi, dword [esp + 0x34]
sub edi, dword [esp + 0x10]
push edi
push str.dwMode___d_n
push 4
call fcn.0041a380
add esp, 0x14
test edi, edi
je 0x4142e8
cmp byte [0x47bb34], 0
jne 0x4142cf
cmp byte [0x47bb1c], 0
jne 0x4142cf
lea eax, [esp + 0xb0]
push eax
push 0xfffffffffffffff6
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
mov ecx, str.e_4l
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x414247
push dword [0x45ac08]
sub ecx, edx
mov edx, str.e_4l
push ecx
mov ecx, dword [0x45aa7c]
call fcn.00418e40
mov edx, dword [0x45a940]
mov ecx, dword [esp + 0x10]
push esi
call fcn.0040a950
mov esi, eax
add esp, 0xc
mov edx, esi
lea eax, [edx + 1]
mov cl, byte [edx]
inc edx
test cl, cl
jne 0x414281
push dword [0x45ac08]
mov ecx, dword [0x45aa7c]
sub edx, eax
push edx
mov edx, esi
call fcn.00418e40
push esi
call fcn.004290b1
add esp, 0xc
cmp byte [0x47bb29], 0
je 0x4142e8
mov eax, str.e_4h
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x4142b8
push dword [0x45ac08]
sub eax, edx
mov edx, str.e_4h
push eax
jmp 0x4142da
push dword [0x45ac08]
mov edx, dword [esp + 0xc]
push edi
mov ecx, dword [0x45aa7c]
call fcn.00418e40
add esp, 8
push dword [esp + 8]
mov edi, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push 0
call edi
mov esi, dword [sym.imp.KERNEL32.dll_HeapFree]
push eax
call esi
push dword [esp + 8]
push str.freed_oldbuf__0x_08d__after_key_press_n
push 4
call fcn.0041a380
add esp, 0xc
jmp 0x41431a
mov esi, dword [sym.imp.KERNEL32.dll_HeapFree]
push dword [0x46b320]
push 0
call edi
push eax
call esi
push dword [0x46b320]
push str.freed_nInputScreen__0x_08d___n
push 4
call fcn.0041a380
add esp, 0xc
mov dword [0x46b320], 0
jmp 0x41434e
mov esi, dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, dword [0x46b214]
test eax, eax
je 0x4143fb
push eax
push 0
call edi
push eax
call esi
push dword [0x46b214]
push str.freed_oInputScreen__0x_08d___n
push 4
call fcn.0041a380
add esp, 0xc
mov dword [0x46b214], 0
jmp 0x4143fb
cmp byte [esp + 0xf], 0
jne 0x4143f5
mov eax, dword [esp + 0x24]
cmp byte [eax], 9
jne 0x41439e
cmp dword [esp + 0x30], 1
je 0x4143f5
lea eax, [esp + 0x54]
mov dword [esp + 0x54], 0
push eax
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
movsx eax, word [0x47b994]
inc eax
cmp eax, dword [0x45a940]
jne 0x4143d6
test byte [esp + 0x54], 2
mov byte [esp + 0x28], 1
jne 0x4143db
mov byte [esp + 0x28], 0
push dword [esp + 0x28]
mov eax, dword [esp + 0x24]
push edi
push ecx
mov cx, word [eax + esi*2]
call fcn.00412f70
add esp, 0xc
mov dword [esp + 0x18], eax
mov edi, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push dword [0x45af80]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov eax, dword [0x45af64]
test eax, eax
je 0x41442c
push eax
push str.Sleep__d_n
push 3
call fcn.0041a380
add esp, 0xc
push dword [0x45af64]
call dword [sym.imp.KERNEL32.dll_Sleep]
mov esi, dword [esp + 0x10]
inc esi
push 0
mov dword [esp + 0x14], esi
call dword [sym.imp.KERNEL32.dll_Sleep]
cmp esi, dword [esp + 0x30]
jb 0x413b40
push dword [esp + 0x20]
call fcn.00426f24
mov ecx, dword [esp + 0x48]
add esp, 4
mov eax, dword [esp + 0x38]
mov dword [ecx], eax
call fcn.00414fb0
mov eax, dword [0x45af90]
test eax, eax
je 0x4144b9
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
test eax, eax
je 0x4144a2
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.Released_Output_Lock_n
push 7
call fcn.0041a380
add esp, 0xc
xor eax, eax
pop edi
pop esi
mov ecx, dword [esp + 0x104]
xor ecx, esp
call fcn.004265fb
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push eax
push str.Failed_to_release_lock_rc___d__0x_0x__n
push 7
call fcn.0041a380
add esp, 0x10
mov ecx, dword [esp + 0x10c]
xor eax, eax
pop edi
pop esi
xor ecx, esp
call fcn.004265fb
mov esp, ebp
pop ebp
ret