VirtualBox

Ignore:
Timestamp:
Jun 17, 2013 2:32:51 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86471
Message:

updates

Location:
trunk/src/VBox/Additions/WINNT/Installer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/VBoxGuestInstallHelper.cpp

    r44529 r46593  
    197197
    198198/**
     199 * Loads a system DLL.
     200 *
     201 * @returns Module handle or NULL
     202 * @param   pszName             The DLL name.
     203 */
     204static HMODULE loadSystemDll(const char *pszName)
     205{
     206    char   szPath[MAX_PATH];
     207    UINT   cchPath = GetSystemDirectoryA(szPath, sizeof(szPath));
     208    size_t cbName  = strlen(pszName) + 1;
     209    if (cchPath + 1 + cbName > sizeof(szPath))
     210        return NULL;
     211    szPath[cchPath] = '\\';
     212    memcpy(&szPath[cchPath + 1], pszName, cbName);
     213    return LoadLibraryA(szPath);
     214}
     215
     216/**
    199217 * Disables the Windows File Protection for a specified file
    200218 * using an undocumented SFC API call. Don't try this at home!
     
    214232    if (SUCCEEDED(hr))
    215233    {
    216         HMODULE hSFC = LoadLibrary("sfc_os.dll");
     234        HMODULE hSFC = loadSystemDll("sfc_os.dll");
    217235        if (NULL != hSFC)
    218236        {
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxDrvInst.cpp

    r45938 r46593  
    130130     if (pCallbackContext)
    131131         fwprintf((FILE*)pCallbackContext, _T("(%u) %u - %s\n"), Event, dwError, pEventDescription);
     132}
     133
     134/**
     135 * Loads a system DLL.
     136 *
     137 * @returns Module handle or NULL
     138 * @param   pszName             The DLL name.
     139 */
     140static HMODULE loadSystemDll(const char *pszName)
     141{
     142    char   szPath[MAX_PATH];
     143    UINT   cchPath = GetSystemDirectoryA(szPath, sizeof(szPath));
     144    size_t cbName  = strlen(pszName) + 1;
     145    if (cchPath + 1 + cbName > sizeof(szPath))
     146        return NULL;
     147    szPath[cchPath] = '\\';
     148    memcpy(&szPath[cchPath + 1], pszName, cbName);
     149    return LoadLibraryA(szPath);
    132150}
    133151
     
    146164{
    147165    HRESULT hr = S_OK;
    148     HMODULE hDIFxAPI = LoadLibrary(_T("DIFxAPI.dll"));
     166    HMODULE hDIFxAPI = loadSystemDll("DIFxAPI.dll");
    149167    if (NULL == hDIFxAPI)
    150168    {
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