From be028db42c08859ca3172d854c1ae6523d130232 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 15 Apr 2023 21:08:54 +0300 Subject: [PATCH] Log message if winuaelog.txt open failed --- od-win32/win32.cpp | 13 +++++++++---- od-win32/win32.h | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 79ad3eea..d573c92d 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -3530,13 +3530,13 @@ void toggle_mousegrab(void) static bool createbootlog = true; static bool logging_disabled = false; -void logging_open (int bootlog, int append) +bool logging_open(int bootlog, int append) { TCHAR *outpath; TCHAR debugfilename[MAX_DPATH]; if (logging_disabled && !winuaelog_temporary_enable) - return; + return true; outpath = logpath; debugfilename[0] = 0; @@ -3553,8 +3553,10 @@ void logging_open (int bootlog, int append) if (debugfilename[0]) { if (!debugfile) debugfile = log_open (debugfilename, append, bootlog, outpath); + return debugfile != NULL; } #endif + return true; } typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); @@ -3578,9 +3580,12 @@ void logging_init (void) start_path_data, LOG_NORMAL); if (debugfile) log_close (debugfile); - debugfile = 0; + debugfile = NULL; + } + bool ok = logging_open(first ? 0 : 1, 0); + if (first == 1 && !ok) { + write_log(_T("Failed to create log file.\n")); } - logging_open (first ? 0 : 1, 0); logging_started = 1; first++; diff --git a/od-win32/win32.h b/od-win32/win32.h index e2259957..de9c059c 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -175,8 +175,8 @@ extern unsigned int fpucontrol; extern void fpux_save (int *v); extern void fpux_restore (int *v); -extern void logging_open (int,int); -extern void logging_cleanup (void); +extern bool logging_open(int,int); +extern void logging_cleanup(void); extern LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS *pExceptionPointers, DWORD ec); -- 2.47.3