terminal-win: use proper NTAPI callback for FLS

Fixes crash when FLS data is attempted to be cleared.

This affects only 32-bit build where the calling convention were not
matching the expected one. It has to be __stdcall in this case.

Fixes: 3372e17d
This commit is contained in:
Kacper Michajłow 2024-06-06 00:05:17 +02:00
parent 112fa549be
commit a32674bb29
1 changed files with 6 additions and 1 deletions

View File

@ -632,6 +632,11 @@ void terminal_set_mouse_input(bool enable)
}
}
static VOID NTAPI fls_free_cb(PVOID ptr)
{
talloc_free(ptr);
}
void terminal_init(void)
{
CONSOLE_SCREEN_BUFFER_INFO cinfo;
@ -653,6 +658,6 @@ void terminal_init(void)
GetConsoleScreenBufferInfo(hSTDOUT, &cinfo);
stdoutAttrs = cinfo.wAttributes;
tmp_buffers_key = FlsAlloc((PFLS_CALLBACK_FUNCTION)talloc_free);
tmp_buffers_key = FlsAlloc(fls_free_cb);
utf8_output = SetConsoleOutputCP(CP_UTF8);
}