Beispiel #1
0
void PMAPI PM_fatalError(const char *msg)
{
    if (fatalErrorCleanup)
        fatalErrorCleanup();
    fprintf(stderr,"%s\n", msg);
    exit(1);
}
Beispiel #2
0
/****************************************************************************
REMARKS:
Handle fatal errors internally in the driver.
****************************************************************************/
void PMAPI PM_fatalError(
    const char *msg)
{
    ULONG   BugCheckCode = 0;
    ULONG   MoreBugCheckData[4] = {0};
    char    *p;
    ULONG   len;

    // Clean up the system first!
    if (fatalErrorCleanup)
        fatalErrorCleanup();

    // KeBugCheckEx brings down the system in a controlled
    // manner when the caller discovers an unrecoverable
    // inconsistency that would corrupt the system if
    // the caller continued to run.
    //
    // hack - dump the first 20 chars in hex using the variables
    //      provided - Each ULONG is equal to four characters...
    for(len = 0; len < 20; len++)
        if (msg[len] == (char)0)
            break;

    // This looks bad but it's quick and reliable...
    p = (char *)&BugCheckCode;
    if(len > 0) p[3] = msg[0];
    if(len > 1) p[2] = msg[1];
    if(len > 2) p[1] = msg[2];
    if(len > 3) p[0] = msg[3];

    p = (char *)&MoreBugCheckData[0];
    if(len > 4) p[3] = msg[4];
    if(len > 5) p[2] = msg[5];
    if(len > 6) p[1] = msg[6];
    if(len > 7) p[0] = msg[7];

    p = (char *)&MoreBugCheckData[1];
    if(len > 8) p[3] = msg[8];
    if(len > 9) p[2] = msg[9];
    if(len > 10) p[1] = msg[10];
    if(len > 11) p[0] = msg[11];

    p = (char *)&MoreBugCheckData[2];
    if(len > 12) p[3] = msg[12];
    if(len > 13) p[2] = msg[13];
    if(len > 14) p[1] = msg[14];
    if(len > 15) p[0] = msg[15];

    p = (char *)&MoreBugCheckData[3];
    if(len > 16) p[3] = msg[16];
    if(len > 17) p[2] = msg[17];
    if(len > 18) p[1] = msg[18];
    if(len > 19) p[0] = msg[19];

    // Halt the system!
    KeBugCheckEx(BugCheckCode, MoreBugCheckData[0], MoreBugCheckData[1], MoreBugCheckData[2], MoreBugCheckData[3]);
}
Beispiel #3
0
/****************************************************************************
REMARKS:
Report a fatal error condition and halt the program.
****************************************************************************/
void PMAPI PM_fatalError(
	const char *msg)
{
	if (fatalErrorCleanup)
		fatalErrorCleanup();
	// TODO: Display a fatal error message and exit!
//	MessageBox(NULL,msg,"Fatal Error!", MB_ICONEXCLAMATION);
	exit(1);
}
Beispiel #4
0
void PMAPI PM_fatalError(const char *msg)
{
    // TODO: If you are running in a GUI environment without a console,
    //       this needs to be changed to bring up a fatal error message
    //       box and terminate the program.
    if (fatalErrorCleanup)
        fatalErrorCleanup();
    fprintf(stderr,"%s\n", msg);
    exit(1);
}