From c29d128451d39f05070d17f3dfd7d741b8cf7018 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Thu, 25 Jul 2024 08:49:45 +0200 Subject: [PATCH] screen_win: use get_win32_error to obtain err string --- src/video_capture/screen_win.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/video_capture/screen_win.c b/src/video_capture/screen_win.c index 970f658ea..1352a996e 100644 --- a/src/video_capture/screen_win.c +++ b/src/video_capture/screen_win.c @@ -361,17 +361,8 @@ static int register_screen_cap_rec_library(bool is_elevated) { HMODULE screen_cap_lib = LoadLibraryA("screen-capture-recorder-x64.dll"); if(!screen_cap_lib){ DWORD err_code = GetLastError(); - - char buf[512] = ""; - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - err_code, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - buf, - sizeof(buf), - NULL); - - log_msg(LOG_LEVEL_ERROR, MOD_NAME "Failed to load screen capture dll. Error code: %x (%s)\n", err_code, buf); + MSG(ERROR, "Failed to load screen capture dll: %ld - %s\n", + err_code, get_win32_error(err_code)); return -1; }