VirtualBox

Changeset 47236 in vbox for trunk/include/iprt/win


Ignore:
Timestamp:
Jul 18, 2013 7:04:29 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
87354
Message:

lazy-dbghelp.h: Use RTLdrLoadSystem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/win/lazy-dbghelp.h

    r46126 r47236  
    3838static int rtLdrLazyLoadDbgHelp(const char *pszFile, PRTLDRMOD phMod)
    3939{
    40     char        szPath[RTPATH_MAX];
    41     size_t      cchPath;
    42     int rc = RTEnvGetEx(RTENV_DEFAULT, "ProgramFiles", szPath, sizeof(szPath), &cchPath);
    43     if (RT_SUCCESS(rc))
     40    static const struct
    4441    {
    45         /** @todo try Windows SDK location. */
    46 #ifdef RT_ARCH_X86
    47         rc = RTPathAppend(szPath, sizeof(szPath), "Debugging Tools for Windows (x86)\\dbghelp.dll");
     42        const char *pszEnv;
     43        const char *pszSubDir;
     44    } s_aLocations[] =
     45    {
     46#ifdef RT_ARCH_AMD64
     47        { "ProgramFiles(x86)",  "Windows Kits\\8.1\\Debuggers\\x64\\dbghelp.dll" },
     48        { "ProgramFiles(x86)",  "Windows Kits\\8.0\\Debuggers\\x64\\dbghelp.dll" },
     49        { "ProgramFiles",       "Debugging Tools for Windows (x64)\\dbghelp.dll" },
    4850#else
    49         rc = RTPathAppend(szPath, sizeof(szPath), "Debugging Tools for Windows (x64)\\dbghelp.dll");
    50 #endif
    51         if (RTPathExists(szPath))
     51        { "ProgramFiles",       "Windows Kits\\8.1\\Debuggers\\x86\\dbghelp.dll" },
     52        { "ProgramFiles",       "Windows Kits\\8.0\\Debuggers\\x86\\dbghelp.dll" },
     53        { "ProgramFiles",       "Debugging Tools for Windows (x86)\\dbghelp.dll" },
     54#endif /** @todo More places we should look? */
     55    };
     56    uint32_t i;
     57    for (i = 0; i < RT_ELEMENTS(s_aLocations); i++)
     58    {
     59        char   szPath[RTPATH_MAX];
     60        size_t cchPath;
     61        int rc = RTEnvGetEx(RTENV_DEFAULT, s_aLocations[i].pszEnv, szPath, sizeof(szPath), &cchPath);
     62        if (RT_SUCCESS(rc))
    5263        {
    53             rc = RTLdrLoad(szPath, phMod);
     64            rc = RTPathAppend(szPath, sizeof(szPath), s_aLocations[i].pszSubDir);
    5465            if (RT_SUCCESS(rc))
    55                 return rc;
     66            {
     67                rc = RTLdrLoad(szPath, phMod);
     68                if (RT_SUCCESS(rc))
     69                    return rc;
     70            }
    5671        }
    5772    }
    5873
    59     return RTLdrLoad(pszFile, phMod);
     74    /* Fall back on the system one, if present. */
     75    return RTLdrLoadSystem(pszFile, true /*fNoUnload*/, phMod);
    6076}
    6177
Note: See TracChangeset for help on using the changeset viewer.

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