1. cmd.exe
2. cp msvcr100d.dll msvcr100.dll
3. gcc main.c -lmsvcr100 -lgcc
main.c与msvcr100.dll在同一个目录,
-
//main.c
-
#include <stdio.h>
-
#include <stdlib.h>
-
#include <string.h>
-
-
-
void myInvalidParameterHandler(const wchar_t* expression,
-
const wchar_t* function,
-
const wchar_t* file,
-
unsigned int line,
-
uintptr_t pReserved)
-
{
-
wprintf(L"Invalid parameter detected in function %s."
-
L" File: %s Line: %d\n", function, file, line);
-
wprintf(L"Expression: %s\n", expression);
-
abort();
-
}
-
-
int main(int argc, char **argv)
-
{
-
char* formatString;
-
-
_invalid_parameter_handler oldHandler, newHandler;
-
newHandler = myInvalidParameterHandler;
-
oldHandler = _set_invalid_parameter_handler(newHandler);
-
-
// Disable the message box for assertions.
-
//_CrtSetReportMode(_CRT_ASSERT, 0);
-
-
// Call printf_s with invalid parameters.
-
-
formatString = NULL;
-
printf(formatString);
-
return 0;
-
}
阅读(903) | 评论(0) | 转发(0) |