Index: /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Makefile.kmk	(revision 42301)
+++ /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Makefile.kmk	(revision 42302)
@@ -25,11 +25,7 @@
 VBoxSF_TEMPLATE    = VBOXGUESTR0
 VBoxSF_DEFS        = LOG_TO_BACKDOOR VBOX_WITH_HGCM IN_RING0
-#VBoxSF_DEFS       += LOG_ENABLED
+VBoxSF_DEFS       += LOG_ENABLED
 
-ifeq ($(VBOX_WINDDK_GST),W2K3DDK)
-VBoxSF_SDKS.x86    = ReorderCompilerIncs WINDDKW2K
-else
-VBoxSF_SDKS.x86    = ReorderCompilerIncs $(VBOX_WINDDK_GST_W2K)
-endif
+VBoxSF_SDKS.x86    = ReorderCompilerIncs $(VBOX_WINDDK_GST_W2K3)
 VBoxSF_SDKS.amd64  = ReorderCompilerIncs $(VBOX_WINDDK_GST_WLH)
 
@@ -47,24 +43,16 @@
 	vbsfhlp.c \
  	VBoxSF.rc
+VBoxSF_SOURCES.x86 = \
+	Win2kWorkarounds.c \
+	Win2kWorkaroundsA.asm
 
-ifeq ($(VBOX_WINDDK_GST),W2K3DDK)
- VBoxSF_LIBS.x86  = \
- 	$(PATH_SDK_WINDDKW2K_LIB.x86)/fre/rxce.lib \
- 	$(PATH_SDK_WINDDKW2K_LIB.x86)/fre/rdbsslib.lib \
- 	$(PATH_SDK_WINDDKW2K_LIB.x86)/fre/copysup.lib \
- 	$(PATH_SDK_WINDDKW2K_LIB.x86)/ntoskrnl.lib \
- 	$(PATH_SDK_WINDDKW2K_LIB.x86)/hal.lib \
- 	$(PATH_SDK_WINDDKW2K_LIB.x86)/ksecdd.lib \
- 	$(PATH_SDK_WINDDKW2K_LIB.x86)/BufferOverflowK.lib
-else
- VBoxSF_LIBS.x86  = \
- 	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K)_LIB.x86)/rxce.lib \
- 	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K)_LIB.x86)/rdbsslib.lib \
- 	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K)_LIB.x86)/copysup.lib \
- 	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K)_LIB.x86)/ntoskrnl.lib \
- 	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K)_LIB.x86)/hal.lib \
- 	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K)_LIB.x86)/ksecdd.lib \
- 	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K)_LIB.x86)/BufferOverflowK.lib
-endif
+VBoxSF_LIBS.x86  = \
+	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K3)_LIB.x86)/rxce.lib \
+	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K3)_LIB.x86)/rdbsslib.lib \
+	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K3)_LIB.x86)/copysup.lib \
+	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K3)_LIB.x86)/ntoskrnl.lib \
+	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K3)_LIB.x86)/hal.lib \
+	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K3)_LIB.x86)/ksecdd.lib \
+	$(PATH_SDK_$(VBOX_WINDDK_GST_W2K3)_LIB.x86)/BufferOverflowK.lib
 
 VBoxSF_LIBS.amd64  = \
