VirtualBox

Changeset 70346 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Dec 26, 2017 3:52:28 PM (7 years ago)
Author:
vboxsync
Message:

VBoxService: Needed to dynamically resolve two more APIs to make it work on NT 3.1.

Location:
trunk/src/VBox/Additions/common/VBoxService
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk

    r70330 r70346  
    189189
    190190VBoxService_USES.win += vboximportchecker
    191 VBoxService_VBOX_IMPORT_CHECKER.win.x86 = nt4
     191VBoxService_VBOX_IMPORT_CHECKER.win.x86 = nt31
    192192VBoxService_VBOX_IMPORT_CHECKER.win.amd64 = xp64
    193193
  • trunk/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp

    r70267 r70346  
    7878decltype(Module32First)                 *g_pfnModule32First;                    /**< W2K+, but Geoff says NT4. Hmm. */
    7979decltype(Module32Next)                  *g_pfnModule32Next;                     /**< W2K+, but Geoff says NT4. Hmm. */
     80decltype(GetSystemTimeAdjustment)       *g_pfnGetSystemTimeAdjustment;          /**< NT 3.50+ */
     81decltype(SetSystemTimeAdjustment)       *g_pfnSetSystemTimeAdjustment;          /**< NT 3.50+ */
    8082/** @} */
    8183
     
    136138        RESOLVE_SYMBOL(Module32First);
    137139        RESOLVE_SYMBOL(Module32Next);
     140        RESOLVE_SYMBOL(GetSystemTimeAdjustment);
     141        RESOLVE_SYMBOL(SetSystemTimeAdjustment);
    138142        RTLdrClose(hLdrMod);
    139143    }
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h

    r70214 r70346  
    209209extern decltype(Module32Next)                  *g_pfnModule32Next;
    210210# endif
     211extern decltype(GetSystemTimeAdjustment)       *g_pfnGetSystemTimeAdjustment;
     212extern decltype(SetSystemTimeAdjustment)       *g_pfnSetSystemTimeAdjustment;
    211213# ifdef ___iprt_nt_nt_h___
    212214extern decltype(ZwQuerySystemInformation)      *g_pfnZwQuerySystemInformation;
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp

    r70072 r70346  
    367367    }
    368368
    369     if (GetSystemTimeAdjustment(&g_dwWinTimeAdjustment, &g_dwWinTimeIncrement, &g_bWinTimeAdjustmentDisabled))
    370         vgsvcTimeSyncLog(0, "vgsvcTimeSyncInit: Initially %ld (100ns) units per %ld (100 ns) units interval, disabled=%d\n",
    371                          g_dwWinTimeAdjustment, g_dwWinTimeIncrement, g_bWinTimeAdjustmentDisabled ? 1 : 0);
    372     else
    373     {
    374         DWORD dwErr = GetLastError();
    375         rc = RTErrConvertFromWin32(dwErr);
    376         VGSvcError("vgsvcTimeSyncInit: Could not get time adjustment values! Last error: %ld!\n", dwErr);
     369    if (g_pfnGetSystemTimeAdjustment)
     370    {
     371        if (g_pfnGetSystemTimeAdjustment(&g_dwWinTimeAdjustment, &g_dwWinTimeIncrement, &g_bWinTimeAdjustmentDisabled))
     372            vgsvcTimeSyncLog(0, "vgsvcTimeSyncInit: Initially %ld (100ns) units per %ld (100 ns) units interval, disabled=%d\n",
     373                             g_dwWinTimeAdjustment, g_dwWinTimeIncrement, g_bWinTimeAdjustmentDisabled ? 1 : 0);
     374        else
     375        {
     376            DWORD dwErr = GetLastError();
     377            rc = RTErrConvertFromWin32(dwErr);
     378            VGSvcError("vgsvcTimeSyncInit: Could not get time adjustment values! Last error: %ld!\n", dwErr);
     379        }
    377380    }
    378381#endif /* RT_OS_WINDOWS */
     
    400403        return false;
    401404
     405    /* The API appeared in NT 3.50. */
     406    if (   !g_pfnSetSystemTimeAdjustment
     407        || !g_pfnGetSystemTimeAdjustment)
     408        return false;
     409
    402410    DWORD dwWinTimeAdjustment, dwWinNewTimeAdjustment, dwWinTimeIncrement;
    403411    BOOL  fWinTimeAdjustmentDisabled;
    404     if (GetSystemTimeAdjustment(&dwWinTimeAdjustment, &dwWinTimeIncrement, &fWinTimeAdjustmentDisabled))
     412    if (g_pfnGetSystemTimeAdjustment(&dwWinTimeAdjustment, &dwWinTimeIncrement, &fWinTimeAdjustmentDisabled))
    405413    {
    406414        DWORD dwDiffMax = g_dwWinTimeAdjustment * 0.50;
     
    429437        vgsvcTimeSyncLog(3, "vgsvcTimeSyncAdjust: OrgTA=%ld, CurTA=%ld, NewTA=%ld, DiffNew=%ld, DiffMax=%ld\n",
    430438                         g_dwWinTimeAdjustment, dwWinTimeAdjustment, dwWinNewTimeAdjustment, dwDiffNew, dwDiffMax);
    431         if (SetSystemTimeAdjustment(dwWinNewTimeAdjustment, FALSE /* Periodic adjustments enabled. */))
     439        if (g_pfnSetSystemTimeAdjustment(dwWinNewTimeAdjustment, FALSE /* Periodic adjustments enabled. */))
    432440        {
    433441            g_cTimeSyncErrors = 0;
     
    475483    if (g_hTokenProcess == NULL) /* No process token (anymore)? */
    476484        return;
    477     if (SetSystemTimeAdjustment(0, TRUE /* Periodic adjustments disabled. */))
     485    if (!g_pfnSetSystemTimeAdjustment)
     486        return;
     487    if (g_pfnSetSystemTimeAdjustment(0, TRUE /* Periodic adjustments disabled. */))
    478488        vgsvcTimeSyncLog(5, "vgsvcTimeSyncCancelAdjust: Windows Time Adjustment is now disabled.\n");
    479489    else if (g_cTimeSyncErrors++ < 10)
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