Index: /trunk/src/VBox/Runtime/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Runtime/Makefile.kmk	(revision 57904)
+++ /trunk/src/VBox/Runtime/Makefile.kmk	(revision 57905)
@@ -1302,5 +1302,9 @@
 RuntimeGuestR3_SOURCES.win.x86               += \
  	r3/win/vcc100-kernel32-fakes.cpp \
- 	r3/win/vcc100-kernel32-fakesA.asm
+ 	r3/win/vcc100-kernel32-fakesA.asm \
+	r3/win/vcc100-ntdll-fakes.cpp \
+	r3/win/vcc100-ntdll-fakesA.asm \
+ 	r3/win/vcc100-ws2_32-fakes.cpp \
+ 	r3/win/vcc100-ws2_32-fakesA.asm
 
 #
@@ -1481,4 +1485,8 @@
  	r3/win/vcc100-kernel32-fakes.cpp \
  	r3/win/vcc100-kernel32-fakesA.asm \
+ 	r3/win/vcc100-ws2_32-fakes.cpp \
+ 	r3/win/vcc100-ws2_32-fakesA.asm \
+	r3/win/vcc100-ntdll-fakes.cpp \
+	r3/win/vcc100-ntdll-fakesA.asm \
 	r3/win/vcc100-msvcrt-fakes.cpp
  VBoxRT_TEMPLATE         = VBoxR3RuntimeDllItself
Index: /trunk/src/VBox/Runtime/generic/http-curl.cpp
===================================================================
--- /trunk/src/VBox/Runtime/generic/http-curl.cpp	(revision 57904)
+++ /trunk/src/VBox/Runtime/generic/http-curl.cpp	(revision 57905)
@@ -63,4 +63,5 @@
 #ifdef RT_OS_WINDOWS
 # include <Winhttp.h>
+# include "../r3/win/internal-r3-win.h"
 #endif
 
@@ -1337,4 +1338,7 @@
 static DECLCALLBACK(int) rtHttpWinResolveImports(void *pvUser)
 {
+    /*
+     * winhttp.dll is not present on NT4 and probably was first introduced with XP.
+     */
     RTLDRMOD hMod;
     int rc = RTLdrLoadSystem("winhttp.dll", true /*fNoUnload*/, &hMod);
@@ -1351,6 +1355,8 @@
             rc = RTLdrGetSymbol(hMod, "WinHttpGetIEProxyConfigForCurrentUser", (void **)&g_pfnWinHttpGetIEProxyConfigForCurrentUser);
         RTLdrClose(hMod);
-    }
-    AssertRC(rc);
+        AssertRC(rc);
+    }
+    else
+        AssertMsg(g_enmWinVer < kRTWinOSType_XP, ("%Rrc\n", rc));
 
     NOREF(pvUser);
Index: /trunk/src/VBox/Runtime/r3/win/RTSystemQueryTotalRam-win.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/RTSystemQueryTotalRam-win.cpp	(revision 57904)
+++ /trunk/src/VBox/Runtime/r3/win/RTSystemQueryTotalRam-win.cpp	(revision 57905)
@@ -37,17 +37,59 @@
 #include <iprt/string.h>
 