Index: /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Win2kWorkarounds.c
===================================================================
--- /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Win2kWorkarounds.c	(revision 42302)
+++ /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Win2kWorkarounds.c	(revision 42302)
@@ -0,0 +1,186 @@
+/* $Id$ */
+/** @file
+ * VirtualBox Windows Guest Shared Folders - Windows 2000 Hacks.
+ */
+
+/*
+ * Copyright (C) 2012 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.
+ */
+
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#define FsRtlTeardownPerStreamContexts  FsRtlTeardownPerStreamContexts_AvoidIt
+#define RtlGetVersion                   RtlGetVersion_AvoidIt
+#define PsGetProcessImageFileName       PsGetProcessImageFileName_AvoidIt
+#include "vbsf.h"
+
+#include <iprt/asm.h>
+
+
+#if 0
+/*
+ * FsRtlTeardownPerStreamContexts.
+ */
+static VOID __stdcall Resolve_FsRtlTeardownPerStreamContexts(PFSRTL_ADVANCED_FCB_HEADER);
+static volatile PFN_FSRTLTEARDOWNPERSTREAMCONTEXTS g_pfnFsRtlTeardownPerStreamContexts = Resolve_FsRtlTeardownPerStreamContexts;
+
+
+static VOID __stdcall Fake_FsRtlTeardownPerStreamContexts(PFSRTL_ADVANCED_FCB_HEADER pAdvancedHeader)
+{
+    PLIST_ENTRY pCur;
+
+    ExAcquireFastMutex(pAdvancedHeader->FastMutex);
+
+    pCur = pAdvancedHeader->FilterContexts.Flink;
+    while (pCur != &pAdvancedHeader->FilterContexts)
+    {
+        PLIST_ENTRY                 pNext = pCur->Flink;
+        PFSRTL_PER_STREAM_CONTEXT   pCtx  = CONTAINING_RECORD(pCur, FSRTL_PER_STREAM_CONTEXT, Links);
+        Log(("Fake_FsRtlTeardownPerStreamContexts: %p\n", pCtx));
+        pCtx->FreeCallback(pCtx);
+        pCur = pNext;
+    }
+    InitializeListHead(&pAdvancedHeader->FilterContexts);
+
+    ExReleaseFastMutex(pAdvancedHeader->FastMutex);
+    return;
+}
+
+
+static VOID __stdcall Resolve_FsRtlTeardownPerStreamContexts(PFSRTL_ADVANCED_FCB_HEADER pAdvancedHeader)
+{
+    UNICODE_STRING                      RoutineName;
+    PFN_FSRTLTEARDOWNPERSTREAMCONTEXTS  pfn;
+    Log(("Resolve_FsRtlTeardownPerStreamContexts: %p\n", pAdvancedHeader));
+
+    RtlInitUnicodeString(&RoutineName, L"KeIpiGenericCall");
+    pfn = (PFN_FSRTLTEARDOWNPERSTREAMCONTEXTS)MmGetSystemRoutineAddress(&RoutineName);
+    if (!pfn)
+        pfn = Fake_FsRtlTeardownPerStreamContexts;
+    ASMAtomicWritePtr(&g_pfnFsRtlTeardownPerStreamContexts, pfn);
+    pfn(pAdvancedHeader);
+}
+
+
+#undef FsRtlTeardownPerStreamContexts
+__declspec(dllexport) VOID
+FsRtlTeardownPerStreamContexts(PFSRTL_ADVANCED_FCB_HEADER pAdvancedHeader)
+{
+    Log(("FsRtlTeardownPerStreamContexts: %p\n", pAdvancedHeader));
+    g_pfnFsRtlTeardownPerStreamContexts(pAdvancedHeader);
+    Log(("FsRtlTeardownPerStreamContexts: returns\n"));
+}
+#endif
+
+
+/*
+ * RtlGetVersion
+ */
+typedef NTSTATUS (__stdcall * PFNRTLGETVERSION)(PRTL_OSVERSIONINFOW);
+static NTSTATUS __stdcall Resolve_RtlGetVersion(PRTL_OSVERSIONINFOW pVerInfo);
+static volatile PFNRTLGETVERSION g_pfnRtlGetVersion = Resolve_RtlGetVersion;
+
+
+static NTSTATUS __stdcall Fake_RtlGetVersion(PRTL_OSVERSIONINFOW pVerInfo)
+{
+    Log(("Fake_RtlGetVersion: %p\n", pVerInfo));
+    if (pVerInfo->dwOSVersionInfoSize < sizeof(*pVerInfo))
+    {
+        Log(("Fake_RtlGetVersion: -> STATUS_INVALID_PARAMETER (size = %#x)\n", pVerInfo->dwOSVersionInfoSize));
+        return STATUS_INVALID_PARAMETER;
+    }
+
+    /* Report Windows 2000 w/o SP. */
+    pVerInfo->dwMajorVersion  = 5;
+    pVerInfo->dwMinorVersion  = 0;
+    pVerInfo->dwBuildNumber   = 2195;
+    pVerInfo->dwPlatformId    = VER_PLATFORM_WIN32_NT;
+    pVerInfo->szCSDVersion[0] = '\0';
+
+    if (pVerInfo->dwOSVersionInfoSize >= sizeof(RTL_OSVERSIONINFOEXW))
+    {
+        PRTL_OSVERSIONINFOEXW pVerInfoEx = (PRTL_OSVERSIONINFOEXW)pVerInfo;
+        pVerInfoEx->wServicePackMajor = 0;
+        pVerInfoEx->wServicePackMinor = 0;
+        pVerInfoEx->wSuiteMask        = 0;
+        pVerInfoEx->wProductType      = VER_NT_WORKSTATION;
+        pVerInfoEx->wReserved         = 0;
+    }
+
+    return STATUS_SUCCESS;
+}
+
+
+static NTSTATUS __stdcall Resolve_RtlGetVersion(PRTL_OSVERSIONINFOW pVerInfo)
+{
+    UNICODE_STRING  RoutineName;
+    PFNRTLGETVERSION pfn;
+    Log(("Resolve_RtlGetVersion: %p\n", pVerInfo));
+
+    RtlInitUnicodeString(&RoutineName, L"RtlGetVersion");
+    pfn = (PFNRTLGETVERSION)MmGetSystemRoutineAddress(&RoutineName);
+    if (!pfn)
+        pfn = Fake_RtlGetVersion;
+    ASMAtomicWritePtr(&g_pfnRtlGetVersion, pfn);
+
+    return pfn(pVerInfo);
+}
+
+
+#undef RtlGetVersion
+__declspec(dllexport) NTSTATUS __stdcall
+RtlGetVersion(PRTL_OSVERSIONINFOW pVerInfo)
+{
+    return g_pfnRtlGetVersion(pVerInfo);
+}
+
+
+/*
+ * PsGetProcessImageFileName
+ */
+
+typedef LPSTR (__stdcall * PFNPSGETPROCESSIMAGEFILENAME)(PEPROCESS pProcess);
+static LPSTR __stdcall Resolve_PsGetProcessImageFileName(PEPROCESS pProcess);
+static volatile PFNPSGETPROCESSIMAGEFILENAME g_pfnPsGetProcessImageFileName = Resolve_PsGetProcessImageFileName;
+
+
+static LPSTR __stdcall Fake_PsGetProcessImageFileName(PEPROCESS pProcess)
+{
+    Log(("Fake_PsGetProcessImageFileName: %p\n", pProcess));
+    return "Fake_PsGetProcessImageFileName";
+}
+
+
+static LPSTR __stdcall Resolve_PsGetProcessImageFileName(PEPROCESS pProcess)
+{
+    UNICODE_STRING                  RoutineName;
+    PFNPSGETPROCESSIMAGEFILENAME    pfn;
+    Log(("Resolve_PsGetProcessImageFileName: %p\n", pProcess));
+
+    RtlInitUnicodeString(&RoutineName, L"PsGetProcessImageFileName");
+    pfn = (PFNPSGETPROCESSIMAGEFILENAME)MmGetSystemRoutineAddress(&RoutineName);
+    if (!pfn)
+        pfn = Fake_PsGetProcessImageFileName;
+    ASMAtomicWritePtr(&g_pfnPsGetProcessImageFileName, pfn);
+
+    return pfn(pProcess);
+}
+
+
+#undef PsGetProcessImageFileName
+__declspec(dllexport) LPSTR __stdcall
+PsGetProcessImageFileName(PEPROCESS pProcess)
+{
+    return g_pfnPsGetProcessImageFileName(pProcess);
+}
+
Index: /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Win2kWorkaroundsA.asm
===================================================================
--- /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Win2kWorkaroundsA.asm	(revision 42302)
+++ /trunk/src/VBox/Additions/WINNT/SharedFolders/driver/Win2kWorkaroundsA.asm	(revision 42302)
@@ -0,0 +1,41 @@
+; $Id$
+;; @file
+; VirtualBox Windows Guest Shared Folders - Windows 2000 Hacks, Assembly Parts.
+;
+
+;
+; Copyright (C) 2006-2012 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.
+;
+
+;*******************************************************************************
+;*  Header Files                                                               *
+;*******************************************************************************
+%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
+
+;MAKE_IMPORT_ENTRY FsRtlTeardownPerStreamContexts, 4
+MAKE_IMPORT_ENTRY RtlGetVersion, 4
+MAKE_IMPORT_ENTRY PsGetProcessImageFileName, 4
+
