18#undef OutputDebugString
19#undef _CrtSetReportMode
20#undef _CrtSetReportFile
22#define DBGRPT_MAX_BUFFER_SIZE 4096
23#define DBGRPT_ASSERT_PREFIX_MESSAGE "Assertion failed: "
24#define DBGRPT_ASSERT_PREFIX_NOMESSAGE "Assertion failed!"
25#define DBGRPT_STRING_TOO_LONG "_CrtDbgReport: String too long"
56template <
typename char_t>
95 L"\n\n(Press Retry to debug the application)";
102 L"\n\n(Press Retry to debug the application)";
156template <
typename char_t>
162 wchar_t LineBuffer[20] = {0};
166 if (moduleName && !moduleName[0])
171 _itow(linenumber, LineBuffer, 10);
175 traits::szAssertionMessage,
177 moduleName ?
L"\nModule: " :
L"", moduleName ? moduleName : traits::szEmptyString,
179 LineBuffer[0] ?
L"\nLine: " :
L"", LineBuffer[0] ? LineBuffer :
L"",
192 return messageBox(
NULL, szCompleteMessage,
L"ReactOS C++ Runtime Library",
196template <
typename char_t>
208 char LineBuffer[20] = {0};
210 _itoa(linenumber, LineBuffer, 10);
243 return oldReportMode;
255 return oldReportFile;
258template <
typename char_t>
271 DWORD cbMsg = (
DWORD)(traits::StringLength(szMsg) *
sizeof(char_t));
272 return ::WriteFile(
hFile, szMsg, cbMsg, &cbMsg,
NULL);
275template <
typename char_t>
277 const char_t *
filename,
int linenumber,
const char_t *moduleName)
283 _CrtDbgReportToFile<char_t>(
_CrtReportFiles[reportType], szCompleteMessage);
288 traits::OutputDebugString(szCompleteMessage);
318 const char *moduleName,
351 strcat(szCompleteMessage, szFormatted);
361 strcat(szCompleteMessage,
"\r");
362 strcat(szCompleteMessage,
"\n");
380 const wchar_t *moduleName,
413 wcscat(szCompleteMessage, szFormatted);
423 wcscat(szCompleteMessage,
L"\r");
424 wcscat(szCompleteMessage,
L"\n");
442 const char *moduleName,
455 const wchar_t *moduleName,
468 const char *moduleName,
487 const wchar_t *moduleName,
std::map< E_MODULE, HMODULE > mod
char * strcat(char *DstString, const char *SrcString)
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
int __cdecl raise(int _SigNum)
#define _CRTDBG_MODE_DEBUG
#define _CRTDBG_FILE_STDOUT
#define _CRTDBG_MODE_WNDW
#define _CRTDBG_MODE_FILE
#define _CRTDBG_REPORT_MODE
#define _CrtSetReportMode(t, f)
#define _CRTDBG_FILE_STDERR
#define _CRTDBG_INVALID_HFILE
#define _CRTDBG_REPORT_FILE
#define _CrtSetReportFile(t, f)
static _HFILE _CrtReportFiles[_CRT_ERRCNT]
static HMODULE _CrtUser32Handle
static BOOL _CrtDbgReportToFile(HANDLE hFile, const char_t *szMsg)
EXTERN_C int __cdecl _VCrtDbgReportA(int reportType, const char *filename, int linenumber, const char *moduleName, const char *format, va_list arglist)
#define DBGRPT_MAX_BUFFER_SIZE
EXTERN_C int __cdecl _CrtDbgReportWV(int reportType, const wchar_t *filename, int linenumber, const wchar_t *moduleName, const wchar_t *format, va_list arglist)
static void _CrtLeaveDbgReport(int reportType)
EXTERN_C int __cdecl _VCrtDbgReportW(int reportType, const wchar_t *filename, int linenumber, const wchar_t *moduleName, const wchar_t *format, va_list arglist)
EXTERN_C int __cdecl _CrtDbgReportV(int reportType, const char *filename, int linenumber, const char *moduleName, const char *format, va_list arglist)
dbgrpt_char_traits< wchar_t > wchar_traits
EXTERN_C int __cdecl _CrtDbgReportW(int reportType, const wchar_t *filename, int linenumber, const wchar_t *moduleName, const wchar_t *format,...)
static int _CrtHandleDbgReport(int reportType, const char_t *szCompleteMessage, const char_t *szFormatted, const char_t *filename, int linenumber, const char_t *moduleName)
int(WINAPI * tMessageBoxW)(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define DBGRPT_STRING_TOO_LONG
static int _CrtEnterDbgReport(int reportType, const char_t *filename, int linenumber)
static tMessageBoxW _CrtGetMessageBox()
EXTERN_C int __cdecl _CrtDbgReport(int reportType, const char *filename, int linenumber, const char *moduleName, const char *format,...)
static tMessageBoxW _CrtMessageBoxW
dbgrpt_char_traits< char > achar_traits
static int _CrtDbgReportWindow(int reportType, const char_t *filename, int linenumber, const char_t *moduleName, const char_t *message)
#define DBGRPT_ASSERT_PREFIX_MESSAGE
#define DBGRPT_ASSERT_PREFIX_NOMESSAGE
static int _CrtModeOutputFormat[_CRT_ERRCNT]
static const wchar_t * _CrtModeMessages[_CRT_ERRCNT]
static HMODULE _CrtGetUser32()
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
void WINAPI SHIM_OBJ_NAME() OutputDebugStringA(LPCSTR lpOutputString)
void WINAPI SHIM_OBJ_NAME() OutputDebugStringW(LPCWSTR lpOutputString)
_CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest, size_t _Count, const wchar_t *_Format, va_list _Args)
_CRTIMP char *__cdecl _itoa(_In_ int _Value, _Pre_notnull_ _Post_z_ char *_Dest, _In_ int _Radix)
_CRTIMP wchar_t *__cdecl _itow(_In_ int _Value, _Pre_notnull_ _Post_z_ wchar_t *_Dest, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
void * _InterlockedCompareExchangePointer(_Interlocked_operand_ void *volatile *_Destination, void *_Exchange, void *_Comparand)
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
long __cdecl _InterlockedDecrement(_Interlocked_operand_ long volatile *_Addend)
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const char_t * szUnknownFile
static void OutputDebugString(const char_t *message)
static size_t StringLength(const char_t *str)
static const wchar_t * szAssertionMessage
static const char_t * szEmptyString
static void OutputDebugString(const char_t *message)
static const char_t * szEmptyString
static const wchar_t * szAssertionMessage
static size_t StringLength(const char_t *str)
static const char_t * szUnknownFile
#define _CRT_WIDE(_String)
#define STD_OUTPUT_HANDLE
#define OutputDebugString
BOOL WINAPI IsDebuggerPresent(void)
#define MB_ABORTRETRYIGNORE