Loading toolkit/mozapps/defaultagent/EventLog.h +17 −6 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ #ifndef __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__ #define __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__ #include "mozilla/Types.h" #include <cwchar> MOZ_BEGIN_EXTERN_C Loading @@ -15,10 +15,21 @@ extern MOZ_EXPORT const wchar_t* gWinEventLogSourceName; MOZ_END_EXTERN_C #include "mozilla/WindowsEventLog.h" // This is not compatible with Mingw. #ifdef LOG_ERRORS_FILE extern FILE* gLogFile; # define LOG_ERROR(hr) \ if (gLogFile) { \ fprintf(gLogFile, "Error in %s:%d: 0x%X\r\n", __FILE__, __LINE__, \ (unsigned int)hr); \ } # define LOG_ERROR_MESSAGE(format, ...) \ if (gLogFile) { \ fwprintf(gLogFile, format __VA_OPT__(, ) __VA_ARGS__); \ fputs("\r\n", gLogFile); \ } #else # define LOG_ERROR(hr) # define LOG_ERROR_MESSAGE(format, ...) #endif #endif // __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__ toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -364,12 +364,22 @@ HRESULT SetDefaultExtensionHandlersUserChoiceImpl( return S_OK; } #ifdef LOG_ERRORS_FILE FILE* gLogFile; #endif // Simplified version of wmain that uses only this file from main.cpp. int wmain(int argc, wchar_t** argv) { if (argc < 3 || !argv[1] || !argv[2]) { return E_INVALIDARG; } #ifdef LOG_ERRORS_FILE std::unique_ptr<FILE, decltype(&fclose)> logFile(fopen(LOG_ERRORS_FILE, "a+"), &fclose); gLogFile = logFile.get(); #endif HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); if (FAILED(hr)) { LOG_ERROR(hr); Loading Loading
toolkit/mozapps/defaultagent/EventLog.h +17 −6 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ #ifndef __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__ #define __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__ #include "mozilla/Types.h" #include <cwchar> MOZ_BEGIN_EXTERN_C Loading @@ -15,10 +15,21 @@ extern MOZ_EXPORT const wchar_t* gWinEventLogSourceName; MOZ_END_EXTERN_C #include "mozilla/WindowsEventLog.h" // This is not compatible with Mingw. #ifdef LOG_ERRORS_FILE extern FILE* gLogFile; # define LOG_ERROR(hr) \ if (gLogFile) { \ fprintf(gLogFile, "Error in %s:%d: 0x%X\r\n", __FILE__, __LINE__, \ (unsigned int)hr); \ } # define LOG_ERROR_MESSAGE(format, ...) \ if (gLogFile) { \ fwprintf(gLogFile, format __VA_OPT__(, ) __VA_ARGS__); \ fputs("\r\n", gLogFile); \ } #else # define LOG_ERROR(hr) # define LOG_ERROR_MESSAGE(format, ...) #endif #endif // __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__
toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -364,12 +364,22 @@ HRESULT SetDefaultExtensionHandlersUserChoiceImpl( return S_OK; } #ifdef LOG_ERRORS_FILE FILE* gLogFile; #endif // Simplified version of wmain that uses only this file from main.cpp. int wmain(int argc, wchar_t** argv) { if (argc < 3 || !argv[1] || !argv[2]) { return E_INVALIDARG; } #ifdef LOG_ERRORS_FILE std::unique_ptr<FILE, decltype(&fclose)> logFile(fopen(LOG_ERRORS_FILE, "a+"), &fclose); gLogFile = logFile.get(); #endif HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); if (FAILED(hr)) { LOG_ERROR(hr); Loading