10 #error This file is supported only in debug builds
45#ifndef _UCRT_ENCLAVE_BUILD
49 return L"Debug %ls!\n\nProgram: %hs%ls%ls%hs%ls%hs%ls%hs%ls%ls%hs%ls\n\n(Press Retry to debug the application)\n";
54 return L"Debug %ls!\n\nProgram: %ls%ls%ls%ls%ls%ls%ls%ls%ls%ls%ls%ls\n\n(Press Retry to debug the application)\n";
58 L"\n\nFor information on how your program can cause an assertion"
59 L"\nfailure, see the Visual C++ documentation on asserts.";
87template <
typename Character,
typename Hook>
93 using node_type = __crt_report_hook_node<Character>;
107 if (
p->hook == new_hook)
115 if ((
ret = --
p->refcount) == 0)
119 p->next->prev =
p->prev;
123 p->prev->next =
p->next;
135 _ASSERTE((
"The hook function is not in the list!", 0));
150 p->next->prev =
p->prev;
151 p->prev->next =
p->next;
161 __crt_unique_heap_ptr<node_type> new_node(_calloc_crt_t(node_type, 1));
169 new_node.get()->prev =
nullptr;
177 ret = new_node.get()->refcount = 1;
178 new_node.get()->hook = new_hook;
193 return common_set_report_hook<char>(
mode, new_hook);
201 return common_set_report_hook<wchar_t>(
mode, new_hook);
273 wchar_t const*
const format,
284#if !defined _UCRT_ENCLAVE_BUILD
315template <
typename Character>
318 void*
const return_address,
322 Character
const*
const user_message
327 if (user_message ==
nullptr)
334 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
335 static_cast<LPCWSTR>(return_address),
356 size_t const program_name_length = traits::tcslen(
program_name);
360 short_program_name += program_name_length -
MAXLINELEN;
363#pragma warning(disable:__WARNING_POTENTIAL_BUFFER_OVERFLOW_HIGH_PRIORITY)
364 short_program_name[0] =
'.';
365 short_program_name[1] =
'.';
366 short_program_name[2] =
'.';
372 Character
const* short_module_name =
nullptr;
378 static Character
const empty_string[] = {
'\0' };
381 int const sprintf_result = _snwprintf_s(
391 short_module_name ?
L"..." :
L"",
397 user_message[0] ?
L"\n\n" :
L"",
399 user_message[0] ? user_message : empty_string,
404 if (sprintf_result < 0)
411 L"Microsoft Visual C++ Runtime Library",
414 switch (message_box_result)
445 void*
const return_address,
449 char const*
const user_message
457 void*
const return_address,
461 wchar_t const*
const user_message
void(__cdecl * __crt_signal_handler_t)(int)
__crt_signal_handler_t __cdecl __acrt_get_sigabrt_handler(void)
int __cdecl __acrt_show_wide_message_box(_In_opt_z_ wchar_t const *text, _In_opt_z_ wchar_t const *caption, _In_ unsigned type)
#define _ERRCHECK_SPRINTF(_PrintfCall)
#define DBGRPT_TOOLONGMSG
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
#define _GENERATE_TCHAR_STRING_FUNCTIONS(name, string)
#define _CrtSetReportHook2(t, f)
#define _CrtSetReportHookW2(t, f)
#define _CRT_RPTHOOK_INSTALL
int(__cdecl * _CRT_REPORT_HOOKW)(int, wchar_t *, int *)
#define _CRT_RPTHOOK_REMOVE
int(__cdecl * _CRT_REPORT_HOOK)(int, char *, int *)
EXTERN_C int __cdecl _VCrtDbgReportA(int reportType, const char *filename, int linenumber, const char *moduleName, const char *format, va_list arglist)
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 _CrtDbgReportW(int reportType, const wchar_t *filename, int linenumber, const wchar_t *moduleName, const wchar_t *format,...)
EXTERN_C int __cdecl _CrtDbgReport(int reportType, const char *filename, int linenumber, const char *moduleName, const char *format,...)
int __cdecl raise(int _SigNum)
static LPCWSTR LPCWSTR module_name
int const char const *const int const line_number
#define GetCurrentProcess()
BOOL WINAPI GetModuleHandleExW(IN DWORD dwFlags, IN LPCWSTR lpwModuleName OPTIONAL, OUT HMODULE *phModule)
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
static OleMenuHookItem * hook_list
static char * program_name
#define wcscpy_s(d, l, s)
__crt_report_hook_node< wchar_t > * _pReportHookListW
static wchar_t const *const report_type_messages[_CRT_ERRCNT]
static wchar_t const *__cdecl get_output_message_format(char)
static int __cdecl common_message_window(int const report_type, void *const return_address, Character const *const file_name, Character const *const line_number, Character const *const module_name, Character const *const user_message)
__crt_report_hook_node< char > * _pReportHookList
_CRT_REPORT_HOOK _pfnReportHook
static int __cdecl common_set_report_hook(int const mode, Hook const new_hook)
int __cdecl __acrt_MessageWindowA(int const report_type, void *const return_address, char const *const file_name, char const *const line_number, char const *const module_name, char const *const user_message)
int __cdecl __acrt_MessageWindowW(int const report_type, void *const return_address, wchar_t const *const file_name, wchar_t const *const line_number, wchar_t const *const module_name, wchar_t const *const user_message)
static wchar_t const *const more_info_string
static __crt_report_hook_node< char > *&__cdecl get_report_hook_list(char)
#define _CRT_WIDE(_String)
#define MB_ABORTRETRYIGNORE