VirtualBox

Changeset 38636 in vbox


Ignore:
Timestamp:
Sep 5, 2011 1:49:45 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
73843
Message:

*,IPRT: Redid the ring-3 init to always convert the arguments to UTF-8.

Location:
trunk
Files:
147 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/initterm.h

    r36508 r38636  
    4141
    4242#ifdef IN_RING3
     43/** @name RTR3Init flags (RTR3INIT_XXX).
     44 * @{ */
     45/** Try initialize SUPLib. */
     46#define RTR3INIT_FLAGS_SUPLIB       RT_BIT(0)
     47/** Initializing IPRT from a DLL. */
     48#define RTR3INIT_FLAGS_DLL          RT_BIT(1)
     49/** @} */
     50
     51/** @name RTR3InitEx version
     52 * @{ */
     53/** Version 1. */
     54#define RTR3INIT_VER_1              UINT32_C(1)
     55/** The current version. */
     56#define RTR3INIT_VER_CUR            RTR3INIT_VER_1
     57/** @} */
     58
    4359/**
    4460 * Initializes the runtime library.
    4561 *
    4662 * @returns iprt status code.
    47  */
    48 RTR3DECL(int) RTR3Init(void);
    49 
    50 
    51 /**
    52  * Initializes the runtime library and try initialize SUPLib too.
    53  *
    54  * @returns IPRT status code.
    55  *
    56  * @remarks Failure to initialize SUPLib is ignored.
    57  */
    58 RTR3DECL(int) RTR3InitAndSUPLib(void);
    59 
    60 /**
    61  * Initializes the runtime library passing it the program path.
    62  *
    63  * @returns IPRT status code.
    64  * @param   pszProgramPath      The path to the program file.
    65  */
    66 RTR3DECL(int) RTR3InitWithProgramPath(const char *pszProgramPath);
    67 
    68 /**
    69  * Initializes the runtime library passing it the program path,
    70  * and try initialize SUPLib too (failures ignored).
    71  *
    72  * @returns IPRT status code.
    73  * @param   pszProgramPath      The path to the program file.
    74  *
    75  * @remarks Failure to initialize SUPLib is ignored.
    76  */
    77 RTR3DECL(int) RTR3InitAndSUPLibWithProgramPath(const char *pszProgramPath);
     63 * @param   fFlags          Flags, see RTR3INIT_XXX.
     64 */
     65RTR3DECL(int) RTR3InitExeNoArguments(uint32_t fFlags);
     66
     67/**
     68 * Initializes the runtime library.
     69 *
     70 * @returns iprt status code.
     71 * @param   cArgs           Pointer to the argument count.
     72 * @param   ppapszArgs      Pointer to the argument vector pointer.
     73 * @param   fFlags          Flags, see RTR3INIT_XXX.
     74 */
     75RTR3DECL(int) RTR3InitExe(int cArgs, char ***papszArgs, uint32_t fFlags);
     76
     77/**
     78 * Initializes the runtime library.
     79 *
     80 * @returns iprt status code.
     81 * @param   fFlags          Flags, see RTR3INIT_XXX.
     82 */
     83RTR3DECL(int) RTR3InitDll(uint32_t fFlags);
    7884
    7985/**
     
    8490 * @returns IPRT status code.
    8591 * @param   iVersion        The interface version. Must be 0 atm.
    86  * @param   pszProgramPath  The program path. Pass NULL if we're to figure it out ourselves.
    87  * @param   fInitSUPLib     Whether to initialize the support library or not.
    88  */
    89 RTR3DECL(int) RTR3InitEx(uint32_t iVersion, const char *pszProgramPath, bool fInitSUPLib);
     92 * @param   fFlags          Flags, see RTR3INIT_XXX.
     93 * @param   cArgs           Pointer to the argument count.
     94 * @param   ppapszArgs      Pointer to the argument vector pointer. NULL
     95 *                          allowed if @a cArgs is 0.
     96 * @param   pszProgramPath  The program path.  Pass NULL if we're to figure it
     97 *                          out ourselves.
     98 */
     99RTR3DECL(int) RTR3InitEx(uint32_t iVersion, uint32_t fFlags, int cArgs, char ***papszArgs, const char *pszProgramPath);
    90100
    91101/**
  • trunk/include/iprt/mangling.h

    r38581 r38636  
    980980# define RTR0Term                                       RT_MANGLER(RTR0Term)                   /* r0drv */
    981981# define RTR0TermForced                                 RT_MANGLER(RTR0TermForced)             /* r0drv */
    982 # define RTR3Init                                       RT_MANGLER(RTR3Init)
    983 # define RTR3InitAndSUPLib                              RT_MANGLER(RTR3InitAndSUPLib)
    984 # define RTR3InitAndSUPLibWithProgramPath               RT_MANGLER(RTR3InitAndSUPLibWithProgramPath)
     982# define RTR3InitDll                                    RT_MANGLER(RTR3InitDll)
     983# define RTR3InitExe                                    RT_MANGLER(RTR3InitExe)
     984# define RTR3InitExeNoArguments                         RT_MANGLER(RTR3InitExeNoArguments)
    985985# define RTR3InitEx                                     RT_MANGLER(RTR3InitEx)
    986 # define RTR3InitWithProgramPath                        RT_MANGLER(RTR3InitWithProgramPath)
    987986# define rtR3MemAlloc                                   RT_MANGLER(rtR3MemAlloc)
    988987# define rtR3MemFree                                    RT_MANGLER(rtR3MemFree)
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp

    r38565 r38636  
    28312831            vboxVDbgVEHandlerRegister();
    28322832#endif
    2833             int rc = RTR3Init();
     2833            int rc = RTR3InitDll(0);
    28342834            AssertRC(rc);
    28352835            if (RT_SUCCESS(rc))
  • trunk/src/VBox/Additions/WINNT/SharedFolders/redirector/dll/dllmain.cpp

    r31634 r38636  
    3737    case DLL_PROCESS_ATTACH:
    3838
    39         RTR3Init();
     39        RTR3InitDll(0);
    4040        VbglR3Init();
    4141        LogRel(("VBOXNP: DLL loaded.\n"));
  • trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProv.cpp

    r36454 r38636  
    3030    LONG l = DllAddRef();
    3131
    32     int rc = RTR3Init(); /* Never terminate the runtime! */
     32    int rc = RTR3InitDll(0); /* Never terminate the runtime! */
    3333    if (RT_FAILURE(rc))
    3434        LogRel(("VBoxCredProv: Could not init runtime! rc = %Rrc\n", rc));
  • trunk/src/VBox/Additions/WINNT/VBoxGINA/VBoxGINA.cpp

    r38313 r38636  
    7878        case DLL_PROCESS_ATTACH:
    7979        {
    80             RTR3Init();
     80            RTR3InitDll();
    8181            VbglR3Init();
    8282            LogRel(("VBoxGINA: DLL loaded.\n"));
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.cpp

    r37423 r38636  
    680680    LogRel(("VBoxTray: %s r%s\n", RTBldCfgVersion(), RTBldCfgRevisionStr()));
    681681
    682     int rc = RTR3Init();
     682    int rc = RTR3InitExeNoArguments(0);
    683683    if (RT_SUCCESS(rc))
    684684    {
  • trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp

    r33540 r38636  
    15421542    bool fOnlyInfo = false;
    15431543
    1544     rrc = RTR3Init();
     1544    rrc = RTR3InitExe(argc, &argv, 0);
    15451545    if (RT_FAILURE(rrc))
    15461546        return RTMsgInitFailure(rrc);
  • trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp

    r38633 r38636  
    597597     * Init globals and such.
    598598     */
    599     int rc = RTR3Init();
     599    int rc = RTR3InitExe(argc, &argv, 0);
    600600    if (RT_FAILURE(rc))
    601601        return RTMsgInitFailure(rc);
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp

    r38633 r38636  
    11851185
    11861186    /*
    1187      * The input is ASSUMED to be in the current process codeset (NT guarantees
    1188      * ACP, unixy systems doesn't guarantee anything).  This loop converts all
    1189      * the argv[*] strings to UTF-8, which is a tad ugly but who cares.
    1190      * (As a rule all strings in VirtualBox are UTF-8.)
    1191      */
    1192     for (int i = 0; i < argc; i++)
    1193     {
    1194         char *pszConverted;
    1195         int rc = RTStrCurrentCPToUtf8(&pszConverted, argv[i]);
    1196         if (RT_SUCCESS(rc))
    1197             argv[i] = pszConverted;
    1198         else
    1199         {
    1200             RTMsgError("Failed to convert argument %d to UTF-8, rc=%Rrc\n",
    1201                        i + 1, rc);
    1202 
    1203             /* Conversion was not possible,probably due to invalid characters.
    1204              * Keep in mind that we do RTStrFree on the whole array below. */
    1205             argv[i] = RTStrDup(argv[i]);
    1206         }
    1207     }
    1208 
    1209     /*
    12101187     * Invoke the handler.
    12111188     */
     
    12131190    *prcExit = pfnHandler(argc, argv);
    12141191
    1215     /*
    1216      * Free converted argument vector
    1217      */
    1218     for (int i = 0; i < argc; i++)
    1219     {
    1220         RTStrFree(argv[i]);
    1221         argv[i] = NULL;
    1222     }
    12231192    return true;
    1224 
    1225 }
    1226 
     1193}
     1194
  • trunk/src/VBox/Additions/common/VBoxService/testcase/tstUserInfo.cpp

    r32652 r38636  
    4141     * Init globals and such.
    4242     */
    43     RTR3Init();
     43    RTR3InitExeNoArguments(0);
    4444
    4545    int rc = VbglR3Init();
  • trunk/src/VBox/Additions/common/crOpenGL/load.c

    r38315 r38636  
    103103        devMode.dmSize = sizeof(DEVMODE);
    104104        EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devMode);
    105        
     105
    106106        if (devMode.dmPelsWidth!=window->dmPelsWidth || devMode.dmPelsHeight!=window->dmPelsHeight)
    107107        {
     
    327327    ASMAtomicWriteBool(&stub.bShutdownSyncThread, true);
    328328#endif
    329  
     329
    330330    //delete all created contexts
    331331    stubMakeCurrent( NULL, NULL);
     
    409409            /*Same issue as on linux, RTThreadWait exits before system thread is terminated, which leads
    410410             * to issues as our dll goes to be unloaded.
    411              *@todo 
     411             *@todo
    412412             *We usually call this function from DllMain which seems to be holding some lock and thus we have to
    413413             * kill thread via TerminateThread.
     
    653653        line[crStrlen(line) - 1] = 0; /* remove trailing newline */
    654654        if (crStrncmp(line, procName, procNameLen) == 0 &&
    655             (line[procNameLen] == ' ' || line[procNameLen] == '\t')) 
     655            (line[procNameLen] == ' ' || line[procNameLen] == '\t'))
    656656        {
    657657            crWarning("Using Chromium configuration for %s from %s",
     
    888888        if (pWindow->hVisibleRegion!=INVALID_HANDLE_VALUE)
    889889        {
    890             CombineRgn(hNewRgn, pWindow->hVisibleRegion, hNewRgn, 
     890            CombineRgn(hNewRgn, pWindow->hVisibleRegion, hNewRgn,
    891891                       pRegions->pRegions->fFlags.bAddHiddenRects ? RGN_DIFF:RGN_OR);
    892892
     
    11051105{
    11061106    /* Here is where we contact the mothership to find out what we're supposed
    1107      * to  be doing.  Networking code in a DLL initializer.  I sure hope this 
    1108      * works :) 
    1109      * 
     1107     * to  be doing.  Networking code in a DLL initializer.  I sure hope this
     1108     * works :)
     1109     *
    11101110     * HOW can I pass the mothership address to this if I already know it?
    11111111     */
    1112    
     1112
    11131113    CRConnection *conn = NULL;
    11141114    char response[1024];
     
    12001200    crSPUInitDispatchTable( &glim );
    12011201
    1202     /* This is unlikely to change -- We still want to initialize our dispatch 
     1202    /* This is unlikely to change -- We still want to initialize our dispatch
    12031203     * table with the functions of the first SPU in the chain. */
    12041204    stubInitSPUDispatch( stub.spu );
     
    12251225        int rc;
    12261226
    1227         RTR3Init();
     1227        RTR3InitDll(0);
    12281228
    12291229        if (!disable_sync)
     
    12581258}
    12591259
    1260 /* Sigh -- we can't do initialization at load time, since Windows forbids 
     1260/* Sigh -- we can't do initialization at load time, since Windows forbids
    12611261 * the loading of other libraries from DLLMain. */
    12621262
    12631263#ifdef LINUX
    1264 /* GCC crap 
     1264/* GCC crap
    12651265 *void (*stub_init_ptr)(void) __attribute__((section(".ctors"))) = __stubInit; */
    12661266#endif
     
    12751275    (void) lpvReserved;
    12761276
    1277     switch (fdwReason) 
     1277    switch (fdwReason)
    12781278    {
    12791279    case DLL_PROCESS_ATTACH:
  • trunk/src/VBox/Additions/common/pam/pam_vbox.cpp

    r38548 r38636  
    227227    RTAssertSetMayPanic(false);
    228228
    229     int rc = RTR3Init();
     229    int rc = RTR3InitDll(0);
    230230    if (RT_FAILURE(rc))
    231231    {
  • trunk/src/VBox/Additions/common/testcase/tstPageFusion.cpp

    r37955 r38636  
    2323#include <iprt/asm.h>
    2424#include <iprt/mem.h>
     25#include <iprt/messages.h>
    2526#include <iprt/stream.h>
    2627#include <iprt/string.h>
     
    349350int main(int argc, char **argv)
    350351{
    351     int rc = VINF_SUCCESS;
    352352    /*
    353353     * Init globals and such.
    354354     */
    355     RTR3Init();
     355    int rc = RTR3InitExe(argc, &argv, 0);
     356    if (RT_FAILURE(rc))
     357        return RTMsgInitFailure(rc);
    356358
    357359    /*
  • trunk/src/VBox/Additions/x11/VBoxClient/main.cpp

    r35617 r38636  
    3030#include <iprt/env.h>
    3131#include <iprt/initterm.h>
     32#include <iprt/message.h>
    3233#include <iprt/path.h>
    3334#include <iprt/param.h>
     
    159160int main(int argc, char *argv[])
    160161{
    161     int rcClipboard, rc;
     162    /* Initialise our runtime before all else. */
     163    int rc = RTR3InitExe(argc, &argv, 0);
     164    if (RT_FAILURE(rc))
     165        return RTMsgInitFailure(rc);
     166
     167    int rcClipboard;
    162168    const char *pszFileName = RTPathFilename(argv[0]);
    163169    bool fDaemonise = true;
     
    170176        pszFileName = "VBoxClient";
    171177
    172     /* Initialise our runtime before all else. */
    173     rc = RTR3Init();
    174     if (RT_FAILURE(rc))
    175     {
    176         /* Of course, this should never happen. */
    177         RTPrintf("%s: Failed to initialise the run-time library, rc=%Rrc\n", pszFileName, rc);
    178         exit(1);
    179     }
    180 
    181178    /* Initialise our global clean-up critical section */
    182179    rc = RTCritSectInit(&g_critSect);
     
    185182        /* Of course, this should never happen. */
    186183        RTPrintf("%s: Failed to initialise the global critical section, rc=%Rrc\n", pszFileName, rc);
    187         exit(1);
     184        return 1;
    188185    }
    189186
     
    225222        {
    226223            vboxClientUsage(pszFileName);
    227             exit(0);
     224            return 0;
    228225        }
    229226        else
     
    231228            RTPrintf("%s: unrecognized option `%s'\n", pszFileName, argv[i]);
    232229            RTPrintf("Try `%s --help' for more information\n", pszFileName);
    233             exit(1);
     230            return 1;
    234231        }
    235232    }
     
    237234    {
    238235        vboxClientUsage(pszFileName);
    239         exit(1);
     236        return 1;
    240237    }
    241238    /* Get the path for the pidfiles */
  • trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11-auto.cpp

    r37173 r38636  
    685685int main( int argc, char **argv)
    686686{
    687     RTR3Init();
     687    RTR3InitExe(argc, &argv, 0);
    688688    unsigned cErrs = 0;
    689689    g_pszTestName = RTPathFilename(argv[0]);
  • trunk/src/VBox/Additions/x11/VBoxClient/testcase/tstSeamlessX11.cpp

    r36808 r38636  
    107107    char ach[2];
    108108
    109     RTR3Init();
     109    RTR3InitExe(argc, &argv, 0);
    110110    RTPrintf("VirtualBox guest additions X11 seamless mode testcase\n");
    111111    if (0 == XInitThreads())
  • trunk/src/VBox/Debugger/testcase/tstVBoxDbg.cpp

    r35346 r38636  
    3939    int     cErrors = 0;                  /* error count. */
    4040
    41     RTR3InitAndSUPLib();
     41    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    4242    RTPrintf(TESTCASE ": TESTING...\n");
    4343
  • trunk/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp

    r36470 r38636  
    602602     * Init the runtime and parse the arguments.
    603603     */
    604     RTR3Init();
     604    RTR3InitExe(argc, &argv, 0);
    605605
    606606    static RTGETOPTDEF const s_aOptions[] =
  • trunk/src/VBox/Disassembler/testcase/tstDisasm-2.cpp

    r33540 r38636  
    805805int main(int argc, char **argv)
    806806{
    807     RTR3Init();
     807    RTR3InitExe(argc, &argv, 0);
    808808    const char * const argv0 = RTPathFilename(argv[0]);
    809809
  • trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp

    r37596 r38636  
    914914     * Before we do *anything*, we initialize the runtime.
    915915     */
    916     int rc = RTR3Init();
     916    int rc = RTR3InitExe(argc, &argv, 0);
    917917    if (RT_FAILURE(rc))
    918         return FatalError("RTR3Init failed rc=%Rrc\n", rc);
     918        return FatalError("RTR3InitExe failed rc=%Rrc\n", rc);
    919919
    920920    return TrustedMain(argc, argv, NULL);
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxBalloonCtrl.cpp

    r37103 r38636  
    12731273     * the support driver.
    12741274     */
    1275     int rc = RTR3Init();
     1275    int rc = RTR3InitExe(argc, &argv, 0);
    12761276    if (RT_FAILURE(rc))
    12771277        return RTMsgInitFailure(rc);
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r38626 r38636  
    13521352{
    13531353    // initialize VBox Runtime
    1354     int rc = RTR3InitAndSUPLib();
     1354    int rc = RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    13551355    if (RT_FAILURE(rc))
    13561356    {
  • trunk/src/VBox/Frontends/VBoxHeadless/testcase/tstHeadless.cpp

    r35521 r38636  
    4141{
    4242    // initialize VBox Runtime
    43     RTR3Init();
     43    RTR3InitExe(argc, &argv, 0);
    4444
    4545    // the below cannot be Bstr because on Linux Bstr doesn't work
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r38417 r38636  
    244244     * the support driver.
    245245     */
    246     RTR3Init();
     246    RTR3InitExe(argc, &argv, 0);
    247247
    248248    /*
     
    329329    if (FAILED(hrc))
    330330        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to initialize COM!");
    331 
    332     /*
    333      * The input is ASSUMED to be in the current process codeset (NT guarantees
    334      * ACP, unixy systems doesn't guarantee anything).  This loop converts all
    335      * the argv[*] strings to UTF-8, which is a tad ugly but who cares.
    336      * (As a rule all strings in VirtualBox are UTF-8.)
    337      */
    338     for (int i = iCmdArg; i < argc; i++)
    339     {
    340         char *pszConverted;
    341         int rc = RTStrCurrentCPToUtf8(&pszConverted, argv[i]);
    342         if (RT_SUCCESS(rc))
    343             argv[i] = pszConverted;
    344         else
    345             /* Conversion was not possible,probably due to invalid characters.
    346              * Keep in mind that we do RTStrFree on the whole array below. */
    347             argv[i] = RTStrDup(argv[i]);
    348     }
    349331
    350332    RTEXITCODE rcExit = RTEXITCODE_FAILURE;
     
    500482    com::Shutdown();
    501483
    502     /*
    503      * Free converted argument vector
    504      */
    505     for (int i = iCmdArg; i < argc; i++)
    506     {
    507         RTStrFree(argv[i]);
    508         argv[i] = NULL;
    509     }
    510 
    511484    return rcExit;
    512485#else  /* VBOX_ONLY_DOCS */
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r37525 r38636  
    6767#include <iprt/ldr.h>
    6868#include <iprt/initterm.h>
     69#include <iprt/message.h>
    6970#include <iprt/path.h>
    7071#include <iprt/process.h>
     
    29122913     * Before we do *anything*, we initialize the runtime.
    29132914     */
    2914     int rcRT = RTR3InitAndSUPLib();
    2915     if (RT_FAILURE(rcRT))
    2916     {
    2917         RTPrintf("Error: RTR3Init failed rcRC=%d\n", rcRT);
    2918         return 1;
    2919     }
     2915    int rc = RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
     2916    if (RT_FAILURE(rc))
     2917        return RTMsgInitFailure(rc);
    29202918    return TrustedMain(argc, argv, NULL);
    29212919}
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDLTest.cpp

    r37043 r38636  
    7171{
    7272    int rc;
    73     RTR3Init();
     73    RTR3InitExe(argc, &argv, 0);
    7474
    7575    for (int i = 1; i < argc; i++)
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r38476 r38636  
    568568    }
    569569
    570     int rc;
    571     if (!fInitSUPLib)
    572         rc = RTR3Init();
    573     else
    574         rc = RTR3InitAndSUPLib();
     570    int rc = RTR3InitExe(argc, &argv, fInitSUPLib ? RTR3INIT_FLAGS_SUPLIB : 0);
    575571    if (RT_FAILURE(rc))
    576572    {
  • trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/tstDarwinKeyboard.cpp

    r28800 r38636  
    3232int main(int argc, char **argv)
    3333{
    34     int rc = RTR3Init();
     34    int rc = RTR3InitExe(argc, &argv, 0);
    3535    AssertReleaseRCReturn(rc, 1);
    3636
  • trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h

    r37596 r38636  
    277277 *
    278278 * This is dynamically resolved and invoked by the static library before it
    279  * calls RTR3Init and thereby SUPR3Init.
     279 * calls RTR3InitEx and thereby SUPR3Init.
    280280 *
    281281 * @returns IPRT status code.
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp

    r38076 r38636  
    7979#include <VBox/err.h>
    8080#include <iprt/string.h>
     81#include <iprt/initterm.h>
    8182#include <iprt/param.h>
    8283
     
    110111*******************************************************************************/
    111112/** @see RTR3InitEx */
    112 typedef DECLCALLBACK(int) FNRTR3INITEX(uint32_t iVersion, const char *pszProgramPath, bool fInitSUPLib);
     113typedef DECLCALLBACK(int) FNRTR3INITEX(uint32_t iVersion, uint32_t fFlags, int cArgs,
     114                                       char **papszArgs, const char *pszProgramPath);
    113115typedef FNRTR3INITEX *PFNRTR3INITEX;
    114116
     
    826828/**
    827829 * Loads the VBoxRT DLL/SO/DYLIB, hands it the open driver,
    828  * and calls RTR3Init.
     830 * and calls RTR3InitEx.
    829831 *
    830832 * @param   fFlags      The SUPR3HardenedMain fFlags argument, passed to supR3PreInit.
     
    896898        pszExePath = g_szSupLibHardenedExePath;
    897899#endif
    898     rc = pfnRTInitEx(0, pszExePath, !(fFlags & SUPSECMAIN_FLAGS_DONT_OPEN_DEV));
     900    rc = pfnRTInitEx(RTR3INIT_VER_1,
     901                     fFlags & SUPSECMAIN_FLAGS_DONT_OPEN_DEV ? 0 : RTR3INIT_FLAGS_SUPLIB,
     902                     0 /*cArgs*/, NULL /*papszArgs*/, pszExePath);
    899903    if (RT_FAILURE(rc))
    900904        supR3HardenedFatalMsg("supR3HardenedMainInitRuntime", kSupInitOp_IPRT, rc,
    901                               "RTR3Init failed with rc=%d", rc);
     905                              "RTR3InitEx failed with rc=%d", rc);
    902906}
    903907
     
    10851089    /*
    10861090     * Load the IPRT, hand the SUPLib part the open driver and
    1087      * call RTR3Init.
     1091     * call RTR3InitEx.
    10881092     */
    10891093    supR3HardenedMainInitRuntime(fFlags);
  • trunk/src/VBox/HostDrivers/Support/testcase/SUPInstall.cpp

    r28800 r38636  
    3737int main(int argc, char **argv)
    3838{
    39     RTR3Init();
     39    RTR3InitExeNoArguments(0);
    4040    int rc = SUPR3Install();
    4141    if (RT_SUCCESS(rc))
  • trunk/src/VBox/HostDrivers/Support/testcase/SUPLoggerCtl.cpp

    r28800 r38636  
    5858int main(int argc, char **argv)
    5959{
    60     RTR3InitAndSUPLib();
     60    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    6161
    6262    /*
  • trunk/src/VBox/HostDrivers/Support/testcase/SUPUninstall.cpp

    r28800 r38636  
    3737int main(int argc, char **argv)
    3838{
    39     RTR3Init();
     39    RTR3InitExeNoArguments(0);
    4040    int rc = SUPR3Uninstall();
    4141    if (RT_SUCCESS(rc))
  • trunk/src/VBox/HostDrivers/Support/testcase/tstContiguous.cpp

    r28800 r38636  
    4242    int rcRet = 0;
    4343
    44     RTR3Init();
     44    RTR3InitExe(argc, &argv, 0);
    4545    rc = SUPR3Init(NULL);
    4646    RTPrintf("tstContiguous: SUPR3Init -> rc=%Rrc\n", rc);
  • trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp

    r33595 r38636  
    4343int main(int argc, char **argv)
    4444{
    45     RTR3Init();
     45    RTR3InitExe(argc, &argv, 0);
    4646
    4747    /*
  • trunk/src/VBox/HostDrivers/Support/testcase/tstGetPagingMode.cpp

    r28800 r38636  
    3838{
    3939    int rc;
    40     RTR3Init();
     40    RTR3InitExe(argc, &argv, 0);
    4141    rc = SUPR3Init(NULL);
    4242    if (RT_SUCCESS(rc))
  • trunk/src/VBox/HostDrivers/Support/testcase/tstInit.cpp

    r28800 r38636  
    3838{
    3939    int rc;
    40     RTR3Init();
     40    RTR3InitExe(argc, &argv, 0);
    4141    rc = SUPR3Init(NULL);
    4242    RTPrintf("tstInit: SUPR3Init -> rc=%d\n", rc);
  • trunk/src/VBox/HostDrivers/Support/testcase/tstInt.cpp

    r35346 r38636  
    7878     * Init.
    7979     */
    80     RTR3Init();
     80    RTR3InitExe(argc, &argv, 0);
    8181    PSUPDRVSESSION pSession;
    8282    rc = SUPR3Init(&pSession);
  • trunk/src/VBox/HostDrivers/Support/testcase/tstLow.cpp

    r28800 r38636  
    4242    int rcRet = 0;
    4343
    44     RTR3Init();
     44    RTR3InitExe(argc, &argv, 0);
    4545    RTPrintf("tstLow: TESTING...\n");
    4646
  • trunk/src/VBox/HostDrivers/Support/testcase/tstPage.cpp

    r28800 r38636  
    3939{
    4040    int cErrors = 0;
    41     int rc = 0;
    42     RTR3InitAndSUPLib();
    43     rc = SUPR3Init(NULL);
     41
     42    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
     43    int rc = SUPR3Init(NULL);
    4444    cErrors += rc != 0;
    4545    if (!rc)
  • trunk/src/VBox/HostDrivers/Support/testcase/tstPin.cpp

    r28800 r38636  
    4646    RTHCPHYS    HCPhys;
    4747
    48     RTR3InitAndSUPLib();
     48    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    4949    rc = SUPR3Init(NULL);
    5050    RTPrintf("SUPR3Init -> rc=%d\n", rc);
  • trunk/src/VBox/HostDrivers/Support/testcase/tstSupLoadModule.cpp

    r35188 r38636  
    4545     * Init.
    4646     */
    47     int rc = RTR3InitAndSUPLib();
     47    int rc = RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    4848    if (RT_FAILURE(rc))
    49     {
    50         RTMsgError("RTR3InitAndSUPLib failed with rc=%Rrc\n", rc);
    51         return 1;
    52     }
     49        return RTMsgInitFailure(rc);
    5350
    5451    /*
  • trunk/src/VBox/HostDrivers/Support/testcase/tstSupSem-Zombie.cpp

    r28800 r38636  
    9595     * Init.
    9696     */
    97     int rc = RTR3InitAndSUPLib();
     97    int rc = RTR3InitExeNoArguments(RTR3INIT_FLAGS_SUPLIB);
    9898    if (RT_FAILURE(rc))
    9999    {
    100         RTPrintf("tstSupSem-Zombie-Child: fatal error: RTR3InitAndSUPLib failed with rc=%Rrc\n", rc);
     100        RTPrintf("tstSupSem-Zombie-Child: fatal error: RTR3InitExeNoArguments failed with rc=%Rrc\n", rc);
    101101        return 1;
    102102    }
  • trunk/src/VBox/HostDrivers/Support/testcase/tstSupSem.cpp

    r33383 r38636  
    3434#include <iprt/err.h>
    3535#include <iprt/initterm.h>
     36#include <iprt/message.h>
    3637#include <iprt/stream.h>
    3738#include <iprt/test.h>
     
    7980     * Init.
    8081     */
    81     int rc = RTR3InitAndSUPLib();
     82    int rc = RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    8283    if (RT_FAILURE(rc))
    83     {
    84         RTPrintf("tstSupSem: fatal error: RTR3InitAndSUPLib failed with rc=%Rrc\n", rc);
    85         return 1;
    86     }
     84        return RTMsgInitFailure(rc);
    8785
    8886    if (argc == 2 && !strcmp(argv[1], "child"))
  • trunk/src/VBox/HostDrivers/Support/win/SUPSvc-win.cpp

    r33540 r38636  
    775775    RTEnvSet("VBOX_LOG_FLAGS", "unbuffered thread msprog");
    776776#endif
    777     int rc = RTR3Init();
     777    int rc = RTR3InitExe(argc, &argv, 0);
    778778    if (RT_FAILURE(rc))
    779779    {
    780         supSvcLogError("RTR3Init failed with rc=%Rrc", rc);
     780        supSvcLogError("RTR3InitExe failed with rc=%Rrc", rc);
    781781        return 1;
    782782    }
  • trunk/src/VBox/HostDrivers/VBoxUSB/darwin/testcase/tstOpenUSBDev.cpp

    r31898 r38636  
    168168int main(int argc, char **argv)
    169169{
    170     RTR3Init();
     170    RTR3InitExe(argc, &argv, 0);
    171171
    172172    /*
  • trunk/src/VBox/HostDrivers/VBoxUSB/testcase/tstUSBFilter.cpp

    r31898 r38636  
    7878{
    7979    unsigned cErrors = 0;
    80     RTR3Init();
     80    RTR3InitExeNoArguments(0);
    8181
    8282    /*
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/Install/USBInstall.cpp

    r36941 r38636  
    5959int __cdecl main(int argc, char **argv)
    6060{
    61     if (RTR3Init() != VINF_SUCCESS)
     61    if (RTR3InitExe(argc, &argv, 0) != VINF_SUCCESS)
    6262    {
    6363        printf("Could not init IPRT!\n");
  • trunk/src/VBox/HostDrivers/win/cfg/VBoxDrvCfg.cpp

    r36941 r38636  
    535535VBOXDRVCFG_DECL(HRESULT) VBoxDrvCfgInit()
    536536{
    537     int rc = RTR3Init();
     537    int rc = RTR3InitDll(0);
    538538    if (rc != VINF_SUCCESS)
    539539    {
  • trunk/src/VBox/HostServices/SharedClipboard/x11-clipboard.cpp

    r37472 r38636  
    509509    VBOXCLIPBOARDCLIENTDATA client;
    510510    unsigned cErrors = 0;
    511     int rc = RTR3Init();
     511    int rc = RTR3InitExeNoArguments(0);
    512512    RTPrintf(TEST_NAME ": TESTING\n");
    513513    AssertRCReturn(rc, 1);
  • trunk/src/VBox/ImageMounter/VBoxFUSE/VBoxFUSE.cpp

    r33540 r38636  
    14211421     * Initialize the runtime and VD.
    14221422     */
    1423     int rc = RTR3Init();
     1423    int rc = RTR3InitExe(argc, &argv, 0);
    14241424    if (RT_FAILURE(rc))
    14251425    {
    1426         RTStrmPrintf(g_pStdErr, "VBoxFUSE: RTR3Init failed, rc=%Rrc\n", rc);
     1426        RTStrmPrintf(g_pStdErr, "VBoxFUSE: RTR3InitExe failed, rc=%Rrc\n", rc);
    14271427        return 1;
    14281428    }
  • trunk/src/VBox/Installer/win/Stub/VBoxStub.cpp

    r37989 r38636  
    346346
    347347    /* Init IPRT. */
    348     int vrc = RTR3Init();
     348    int vrc = RTR3InitExe(argc, &argv, 0);
    349349    if (RT_FAILURE(vrc))
    350350        return vrc;
  • trunk/src/VBox/Main/src-client/win/dllmain.cpp

    r35368 r38636  
    4646
    4747        // idempotent, so doesn't harm, and needed for COM embedding scenario
    48         RTR3Init();
     48        RTR3InitDll(0);
    4949    }
    5050    else if (dwReason == DLL_PROCESS_DETACH)
  • trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp

    r36527 r38636  
    17461746     * Initialize IPRT and check that we're correctly installed.
    17471747     */
    1748     int rc = RTR3Init();
     1748    int rc = RTR3InitExe(argc, &argv, 0);
    17491749    if (RT_FAILURE(rc))
    17501750        return RTMsgInitFailure(rc);
     
    18851885    NOREF(hPrevInstance); NOREF(nShowCmd); NOREF(lpCmdLine);
    18861886
    1887     int rc = RTR3Init();
     1887    int rc = RTR3InitExeNoArguments(0);
    18881888    if (RT_FAILURE(rc))
    18891889        return RTMsgInitFailure(rc);
  • trunk/src/VBox/Main/src-server/darwin/iokit.cpp

    r33540 r38636  
    16831683int main(int argc, char **argv)
    16841684{
    1685     RTR3Init();
     1685    RTR3InitExe(argc, &argv, 0);
    16861686
    16871687    if (1)
  • trunk/src/VBox/Main/src-server/generic/OpenGLTestApp.cpp

    r36344 r38636  
    211211    int rc = 0;
    212212
    213     RTR3Init();
     213    RTR3InitExe(argc, &argv, 0);
    214214
    215215    if(argc < 2)
  • trunk/src/VBox/Main/src-server/win/svcmain.cpp

    r37683 r38636  
    159159    LPCTSTR lpCmdLine = GetCommandLine(); /* this line necessary for _ATL_MIN_CRT */
    160160
    161     /* Need to parse the command line before initializing the VBox runtime. */
     161    /*
     162     * Need to parse the command line before initializing the VBox runtime.
     163     */
    162164    TCHAR szTokens[] = _T("-/");
    163165    LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens);
     
    188190     * the support driver.
    189191     */
    190     RTR3Init();
     192    int    argc = __argc;
     193    char **argv = __argv;
     194    RTR3InitExe(argc, &argv, 0);
    191195
    192196    /* Note that all options are given lowercase/camel case/uppercase to
     
    233237
    234238    RTGETOPTSTATE   GetOptState;
    235     int vrc = RTGetOptInit(&GetOptState, __argc, __argv, &s_aOptions[0], RT_ELEMENTS(s_aOptions), 1, 0 /*fFlags*/);
     239    int vrc = RTGetOptInit(&GetOptState, argc, argv, &s_aOptions[0], RT_ELEMENTS(s_aOptions), 1, 0 /*fFlags*/);
    236240    AssertRC(vrc);
    237241
  • trunk/src/VBox/Main/src-server/xpcom/server.cpp

    r37666 r38636  
    789789     * the support driver
    790790     */
    791     RTR3Init();
     791    int vrc = RTR3InitExe(argc, &argv, 0);
     792    if (RT_FAILURE(vrc))
     793        return RTMsgInitFailure(vrc);
    792794
    793795    static const RTGETOPTDEF s_aOptions[] =
     
    811813
    812814    RTGETOPTSTATE   GetOptState;
    813     int vrc = RTGetOptInit(&GetOptState, argc, argv, &s_aOptions[0], RT_ELEMENTS(s_aOptions), 1, 0 /*fFlags*/);
     815    vrc = RTGetOptInit(&GetOptState, argc, argv, &s_aOptions[0], RT_ELEMENTS(s_aOptions), 1, 0 /*fFlags*/);
    814816    AssertRC(vrc);
    815817
  • trunk/src/VBox/Main/testcase/tstAPI.cpp

    r36128 r38636  
    201201     * the support driver.
    202202     */
    203     RTR3Init();
     203    RTR3InitExe(argc, &argv, 0);
    204204
    205205    HRESULT rc;
  • trunk/src/VBox/Main/testcase/tstCollector.cpp

    r35368 r38636  
    148148     * the support driver.
    149149     */
    150     int rc = RTR3Init();
    151     if (RT_FAILURE(rc))
    152     {
    153         RTPrintf("tstCollector: RTR3Init() -> %d\n", rc);
     150    int rc = RTR3InitExe(argc, &argv, 0);
     151    if (RT_FAILURE(rc))
     152    {
     153        RTPrintf("tstCollector: RTR3InitExe() -> %d\n", rc);
    154154        return 1;
    155155    }
  • trunk/src/VBox/Main/testcase/tstOVF.cpp

    r37862 r38636  
    282282int main(int argc, char *argv[])
    283283{
    284     RTR3Init();
     284    RTR3InitExe(argc, &argv, 0);
    285285
    286286    HRESULT rc = S_OK;
  • trunk/src/VBox/Main/webservice/vboxweb.cpp

    r37167 r38636  
    784784{
    785785    // initialize runtime
    786     int rc = RTR3Init();
     786    int rc = RTR3InitExe(argc, &argv, 0);
    787787    if (RT_FAILURE(rc))
    788788        return RTMsgInitFailure(rc);
  • trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp

    r36469 r38636  
    3131#include <iprt/getopt.h>
    3232#include <iprt/initterm.h>
     33#include <iprt/message.h>
    3334#include <iprt/param.h>
    3435#include <iprt/path.h>
     
    20382039int main(int argc, char **argv, char **envp)
    20392040{
    2040     int rc = RTR3InitAndSUPLib();
     2041    int rc = RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    20412042    if (RT_FAILURE(rc))
    2042     {
    2043         RTStrmPrintf(g_pStdErr, "VBoxNetDHCP: RTR3InitAndSupLib failed, rc=%Rrc\n", rc);
    2044         return 1;
    2045     }
     2043        return RTMsgInitFailure(rc);
    20462044
    20472045    return TrustedMain(argc, argv, envp);
  • trunk/src/VBox/NetworkServices/NAT/VBoxNetNAT.cpp

    r37596 r38636  
    3939#include <iprt/string.h>
    4040#include <iprt/mem.h>
     41#include <iprt/message.h>
    4142#include <iprt/req.h>
    4243#include <iprt/file.h>
     
    561562int main(int argc, char **argv, char **envp)
    562563{
    563     int rc = RTR3InitAndSUPLib();
     564    int rc = RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    564565    if (RT_FAILURE(rc))
    565     {
    566         RTStrmPrintf(g_pStdErr, "VBoxNetDHCP: RTR3InitAndSupLib failed, rc=%Rrc\n", rc);
    567         return 1;
    568     }
     566        return RTMsgInitFailure(rc);
    569567
    570568    return TrustedMain(argc, argv, envp);
  • trunk/src/VBox/Runtime/VBox/VBoxRTImp.def

    r35185 r38636  
    858858    RTProcWait
    859859    RTProcWaitNoResume
    860     RTR3Init
    861     RTR3InitAndSUPLib
    862     RTR3InitAndSUPLibWithProgramPath
     860    RTR3InitDll
     861    RTR3InitExe
     862    RTR3InitExeNoArguments
    863863    RTR3InitEx
    864     RTR3InitWithProgramPath
    865864    RTRandAdvBytes
    866865    RTRandAdvCreateParkMiller
  • trunk/src/VBox/Runtime/common/misc/thread.cpp

    r36951 r38636  
    107107 * All the RTTHREADINT structures are kept in a AVL tree which is protected by a
    108108 * read/write lock for efficient access. A thread is inserted into the tree in
    109  * three places in the code. The main thread is 'adopted' by IPRT on RTR3Init()
     109 * three places in the code. The main thread is 'adopted' by IPRT on rtR3Init()
    110110 * by rtThreadAdopt(). When creating a new thread there the child and the parent
    111111 * race inserting the thread, this is rtThreadMain() and RTThreadCreate.
     
    981981 * @param   hThread     The thread handle.
    982982 *
    983  * @remarks This function may not return the correct value when RTR3Init was
     983 * @remarks This function may not return the correct value when rtR3Init was
    984984 *          called on a thread of the than the main one.  This could for
    985985 *          instance happen when the DLL/DYLIB/SO containing IPRT is dynamically
  • trunk/src/VBox/Runtime/common/time/timeprog.cpp

    r28800 r38636  
    8080RTDECL(uint32_t)  RTTimeProgramSecTS(void)
    8181{
    82     AssertMsg(g_u64ProgramStartMilliTS, ("RTR3Init hasn't been called!\n"));
     82    AssertMsg(g_u64ProgramStartMilliTS, ("rtR3Init hasn't been called!\n"));
    8383    return (uint32_t)(RTTimeProgramMilliTS() / 1000);
    8484}
  • trunk/src/VBox/Runtime/generic/RTProcDaemonize-generic.cpp

    r33806 r38636  
    4646    /*
    4747     * Get the executable name.
    48      * If this asserts, it's probably because RTR3Init hasn't been called.
     48     * If this asserts, it's probably because rtR3Init hasn't been called.
    4949     */
    5050    char szExecPath[RTPATH_MAX];
  • trunk/src/VBox/Runtime/r3/init.cpp

    r36549 r38636  
    5353#include <iprt/err.h>
    5454#include <iprt/log.h>
     55#include <iprt/mem.h>
    5556#include <iprt/path.h>
    5657#include <iprt/time.h>
     
    7475*   Global Variables                                                           *
    7576*******************************************************************************/
    76 /** The number of calls to RTR3Init. */
     77/** The number of calls to RTR3Init*. */
    7778static int32_t volatile     g_cUsers = 0;
    7879/** Whether we're currently initializing the IPRT. */
     
    8990DECLHIDDEN(size_t)          g_offrtProcName;
    9091
     92/** The argument count of the program.  */
     93DECLHIDDEN(int)             g_crtArgs = -1;
     94/** The arguments of the program (UTF-8).  This is "leaked". */
     95DECLHIDDEN(char **)         g_papszrtArgs;
     96/** The original argument vector of the program. */
     97DECLHIDDEN(char **)         g_papszrtOrgArgs;
     98
    9199/**
    92100 * Program start nanosecond TS.
     
    222230
    223231
     232/**
     233 * Internal worker which initializes or re-initializes the
     234 * program path, name and directory globals.
     235 *
     236 * @returns IPRT status code.
     237 * @param   fFlags          Flags, see RTR3INIT_XXX.
     238 * @param   cArgs           Pointer to the argument count.
     239 * @param   ppapszArgs      Pointer to the argument vector pointer. NULL
     240 *                          allowed if @a cArgs is 0.
     241 */
     242static int rtR3InitArgv(uint32_t fFlags, int cArgs, char ***ppapszArgs)
     243{
     244    NOREF(fFlags);
     245    if (cArgs)
     246    {
     247        AssertPtr(ppapszArgs);
     248        AssertPtr(*ppapszArgs);
     249        char **papszOrgArgs = *ppapszArgs;
     250
     251        /*
     252         * Normally we should only be asked to convert arguments once.  If we
     253         * are though, it should be the already convered arguments.
     254         */
     255        if (g_crtArgs != -1)
     256        {
     257            AssertReturn(   g_crtArgs == cArgs
     258                         && g_papszrtArgs == papszOrgArgs,
     259                         VERR_WRONG_ORDER); /* only init once! */
     260            return VINF_SUCCESS;
     261        }
     262
     263        /*
     264         * Convert the arguments.
     265         */
     266        char **papszArgs = (char **)RTMemAllocZ((cArgs + 1) * sizeof(char *));
     267        if (!papszArgs)
     268            return VERR_NO_MEMORY;
     269
     270        for (int i = 0; i < cArgs; i++)
     271        {
     272            int rc = RTStrCurrentCPToUtf8(&papszArgs[i], papszOrgArgs[i]);
     273            if (RT_FAILURE(rc))
     274            {
     275                while (i--)
     276                    RTStrFree(papszArgs[i]);
     277                RTMemFree(papszArgs);
     278                return rc;
     279            }
     280        }
     281        papszArgs[cArgs] = NULL;
     282
     283        g_papszrtOrgArgs = papszOrgArgs;
     284        g_papszrtArgs    = papszArgs;
     285        g_crtArgs        = cArgs;
     286
     287        *ppapszArgs = papszArgs;
     288    }
     289
     290    return VINF_SUCCESS;
     291}
     292
     293
    224294#ifdef IPRT_USE_SIG_CHILD_DUMMY
    225295/**
     
    239309 * rtR3Init worker.
    240310 */
    241 static int rtR3InitBody(bool fInitSUPLib, const char *pszProgramPath)
     311static int rtR3InitBody(uint32_t fFlags, int cArgs, char ***papszArgs, const char *pszProgramPath)
    242312{
    243313    /*
     
    283353
    284354#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
    285     if (fInitSUPLib)
     355    if (fFlags & RTR3INIT_FLAGS_SUPLIB)
    286356    {
    287357        /*
     
    295365
    296366    /*
    297      * The executable path, name and directory.
     367     * The executable path, name and directory.  Convert arguments.
    298368     */
    299369    rc = rtR3InitProgramPath(pszProgramPath);
    300370    AssertLogRelMsgRCReturn(rc, ("Failed to get executable directory path, rc=%Rrc!\n", rc), rc);
    301371
     372    rc = rtR3InitArgv(fFlags, cArgs, papszArgs);
     373    AssertLogRelMsgRCReturn(rc, ("Failed to convert the arguments, rc=%Rrc!\n", rc), rc);
     374
    302375#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
    303376    /*
     
    305378     * needs some time to update itself updating.
    306379     */
    307     if (fInitSUPLib && g_pSUPGlobalInfoPage)
     380    if ((fFlags & RTR3INIT_FLAGS_SUPLIB) && g_pSUPGlobalInfoPage)
    308381    {
    309382        RTThreadSleep(20);
     
    386459 *
    387460 * @returns IPRT status code.
    388  * @param   fInitSUPLib     Whether to call SUPR3Init.
    389  * @param   pszProgramPath  The program path, NULL if not specified.
    390  */
    391 static int rtR3Init(bool fInitSUPLib, const char *pszProgramPath)
     461 * @param   fFlags          Flags, see RTR3INIT_XXX.
     462 * @param   cArgs           Pointer to the argument count.
     463 * @param   ppapszArgs      Pointer to the argument vector pointer. NULL
     464 *                          allowed if @a cArgs is 0.
     465 * @param   pszProgramPath  The program path.  Pass NULL if we're to figure it
     466 *                          out ourselves.
     467 */
     468static int rtR3Init(uint32_t fFlags, int cArgs, char ***papszArgs, const char *pszProgramPath)
    392469{
    393470    /* no entry log flow, because prefixes and thread may freak out. */
     471    Assert(!(fFlags & ~(RTR3INIT_FLAGS_DLL | RTR3INIT_FLAGS_SUPLIB)));
     472    Assert(!(fFlags & RTR3INIT_FLAGS_DLL) || cArgs == 0);
    394473
    395474    /*
    396475     * Do reference counting, only initialize the first time around.
    397476     *
    398      * We are ASSUMING that nobody will be able to race RTR3Init calls when the
     477     * We are ASSUMING that nobody will be able to race RTR3Init* calls when the
    399478     * first one, the real init, is running (second assertion).
    400479     */
     
    405484        Assert(!g_fInitializing);
    406485#if !defined(IN_GUEST) && !defined(RT_NO_GIP)
    407         if (fInitSUPLib)
     486        if (fFlags & RTR3INIT_FLAGS_SUPLIB)
    408487            SUPR3Init(NULL);
    409488#endif
    410489        if (!pszProgramPath)
    411490            return VINF_SUCCESS;
    412         return rtR3InitProgramPath(pszProgramPath);
     491
     492        int rc = rtR3InitProgramPath(pszProgramPath);
     493        if (RT_SUCCESS(rc))
     494            rc = rtR3InitArgv(fFlags, cArgs, papszArgs);
     495        return rc;
    413496    }
    414497    ASMAtomicWriteBool(&g_fInitializing, true);
     
    417500     * Do the initialization.
    418501     */
    419     int rc = rtR3InitBody(fInitSUPLib, pszProgramPath);
     502    int rc = rtR3InitBody(fFlags, cArgs, papszArgs, pszProgramPath);
    420503    if (RT_FAILURE(rc))
    421504    {
     
    427510
    428511    /* success */
    429     LogFlow(("RTR3Init: returns VINF_SUCCESS\n"));
     512    LogFlow(("rtR3Init: returns VINF_SUCCESS\n"));
    430513    ASMAtomicWriteBool(&g_fInitializing, false);
    431514    return VINF_SUCCESS;
     
    433516
    434517
    435 RTR3DECL(int) RTR3Init(void)
    436 {
    437     return rtR3Init(false /* fInitSUPLib */, NULL);
    438 }
    439 
    440 
    441 RTR3DECL(int) RTR3InitEx(uint32_t iVersion, const char *pszProgramPath, bool fInitSUPLib)
    442 {
    443     AssertReturn(iVersion == 0, VERR_NOT_SUPPORTED);
    444     return rtR3Init(fInitSUPLib, pszProgramPath);
    445 }
    446 
    447 
    448 RTR3DECL(int) RTR3InitWithProgramPath(const char *pszProgramPath)
    449 {
    450     return rtR3Init(false /* fInitSUPLib */, pszProgramPath);
    451 }
    452 
    453 
    454 RTR3DECL(int) RTR3InitAndSUPLib(void)
    455 {
    456     return rtR3Init(true /* fInitSUPLib */, NULL /* pszProgramPath */);
    457 }
    458 
    459 
    460 RTR3DECL(int) RTR3InitAndSUPLibWithProgramPath(const char *pszProgramPath)
    461 {
    462     return rtR3Init(true /* fInitSUPLib */, pszProgramPath);
     518RTR3DECL(int) RTR3InitExe(int cArgs, char ***papszArgs, uint32_t fFlags)
     519{
     520    Assert(!(fFlags & RTR3INIT_FLAGS_DLL));
     521    return rtR3Init(fFlags, cArgs, papszArgs, NULL);
     522}
     523
     524
     525RTR3DECL(int) RTR3InitExeNoArguments(uint32_t fFlags)
     526{
     527    Assert(!(fFlags & RTR3INIT_FLAGS_DLL));
     528    return rtR3Init(fFlags, 0, NULL, NULL);
     529}
     530
     531
     532RTR3DECL(int) RTR3InitDll(uint32_t fFlags)
     533{
     534    Assert(!(fFlags & RTR3INIT_FLAGS_DLL));
     535    return rtR3Init(fFlags | RTR3INIT_FLAGS_DLL, 0, NULL, NULL);
     536}
     537
     538
     539RTR3DECL(int) RTR3InitEx(uint32_t iVersion, uint32_t fFlags, int cArgs, char ***papszArgs, const char *pszProgramPath)
     540{
     541    AssertReturn(iVersion == RTR3INIT_VER_CUR, VERR_NOT_SUPPORTED);
     542    return rtR3Init(fFlags, cArgs, papszArgs, pszProgramPath);
    463543}
    464544
  • trunk/src/VBox/Runtime/r3/test.cpp

    r33540 r38636  
    371371RTR3DECL(RTEXITCODE) RTTestInitAndCreate(const char *pszTest, PRTTEST phTest)
    372372{
    373     int rc = RTR3Init();
     373    int rc = RTR3InitExeNoArguments(0);
    374374    if (RT_FAILURE(rc))
    375375    {
    376         RTStrmPrintf(g_pStdErr, "%s: fatal error: RTR3Init failed with rc=%Rrc\n", pszTest, rc);
     376        RTStrmPrintf(g_pStdErr, "%s: fatal error: RTR3InitExeNoArguments failed with rc=%Rrc\n", pszTest, rc);
    377377        return RTEXITCODE_INIT;
    378378    }
  • trunk/src/VBox/Runtime/testcase/tstDir-2.cpp

    r28800 r38636  
    3333{
    3434    int rcRet = 0;
    35     RTR3Init();
     35    RTR3InitExe(argc, &argv, 0);
    3636
    3737    /*
  • trunk/src/VBox/Runtime/testcase/tstDir-3.cpp

    r33464 r38636  
    8080    int rc;
    8181    unsigned cMatch;
    82     RTR3Init();
     82    RTR3InitExe(argc, &argv, 0);
    8383
    8484    const char *pszTestDir = ".";
  • trunk/src/VBox/Runtime/testcase/tstDir.cpp

    r28800 r38636  
    3535{
    3636    int rcRet = 0;
    37     RTR3Init();
     37    RTR3InitExe(argc, &argv, 0);
    3838
    3939    /*
  • trunk/src/VBox/Runtime/testcase/tstEnv.cpp

    r28800 r38636  
    3737int main()
    3838{
    39     RTR3Init();
     39    RTR3InitExeNoArguments(0);
    4040    RTPrintf("tstEnv: TESTING...\n");
    4141
  • trunk/src/VBox/Runtime/testcase/tstErrUnique.cpp

    r28800 r38636  
    6363{
    6464    int         cErrors = 0;
    65     RTR3Init();
     65    RTR3InitExeNoArguments(0);
    6666    RTPrintf("tstErrUnique: TESTING\n");
    6767
  • trunk/src/VBox/Runtime/testcase/tstFile.cpp

    r28800 r38636  
    4040    int         cErrors = 0;
    4141    RTPrintf("tstFile: TESTING\n");
    42     RTR3Init();
     42    RTR3InitExeNoArguments(0);
    4343
    4444    RTFILE    File;
  • trunk/src/VBox/Runtime/testcase/tstFileLock.cpp

    r28800 r38636  
    4848int main()
    4949{
    50     RTR3Init();
     50    RTR3InitExeNoArguments(0);
    5151    RTPrintf("tstFileLock: TESTING\n");
    5252
  • trunk/src/VBox/Runtime/testcase/tstHandleTable.cpp

    r28800 r38636  
    449449     * Init the runtime and parse the arguments.
    450450     */
    451     RTR3Init();
     451    RTR3InitExe(argc, &argv, 0);
    452452
    453453    static RTGETOPTDEF const s_aOptions[] =
  • trunk/src/VBox/Runtime/testcase/tstLdr-2.cpp

    r28800 r38636  
    173173int main(int argc, char **argv)
    174174{
    175     RTR3Init();
     175    RTR3InitExe(argc, &argv, 0);
    176176
    177177    int rcRet = 0;
  • trunk/src/VBox/Runtime/testcase/tstLdr-3.cpp

    r32878 r38636  
    166166int main(int argc, char **argv)
    167167{
    168     RTR3Init();
     168    RTR3InitExe(argc, &argv, 0);
    169169
    170170    int rcRet = 0;
  • trunk/src/VBox/Runtime/testcase/tstLdr-4.cpp

    r33269 r38636  
    217217{
    218218    int cErrors = 0;
    219     RTR3Init();
     219    RTR3InitExe(argc, &argv, 0);
    220220
    221221    /*
  • trunk/src/VBox/Runtime/testcase/tstLdr.cpp

    r33540 r38636  
    316316int main(int argc, char **argv)
    317317{
    318     RTR3Init();
     318    RTR3InitExe(argc, &argv, 0);
    319319
    320320    int rcRet = 0;
  • trunk/src/VBox/Runtime/testcase/tstLdrLoad.cpp

    r28800 r38636  
    3131#include <iprt/err.h>
    3232
    33 int main(int argc, const char * const *argv)
     33int main(int argc, char **argv)
    3434{
    3535    int rcRet = 0;
    36     RTR3Init();
     36    RTR3InitExe(argc, &argv, 0);
    3737
    3838    /*
  • trunk/src/VBox/Runtime/testcase/tstLog.cpp

    r28800 r38636  
    3636int main()
    3737{
    38     RTR3Init();
     38    RTR3InitExeNoArguments(0);
    3939    printf("tstLog: Requires manual inspection of the log output!\n");
    4040    RTLogPrintf("%%Rrc %d: %Rrc\n", VERR_INVALID_PARAMETER, VERR_INVALID_PARAMETER);
  • trunk/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp

    r36529 r38636  
    125125int main()
    126126{
    127     RTR3Init();
     127    RTR3InitExeNoArguments(0);
    128128    RTPrintf("tstMemAutoPtr: TESTING...\n");
    129129
  • trunk/src/VBox/Runtime/testcase/tstMove.cpp

    r28800 r38636  
    5555int main(int argc, char **argv)
    5656{
    57     RTR3Init();
     57    RTR3InitExe(argc, &argv, 0);
    5858
    5959    /*
  • trunk/src/VBox/Runtime/testcase/tstMp-1.cpp

    r33814 r38636  
    4444int main()
    4545{
    46     RTR3Init();
     46    RTR3InitExeNoArguments(0);
    4747    RTPrintf("tstMp-1: TESTING...\n");
    4848
  • trunk/src/VBox/Runtime/testcase/tstNoCrt-1.cpp

    r30320 r38636  
    119119     * Prologue.
    120120     */
    121     RTR3Init();
     121    RTR3InitExeNoArguments(0);
    122122    RTPrintf("tstNoCrt-1: TESTING...\n");
    123123
  • trunk/src/VBox/Runtime/testcase/tstOnce.cpp

    r28800 r38636  
    105105int main()
    106106{
    107     RTR3Init();
     107    RTR3InitExeNoArguments(0);
    108108
    109109    /*
  • trunk/src/VBox/Runtime/testcase/tstPrfRT.cpp

    r29250 r38636  
    101101    unsigned    i;
    102102
    103     RTR3Init();
     103    RTR3InitExeNoArguments(0);
    104104    RTPrintf("tstPrfRT: TESTING...\n");
    105105
  • trunk/src/VBox/Runtime/testcase/tstRTDigest.cpp

    r33806 r38636  
    6363int main(int argc, char **argv)
    6464{
    65      RTR3Init();
     65     RTR3InitExe(argc, &argv, 0);
    6666
    6767     enum
  • trunk/src/VBox/Runtime/testcase/tstRTFsQueries.cpp

    r30365 r38636  
    3636int main(int argc, char **argv)
    3737{
    38     RTR3Init();
     38    RTR3InitExe(argc, &argv, 0);
    3939
    4040    /*
  • trunk/src/VBox/Runtime/testcase/tstRTMemEf.cpp

    r36580 r38636  
    6060int main()
    6161{
    62     RTR3Init();
     62    RTR3InitExeNoArguments(0);
    6363    RTPrintf("tstRTMemEf: TESTING...\n");
    6464
  • trunk/src/VBox/Runtime/testcase/tstRTPipe.cpp

    r33806 r38636  
    5151static RTEXITCODE tstRTPipe5Child(const char *pszPipe)
    5252{
    53     int rc = RTR3Init();
     53    int rc = RTR3InitExeNoArguments(0);
    5454    if (RT_FAILURE(rc))
    5555        return RTMsgInitFailure(rc);
     
    128128static RTEXITCODE tstRTPipe4Child(const char *pszPipe)
    129129{
    130     int rc = RTR3Init();
     130    int rc = RTR3InitExeNoArguments(0);
    131131    if (RT_FAILURE(rc))
    132132        return RTMsgInitFailure(rc);
  • trunk/src/VBox/Runtime/testcase/tstRTProcCreateEx.cpp

    r33806 r38636  
    7474static int tstRTCreateProcEx5Child(int argc, char **argv)
    7575{
    76     int rc = RTR3Init();
     76    int rc = RTR3InitExeNoArguments(0);
    7777    if (rc)
    7878        return RTMsgInitFailure(rc);
     
    173173static int tstRTCreateProcEx4Child(int argc, char **argv)
    174174{
    175     int rc = RTR3Init();
     175    int rc = RTR3InitExeNoArguments(0);
    176176    if (rc)
    177177        return RTMsgInitFailure(rc);
     
    208208static int tstRTCreateProcEx3Child(void)
    209209{
    210     int rc = RTR3Init();
     210    int rc = RTR3InitExeNoArguments(0);
    211211    if (rc)
    212212        return RTMsgInitFailure(rc);
     
    278278static int tstRTCreateProcEx2Child(void)
    279279{
    280     int rc = RTR3Init();
     280    int rc = RTR3InitExeNoArguments(0);
    281281    if (rc)
    282282        return RTMsgInitFailure(rc);
     
    345345static int tstRTCreateProcEx1Child(void)
    346346{
    347     int rc = RTR3Init();
     347    int rc = RTR3InitExeNoArguments(0);
    348348    if (rc)
    349349        return RTMsgInitFailure(rc);
  • trunk/src/VBox/Runtime/testcase/tstRTProcIsRunningByName.cpp

    r33806 r38636  
    4242    int cErrors = 0;
    4343
    44     RTR3Init();
     44    RTR3InitExe(argc, &argv, 0);
    4545    RTPrintf("tstRTPRocIsRunningByName: TESTING...\n");
    4646
  • trunk/src/VBox/Runtime/testcase/tstRTProcWait.cpp

    r28800 r38636  
    5959int main(int argc, char **argv)
    6060{
    61     RTR3Init();
     61    RTR3InitExe(argc, &argv, 0);
    6262    if (argc == 2 && !strcmp(argv[1], "child"))
    6363        return 42;
  • trunk/src/VBox/Runtime/testcase/tstRand.cpp

    r28800 r38636  
    354354int main()
    355355{
    356     RTR3Init();
     356    RTR3InitExeNoArguments(0);
    357357    RTPrintf("tstRand: TESTING...\n");
    358358
  • trunk/src/VBox/Runtime/testcase/tstSemMutex.cpp

    r28800 r38636  
    204204int main(int argc, char **argv)
    205205{
    206     int rc = RTR3Init();
    207     if (RT_FAILURE(rc))
    208     {
    209         RTPrintf("tstSemMutex: RTR3Init failed (rc=%Rrc)\n", rc);
     206    int rc = RTR3InitExe(argc, &argv, 0);
     207    if (RT_FAILURE(rc))
     208    {
     209        RTPrintf("tstSemMutex: RTR3InitExe failed (rc=%Rrc)\n", rc);
    210210        return 1;
    211211    }
  • trunk/src/VBox/Runtime/testcase/tstSemPingPong.cpp

    r28800 r38636  
    8686int main()
    8787{
    88     RTR3Init();
     88    RTR3InitExeNoArguments(0);
    8989
    9090    /*
  • trunk/src/VBox/Runtime/testcase/tstStrToNum.cpp

    r28800 r38636  
    9292int main()
    9393{
    94     RTR3Init();
     94    RTR3InitExeNoArguments(0);
    9595
    9696    int cErrors = 0;
  • trunk/src/VBox/Runtime/testcase/tstTSC.cpp

    r33540 r38636  
    406406int main(int argc, char **argv)
    407407{
    408     RTR3Init();
     408    RTR3InitExe(argc, &argv, 0);
    409409
    410410    /*
  • trunk/src/VBox/Runtime/testcase/tstThread-1.cpp

    r28800 r38636  
    4848
    4949
    50 int main(int argc, const char * const *argv)
     50int main(int argc, char **argv)
    5151{
    52     RTR3Init();
     52    RTR3InitExe(argc, &argv, 0);
    5353
    5454    /*
  • trunk/src/VBox/Runtime/testcase/tstTime-2.cpp

    r29279 r38636  
    4040    unsigned cErrors = 0;
    4141    int i;
    42     RTR3InitAndSUPLib();
     42    RTR3InitExeNoArguments(RTR3INIT_FLAGS_SUPLIB);
    4343    RTPrintf("tstTime-2: TESTING...\n");
    4444
  • trunk/src/VBox/Runtime/testcase/tstTime-3.cpp

    r28800 r38636  
    6969int main(int argc, char **argv)
    7070{
    71     RTR3InitAndSUPLib();
     71    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    7272
    7373    if (argc <= 1)
  • trunk/src/VBox/Runtime/testcase/tstTime-4.cpp

    r28800 r38636  
    4040    unsigned cErrors = 0;
    4141
    42     RTR3InitAndSUPLib();
     42    RTR3InitExeNoArguments(RTR3INIT_FLAGS_SUPLIB);
    4343    RTPrintf("tstTime-4: TESTING...\n");
    4444
  • trunk/src/VBox/Runtime/testcase/tstTime.cpp

    r29279 r38636  
    3939    unsigned cErrors = 0;
    4040    int i;
    41     RTR3InitAndSUPLib();
     41
     42    RTR3InitExeNoArguments(RTR3INIT_FLAGS_SUPLIB);
    4243    RTPrintf("tstTime: TESTING...\n");
    4344
  • trunk/src/VBox/Runtime/testcase/tstTimer.cpp

    r32431 r38636  
    3232#include <iprt/thread.h>
    3333#include <iprt/initterm.h>
     34#include <iprt/message.h>
    3435#include <iprt/stream.h>
    3536#include <iprt/err.h>
     
    7677     */
    7778    unsigned cErrors = 0;
    78     int rc = RTR3Init();
     79    int rc = RTR3InitExeNoArguments(0);
    7980    if (RT_FAILURE(rc))
    80     {
    81         RTPrintf("tstTimer: RTR3Init() -> %d\n", rc);
    82         return 1;
    83     }
     81        return RTMsgInitFailure(rc);
    8482
    8583    /*
  • trunk/src/VBox/Runtime/testcase/tstTimerLR.cpp

    r28800 r38636  
    3232#include <iprt/thread.h>
    3333#include <iprt/initterm.h>
     34#include <iprt/message.h>
    3435#include <iprt/stream.h>
    3536#include <iprt/err.h>
     
    6869     */
    6970    unsigned cErrors = 0;
    70     int rc = RTR3Init();
     71    int rc = RTR3InitExeNoArguments(0);
    7172    if (RT_FAILURE(rc))
    72     {
    73         RTPrintf("tstTimer: RTR3Init() -> %d\n", rc);
    74         return 1;
    75     }
     73        return RTMsgInitFailure(rc);
    7674
    7775    /*
  • trunk/src/VBox/Runtime/tools/RTGzip.cpp

    r34464 r38636  
    208208int main(int argc, char **argv)
    209209{
    210     int rc = RTR3Init();
     210    int rc = RTR3InitExe(argc, &argv, 0);
    211211    if (RT_FAILURE(rc))
    212212        return RTMsgInitFailure(rc);
  • trunk/src/VBox/Runtime/tools/RTLdrFlt.cpp

    r38619 r38636  
    117117int main(int argc, char **argv)
    118118{
    119     int rc = RTR3Init();
     119    int rc = RTR3InitExe(argc, &argv, 0);
    120120    if (RT_FAILURE(rc))
    121121        return RTMsgInitFailure(rc);
  • trunk/src/VBox/Runtime/tools/RTManifest.cpp

    r34466 r38636  
    277277int main(int argc, char **argv)
    278278{
    279     int rc = RTR3Init();
     279    int rc = RTR3InitExe(argc, &argv, 0);
    280280    if (RT_FAILURE(rc))
    281281        return RTMsgInitFailure(rc);
  • trunk/src/VBox/Runtime/tools/RTTar.cpp

    r34464 r38636  
    3737int main(int argc, char **argv)
    3838{
    39     int rc = RTR3Init();
     39    int rc = RTR3InitExe(argc, &argv, 0);
    4040    if (RT_FAILURE(rc))
    4141        return RTMsgInitFailure(rc);
  • trunk/src/VBox/Storage/testcase/tstVD-2.cpp

    r38469 r38636  
    230230    int rc;
    231231
    232     RTR3Init();
     232    RTR3InitExe(argc, &argv, 0);
    233233    RTPrintf("tstVD-2: TESTING...\n");
    234234
  • trunk/src/VBox/Storage/testcase/tstVD.cpp

    r38469 r38636  
    843843int main(int argc, char *argv[])
    844844{
    845     RTR3Init();
     845    RTR3InitExe(argc, &argv, 0);
    846846    int rc;
    847847
  • trunk/src/VBox/Storage/testcase/tstVDCopy.cpp

    r38469 r38636  
    5151    int rc;
    5252
    53     RTR3Init();
     53    RTR3InitExe(argc, &argv, 0);
    5454
    5555    if (argc != 3)
  • trunk/src/VBox/Storage/testcase/tstVDIo.cpp

    r38621 r38636  
    31973197int main(int argc, char *argv[])
    31983198{
    3199     RTR3Init();
     3199    RTR3InitExe(argc, &argv, 0);
    32003200    int rc;
    32013201    RTGETOPTUNION ValueUnion;
  • trunk/src/VBox/Storage/testcase/tstVDShareable.cpp

    r38469 r38636  
    119119int main(int argc, char *argv[])
    120120{
    121     RTR3Init();
     121    RTR3InitExe(argc, &argv, 0);
    122122    int rc;
    123123
  • trunk/src/VBox/Storage/testcase/tstVDSnap.cpp

    r38469 r38636  
    378378int main(int argc, char *argv[])
    379379{
    380     RTR3Init();
     380    RTR3InitExe(argc, &argv, 0);
    381381    int rc;
    382382    VDSNAPTEST Test;
  • trunk/src/VBox/Storage/testcase/vbox-img.cpp

    r38469 r38636  
    10261026int main(int argc, char *argv[])
    10271027{
    1028     RTR3Init();
    1029     int rc;
    10301028    int exitcode = 0;
     1029
     1030    int rc = RTR3InitExe(argc, &argv, 0);
     1031    if (RT_FAILURE(rc))
     1032        return RTMsgInitFailure(rc);
    10311033
    10321034    g_pszProgName = RTPathFilename(argv[0]);
  • trunk/src/VBox/Storage/testcase/vditool.cpp

    r38352 r38636  
    379379    putenv((char*)"VBOX_LOG_FLAGS=");
    380380
    381     RTR3Init();
     381    RTR3InitExe(argc, &argv, 0);
    382382    RTPrintf("vditool -- for internal use only!\n"
    383383             "Copyright (c) 2009 Oracle Corporation\n\n");
  • trunk/src/VBox/VMM/testcase/tstAnimate.cpp

    r38324 r38636  
    615615    int rcRet = 1;
    616616    int rc;
    617     RTR3InitAndSUPLib();
     617    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    618618
    619619    /*
  • trunk/src/VBox/VMM/testcase/tstCFGM.cpp

    r35346 r38636  
    3939     * Init runtime.
    4040     */
    41     RTR3InitAndSUPLib();
     41    RTR3InitExeNoArguments(RTR3INIT_FLAGS_SUPLIB);
    4242
    4343    /*
  • trunk/src/VBox/VMM/testcase/tstCompiler.cpp

    r37955 r38636  
    225225int main()
    226226{
    227     int rc = RTR3Init();
     227    int rc = RTR3InitExeNoArguments(0);
    228228    if (RT_FAILURE(rc))
    229229        return RTMsgInitFailure(rc);
  • trunk/src/VBox/VMM/testcase/tstCompressionBenchmark.cpp

    r33550 r38636  
    233233int main(int argc, char **argv)
    234234{
    235     RTR3Init();
     235    RTR3InitExe(argc, &argv, 0);
    236236
    237237    /*
  • trunk/src/VBox/VMM/testcase/tstGlobalConfig.cpp

    r35346 r38636  
    4141int main(int argc, char **argv)
    4242{
    43     RTR3Init();
     43    RTR3InitExe(argc, &argv, 0);
    4444
    4545    /*
  • trunk/src/VBox/VMM/testcase/tstInstrEmul.cpp

    r35346 r38636  
    3636    int     rcRet = 0;                  /* error count. */
    3737
    38     RTR3Init();
     38    RTR3InitExe(argc, &argv, 0);
    3939    RTPrintf("tstInstrEmul: TESTING...\n");
    4040
  • trunk/src/VBox/VMM/testcase/tstMMHyperHeap.cpp

    r35346 r38636  
    4444     * Init runtime.
    4545     */
    46     RTR3Init();
     46    RTR3InitExe(argc, &argv, 0);
    4747
    4848    /*
  • trunk/src/VBox/VMM/testcase/tstMicro.cpp

    r35346 r38636  
    339339    int     rcRet = 0;                  /* error count. */
    340340
    341     RTR3InitAndSUPLib();
     341    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    342342
    343343    /*
  • trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletion.cpp

    r35346 r38636  
    7575{
    7676    int rcRet = 0; /* error count */
    77     int rc = VINF_SUCCESS;
    7877    PPDMASYNCCOMPLETIONENDPOINT pEndpointSrc, pEndpointDst;
    7978
    80     RTR3InitAndSUPLib();
     79    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    8180
    8281    if (argc != 3)
     
    8786
    8887    PVM pVM;
    89     rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM);
     88    int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM);
    9089    if (RT_SUCCESS(rc))
    9190    {
  • trunk/src/VBox/VMM/testcase/tstPDMAsyncCompletionStress.cpp

    r35346 r38636  
    570570{
    571571    int rcRet = 0; /* error count */
    572     int rc = VINF_SUCCESS;
    573 
    574     RTR3InitAndSUPLib();
     572
     573    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    575574
    576575    PVM pVM;
    577     rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM);
     576    int rc = VMR3Create(1, NULL, NULL, NULL, NULL, NULL, &pVM);
    578577    if (RT_SUCCESS(rc))
    579578    {
  • trunk/src/VBox/VMM/testcase/tstSSM.cpp

    r35346 r38636  
    680680     * Init runtime and static data.
    681681     */
    682     RTR3InitAndSUPLib();
     682    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    683683    RTPrintf("tstSSM: TESTING...\n");
    684684    initBigMem();
  • trunk/src/VBox/VMM/testcase/tstVMM-HwAccm.cpp

    r35346 r38636  
    6565    int     rcRet = 0;                  /* error count. */
    6666
    67     RTR3InitAndSUPLib();
     67    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    6868
    6969    /*
  • trunk/src/VBox/VMM/testcase/tstVMM.cpp

    r35346 r38636  
    3131#include <iprt/getopt.h>
    3232#include <iprt/initterm.h>
     33#include <iprt/message.h>
    3334#include <iprt/semaphore.h>
    3435#include <iprt/stream.h>
     
    180181     * Init runtime and the test environment.
    181182     */
    182     int rc = RTR3InitAndSUPLib();
     183    int rc = RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    183184    if (RT_FAILURE(rc))
    184     {
    185         RTPrintf("tstVMM: RTR3InitAndSUPLib failed: %Rrc\n", rc);
    186         return 1;
    187     }
     185        return RTMsgInitFailure(rc);
    188186    RTTEST hTest;
    189187    rc = RTTestCreate("tstVMM", &hTest);
  • trunk/src/VBox/VMM/testcase/tstVMMFork.cpp

    r35346 r38636  
    4949     * Initialize the runtime.
    5050     */
    51     RTR3InitAndSUPLib();
     51    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    5252
    5353#ifndef AUTO_TEST_ARGS
  • trunk/src/VBox/VMM/testcase/tstVMMR0CallHost-1.cpp

    r35346 r38636  
    145145    RTTEST hTest;
    146146    int rc;
    147     if (    RT_FAILURE(rc = RTR3Init())
     147    if (    RT_FAILURE(rc = RTR3InitExeNoArguments(0))
    148148        ||  RT_FAILURE(rc = RTTestCreate("tstVMMR0CallHost-1", &hTest)))
    149149    {
  • trunk/src/VBox/VMM/testcase/tstVMREQ.cpp

    r35346 r38636  
    208208int main(int argc, char **argv)
    209209{
    210     RTR3InitAndSUPLib();
     210    RTR3InitExe(argc, &argv, RTR3INIT_FLAGS_SUPLIB);
    211211    RTPrintf(TESTCASE ": TESTING...\n");
    212212
  • trunk/src/bldprogs/scm.cpp

    r35404 r38636  
    39733973int main(int argc, char **argv)
    39743974{
    3975     int rc = RTR3Init();
     3975    int rc = RTR3InitExe(argc, &argv, 0);
    39763976    if (RT_FAILURE(rc))
    39773977        return 1;
  • trunk/src/libs/xpcom18a4/ipc/ipcd/daemon/src/ipcdUnix.cpp

    r33044 r38636  
    474474#ifdef VBOX
    475475    /* Set up the runtime without loading the support driver. */
    476     RTR3Init();
     476    RTR3InitExe(argc, &argv, 0);
    477477#endif
    478478
  • trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcLog.cpp

    r11822 r38636  
    5252#undef PAGE_SIZE
    5353#endif
    54 #include <iprt/initterm.h> // for RTR3Init
     54#include <iprt/initterm.h> // for RTR3InitDll
    5555#else // !VBOX
    5656PRBool ipcLogEnabled = PR_FALSE;
     
    122122#ifdef VBOX
    123123    // initialize VBox Runtime
    124     RTR3Init();
     124    RTR3InitDll(0);
    125125
    126126    PL_strncpyz(ipcLogPrefix, prefix, sizeof(ipcLogPrefix));
  • trunk/src/libs/xpcom18a4/java/src/nsJavaInterfaces.cpp

    r31598 r38636  
    147147{
    148148#if defined(VBOX_PATH_APP_PRIVATE_ARCH) && defined(VBOX_PATH_SHARED_LIBS)
    149     rv = RTR3Init();
    150 #else
    151     const char *home  = nsnull;
     149    rv = RTR3InitDll(0);
     150#else
     151    const char *pszHome  = nsnull;
    152152    const char *jhome = nsnull;
    153153    jstring path = nsnull;
     
    164164    {
    165165        path = (jstring)env->CallObjectMethod(aVBoxBinDirectory, getPathMID);
    166         home = jhome = env->GetStringUTFChars(path, nsnull);
    167     }
    168 
    169     if (home == nsnull)
    170         home = getenv("VBOX_PROGRAM_PATH");
    171 
    172     if (home) {
    173       size_t len = strlen(home);
    174       char *exepath = (char *)alloca(len + 32);
    175       memcpy(exepath, home, len);
    176       memcpy(exepath + len, "/javafake", sizeof("/javafake"));
    177       rv = RTR3InitWithProgramPath(exepath);
     166        pszHome = jhome = env->GetStringUTFChars(path, nsnull);
     167    }
     168
     169    if (pszHome == nsnull)
     170        pszHome = getenv("VBOX_PROGRAM_PATH");
     171
     172    if (pszHome) {
     173      size_t cchHome = strlen(pszHome);
     174      char *pszExePath = (char *)alloca(cchHome + 32);
     175      memcpy(pszExePath, pszHome, cchHome);
     176      memcpy(pszExePath + cchHome, "/javafake", sizeof("/javafake"));
     177      rv = RTR3InitEx(RTR3INIT_VER_CUR, RTR3INIT_FLAGS_DLL, 0, NULL, pszExePath);
    178178    } else {
    179       rv = RTR3Init();
     179      rv = RTR3InitDll(0);
    180180    }
    181181
  • trunk/src/libs/xpcom18a4/java/tools/genifaces/GenerateJavaInterfaces.cpp

    r29179 r38636  
    874874#ifdef VBOX
    875875#if defined(VBOX_PATH_APP_PRIVATE_ARCH) && defined(VBOX_PATH_SHARED_LIBS)
    876     rv = RTR3Init();
     876  rv = RTR3InitExe(argc, &argv, 0);
    877877#else
    878     const char *home = getenv("VBOX_PROGRAM_PATH");
    879     if (home) {
    880       size_t len = strlen(home);
    881       char *exepath = (char *)alloca(len + 32);
    882       memcpy(exepath, home, len);
    883       memcpy(exepath + len, "/pythonfake", sizeof("/pythonfake"));
    884       rv = RTR3InitWithProgramPath(exepath);
    885     } else {
    886       rv = RTR3Init();
    887     }
     878  const char *pszHome = getenv("VBOX_PROGRAM_PATH");
     879  if (pszHome) {
     880    size_t cchHome = strlen(pszHome);
     881    char *pszExePath = (char *)alloca(cchHome + 32);
     882    memcpy(pszExePath, pszHome, cchHome);
     883    memcpy(pszExePath + cchHome, "/pythonfake", sizeof("/pythonfake"));
     884    rc = RTR3InitEx(RTR3INIT_VER_CUR, 0, argc, &argv, pszExePath);
     885  } else {
     886    rv = RTR3InitExe(argc, &argv, 0);
     887  }
    888888#endif
    889889#endif
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prlog.c

    r31259 r38636  
    5151
    5252#if defined(VBOX) && defined(DEBUG)
    53 # include <iprt/initterm.h> /* for RTR3Init */
     53# include <iprt/initterm.h> /* for RTR3InitDll */
    5454# include <iprt/log.h>
    5555#endif
     
    424424    if (strcmp(file, "IPRT") == 0) {
    425425        /* initialize VBox Runtime */
    426         RTR3Init();
     426        RTR3InitDll(0);
    427427        newLogFile = IPRT_DEBUG_FILE;
    428428    }
     
    465465    if (strcmp(file, "IPRT") == 0) {
    466466        /* initialize VBox Runtime */
    467         RTR3Init();
     467        RTR3InitDll(0);
    468468        logFile = IPRT_DEBUG_FILE;
    469469        return PR_TRUE;
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c

    r32971 r38636  
    177177    _pr_initialized = PR_TRUE;
    178178#ifdef VBOX_USE_IPRT_IN_NSPR
    179     RTR3Init();
     179    RTR3InitDll(0);
    180180#endif
    181181#ifdef _PR_ZONE_ALLOCATOR
  • trunk/src/libs/xpcom18a4/python/src/module/_xpcom.cpp

    r31604 r38636  
    781781
    782782#if defined(VBOX_PATH_APP_PRIVATE_ARCH) && defined(VBOX_PATH_SHARED_LIBS)
    783     rc = RTR3Init();
     783    rc = RTR3InitDll(0);
    784784#else
    785785    const char *home = getenv("VBOX_PROGRAM_PATH");
     
    789789      memcpy(exepath, home, len);
    790790      memcpy(exepath + len, "/pythonfake", sizeof("/pythonfake"));
    791       rc = RTR3InitWithProgramPath(exepath);
     791      rc = RTR3InitEx(RTR3INIT_VER_CUR, RTR3INIT_FLAGS_DLL, 0, NULL, exepath);
    792792    } else {
    793       rc = RTR3Init();
     793      rc = RTR3InitDll(0);
    794794    }
    795795#endif
  • trunk/src/testcase/tstRunTestcases.cpp

    r33540 r38636  
    284284int main(int argc, char **argv)
    285285{
    286     RTR3Init();
     286    RTR3InitExe(argc, &argv, 0);
    287287
    288288    if (argc == 1)
Note: See TracChangeset for help on using the changeset viewer.

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