VirtualBox

Changeset 70213 in vbox for trunk/src


Ignore:
Timestamp:
Dec 19, 2017 2:56:25 AM (7 years ago)
Author:
vboxsync
Message:

IPRT/r3/win: Wrapped two more kernel32 APIs that's used by the VC v10 CRT and IPRT, making it work on NT 3.50 - just because we can :-)

Location:
trunk/src/VBox/Runtime/r3/win
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakes.cpp

    r70195 r70213  
    5757#define IsProcessorFeaturePresent               Ignore_IsProcessorFeaturePresent /* NT 3.51 start */
    5858#define CancelIo                                Ignore_CancelIo
     59#define IsDebuggerPresent                       Ignore_IsDebuggerPresent /* NT 3.50 start */
     60#define GetSystemTimeAsFileTime                 Ignore_GetSystemTimeAsFileTime
    5961
    6062#include <iprt/nt/nt-and-windows.h>
     
    7779#undef IsProcessorFeaturePresent
    7880#undef CancelIo
     81#undef IsDebuggerPresent
     82#undef GetSystemTimeAsFileTime
    7983
    8084
     
    484488
    485489
     490/*
     491 * NT 3.50 stuff.
     492 */
     493
     494extern "C" DECLEXPORT(BOOL) WINAPI IsDebuggerPresent(VOID)
     495{
     496    RESOLVE_ME(IsDebuggerPresent);
     497    if (pfnApi)
     498        return pfnApi();
     499    return FALSE;
     500}
     501
     502
     503extern "C" DECLEXPORT(VOID) WINAPI GetSystemTimeAsFileTime(LPFILETIME pTime)
     504{
     505    RESOLVE_ME(GetSystemTimeAsFileTime);
     506    if (pfnApi)
     507        pfnApi(pTime);
     508    else
     509    {
     510        DWORD dwVersion = GetVersion();
     511        if (   (dwVersion & 0xff) > 3
     512            || (   (dwVersion & 0xff) == 3
     513                && ((dwVersion >> 8) & 0xff) >= 50) )
     514        {
     515            PKUSER_SHARED_DATA pUsd = (PKUSER_SHARED_DATA)MM_SHARED_USER_DATA_VA;
     516
     517            /* use interrupt time */
     518            LARGE_INTEGER Time;
     519            do
     520            {
     521                Time.HighPart = pUsd->SystemTime.High1Time;
     522                Time.LowPart  = pUsd->SystemTime.LowPart;
     523            } while (pUsd->SystemTime.High2Time != Time.HighPart);
     524
     525            pTime->dwHighDateTime = Time.HighPart;
     526            pTime->dwLowDateTime  = Time.LowPart;
     527        }
     528        else
     529        {
     530            /** @todo    */
     531            __debugbreak();
     532        }
     533    }
     534}
     535
     536
    486537/* Dummy to force dragging in this object in the link, so the linker
    487538   won't accidentally use the symbols from kernel32. */
  • trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakesA.asm

    r70195 r70213  
    6262MAKE_IMPORT_ENTRY IsProcessorFeaturePresent, 4
    6363MAKE_IMPORT_ENTRY CancelIo, 4
     64MAKE_IMPORT_ENTRY IsDebuggerPresent, 0
     65MAKE_IMPORT_ENTRY GetSystemTimeAsFileTime, 4
    6466
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