Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

int kldrDyldFindInit ( void   ) 

Initializes the find paths.

Returns:
0 on success, non-zero on failure.

Definition at line 228 of file kLdrDyldFind.c.

References kLdrDyldDefPrefix, kLdrDyldDefSuffix, kLdrDyldLibraryPath, kLdrDyldOS2BeginLibpath, kLdrDyldOS2EndLibpath, kLdrDyldOS2Libpath, kLdrDyldOS2LibpathStrict, kLdrDyldUnixLibraryPath, kLdrDyldWindowsDir, kLdrDyldWindowsPath, kLdrDyldWindowsSystemDir, and KSIZE.

Referenced by kldrDyldInit().

{
    KSIZE   cch;
    int     rc;
    char    szTmp[sizeof(kLdrDyldDefSuffix)];

    /*
     * The kLdr search parameters.
     */
    rc = kHlpGetEnv("KLDR_LIBRARY_PATH", kLdrDyldLibraryPath, sizeof(kLdrDyldLibraryPath));
    rc = kHlpGetEnv("KLDR_DEF_PREFIX", szTmp, sizeof(szTmp));
    if (!rc)
        kHlpMemCopy(kLdrDyldDefPrefix, szTmp, sizeof(szTmp));
    rc = kHlpGetEnv("KLDR_DEF_SUFFIX", szTmp, sizeof(szTmp));
    if (!rc)
        kHlpMemCopy(kLdrDyldDefSuffix, szTmp, sizeof(szTmp));

    /*
     * The OS/2 search parameters.
     */
#if K_OS == K_OS_OS2
    rc = DosQueryHeaderInfo(NULLHANDLE, 0, kLdrDyldOS2Libpath, sizeof(kLdrDyldOS2Libpath), QHINF_LIBPATH);
    if (rc)
        return rc;
    rc = DosQueryExtLIBPATH((PSZ)kLdrDyldOS2LibpathStrict, LIBPATHSTRICT);
    if (rc)
        kLdrDyldOS2LibpathStrict[0] = '\0';
    rc = DosQueryExtLIBPATH((PSZ)kLdrDyldOS2BeginLibpath, BEGIN_LIBPATH);
    if (rc)
        kLdrDyldOS2BeginLibpath[0] = '\0';
    rc = DosQueryExtLIBPATH((PSZ)kLdrDyldOS2EndLibpath, END_LIBPATH);
    if (rc)
        kLdrDyldOS2EndLibpath[0] = '\0';

#else
    kHlpGetEnv("KLDR_OS2_LIBPATH", kLdrDyldOS2Libpath, sizeof(kLdrDyldOS2Libpath));
    kHlpGetEnv("KLDR_OS2_LIBPATHSTRICT", kLdrDyldOS2LibpathStrict, sizeof(kLdrDyldOS2LibpathStrict));
    if (    kLdrDyldOS2LibpathStrict[0] == 'T'
        ||  kLdrDyldOS2LibpathStrict[0] == 't')
        kLdrDyldOS2LibpathStrict[0] = 'T';
    else
        kLdrDyldOS2LibpathStrict[0] = '\0';
    kLdrDyldOS2LibpathStrict[1] = '\0';
    kHlpGetEnv("KLDR_OS2_BEGINLIBPATH", kLdrDyldOS2BeginLibpath, sizeof(kLdrDyldOS2BeginLibpath));
    kHlpGetEnv("KLDR_OS2_ENDLIBPATH", kLdrDyldOS2EndLibpath, sizeof(kLdrDyldOS2EndLibpath));
#endif

    /*
     * The windows search parameters.
     */
#if K_OS == K_OS_WINDOWS
    cch = GetSystemDirectory(kLdrDyldWindowsSystemDir, sizeof(kLdrDyldWindowsSystemDir));
    if (cch >= sizeof(kLdrDyldWindowsSystemDir))
        return (rc = GetLastError()) ? rc : -1;
    cch = GetWindowsDirectory(kLdrDyldWindowsDir, sizeof(kLdrDyldWindowsDir));
    if (cch >= sizeof(kLdrDyldWindowsDir))
        return (rc = GetLastError()) ? rc : -1;
    kHlpGetEnv("PATH", kLdrDyldWindowsPath, sizeof(kLdrDyldWindowsPath));
#else
    kHlpGetEnv("KLDR_WINDOWS_SYSTEM_DIR", kLdrDyldWindowsSystemDir, sizeof(kLdrDyldWindowsSystemDir));
    kHlpGetEnv("KLDR_WINDOWS_DIR", kLdrDyldWindowsDir, sizeof(kLdrDyldWindowsDir));
    rc = kHlpGetEnv("KLDR_WINDOWS_PATH", kLdrDyldWindowsPath, sizeof(kLdrDyldWindowsPath));
    if (rc)
        kHlpGetEnv("PATH", kLdrDyldWindowsPath, sizeof(kLdrDyldWindowsPath));
#endif

    /*
     * The Unix search parameters.
     */
    rc = kHlpGetEnv("KLDR_UNIX_LIBRARY_PATH", kLdrDyldUnixLibraryPath, sizeof(kLdrDyldUnixLibraryPath));
    if (rc)
        kHlpGetEnv("LD_LIBRARY_PATH", kLdrDyldUnixLibraryPath, sizeof(kLdrDyldUnixLibraryPath));

    (void)cch;
    return 0;
}


Generated by  Doxygen 1.6.0   Back to index