Ignore:
Timestamp:
Jun 23, 2011, 4:19:24 PM (14 years ago)
Author:
dmik
Message:

kernel32: Add the full path to the started executable to the message box shown on DLL load failure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/initkernel32.cpp

    r21651 r21653  
    301301    if (ulFlag == 0 && rc == 0)
    302302    {
    303         static const char msg[] =
    304             "Failed to initialize the KERNEL32 library.\n\r"
     303        static const char msg1[] =
     304            "Failed to initialize the KERNEL32 library while starting \"";
     305
     306        static const char msg2[] =
     307            "\".\n\r"
    305308            "\n\r"
    306309            "It is possible that there is not enough memory in the system to "
     
    309312            "creating a ticket at http://svn.netlabs.org/odin32/.\n\r";
    310313
     314        char msg[sizeof(msg1) + CCHMAXPATH + sizeof(msg2)];
     315
     316        strcpy(msg, msg1);
     317
     318        PPIB ppib;
     319        DosGetInfoBlocks(NULL, &ppib);
     320        if (DosQueryModuleName(ppib->pib_hmte, CCHMAXPATH,
     321                               msg + sizeof(msg1) - 1) != NO_ERROR)
     322            strcat(msg, "<unknown executable>");
     323        strcat(msg, msg2);
     324
    311325        // Initialization has failed. Try to be nice and show an error message
    312326        // to the user.
     
    317331        // available)
    318332        ULONG dummy;
    319         DosWrite((HFILE)1, (PVOID)msg, sizeof(msg), &dummy);
     333        DosWrite((HFILE)1, (PVOID)&msg, strlen(msg), &dummy);
    320334    }
    321335
Note: See TracChangeset for help on using the changeset viewer.