+#include "internal-r3-win.h"
+
+
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
+static bool volatile            g_fInitialized = false;
+typedef BOOL (WINAPI *PFNGLOBALMEMORYSTATUSEX)(LPMEMORYSTATUSEX);
+static PFNGLOBALMEMORYSTATUSEX  g_pfnGlobalMemoryStatusEx = NULL;
+
+
+/**
+ * The GlobalMemoryStatusEx API is not available on older Windows version.
+ *
+ * @returns Pointer to GlobalMemoryStatusEx or NULL if not available.
+ */
+DECLINLINE(PFNGLOBALMEMORYSTATUSEX) rtSystemWinGetExApi(void)
+{
+    PFNGLOBALMEMORYSTATUSEX pfnEx;
+    if (g_fInitialized)
+        pfnEx = g_pfnGlobalMemoryStatusEx;
+    else
+    {
+        pfnEx = (PFNGLOBALMEMORYSTATUSEX)GetProcAddress(g_hModKernel32, "GlobalMemoryStatusEx");
+        g_pfnGlobalMemoryStatusEx = pfnEx;
+        g_fInitialized = true;
+    }
+    return pfnEx;
+}
+
 
 RTDECL(int) RTSystemQueryTotalRam(uint64_t *pcb)
 {
-    MEMORYSTATUSEX MemStatus;
-
     AssertPtrReturn(pcb, VERR_INVALID_POINTER);
 
-    MemStatus.dwLength = sizeof(MemStatus);
-    if (!GlobalMemoryStatusEx(&MemStatus))
-        return RTErrConvertFromWin32(GetLastError());
-
-    *pcb = MemStatus.ullTotalPhys;
-    return VINF_SUCCESS;
+    int rc = VINF_SUCCESS;
+    PFNGLOBALMEMORYSTATUSEX pfnGlobalMemoryStatusEx = rtSystemWinGetExApi();
+    if (pfnGlobalMemoryStatusEx)
+    {
+        MEMORYSTATUSEX MemStatus;
+        MemStatus.dwLength = sizeof(MemStatus);
+        if (pfnGlobalMemoryStatusEx(&MemStatus))
+            *pcb = MemStatus.ullTotalPhys;
+        else
+            rc = RTErrConvertFromWin32(GetLastError());
+    }
+    else
+    {
+        MEMORYSTATUS MemStatus;
+        RT_ZERO(MemStatus);
+        MemStatus.dwLength = sizeof(MemStatus);
+        GlobalMemoryStatus(&MemStatus);
+        *pcb = MemStatus.dwTotalPhys;
+    }
+    return rc;
 }
 
@@ -55,13 +97,25 @@
 RTDECL(int) RTSystemQueryAvailableRam(uint64_t *pcb)
 {
-    MEMORYSTATUSEX MemStatus;
-
     AssertPtrReturn(pcb, VERR_INVALID_POINTER);
 
-    MemStatus.dwLength = sizeof(MemStatus);
-    if (!GlobalMemoryStatusEx(&MemStatus))
-        return RTErrConvertFromWin32(GetLastError());
-
-    *pcb = MemStatus.ullAvailPhys;
-    return VINF_SUCCESS;
+    int rc = VINF_SUCCESS;
+    PFNGLOBALMEMORYSTATUSEX pfnGlobalMemoryStatusEx = rtSystemWinGetExApi();
+    if (pfnGlobalMemoryStatusEx)
+    {
+        MEMORYSTATUSEX MemStatus;
+        MemStatus.dwLength = sizeof(MemStatus);
+        if (pfnGlobalMemoryStatusEx(&MemStatus))
+            *pcb = MemStatus.ullAvailPhys;
+        else
+            rc = RTErrConvertFromWin32(GetLastError());
+    }
+    else
+    {
+        MEMORYSTATUS MemStatus;
+        RT_ZERO(MemStatus);
+        MemStatus.dwLength = sizeof(MemStatus);
+        GlobalMemoryStatus(&MemStatus);
+        *pcb = MemStatus.dwAvailPhys;
+    }
+    return rc;
 }
Index: /trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakes.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakes.cpp	(revision 57904)
+++ /trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakes.cpp	(revision 57905)
@@ -31,4 +31,6 @@
 #include <iprt/cdefs.h>
 #include <iprt/types.h>
+#include <iprt/asm.h>
+#include <iprt/string.h>
 
 #ifndef RT_ARCH_X86
@@ -41,5 +43,17 @@
 #define HeapSetInformation                      Ignore_HeapSetInformation
 #define HeapQueryInformation                    Ignore_HeapQueryInformation
+#define CreateTimerQueue                        Ignore_CreateTimerQueue
+#define CreateTimerQueueTimer                   Ignore_CreateTimerQueueTimer
+#define DeleteTimerQueueTimer                   Ignore_DeleteTimerQueueTimer
+#define InitializeSListHead                     Ignore_InitializeSListHead
+#define InterlockedFlushSList                   Ignore_InterlockedFlushSList
+#define InterlockedPopEntrySList                Ignore_InterlockedPopEntrySList
+#define InterlockedPushEntrySList               Ignore_InterlockedPushEntrySList
+#define QueryDepthSList                         Ignore_QueryDepthSList
+#define VerifyVersionInfoA                      Ignore_VerifyVersionInfoA
+#define VerSetConditionMask                     Ignore_VerSetConditionMask
+
 #include <Windows.h>
