VirtualBox

Changeset 96388 in vbox for trunk/src/VBox/Runtime/r3/win


Ignore:
Timestamp:
Aug 20, 2022 11:08:15 PM (2 years ago)
Author:
vboxsync
Message:

IPRT/nocrt: Introduced an internal rtNoCrtFatalMsg/Write API to be used instead of RTMsgError and RTAssertMsg2 to report no-CRT init and runtime issues. The other two drags in hundreds of KBs of unnecessary code. bugref:10261

Location:
trunk/src/VBox/Runtime/r3/win
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/nocrt-mainCRTStartup-win.asm

    r95831 r96388  
    2828%include "iprt/asmdefs.mac"
    2929
    30 extern  CustomMainEntrypoint
     30extern  NAME(CustomMainEntrypoint)
    3131BEGINPROC mainCRTStartup
    32         jmp     CustomMainEntrypoint
     32        jmp     NAME(CustomMainEntrypoint)
    3333ENDPROC   mainCRTStartup
    3434
  • trunk/src/VBox/Runtime/r3/win/nocrt-startup-common-win.cpp

    r95870 r96388  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
    31 #include "internal/iprt.h"
     31#include "internal/nocrt.h"
    3232#include "internal/process.h"
    3333
    3434#include <iprt/nt/nt-and-windows.h>
     35#ifndef IPRT_NOCRT_WITHOUT_FATAL_WRITE
     36# include <iprt/assert.h>
     37#endif
    3538#include <iprt/getopt.h>
    3639#include <iprt/message.h>
     
    7174        }
    7275        else
     76        {
     77#ifdef IPRT_NOCRT_WITHOUT_FATAL_WRITE
    7378            RTMsgError("initProcExecPath: RTUtf16ToUtf8Ex failed: %Rrc\n", rc);
     79#else
     80            rtNoCrtFatalMsgWithRc(RT_STR_TUPLE("initProcExecPath: RTUtf16ToUtf8Ex failed: "), rc);
     81#endif
     82        }
    7483    }
    7584    else
     85    {
     86#ifdef IPRT_NOCRT_WITHOUT_FATAL_WRITE
    7687        RTMsgError("initProcExecPath: GetModuleFileNameW failed: %Rhrc\n", GetLastError());
     88#else
     89        rtNoCrtFatalWriteBegin(RT_STR_TUPLE("initProcExecPath: GetModuleFileNameW failed: "));
     90        rtNoCrtFatalWriteWinRc(GetLastError());
     91        rtNoCrtFatalWrite(RT_STR_TUPLE("\r\n"));
     92#endif
     93    }
    7794}
    7895
  • trunk/src/VBox/Runtime/r3/win/nocrt-startup-exe-win.cpp

    r95892 r96388  
    3131*   Header Files                                                                                                                 *
    3232*********************************************************************************************************************************/
    33 #include "internal/iprt.h"
     33#include "internal/nocrt.h"
    3434#include "internal/process.h"
    3535
     
    9898         * Get and convert the command line to argc/argv format.
    9999         */
     100        rcExit = RTEXITCODE_INIT;
    100101        UNICODE_STRING const *pCmdLine = pPeb->ProcessParameters ? &pPeb->ProcessParameters->CommandLine : NULL;
    101102        if (pCmdLine)
     
    118119                }
    119120                else
    120                     rcExit = RTMsgErrorExitFailure("Error parsing command line: %Rrc\n", rc);
     121#ifdef IPRT_NOCRT_WITHOUT_FATAL_WRITE
     122                    RTMsgError("Error parsing command line: %Rrc\n", rc);
     123#else
     124                    rtNoCrtFatalMsgWithRc(RT_STR_TUPLE("Error parsing command line: "), rc);
     125#endif
    121126            }
    122127            else
    123                 rcExit = RTMsgErrorExitFailure("Failed to convert command line to UTF-8: %Rrc\n", rc);
     128#ifdef IPRT_NOCRT_WITHOUT_FATAL_WRITE
     129                RTMsgError("Failed to convert command line to UTF-8: %Rrc\n", rc);
     130#else
     131                rtNoCrtFatalMsgWithRc(RT_STR_TUPLE("Failed to convert command line to UTF-8: "), rc);
     132#endif
    124133        }
    125134        else
    126             rcExit = RTMsgErrorExitFailure("No command line\n");
     135#ifdef IPRT_NOCRT_WITHOUT_FATAL_WRITE
     136            RTMsgError("No command line\n");
     137#else
     138            rtNoCrtFatalMsg(RT_STR_TUPLE("No command line\r\n"));
     139#endif
    127140        rtTerminateProcess(rcExit, true /*fDoAtExit*/);
    128141    }
     
    130143    else
    131144    {
     145# ifdef IPRT_NOCRT_WITHOUT_FATAL_WRITE
    132146        RTMsgError("A C static initializor failed (%d)\n", rcExit);
     147# else
     148        rtNoCrtFatalWriteBegin(RT_STR_TUPLE("A C static initializor failed ("));
     149        rtNoCrtFatalWriteWinRc(rcExit);
     150        rtNoCrtFatalWriteEnd(RT_STR_TUPLE("\r\n"));
     151# endif
    133152        rtTerminateProcess(rcExit, false /*fDoAtExit*/);
    134153    }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette