VirtualBox

Changeset 38636 in vbox for trunk/src/VBox/Additions


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/src/VBox/Additions
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • 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())
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