+
 #undef DecodePointer
 #undef EncodePointer
@@ -47,4 +61,14 @@
 #undef HeapSetInformation
 #undef HeapQueryInformation
+#undef CreateTimerQueue
+#undef CreateTimerQueueTimer
+#undef DeleteTimerQueueTimer
+#undef InitializeSListHead
+#undef InterlockedFlushSList
+#undef InterlockedPopEntrySList
+#undef InterlockedPushEntrySList
+#undef QueryDepthSList
+#undef VerifyVersionInfoA
+#undef VerSetConditionMask
 
 
@@ -54,6 +78,18 @@
 
 
-/** @todo Try dynamically resolve the functions the first time one of them is
- *        called. */
+/** Dynamically resolves an kernel32 API.   */
+#define RESOLVE_ME(ApiNm) \
+    static bool volatile    s_fInitialized = false; \
+    static decltype(ApiNm) *s_pfnApi = NULL; \
+    decltype(ApiNm)        *pfnApi; \
+    if (!s_fInitialized) \
+        pfnApi = s_pfnApi; \
+    else \
+    { \
+        pfnApi = (decltype(pfnApi))GetProcAddress(GetModuleHandleW(L"kernel32"), #ApiNm); \
+        s_pfnApi = pfnApi; \
+        s_fInitialized = true; \
+    } do {} while (0) \
+
 
 extern "C"
@@ -61,4 +97,8 @@
 DecodePointer(PVOID pvEncoded)
 {
+    RESOLVE_ME(DecodePointer);
+    if (pfnApi)
+        return pfnApi(pvEncoded);
+
     /*
      * Fallback code.
@@ -72,4 +112,8 @@
 EncodePointer(PVOID pvNative)
 {
+    RESOLVE_ME(EncodePointer);
+    if (pfnApi)
+        return pfnApi(pvNative);
+
     /*
      * Fallback code.
@@ -83,4 +127,7 @@
 InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION pCritSect, DWORD cSpin)
 {
+    RESOLVE_ME(InitializeCriticalSectionAndSpinCount);
+    if (pfnApi)
+        return pfnApi(pCritSect, cSpin);
 
     /*
@@ -96,4 +143,8 @@
 HeapSetInformation(HANDLE hHeap, HEAP_INFORMATION_CLASS enmInfoClass, PVOID pvBuf, SIZE_T cbBuf)
 {
+    RESOLVE_ME(HeapSetInformation);
+    if (pfnApi)
+        return pfnApi(hHeap, enmInfoClass, pvBuf, cbBuf);
+
     /*
      * Fallback code.
@@ -121,4 +172,7 @@
 HeapQueryInformation(HANDLE hHeap, HEAP_INFORMATION_CLASS enmInfoClass, PVOID pvBuf, SIZE_T cbBuf, PSIZE_T pcbRet)
 {
+    RESOLVE_ME(HeapQueryInformation);
+    if (pfnApi)
+        return pfnApi(hHeap, enmInfoClass, pvBuf, cbBuf, pcbRet);
 
     /*
@@ -142,4 +196,233 @@
 
 
+/* These are used by INTEL\mt_obj\Timer.obj: */
+
+extern "C"
+__declspec(dllexport)
+HANDLE WINAPI CreateTimerQueue(void)
+{
+    RESOLVE_ME(CreateTimerQueue);
+    if (pfnApi)
+        return pfnApi();
+    SetLastError(ERROR_NOT_SUPPORTED);
+    return NULL;
+}
+
+extern "C"
+__declspec(dllexport)
+BOOL WINAPI CreateTimerQueueTimer(PHANDLE phTimer, HANDLE hTimerQueue, WAITORTIMERCALLBACK pfnCallback, PVOID pvUser,
+                                  DWORD msDueTime, DWORD msPeriod, ULONG fFlags)
+{
+    RESOLVE_ME(CreateTimerQueueTimer);
+    if (pfnApi)
+        return pfnApi(phTimer, hTimerQueue, pfnCallback, pvUser, msDueTime, msPeriod, fFlags);
+    SetLastError(ERROR_NOT_SUPPORTED);
+    return FALSE;
+}
+
+extern "C"
+__declspec(dllexport)
+BOOL WINAPI DeleteTimerQueueTimer(HANDLE hTimerQueue, HANDLE hTimer, HANDLE hEvtCompletion)
+{
+    RESOLVE_ME(DeleteTimerQueueTimer);
+    if (pfnApi)
+        return pfnApi(hTimerQueue, hTimer, hEvtCompletion);
+    SetLastError(ERROR_NOT_SUPPORTED);
+    return FALSE;
+}
+
+/* This is used by several APIs. */
+
+extern "C"
+__declspec(dllexport)
+VOID WINAPI InitializeSListHead(PSLIST_HEADER pHead)
+{
+    RESOLVE_ME(InitializeSListHead);
+    if (pfnApi)
+        pfnApi(pHead);
+    else /* fallback: */
+        pHead->Alignment = 0;
+}
+
+
+extern "C"
+__declspec(dllexport)
+PSLIST_ENTRY WINAPI InterlockedFlushSList(PSLIST_HEADER pHead)
+{
+    RESOLVE_ME(InterlockedFlushSList);
+    if (pfnApi)
+        return pfnApi(pHead);
+
+    /* fallback: */
+    PSLIST_ENTRY pRet = NULL;
+    if (pHead->Next.Next)
+    {
+        for (;;)
+        {
+            SLIST_HEADER OldHead = *pHead;
+            SLIST_HEADER NewHead;
+            NewHead.Alignment = 0;
+            NewHead.Sequence  = OldHead.Sequence + 1;
+            if (ASMAtomicCmpXchgU64(&pHead->Alignment, NewHead.Alignment, OldHead.Alignment))
+            {
+                pRet = OldHead.Next.Next;
+                break;
+            }
+        }
+    }
+    return pRet;
+}
+
+extern "C"
+__declspec(dllexport)
+PSLIST_ENTRY WINAPI InterlockedPopEntrySList(PSLIST_HEADER pHead)
+{
+    RESOLVE_ME(InterlockedPopEntrySList);
+    if (pfnApi)
+        return pfnApi(pHead);
+
+    /* fallback: */
+    PSLIST_ENTRY pRet = NULL;
+    for (;;)
+    {
+        SLIST_HEADER OldHead = *pHead;
+        pRet = OldHead.Next.Next;
+        if (pRet)
+        {
+            SLIST_HEADER NewHead;
+            __try
+            {
+                NewHead.Next.Next = pRet->Next;
+            }
+            __except(EXCEPTION_EXECUTE_HANDLER)
+            {
+                continue;
+            }
+            NewHead.Depth     = OldHead.Depth - 1;
+            NewHead.Sequence  = OldHead.Sequence + 1;
+            if (ASMAtomicCmpXchgU64(&pHead->Alignment, NewHead.Alignment, OldHead.Alignment))
+                break;
+        }
+        else
+            break;
+    }
+    return pRet;
+}
+
+extern "C"
+__declspec(dllexport)
+PSLIST_ENTRY WINAPI InterlockedPushEntrySList(PSLIST_HEADER pHead, PSLIST_ENTRY pEntry)
+{
+    RESOLVE_ME(InterlockedPushEntrySList);
+    if (pfnApi)
+        return pfnApi(pHead, pEntry);
+
+    /* fallback: */
+    PSLIST_ENTRY pRet = NULL;
+    for (;;)
+    {
+        SLIST_HEADER OldHead = *pHead;
+        pRet = OldHead.Next.Next;
+        pEntry->Next = pRet;
+        SLIST_HEADER NewHead;
+        NewHead.Next.Next = pEntry;
+        NewHead.Depth     = OldHead.Depth + 1;
+        NewHead.Sequence  = OldHead.Sequence + 1;
+        if (ASMAtomicCmpXchgU64(&pHead->Alignment, NewHead.Alignment, OldHead.Alignment))
+            break;
+    }
+    return pRet;
+}
+
+extern "C"
+__declspec(dllexport)
+WORD WINAPI QueryDepthSList(PSLIST_HEADER pHead)
+{
+    RESOLVE_ME(QueryDepthSList);
+    if (pfnApi)
+        return pfnApi(pHead);
+    return pHead->Depth;
+}
+
+
+/* curl drags these in: */
+extern "C"
+__declspec(dllexport)
+BOOL WINAPI VerifyVersionInfoA(LPOSVERSIONINFOEXA pInfo, DWORD fTypeMask, DWORDLONG fConditionMask)
+{
+    RESOLVE_ME(VerifyVersionInfoA);
+    if (pfnApi)
+        return pfnApi(pInfo, fTypeMask, fConditionMask);
+
+    /* fallback to make curl happy: */
+    OSVERSIONINFOEXA VerInfo;
+    RT_ZERO(VerInfo);
+    VerInfo.dwOSVersionInfoSize = sizeof(VerInfo);
+    if (!GetVersionEx((OSVERSIONINFO *)&VerInfo))
+    {
+        RT_ZERO(VerInfo);
+        VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+        AssertReturn(GetVersionEx((OSVERSIONINFO *)&VerInfo), FALSE);
+    }
+
+    BOOL fRet = TRUE;
+    for (unsigned i = 0; i < 8 && fRet; i++)
+        if (fTypeMask & RT_BIT_32(i))
+        {
+            uint32_t uLeft, uRight;
+            switch (RT_BIT_32(i))
+            {
+#define MY_CASE(a_Num, a_Member) case a_Num: uLeft = VerInfo.a_Member; uRight = pInfo->a_Member; break
+                MY_CASE(VER_MINORVERSION,       dwMinorVersion);
+                MY_CASE(VER_MAJORVERSION,       dwMajorVersion);
+                MY_CASE(VER_BUILDNUMBER,        dwBuildNumber);
+                MY_CASE(VER_PLATFORMID,         dwPlatformId);
+                MY_CASE(VER_SERVICEPACKMINOR,   wServicePackMinor);
+                MY_CASE(VER_SERVICEPACKMAJOR,   wServicePackMinor);
+                MY_CASE(VER_SUITENAME,          wSuiteMask);
+                MY_CASE(VER_PRODUCT_TYPE,       wProductType);
+#undef  MY_CASE
+                default: uLeft = uRight = 0; AssertFailed();
+            }
+            switch ((uint8_t)(fConditionMask >> (i*8)))
+            {
+                case VER_EQUAL:             fRet = uLeft == uRight; break;
+                case VER_GREATER:           fRet = uLeft >  uRight; break;
+                case VER_GREATER_EQUAL:     fRet = uLeft >= uRight; break;
+                case VER_LESS:              fRet = uLeft <  uRight; break;
+                case VER_LESS_EQUAL:        fRet = uLeft <= uRight; break;
+                case VER_AND:               fRet = (uLeft & uRight) == uRight; break;
+                case VER_OR:                fRet = (uLeft & uRight) != 0; break;
+                default:                    fRet = FALSE; AssertFailed(); break;
+            }
+        }
+
+    return fRet;
+}
+
+extern "C"
+__declspec(dllexport)
+ULONGLONG WINAPI VerSetConditionMask(ULONGLONG fConditionMask, DWORD fTypeMask, BYTE bOperator)
+{
+    RESOLVE_ME(VerSetConditionMask);
+    if (pfnApi)
+        return pfnApi(fConditionMask, fTypeMask, bOperator);
+
+    /* fallback: */
+    for (unsigned i = 0; i < 8; i++)
+        if (fTypeMask & RT_BIT_32(i))
+        {
+            uint64_t fMask  = 0xff << (i*8);
+            fConditionMask &= ~fMask;
+            fConditionMask |= (uint64_t)bOperator << (i*8);
+
+        }
+    return fConditionMask;
+}
+
+
+
+/* Dummy to force dragging in this object in the link, so the linker
+   won't accidentally use the symbols from kernel32. */
 extern "C" int vcc100_kernel32_fakes_cpp(void)
 {
Index: /trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakesA.asm
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakesA.asm	(revision 57904)
+++ /trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakesA.asm	(revision 57905)
@@ -25,4 +25,15 @@
 MAKE_IMPORT_ENTRY HeapSetInformation, 16
 MAKE_IMPORT_ENTRY HeapQueryInformation, 20
+MAKE_IMPORT_ENTRY CreateTimerQueue, 0
+MAKE_IMPORT_ENTRY CreateTimerQueueTimer, 28
+MAKE_IMPORT_ENTRY DeleteTimerQueueTimer, 12
+MAKE_IMPORT_ENTRY InitializeSListHead, 4
+MAKE_IMPORT_ENTRY InterlockedFlushSList, 4
+MAKE_IMPORT_ENTRY InterlockedPopEntrySList, 4
+MAKE_IMPORT_ENTRY InterlockedPushEntrySList, 8
+MAKE_IMPORT_ENTRY QueryDepthSList, 4
+MAKE_IMPORT_ENTRY VerifyVersionInfoA, 16
+MAKE_IMPORT_ENTRY VerSetConditionMask, 16
 
 
+
Index: /trunk/src/VBox/Runtime/r3/win/vcc100-ntdll-fakes.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/vcc100-ntdll-fakes.cpp	(revision 57905)
+++ /trunk/src/VBox/Runtime/r3/win/vcc100-ntdll-fakes.cpp	(revision 57905)
@@ -0,0 +1,75 @@
+/* $Id$ */
+/** @file
+ * IPRT - Tricks to make the Visual C++ 2010 CRT work on NT4, W2K and XP - NTDLL.DLL.
+ */
+
+/*
+ * Copyright (C) 2012-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
+#include <iprt/cdefs.h>
+#include <iprt/types.h>
+
+#ifndef RT_ARCH_X86
+# error "This code is X86 only"
+#endif
+
+#include <Windows.h>
+
+
+
+/** Dynamically resolves an kernel32 API.   */
+#define RESOLVE_ME(ApiNm) \
+    static bool volatile    s_fInitialized = false; \
+    static decltype(ApiNm) *s_pfnApi = NULL; \
+    decltype(ApiNm)        *pfnApi; \
+    if (!s_fInitialized) \
+        pfnApi = s_pfnApi; \
+    else \
+    { \
+        pfnApi = (decltype(pfnApi))GetProcAddress(GetModuleHandleW(L"ntdll.dll"), #ApiNm); \
+        s_pfnApi = pfnApi; \
+        s_fInitialized = true; \
+    } do {} while (0) \
+
+
+extern "C"
+__declspec(dllexport)
+ULONG WINAPI RtlGetLastWin32Error(VOID)
+{
+    RESOLVE_ME(RtlGetLastWin32Error);
+    if (pfnApi)
+        return pfnApi();
+    return GetLastError();
+}
+
+
+/* Dummy to force dragging in this object in the link, so the linker
+   won't accidentally use the symbols from kernel32. */
+extern "C" int vcc100_ntdll_fakes_cpp(void)
+{
+    return 42;
+}
+
+
Index: /trunk/src/VBox/Runtime/r3/win/vcc100-ntdll-fakesA.asm
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/vcc100-ntdll-fakesA.asm	(revision 57905)
+++ /trunk/src/VBox/Runtime/r3/win/vcc100-ntdll-fakesA.asm	(revision 57905)
@@ -0,0 +1,22 @@
+
+%include "iprt/asmdefs.mac"
+
+%ifndef RT_ARCH_X86
+ %error "This is x86 only code.
+%endif
+
+
+%macro MAKE_IMPORT_ENTRY 2
+extern _ %+ %1 %+ @ %+ %2
+global __imp__ %+ %1 %+ @ %+ %2
+__imp__ %+ %1 %+ @ %+ %2:
+    dd _ %+ %1 %+ @ %+ %2
+
+%endmacro
+
+
+BEGINDATA
+GLOBALNAME vcc100_ntdll_fakes_asm
+
+MAKE_IMPORT_ENTRY RtlGetLastWin32Error, 0
+
Index: /trunk/src/VBox/Runtime/r3/win/vcc100-ws2_32-fakes.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/vcc100-ws2_32-fakes.cpp	(revision 57905)
+++ /trunk/src/VBox/Runtime/r3/win/vcc100-ws2_32-fakes.cpp	(revision 57905)
@@ -0,0 +1,103 @@
+/* $Id$ */
+/** @file
+ * IPRT - Tricks to make the Visual C++ 2010 CRT work on NT4, W2K and XP - WS2_32.DLL.
+ */
+
+/*
+ * Copyright (C) 2012-2015 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ *
+ * The contents of this file may alternatively be used under the terms
+ * of the Common Development and Distribution License Version 1.0
+ * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
+ * VirtualBox OSE distribution, in which case the provisions of the
+ * CDDL are applicable instead of those of the GPL.
+ *
+ * You may elect to license modified versions of this file under the
+ * terms and conditions of either the GPL or the CDDL or both.
+ */
+
+
+/*********************************************************************************************************************************
+*   Header Files                                                                                                                 *
+*********************************************************************************************************************************/
+#include <iprt/cdefs.h>
+#include <iprt/types.h>
+#include <iprt/asm.h>
+#include <iprt/string.h>
+
+#ifndef RT_ARCH_X86
+# error "This code is X86 only"
+#endif
+
+#define getaddrinfo                             Ignore_getaddrinfo
+#define freeaddrinfo                            Ignore_freeaddrinfo
+
+#include <winsock2.h>
+#include <ws2tcpip.h>
+
+#undef getaddrinfo
+#undef freeaddrinfo
+
+
+/** Dynamically resolves an kernel32 API.   */
+#define RESOLVE_ME(ApiNm) \
+    static bool volatile    s_fInitialized = false; \
+    static decltype(ApiNm) *s_pfnApi = NULL; \
+    decltype(ApiNm)        *pfnApi; \
+    if (!s_fInitialized) \
+        pfnApi = s_pfnApi; \
+    else \
+    { \
+        pfnApi = (decltype(pfnApi))GetProcAddress(GetModuleHandleW(L"wc2_32.dll"), #ApiNm); \
+        s_pfnApi = pfnApi; \
+        s_fInitialized = true; \
+    } do {} while (0) \
+
+
+extern "C"
+__declspec(dllexport)
+int WINAPI getaddrinfo(const char *pszNodeName, const char *pszServiceName, const struct addrinfo *pHints,
+                       struct addrinfo **ppResults)
+{
+    RESOLVE_ME(getaddrinfo);
+    if (pfnApi)
+        return pfnApi(pszNodeName, pszServiceName, pHints, ppResults);
+
+    /** @todo  fallback */
+    WSASetLastError(WSAEAFNOSUPPORT);
+    return WSAEAFNOSUPPORT;
+}
+
+
+
+extern "C"
+__declspec(dllexport)
+void WINAPI freeaddrinfo(struct addrinfo *pResults)
+{
+    RESOLVE_ME(freeaddrinfo);
+    if (pfnApi)
+        pfnApi(pResults);
+    else
+    {
+        Assert(!pResults);
+        /** @todo  fallback */
+    }
+}
+
+
+
+/* Dummy to force dragging in this object in the link, so the linker
+   won't accidentally use the symbols from kernel32. */
+extern "C" int vcc100_ws2_32_fakes_cpp(void)
+{
+    return 42;
+}
+
Index: /trunk/src/VBox/Runtime/r3/win/vcc100-ws2_32-fakesA.asm
===================================================================
--- /trunk/src/VBox/Runtime/r3/win/vcc100-ws2_32-fakesA.asm	(revision 57905)
+++ /trunk/src/VBox/Runtime/r3/win/vcc100-ws2_32-fakesA.asm	(revision 57905)
@@ -0,0 +1,23 @@
+
+%include "iprt/asmdefs.mac"
+
+%ifndef RT_ARCH_X86
+ %error "This is x86 only code.
+%endif
+
+
+%macro MAKE_IMPORT_ENTRY 2
+extern _ %+ %1 %+ @ %+ %2
+global __imp__ %+ %1 %+ @ %+ %2
+__imp__ %+ %1 %+ @ %+ %2:
+    dd _ %+ %1 %+ @ %+ %2
+
+%endmacro
+
+
+BEGINDATA
+GLOBALNAME vcc100_ws2_32_fakes_asm
+
+MAKE_IMPORT_ENTRY getaddrinfo, 16
+MAKE_IMPORT_ENTRY freeaddrinfo, 4
+
