VirtualBox

Changeset 19924 in vbox for trunk


Ignore:
Timestamp:
May 22, 2009 9:52:47 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
47626
Message:

IPRT,SUP: Renamed RTPathProgram to RTPathExecDir to make it clear what it returns. Renamed hardened version of it as well.

Location:
trunk
Files:
16 edited

Legend:

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

    r16516 r19924  
    346346
    347347/**
    348  * Gets the program path.
     348 * Gets the path to the directory containing the executable.
    349349 *
    350350 * @returns iprt status code.
     
    352352 * @param   cchPath     Buffer size in bytes.
    353353 */
    354 RTDECL(int) RTPathProgram(char *pszPath, size_t cchPath);
     354RTDECL(int) RTPathExecDir(char *pszPath, size_t cchPath);
    355355
    356356/**
     
    364364
    365365/**
    366  * Gets the directory of shared libraries. This is not the same as
    367  * RTPathAppPrivateArch() as Linux depends all shared libraries in
    368  * a common global directory where ld.so can found them.
     366 * Gets the directory of shared libraries.
     367 *
     368 * This is not the same as RTPathAppPrivateArch() as Linux depends all shared
     369 * libraries in a common global directory where ld.so can found them.
    369370 *
    370371 * Linux:    /usr/lib
    371372 * Windows:  @<program files directory@>/@<application@>
    372  * Old path: same as RTPathProgram()
     373 * Old path: same as RTPathExecDir()
    373374 *
    374375 * @returns iprt status code.
     
    384385 * Linux:    /usr/shared/@<application@>
    385386 * Windows:  @<program files directory@>/@<application@>
    386  * Old path: same as RTPathProgram()
     387 * Old path: same as RTPathExecDir()
    387388 *
    388389 * @returns iprt status code.
     
    398399 * Linux:    /usr/lib/@<application@>
    399400 * Windows:  @<program files directory@>/@<application@>
    400  * Old path: same as RTPathProgram()
     401 * Old path: same as RTPathExecDir()
    401402 *
    402403 * @returns iprt status code.
     
    411412 * Linux:    /usr/share/doc/@<application@>
    412413 * Windows:  @<program files directory@>/@<application@>
    413  * Old path: same as RTPathProgram()
     414 * Old path: same as RTPathExecDir()
    414415 *
    415416 * @returns iprt status code.
  • trunk/src/VBox/Devices/Network/testcase/tstIntNet-1.cpp

    r19454 r19924  
    846846
    847847    char szPath[RTPATH_MAX];
    848     rc = RTPathProgram(szPath, sizeof(szPath) - sizeof("/../VMMR0.r0"));
     848    rc = RTPathExecDir(szPath, sizeof(szPath) - sizeof("/../VMMR0.r0"));
    849849    if (RT_FAILURE(rc))
    850850    {
    851         RTPrintf("tstIntNet-1: RTPathProgram -> %Rrc\n", rc);
     851        RTPrintf("tstIntNet-1: RTPathExecDir -> %Rrc\n", rc);
    852852        return 1;
    853853    }
  • trunk/src/VBox/Frontends/VBoxFB/VBoxFB.cpp

    r19817 r19924  
    137137    // get the path to the executable
    138138    char appPath [RTPATH_MAX];
    139     RTPathProgram (appPath, RTPATH_MAX);
     139    RTPathExecDir (appPath, RTPATH_MAX);
    140140
    141141    nsCOMPtr<nsIFile> nsAppPath;
  • trunk/src/VBox/HostDrivers/Support/SUPLibInternal.h

    r19892 r19924  
    7979# define supR3HardenedPathSharedLibs       supR3HardenedStaticPathSharedLibs
    8080# define supR3HardenedPathAppDocs          supR3HardenedStaticPathAppDocs
    81 # define supR3HardenedPathProgram          supR3HardenedStaticPathProgram
     81# define supR3HardenedPathExecDir          supR3HardenedStaticPathExecDir
    8282# define supR3HardenedPathFilename         supR3HardenedStaticPathFilename
    8383# define supR3HardenedFatalV               supR3HardenedStaticFatalV
     
    274274/** @copydoc RTPathAppDocs */
    275275DECLHIDDEN(int)    supR3HardenedPathAppDocs(char *pszPath, size_t cchPath);
    276 /** @copydoc RTPathProgram */
    277 DECLHIDDEN(int)    supR3HardenedPathProgram(char *pszPath, size_t cchPath);
     276/** @copydoc RTPathExecDir */
     277DECLHIDDEN(int)    supR3HardenedPathExecDir(char *pszPath, size_t cchPath);
    278278/** @copydoc RTPathFilename */
    279279DECLHIDDEN(char *) supR3HardenedPathFilename(const char *pszPath);
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedIPRT.cpp

    r15352 r19924  
    9191
    9292/**
    93  * @copydoc RTPathProgram
     93 * @copydoc RTPathExecDir
    9494 */
    95 DECLHIDDEN(int) supR3HardenedPathProgram(char *pszPath, size_t cchPath)
     95DECLHIDDEN(int) supR3HardenedPathExecDir(char *pszPath, size_t cchPath)
    9696{
    97     return RTPathProgram(pszPath, cchPath);
     97    return RTPathExecDir(pszPath, cchPath);
    9898}
    9999
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp

    r18499 r19924  
    235235
    236236#else
    237     return supR3HardenedPathProgram(pszPath, cchPath);
     237    return supR3HardenedPathExecDir(pszPath, cchPath);
    238238#endif
    239239}
     
    255255
    256256#else
    257     return supR3HardenedPathProgram(pszPath, cchPath);
     257    return supR3HardenedPathExecDir(pszPath, cchPath);
    258258#endif
    259259}
     
    275275
    276276#else
    277     return supR3HardenedPathProgram(pszPath, cchPath);
     277    return supR3HardenedPathExecDir(pszPath, cchPath);
    278278#endif
    279279}
     
    295295
    296296#else
    297     return supR3HardenedPathProgram(pszPath, cchPath);
     297    return supR3HardenedPathExecDir(pszPath, cchPath);
    298298#endif
    299299}
     
    329329# endif
    330330    if (cchLink < 0 || cchLink == sizeof(g_szSupLibHardenedExePath) - 1)
    331         supR3HardenedFatal("supR3HardenedPathProgram: couldn't read \"%s\", errno=%d cchLink=%d\n",
     331        supR3HardenedFatal("supR3HardenedExecDir: couldn't read \"%s\", errno=%d cchLink=%d\n",
    332332                            g_szSupLibHardenedExePath, errno, cchLink);
    333333    g_szSupLibHardenedExePath[cchLink] = '\0';
     
    339339    const char *pszImageName = _dyld_get_image_name(0);
    340340    if (!pszImageName)
    341         supR3HardenedFatal("supR3HardenedPathProgram: _dyld_get_image_name(0) failed\n");
     341        supR3HardenedFatal("supR3HardenedExecDir: _dyld_get_image_name(0) failed\n");
    342342    size_t cchImageName = strlen(pszImageName);
    343343    if (!cchImageName || cchImageName >= sizeof(g_szSupLibHardenedExePath))
    344         supR3HardenedFatal("supR3HardenedPathProgram: _dyld_get_image_name(0) failed, cchImageName=%d\n", cchImageName);
     344        supR3HardenedFatal("supR3HardenedExecDir: _dyld_get_image_name(0) failed, cchImageName=%d\n", cchImageName);
    345345    memcpy(g_szSupLibHardenedExePath, pszImageName, cchImageName + 1);
    346346
     
    348348    HMODULE hExe = GetModuleHandle(NULL);
    349349    if (!GetModuleFileName(hExe, &g_szSupLibHardenedExePath[0], sizeof(g_szSupLibHardenedExePath)))
    350         supR3HardenedFatal("supR3HardenedPathProgram: GetModuleFileName failed, rc=%d\n", GetLastError());
     350        supR3HardenedFatal("supR3HardenedExecDir: GetModuleFileName failed, rc=%d\n", GetLastError());
    351351#else
    352352# error needs porting.
     
    381381
    382382/**
    383  * @copydoc RTPathProgram
    384  */
    385 DECLHIDDEN(int) supR3HardenedPathProgram(char *pszPath, size_t cchPath)
     383 * @copydoc RTPathExecDir
     384 */
     385DECLHIDDEN(int) supR3HardenedPathExecDir(char *pszPath, size_t cchPath)
    386386{
    387387    /*
     
    401401    }
    402402
    403     supR3HardenedFatal("supR3HardenedPathProgram: Buffer too small (%u < %u)\n", cchPath, cch);
     403    supR3HardenedFatal("supR3HardenedPathExecDir: Buffer too small (%u < %u)\n", cchPath, cch);
    404404    return VERR_BUFFER_OVERFLOW;
    405405}
  • trunk/src/VBox/HostDrivers/Support/SUPR3HardenedVerify.cpp

    r18154 r19924  
    216216        case kSupID_AppBin: /** @todo fix this AppBin crap (uncertain wtf some binaries actually are installed). */
    217217        case kSupID_Bin:
    218             rc = supR3HardenedPathProgram(pszDst, cchDst);
     218            rc = supR3HardenedPathExecDir(pszDst, cchDst);
    219219            break;
    220220        case kSupID_SharedLib:
     
    678678
    679679                char szFilename[RTPATH_MAX];
    680                 int rc2 = supR3HardenedPathProgram(szFilename, sizeof(szFilename) - cchProgName - sizeof(SUPLIB_EXE_SUFF));
     680                int rc2 = supR3HardenedPathExecDir(szFilename, sizeof(szFilename) - cchProgName - sizeof(SUPLIB_EXE_SUFF));
    681681                if (RT_SUCCESS(rc2))
    682682                {
  • trunk/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp

    r13865 r19924  
    182182    {
    183183        char szDriver[RTPATH_MAX];
    184         int rc = RTPathProgram(szDriver, sizeof(szDriver) - sizeof("\\VBoxDrv.sys"));
     184        int rc = RTPathExecDir(szDriver, sizeof(szDriver) - sizeof("\\VBoxDrv.sys"));
    185185        if (RT_SUCCESS(rc))
    186186        {
     
    333333        {
    334334            char szDriver[RTPATH_MAX];
    335             int rc = RTPathProgram(szDriver, sizeof(szDriver) - sizeof("\\VBoxDrv.sys"));
     335            int rc = RTPathExecDir(szDriver, sizeof(szDriver) - sizeof("\\VBoxDrv.sys"));
    336336            if (RT_SUCCESS(rc))
    337337            {
  • trunk/src/VBox/Main/generic/NetIf-generic.cpp

    r19433 r19924  
    4343
    4444    char szAdpCtl[RTPATH_MAX];
    45     int rc = RTPathProgram(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME));
     45    int rc = RTPathExecDir(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME));
    4646    if (RT_FAILURE(rc))
    4747    {
     
    151151
    152152            char szAdpCtl[RTPATH_MAX];
    153             int rc = RTPathProgram(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME " add"));
     153            int rc = RTPathExecDir(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME " add"));
    154154            if (RT_FAILURE(rc))
    155155            {
  • trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp

    r19454 r19924  
    872872
    873873    char szPath[RTPATH_MAX];
    874     rc = RTPathProgram(szPath, sizeof(szPath) - sizeof("/VMMR0.r0"));
     874    rc = RTPathExecDir(szPath, sizeof(szPath) - sizeof("/VMMR0.r0"));
    875875    if (RT_FAILURE(rc))
    876876    {
  • trunk/src/VBox/Runtime/r3/init.cpp

    r18997 r19924  
    7878
    7979/** The process path.
    80  * This is used by RTPathProgram and RTProcGetExecutableName and set by rtProcInitName. */
     80 * This is used by RTPathExecDir and RTProcGetExecutableName and set by rtProcInitName. */
    8181char        g_szrtProcExePath[RTPATH_MAX];
    8282/** The length of g_szrtProcExePath. */
  • trunk/src/VBox/Runtime/r3/path.cpp

    r16516 r19924  
    666666#ifndef RT_MINI
    667667
    668 RTDECL(int) RTPathProgram(char *pszPath, size_t cchPath)
     668RTDECL(int) RTPathExecDir(char *pszPath, size_t cchPath)
    669669{
    670670    AssertReturn(g_szrtProcExePath[0], VERR_WRONG_ORDER);
     
    692692 * Linux:    /usr/shared/@<application@>
    693693 * Windows:  @<program files directory@>/@<application@>
    694  * Old path: same as RTPathProgram()
     694 * Old path: same as RTPathExecDir()
    695695 *
    696696 */
     
    712712    return rc;
    713713#else
    714     return RTPathProgram(pszPath, cchPath);
     714    return RTPathExecDir(pszPath, cchPath);
    715715#endif
    716716}
     
    723723 * Linux:    /usr/lib/@<application@>
    724724 * Windows:  @<program files directory@>/@<application@>
    725  * Old path: same as RTPathProgram()
     725 * Old path: same as RTPathExecDir()
    726726 *
    727727 * @returns iprt status code.
     
    746746    return rc;
    747747#else
    748     return RTPathProgram(pszPath, cchPath);
     748    return RTPathExecDir(pszPath, cchPath);
    749749#endif
    750750}
     
    758758 * Linux:    /usr/lib
    759759 * Windows:  @<program files directory@>/@<application@>
    760  * Old path: same as RTPathProgram()
     760 * Old path: same as RTPathExecDir()
    761761 *
    762762 * @returns iprt status code.
     
    781781    return rc;
    782782#else
    783     return RTPathProgram(pszPath, cchPath);
     783    return RTPathExecDir(pszPath, cchPath);
    784784#endif
    785785}
     
    791791 * Linux:    /usr/share/doc/@<application@>
    792792 * Windows:  @<program files directory@>/@<application@>
    793  * Old path: same as RTPathProgram()
     793 * Old path: same as RTPathExecDir()
    794794 *
    795795 * @returns iprt status code.
     
    814814    return rc;
    815815#else
    816     return RTPathProgram(pszPath, cchPath);
     816    return RTPathExecDir(pszPath, cchPath);
    817817#endif
    818818}
  • trunk/src/VBox/Runtime/testcase/tstLdr-4.cpp

    r19308 r19924  
    236236     */
    237237    char szPath[RTPATH_MAX];
    238     rc = RTPathProgram(szPath, sizeof(szPath) - sizeof("/tstLdrObjR0.r0"));
     238    rc = RTPathExecDir(szPath, sizeof(szPath) - sizeof("/tstLdrObjR0.r0"));
    239239    if (RT_SUCCESS(rc))
    240240    {
     
    245245    else
    246246    {
    247         RTPrintf("tstLdr-4: RTPathProgram -> %Rrc\n", rc);
     247        RTPrintf("tstLdr-4: RTPathExecDir -> %Rrc\n", rc);
    248248        cErrors++;
    249249    }
  • trunk/src/VBox/Runtime/testcase/tstPath.cpp

    r15813 r19924  
    6363
    6464    /*
    65      * RTPathProgram, RTPathUserHome and RTProcGetExecutableName.
     65     * RTPathExecDir, RTPathUserHome and RTProcGetExecutableName.
    6666     */
    6767    char szPath[RTPATH_MAX];
    68     CHECK_RC(RTPathProgram(szPath, sizeof(szPath)));
     68    CHECK_RC(RTPathExecDir(szPath, sizeof(szPath)));
    6969    if (RT_SUCCESS(rc))
    70         RTPrintf("Program={%s}\n", szPath);
     70        RTPrintf("ExecDir={%s}\n", szPath);
    7171    CHECK_RC(RTPathUserHome(szPath, sizeof(szPath)));
    7272    if (RT_SUCCESS(rc))
  • trunk/src/VBox/VMM/PDMLdr.cpp

    r19015 r19924  
    978978    if (!RT_SUCCESS(rc))
    979979    {
    980         AssertMsgFailed(("RTPathProgram(,%d) failed rc=%d!\n", sizeof(szPath), rc));
     980        AssertMsgFailed(("RTPath[SharedLibs|AppPrivateArch](,%d) failed rc=%d!\n", sizeof(szPath), rc));
    981981        return NULL;
    982982    }
  • trunk/src/testcase/tstRunTestcases.cpp

    r14831 r19924  
    264264    {
    265265        char szPath[RTPATH_MAX];
    266         int rc = RTPathProgram(szPath, sizeof(szPath) - sizeof("/.."));
     266        int rc = RTPathExecDir(szPath, sizeof(szPath) - sizeof("/.."));
    267267        if (RT_FAILURE(rc))
    268268        {
    269             RTPrintf("fatal error: RTPathProgram -> %Rrc\n", rc);
     269            RTPrintf("fatal error: RTPathExecDir -> %Rrc\n", rc);
    270270            return 1;
    271271        }
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