Index: /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp	(revision 44982)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-legacy.cpp	(revision 44983)
@@ -115,5 +115,5 @@
             if (NT_SUCCESS(rc))
             {
-                rc = vboxguestwinInit(pDrvObj, pDeviceObject, pRegPath);
+                rc = vbgdNtInit(pDrvObj, pDeviceObject, pRegPath);
                 if (NT_SUCCESS(rc))
                 {
Index: /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp	(revision 44982)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win-pnp.cpp	(revision 44983)
@@ -28,17 +28,15 @@
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
-extern winVersion_t g_winVersion;
-
 RT_C_DECLS_BEGIN
-static NTSTATUS vboxguestwinSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict);
-static NTSTATUS vboxguestwinPnPIrpComplete(PDEVICE_OBJECT pDevObj, PIRP pIrp, PKEVENT pEvent);
-static VOID     vboxguestwinShowDeviceResources(PCM_PARTIAL_RESOURCE_LIST pResourceList);
+static NTSTATUS vbgdNtSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict);
+static NTSTATUS vbgdNtPnPIrpComplete(PDEVICE_OBJECT pDevObj, PIRP pIrp, PKEVENT pEvent);
+static VOID     vbgdNtShowDeviceResources(PCM_PARTIAL_RESOURCE_LIST pResourceList);
 RT_C_DECLS_END
 
 #ifdef ALLOC_PRAGMA
-#pragma alloc_text (PAGE, vboxguestwinPnP)
-#pragma alloc_text (PAGE, vboxguestwinPower)
-#pragma alloc_text (PAGE, vboxguestwinSendIrpSynchronously)
-#pragma alloc_text (PAGE, vboxguestwinShowDeviceResources)
+#pragma alloc_text (PAGE, vbgdNtPnP)
+#pragma alloc_text (PAGE, vbgdNtPower)
+#pragma alloc_text (PAGE, vbgdNtSendIrpSynchronously)
+#pragma alloc_text (PAGE, vbgdNtShowDeviceResources)
 #endif
 
@@ -46,8 +44,4 @@
 #define LOG_ENABLED
 
-
-/*******************************************************************************
-*   Internal Functions                                                         *
-*******************************************************************************/
 
 /**
@@ -59,5 +53,5 @@
  * @return   NT status code
  */
-static NTSTATUS vboxguestwinPnpIrpComplete(PDEVICE_OBJECT pDevObj, PIRP pIrp, PKEVENT pEvent)
+static NTSTATUS vbgdNtPnpIrpComplete(PDEVICE_OBJECT pDevObj, PIRP pIrp, PKEVENT pEvent)
 {
     KeSetEvent(pEvent, 0, FALSE);
@@ -74,5 +68,5 @@
  * @return   NT status code
  */
-static NTSTATUS vboxguestwinSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict)
+static NTSTATUS vbgdNtSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict)
 {
     KEVENT event;
@@ -81,5 +75,5 @@
 
     IoCopyCurrentIrpStackLocationToNext(pIrp);
-    IoSetCompletionRoutine(pIrp, (PIO_COMPLETION_ROUTINE)vboxguestwinPnpIrpComplete,
+    IoSetCompletionRoutine(pIrp, (PIO_COMPLETION_ROUTINE)vbgdNtPnpIrpComplete,
                            &event, TRUE, TRUE, TRUE);
 
@@ -98,5 +92,5 @@
     }
 
-    Log(("VBoxGuest::vboxguestwinSendIrpSynchronously: Returning 0x%x\n", rc));
+    Log(("VBoxGuest::vbgdNtSendIrpSynchronously: Returning 0x%x\n", rc));
     return rc;
 }
@@ -109,5 +103,5 @@
  * @param  pIrp       Request packet.
  */
-NTSTATUS vboxguestwinPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+NTSTATUS vbgdNtPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp)
 {
     PVBOXGUESTDEVEXT   pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension;
@@ -142,5 +136,5 @@
         "IRP_MN_SURPRISE_REMOVAL",
     };
-    Log(("VBoxGuest::vboxguestwinGuestPnp: MinorFunction: %s\n",
+    Log(("VBoxGuest::vbgdNtGuestPnp: MinorFunction: %s\n",
            pStack->MinorFunction < (sizeof(aszFnctName) / sizeof(aszFnctName[0]))
          ? aszFnctName[pStack->MinorFunction]
@@ -153,18 +147,18 @@
         case IRP_MN_START_DEVICE:
         {
-            Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: START_DEVICE\n"));
+            Log(("VBoxGuest::vbgdNtVBoxGuestPnP: START_DEVICE\n"));
 
             /* This must be handled first by the lower driver. */
-            rc = vboxguestwinSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE);
+            rc = vbgdNtSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE);
 
             if (   NT_SUCCESS(rc)
                 && NT_SUCCESS(pIrp->IoStatus.Status))
             {
-                Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: START_DEVICE: pStack->Parameters.StartDevice.AllocatedResources = %p\n",
+                Log(("VBoxGuest::vbgdNtVBoxGuestPnP: START_DEVICE: pStack->Parameters.StartDevice.AllocatedResources = %p\n",
                      pStack->Parameters.StartDevice.AllocatedResources));
 
                 if (!pStack->Parameters.StartDevice.AllocatedResources)
                 {
-                    Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: START_DEVICE: No resources, pDevExt = %p, nextLowerDriver = %p!\n",
+                    Log(("VBoxGuest::vbgdNtVBoxGuestPnP: START_DEVICE: No resources, pDevExt = %p, nextLowerDriver = %p!\n",
                          pDevExt, pDevExt ? pDevExt->win.s.pNextLowerDriver : NULL));
                     rc = STATUS_UNSUCCESSFUL;
@@ -172,5 +166,5 @@
                 else
                 {
-                    rc = vboxguestwinInit(pDevObj, pIrp);
+                    rc = vbgdNtInit(pDevObj, pIrp);
                 }
             }
@@ -178,8 +172,8 @@
             if (NT_ERROR(rc))
             {
-                Log(("VBoxGuest::vboxguestwinGuestPnp: START_DEVICE: Error: rc = 0x%x\n", rc));
+                Log(("VBoxGuest::vbgdNtGuestPnp: START_DEVICE: Error: rc = 0x%x\n", rc));
 
                 /* Need to unmap memory in case of errors ... */
-                vboxguestwinUnmapVMMDevMemory(pDevExt);
+                vbgdNtUnmapVMMDevMemory(pDevExt);
             }
             break;
@@ -188,8 +182,8 @@
         case IRP_MN_CANCEL_REMOVE_DEVICE:
         {
-            Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: CANCEL_REMOVE_DEVICE\n"));
+            Log(("VBoxGuest::vbgdNtVBoxGuestPnP: CANCEL_REMOVE_DEVICE\n"));
 
             /* This must be handled first by the lower driver. */
-            rc = vboxguestwinSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE);
+            rc = vbgdNtSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE);
 
             if (NT_SUCCESS(rc) && pDevExt->win.s.devState == PENDINGREMOVE)
@@ -205,5 +199,5 @@
         case IRP_MN_SURPRISE_REMOVAL:
         {
-            Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: IRP_MN_SURPRISE_REMOVAL\n"));
+            Log(("VBoxGuest::vbgdNtVBoxGuestPnP: IRP_MN_SURPRISE_REMOVAL\n"));
 
             VBOXGUEST_UPDATE_DEVSTATE(pDevExt, SURPRISEREMOVED);
@@ -227,8 +221,8 @@
         case IRP_MN_QUERY_REMOVE_DEVICE:
         {
-            Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: QUERY_REMOVE_DEVICE\n"));
+            Log(("VBoxGuest::vbgdNtVBoxGuestPnP: QUERY_REMOVE_DEVICE\n"));
 
 #ifdef VBOX_REBOOT_ON_UNINSTALL
-            Log(("VBoxGuest::vboxguestwinGuestPnp: QUERY_REMOVE_DEVICE: Device cannot be removed without a reboot.\n"));
+            Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_REMOVE_DEVICE: Device cannot be removed without a reboot.\n"));
             rc = STATUS_UNSUCCESSFUL;
 #endif /* VBOX_REBOOT_ON_UNINSTALL */
@@ -244,5 +238,5 @@
 
                 rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp);
-                Log(("VBoxGuest::vboxguestwinGuestPnp: QUERY_REMOVE_DEVICE: Next lower driver replied rc = 0x%x\n", rc));
+                Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_REMOVE_DEVICE: Next lower driver replied rc = 0x%x\n", rc));
 
                 /* we must not do anything the IRP after doing IoSkip & CallDriver
@@ -258,5 +252,5 @@
         case IRP_MN_REMOVE_DEVICE:
         {
-            Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: REMOVE_DEVICE\n"));
+            Log(("VBoxGuest::vbgdNtVBoxGuestPnP: REMOVE_DEVICE\n"));
 
             VBOXGUEST_UPDATE_DEVSTATE(pDevExt, REMOVED);
@@ -264,6 +258,6 @@
             /* Free hardware resources. */
             /* @todo this should actually free I/O ports, interrupts, etc. */
-            rc = vboxguestwinCleanup(pDevObj);
-            Log(("VBoxGuest::vboxguestwinGuestPnp: REMOVE_DEVICE: vboxguestwinCleanup rc = 0x%08X\n", rc));
+            rc = vbgdNtCleanup(pDevObj);
+            Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: vbgdNtCleanup rc = 0x%08X\n", rc));
 
             /*
@@ -277,9 +271,9 @@
 
             rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp);
-            Log(("VBoxGuest::vboxguestwinGuestPnp: REMOVE_DEVICE: Next lower driver replied rc = 0x%x\n", rc));
+            Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: Next lower driver replied rc = 0x%x\n", rc));
 
             IoDetachDevice(pDevExt->win.s.pNextLowerDriver);
 
-            Log(("VBoxGuest::vboxguestwinGuestPnp: REMOVE_DEVICE: Removing device ...\n"));
+            Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: Removing device ...\n"));
 
             /* Destroy device extension and clean up everything else. */
@@ -291,5 +285,5 @@
             IoDeleteSymbolicLink(&win32Name);
 
-            Log(("VBoxGuest::vboxguestwinGuestPnp: REMOVE_DEVICE: Deleting device ...\n"));
+            Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: Deleting device ...\n"));
 
             /* Last action: Delete our device! pDevObj is *not* failed
@@ -297,5 +291,5 @@
             IoDeleteDevice(pDevObj);
 
-            Log(("VBoxGuest::vboxguestwinGuestPnp: REMOVE_DEVICE: Device removed!\n"));
+            Log(("VBoxGuest::vbgdNtGuestPnp: REMOVE_DEVICE: Device removed!\n"));
 
             /* Propagating rc from IoCallDriver. */
@@ -305,8 +299,8 @@
         case IRP_MN_CANCEL_STOP_DEVICE:
         {
-            Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: CANCEL_STOP_DEVICE\n"));
+            Log(("VBoxGuest::vbgdNtVBoxGuestPnP: CANCEL_STOP_DEVICE\n"));
 
             /* This must be handled first by the lower driver. */
-            rc = vboxguestwinSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE);
+            rc = vbgdNtSendIrpSynchronously(pDevExt->win.s.pNextLowerDriver, pIrp, TRUE);
 
             if (NT_SUCCESS(rc) && pDevExt->win.s.devState == PENDINGSTOP)
@@ -322,8 +316,8 @@
         case IRP_MN_QUERY_STOP_DEVICE:
         {
-            Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: QUERY_STOP_DEVICE\n"));
+            Log(("VBoxGuest::vbgdNtVBoxGuestPnP: QUERY_STOP_DEVICE\n"));
 
 #ifdef VBOX_REBOOT_ON_UNINSTALL
-            Log(("VBoxGuest::vboxguestwinGuestPnp: QUERY_STOP_DEVICE: Device cannot be stopped without a reboot!\n"));
+            Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_STOP_DEVICE: Device cannot be stopped without a reboot!\n"));
             pIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
 #endif /* VBOX_REBOOT_ON_UNINSTALL */
@@ -339,5 +333,5 @@
 
                 rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp);
-                Log(("VBoxGuest::vboxguestwinGuestPnp: QUERY_STOP_DEVICE: Next lower driver replied rc = 0x%x\n", rc));
+                Log(("VBoxGuest::vbgdNtGuestPnp: QUERY_STOP_DEVICE: Next lower driver replied rc = 0x%x\n", rc));
 
                 /* we must not do anything with the IRP after doing IoSkip & CallDriver
@@ -353,5 +347,5 @@
         case IRP_MN_STOP_DEVICE:
         {
-            Log(("VBoxGuest::vboxguestwinVBoxGuestPnP: STOP_DEVICE\n"));
+            Log(("VBoxGuest::vbgdNtVBoxGuestPnP: STOP_DEVICE\n"));
 
             VBOXGUEST_UPDATE_DEVSTATE(pDevExt, STOPPED);
@@ -359,6 +353,6 @@
             /* Free hardware resources. */
             /* @todo this should actually free I/O ports, interrupts, etc. */
-            rc = vboxguestwinCleanup(pDevObj);
-            Log(("VBoxGuest::vboxguestwinGuestPnp: STOP_DEVICE: cleaning up, rc = 0x%x\n", rc));
+            rc = vbgdNtCleanup(pDevObj);
+            Log(("VBoxGuest::vbgdNtGuestPnp: STOP_DEVICE: cleaning up, rc = 0x%x\n", rc));
 
             /* Pass to the lower driver. */
@@ -368,5 +362,5 @@
 
             rc = IoCallDriver(pDevExt->win.s.pNextLowerDriver, pIrp);
-            Log(("VBoxGuest::vboxguestwinGuestPnp: STOP_DEVICE: Next lower driver replied rc = 0x%x\n", rc));
+            Log(("VBoxGuest::vbgdNtGuestPnp: STOP_DEVICE: Next lower driver replied rc = 0x%x\n", rc));
 
             return rc;
@@ -384,5 +378,5 @@
     IoCompleteRequest(pIrp, IO_NO_INCREMENT);
 
-    Log(("VBoxGuest::vboxguestwinGuestPnp: Returning with rc = 0x%x\n", rc));
+    Log(("VBoxGuest::vbgdNtGuestPnp: Returning with rc = 0x%x\n", rc));
     return rc;
 }
@@ -397,6 +391,5 @@
  * @param pContext  Context value passed to IoSetCompletionRoutine in VBoxGuestPower.
  */
-NTSTATUS vboxguestwinPowerComplete(IN PDEVICE_OBJECT pDevObj,
-                                   IN PIRP pIrp, IN PVOID pContext)
+static NTSTATUS vbgdNtPowerComplete(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp, IN PVOID pContext)
 {
     PIO_STACK_LOCATION pIrpSp;
@@ -442,5 +435,5 @@
  * @param     pIrp      IRP
  */
-NTSTATUS vboxguestwinPower(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+NTSTATUS vbgdNtPower(PDEVICE_OBJECT pDevObj, PIRP pIrp)
 {
     PIO_STACK_LOCATION pStack = IoGetCurrentIrpStackLocation(pIrp);
@@ -450,5 +443,5 @@
     POWER_ACTION       powerAction;
 
-    Log(("VBoxGuest::vboxguestwinGuestPower\n"));
+    Log(("VBoxGuest::vbgdNtGuestPower\n"));
 
     powerType   = pStack->Parameters.Power.Type;
@@ -460,10 +453,10 @@
         case IRP_MN_SET_POWER:
         {
-            Log(("VBoxGuest::vboxguestwinGuestPower: IRP_MN_SET_POWER, type= %d\n", powerType));
+            Log(("VBoxGuest::vbgdNtGuestPower: IRP_MN_SET_POWER, type= %d\n", powerType));
             switch (powerType)
             {
                 case SystemPowerState:
                 {
-                    Log(("VBoxGuest::vboxguestwinGuestPower: SystemPowerState, action = %d, state = %d\n", powerAction, powerState));
+                    Log(("VBoxGuest::vbgdNtGuestPower: SystemPowerState, action = %d, state = %d\n", powerAction, powerState));
 
                     switch (powerAction)
@@ -477,8 +470,9 @@
                                     && pDevExt->win.s.LastSystemPowerAction == PowerActionHibernate)
                                 {
-                                    Log(("VBoxGuest::vboxguestwinGuestPower: Returning from hibernation!\n"));
-                                    int rc = VBoxGuestReinitDevExtAfterHibernation(pDevExt, vboxguestwinVersionToOSType(g_winVersion));
+                                    Log(("VBoxGuest::vbgdNtGuestPower: Returning from hibernation!\n"));
+                                    int rc = VBoxGuestReinitDevExtAfterHibernation(pDevExt,
+                                                                                   vbgdNtVersionToOSType(g_enmVbgdNtVer));
                                     if (RT_FAILURE(rc))
-                                        Log(("VBoxGuest::vboxguestwinGuestPower: Cannot re-init VMMDev chain, rc = %d!\n", rc));
+                                        Log(("VBoxGuest::vbgdNtGuestPower: Cannot re-init VMMDev chain, rc = %d!\n", rc));
                                 }
                             }
@@ -487,5 +481,5 @@
                         case PowerActionShutdownReset:
                         {
-                            Log(("VBoxGuest::vboxguestwinGuestPower: Power action reset!\n"));
+                            Log(("VBoxGuest::vbgdNtGuestPower: Power action reset!\n"));
 
                             /* Tell the VMM that we no longer support mouse pointer integration. */
@@ -516,8 +510,8 @@
                         case PowerActionShutdownOff:
                         {
-                            Log(("VBoxGuest::vboxguestwinGuestPower: Power action shutdown!\n"));
+                            Log(("VBoxGuest::vbgdNtGuestPower: Power action shutdown!\n"));
                             if (powerState.SystemState >= PowerSystemShutdown)
                             {
-                                Log(("VBoxGuest::vboxguestwinGuestPower: Telling the VMMDev to close the VM ...\n"));
+                                Log(("VBoxGuest::vbgdNtGuestPower: Telling the VMMDev to close the VM ...\n"));
 
                                 VMMDevPowerStateRequest *pReq = pDevExt->win.s.pPowerStateRequest;
@@ -544,5 +538,5 @@
                         case PowerActionHibernate:
 
-                            Log(("VBoxGuest::vboxguestwinGuestPower: Power action hibernate!\n"));
+                            Log(("VBoxGuest::vbgdNtGuestPower: Power action hibernate!\n"));
                             break;
                     }
@@ -578,5 +572,5 @@
     IoCopyCurrentIrpStackLocationToNext(pIrp);
     IoSetCompletionRoutine(pIrp,
-                           vboxguestwinPowerComplete,
+                           vbgdNtPowerComplete,
                            (PVOID)pDevExt,
                            TRUE,
Index: /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp	(revision 44982)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp	(revision 44983)
@@ -1,7 +1,9 @@
+/* $Id$ */
 /** @file
- *
  * VBoxGuest - Windows specifics.
- *
- * Copyright (C) 2010-2012 Oracle Corporation
+ */
+
+/*
+ * Copyright (C) 2010-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -36,20 +38,21 @@
 #endif
 
+
 /*******************************************************************************
 *   Internal Functions                                                         *
 *******************************************************************************/
 RT_C_DECLS_BEGIN
-static NTSTATUS vboxguestwinAddDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj);
-static void     vboxguestwinUnload(PDRIVER_OBJECT pDrvObj);
-static NTSTATUS vboxguestwinCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp);
-static NTSTATUS vboxguestwinClose(PDEVICE_OBJECT pDevObj, PIRP pIrp);
-static NTSTATUS vboxguestwinIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp);
-static NTSTATUS vboxguestwinInternalIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp);
-static NTSTATUS vboxguestwinRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName, PULONG puValue);
-static NTSTATUS vboxguestwinSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp);
-static NTSTATUS vboxguestwinShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp);
-static NTSTATUS vboxguestwinNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+static NTSTATUS vbgdNtAddDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj);
+static void     vbgdNtUnload(PDRIVER_OBJECT pDrvObj);
+static NTSTATUS vbgdNtCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+static NTSTATUS vbgdNtClose(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+static NTSTATUS vbgdNtIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+static NTSTATUS vbgdNtInternalIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+static NTSTATUS vbgdNtRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName, PULONG puValue);
+static NTSTATUS vbgdNtSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+static NTSTATUS vbgdNtShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+static NTSTATUS vbgdNtNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp);
 #ifdef DEBUG
-static void     vboxguestwinDoTests(void);
+static void     vbgdNtDoTests(void);
 #endif
 RT_C_DECLS_END
@@ -64,17 +67,23 @@
 
 #ifdef ALLOC_PRAGMA
-#pragma alloc_text (INIT, DriverEntry)
-#pragma alloc_text (PAGE, vboxguestwinAddDevice)
-#pragma alloc_text (PAGE, vboxguestwinUnload)
-#pragma alloc_text (PAGE, vboxguestwinCreate)
-#pragma alloc_text (PAGE, vboxguestwinClose)
-#pragma alloc_text (PAGE, vboxguestwinIOCtl)
-#pragma alloc_text (PAGE, vboxguestwinShutdown)
-#pragma alloc_text (PAGE, vboxguestwinNotSupportedStub)
-#pragma alloc_text (PAGE, vboxguestwinScanPCIResourceList)
-#endif
-
-/** The detected Windows version. */
-winVersion_t g_winVersion;
+# pragma alloc_text(INIT, DriverEntry)
+# pragma alloc_text(PAGE, vbgdNtAddDevice)
+# pragma alloc_text(PAGE, vbgdNtUnload)
+# pragma alloc_text(PAGE, vbgdNtCreate)
+# pragma alloc_text(PAGE, vbgdNtClose)
+# pragma alloc_text(PAGE, vbgdNtIOCtl)
+# pragma alloc_text(PAGE, vbgdNtShutdown)
+# pragma alloc_text(PAGE, vbgdNtNotSupportedStub)
+# pragma alloc_text(PAGE, vbgdNtScanPCIResourceList)
+#endif
+
+
+/*******************************************************************************
+*   Global Variables                                                           *
+*******************************************************************************/
+/** The detected NT (windows) version. */
+VBGDNTVER g_enmVbgdNtVer = VBGDNTVER_INVALID;
+
+
 
 /**
@@ -91,31 +100,34 @@
     Log(("VBoxGuest::DriverEntry. Driver built: %s %s\n", __DATE__, __TIME__));
 
-    ULONG majorVersion;
-    ULONG minorVersion;
-    ULONG buildNumber;
-    BOOLEAN bCheckedBuild = PsGetVersion(&majorVersion, &minorVersion, &buildNumber, NULL);
-    Log(("VBoxGuest::DriverEntry: Running on Windows NT version %d.%d, build %d\n", majorVersion, minorVersion, buildNumber));
-    if (bCheckedBuild)
+    /*
+     * Check if the the NT version is supported and initializing
+     * g_enmVbgdNtVer in the process.
+     */
+    ULONG ulMajorVer;
+    ULONG ulMinorVer;
+    ULONG ulBuildNo;
+    BOOLEAN fCheckedBuild = PsGetVersion(&ulMajorVer, &ulMinorVer, &ulBuildNo, NULL);
+    Log(("VBoxGuest::DriverEntry: Running on Windows NT version %u.%u, build %u\n", ulMajorVer, ulMinorVer, ulBuildNo));
+    if (fCheckedBuild)
         Log(("VBoxGuest::DriverEntry: Running on a Windows checked build (debug)!\n"));
 #ifdef DEBUG
-    vboxguestwinDoTests();
-#endif
-    switch (majorVersion)
+    vbgdNtDoTests();
+#endif
+    switch (ulMajorVer)
     {
         case 6: /* Windows Vista or Windows 7 (based on minor ver) */
-            switch (minorVersion)
+            switch (ulMinorVer)
             {
                 case 0: /* Note: Also could be Windows 2008 Server! */
-                    g_winVersion = WINVISTA;
+                    g_enmVbgdNtVer = VBGDNTVER_WINVISTA;
                     break;
                 case 1: /* Note: Also could be Windows 2008 Server R2! */
-                    g_winVersion = WIN7;
+                    g_enmVbgdNtVer = VBGDNTVER_WIN7;
                     break;
                 case 2:
-                    g_winVersion = WIN8;
+                    g_enmVbgdNtVer = VBGDNTVER_WIN8;
                     break;
                 default:
-                    Log(("VBoxGuest::DriverEntry: Unknown version of Windows (%u.%u), refusing!\n",
-                         majorVersion, minorVersion));
+                    Log(("VBoxGuest::DriverEntry: Unknown version of Windows (%u.%u), refusing!\n", ulMajorVer, ulMinorVer));
                     rc = STATUS_DRIVER_UNABLE_TO_LOAD;
                     break;
@@ -123,27 +135,30 @@
             break;
         case 5:
-            switch (minorVersion)
+            switch (ulMinorVer)
             {
                 case 2:
-                    g_winVersion = WIN2K3;
+                    g_enmVbgdNtVer = VBGDNTVER_WIN2K3;
                     break;
                 case 1:
-                    g_winVersion = WINXP;
+                    g_enmVbgdNtVer = VBGDNTVER_WINXP;
                     break;
                 case 0:
-                    g_winVersion = WIN2K;
+                    g_enmVbgdNtVer = VBGDNTVER_WIN2K;
                     break;
                 default:
-                    Log(("VBoxGuest::DriverEntry: Unknown version of Windows (%u.%u), refusing!\n",
-                         majorVersion, minorVersion));
+                    Log(("VBoxGuest::DriverEntry: Unknown version of Windows (%u.%u), refusing!\n", ulMajorVer, ulMinorVer));
                     rc = STATUS_DRIVER_UNABLE_TO_LOAD;
             }
             break;
         case 4:
-            g_winVersion = WINNT4;
+            g_enmVbgdNtVer = VBGDNTVER_WINNT4;
             break;
         default:
-            Log(("VBoxGuest::DriverEntry: At least Windows NT4 required!\n"));
+            if (ulMajorVer < 4)
+                Log(("VBoxGuest::DriverEntry: At least Windows NT4 required! (%u.%u)\n", ulMajorVer, ulMinorVer));
+            else
+                Log(("VBoxGuest::DriverEntry: Too new version %u.%u!\n", ulMajorVer, ulMinorVer));
             rc = STATUS_DRIVER_UNABLE_TO_LOAD;
+            break;
     }
 
@@ -153,19 +168,19 @@
          * Setup the driver entry points in pDrvObj.
          */
-        pDrvObj->DriverUnload                                  = vboxguestwinUnload;
-        pDrvObj->MajorFunction[IRP_MJ_CREATE]                  = vboxguestwinCreate;
-        pDrvObj->MajorFunction[IRP_MJ_CLOSE]                   = vboxguestwinClose;
-        pDrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL]          = vboxguestwinIOCtl;
-        pDrvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = vboxguestwinInternalIOCtl;
-        pDrvObj->MajorFunction[IRP_MJ_SHUTDOWN]                = vboxguestwinShutdown;
-        pDrvObj->MajorFunction[IRP_MJ_READ]                    = vboxguestwinNotSupportedStub;
-        pDrvObj->MajorFunction[IRP_MJ_WRITE]                   = vboxguestwinNotSupportedStub;
+        pDrvObj->DriverUnload                                  = vbgdNtUnload;
+        pDrvObj->MajorFunction[IRP_MJ_CREATE]                  = vbgdNtCreate;
+        pDrvObj->MajorFunction[IRP_MJ_CLOSE]                   = vbgdNtClose;
+        pDrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL]          = vbgdNtIOCtl;
+        pDrvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = vbgdNtInternalIOCtl;
+        pDrvObj->MajorFunction[IRP_MJ_SHUTDOWN]                = vbgdNtShutdown;
+        pDrvObj->MajorFunction[IRP_MJ_READ]                    = vbgdNtNotSupportedStub;
+        pDrvObj->MajorFunction[IRP_MJ_WRITE]                   = vbgdNtNotSupportedStub;
 #ifdef TARGET_NT4
         rc = vbgdNt4CreateDevice(pDrvObj, NULL /* pDevObj */, pRegPath);
 #else
-        pDrvObj->MajorFunction[IRP_MJ_PNP]                     = vboxguestwinPnP;
-        pDrvObj->MajorFunction[IRP_MJ_POWER]                   = vboxguestwinPower;
-        pDrvObj->MajorFunction[IRP_MJ_SYSTEM_CONTROL]          = vboxguestwinSystemControl;
-        pDrvObj->DriverExtension->AddDevice                    = (PDRIVER_ADD_DEVICE)vboxguestwinAddDevice;
+        pDrvObj->MajorFunction[IRP_MJ_PNP]                     = vbgdNtPnP;
+        pDrvObj->MajorFunction[IRP_MJ_POWER]                   = vbgdNtPower;
+        pDrvObj->MajorFunction[IRP_MJ_SYSTEM_CONTROL]          = vbgdNtSystemControl;
+        pDrvObj->DriverExtension->AddDevice                    = (PDRIVER_ADD_DEVICE)vbgdNtAddDevice;
 #endif
     }
@@ -184,8 +199,8 @@
  * @param  pDevObj   Device object
  */
-static NTSTATUS vboxguestwinAddDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj)
+static NTSTATUS vbgdNtAddDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj)
 {
     NTSTATUS rc;
-    Log(("VBoxGuest::vboxguestwinGuestAddDevice\n"));
+    Log(("VBoxGuest::vbgdNtGuestAddDevice\n"));
 
     /*
@@ -222,13 +237,13 @@
             if (pDevExt->win.s.pNextLowerDriver == NULL)
             {
-                Log(("VBoxGuest::vboxguestwinGuestAddDevice: IoAttachDeviceToDeviceStack did not give a nextLowerDriver!\n"));
+                Log(("VBoxGuest::vbgdNtGuestAddDevice: IoAttachDeviceToDeviceStack did not give a nextLowerDriver!\n"));
                 rc = STATUS_DEVICE_NOT_CONNECTED;
             }
         }
         else
-            Log(("VBoxGuest::vboxguestwinGuestAddDevice: IoCreateSymbolicLink failed with rc=%#x!\n", rc));
+            Log(("VBoxGuest::vbgdNtGuestAddDevice: IoCreateSymbolicLink failed with rc=%#x!\n", rc));
     }
     else
-        Log(("VBoxGuest::vboxguestwinGuestAddDevice: IoCreateDevice failed with rc=%#x!\n", rc));
+        Log(("VBoxGuest::vbgdNtGuestAddDevice: IoCreateDevice failed with rc=%#x!\n", rc));
 
     if (NT_SUCCESS(rc))
@@ -239,5 +254,5 @@
          */
 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION
-        vboxguestwinBugCheckCallback(pDevExt); /* Ignore failure! */
+        vbgdNtBugCheckCallback(pDevExt); /* Ignore failure! */
 #endif
         /* VBoxGuestPower is pageable; ensure we are not called at elevated IRQL */
@@ -261,5 +276,5 @@
     }
 
-    Log(("VBoxGuest::vboxguestwinGuestAddDevice: returning with rc = 0x%x\n", rc));
+    Log(("VBoxGuest::vbgdNtGuestAddDevice: returning with rc = 0x%x\n", rc));
     return rc;
 }
@@ -272,5 +287,5 @@
  * @param pResourceList  list of device resources.
  */
-static void vboxguestwinShowDeviceResources(PCM_PARTIAL_RESOURCE_LIST pResourceList)
+static void vbgdNtShowDeviceResources(PCM_PARTIAL_RESOURCE_LIST pResourceList)
 {
 #ifdef LOG_ENABLED
@@ -296,5 +311,5 @@
         };
 
-        Log(("VBoxGuest::vboxguestwinShowDeviceResources: Type %s",
+        Log(("VBoxGuest::vbgdNtShowDeviceResources: Type %s",
                uType < (sizeof(aszName) / sizeof(aszName[0]))
              ? aszName[uType] : "Unknown"));
@@ -304,5 +319,5 @@
             case CmResourceTypePort:
             case CmResourceTypeMemory:
-                Log(("VBoxGuest::vboxguestwinShowDeviceResources: Start %8X%8.8lX length %X\n",
+                Log(("VBoxGuest::vbgdNtShowDeviceResources: Start %8X%8.8lX length %X\n",
                          resource->u.Port.Start.HighPart, resource->u.Port.Start.LowPart,
                          resource->u.Port.Length));
@@ -310,5 +325,5 @@
 
             case CmResourceTypeInterrupt:
-                Log(("VBoxGuest::vboxguestwinShowDeviceResources: Level %X, Vector %X, Affinity %X\n",
+                Log(("VBoxGuest::vbgdNtShowDeviceResources: Level %X, Vector %X, Affinity %X\n",
                          resource->u.Interrupt.Level, resource->u.Interrupt.Vector,
                          resource->u.Interrupt.Affinity));
@@ -316,5 +331,5 @@
 
             case CmResourceTypeDma:
-                Log(("VBoxGuest::vboxguestwinShowDeviceResources: Channel %d, Port %X\n",
+                Log(("VBoxGuest::vbgdNtShowDeviceResources: Channel %d, Port %X\n",
                          resource->u.Dma.Channel, resource->u.Dma.Port));
                 break;
@@ -336,7 +351,7 @@
  */
 #ifndef TARGET_NT4
-NTSTATUS vboxguestwinInit(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+NTSTATUS vbgdNtInit(PDEVICE_OBJECT pDevObj, PIRP pIrp)
 #else
-NTSTATUS vboxguestwinInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath)
+NTSTATUS vbgdNtInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath)
 #endif
 {
@@ -346,5 +361,5 @@
 #endif
 
-    Log(("VBoxGuest::vboxguestwinInit\n"));
+    Log(("VBoxGuest::vbgdNtInit\n"));
 
     int rc = STATUS_SUCCESS;
@@ -353,5 +368,5 @@
      * Let's have a look at what our PCI adapter offers.
      */
-    Log(("VBoxGuest::vboxguestwinInit: Starting to scan PCI resources of VBoxGuest ...\n"));
+    Log(("VBoxGuest::vbgdNtInit: Starting to scan PCI resources of VBoxGuest ...\n"));
 
     /* Assign the PCI resources. */
@@ -364,12 +379,12 @@
                                 &pResourceList);
     if (pResourceList && pResourceList->Count > 0)
-        vboxguestwinShowDeviceResources(&pResourceList->List[0].PartialResourceList);
+        vbgdNtShowDeviceResources(&pResourceList->List[0].PartialResourceList);
     if (NT_SUCCESS(rc))
-        rc = vboxguestwinScanPCIResourceList(pResourceList, pDevExt);
+        rc = vbgdNtScanPCIResourceList(pResourceList, pDevExt);
 #else
     if (pStack->Parameters.StartDevice.AllocatedResources->Count > 0)
-        vboxguestwinShowDeviceResources(&pStack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList);
+        vbgdNtShowDeviceResources(&pStack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList);
     if (NT_SUCCESS(rc))
-        rc = vboxguestwinScanPCIResourceList(pStack->Parameters.StartDevice.AllocatedResourcesTranslated,
+        rc = vbgdNtScanPCIResourceList(pStack->Parameters.StartDevice.AllocatedResourcesTranslated,
                                              pDevExt);
 #endif
@@ -382,14 +397,14 @@
         void *pvMMIOBase = NULL;
         uint32_t cbMMIO = 0;
-        rc = vboxguestwinMapVMMDevMemory(pDevExt,
-                                         pDevExt->win.s.vmmDevPhysMemoryAddress,
-                                         pDevExt->win.s.vmmDevPhysMemoryLength,
-                                         &pvMMIOBase,
-                                         &cbMMIO);
+        rc = vbgdNtMapVMMDevMemory(pDevExt,
+                                   pDevExt->win.s.vmmDevPhysMemoryAddress,
+                                   pDevExt->win.s.vmmDevPhysMemoryLength,
+                                   &pvMMIOBase,
+                                   &cbMMIO);
         if (NT_SUCCESS(rc))
         {
             pDevExt->pVMMDevMemory = (VMMDevMemory *)pvMMIOBase;
 
-            Log(("VBoxGuest::vboxguestwinInit: pvMMIOBase = 0x%p, pDevExt = 0x%p, pDevExt->pVMMDevMemory = 0x%p\n",
+            Log(("VBoxGuest::vbgdNtInit: pvMMIOBase = 0x%p, pDevExt = 0x%p, pDevExt->pVMMDevMemory = 0x%p\n",
                  pvMMIOBase, pDevExt, pDevExt ? pDevExt->pVMMDevMemory : NULL));
 
@@ -397,14 +412,14 @@
                                           pDevExt->IOPortBase,
                                           pvMMIOBase, cbMMIO,
-                                          vboxguestwinVersionToOSType(g_winVersion),
+                                          vbgdNtVersionToOSType(g_enmVbgdNtVer),
                                           VMMDEV_EVENT_MOUSE_POSITION_CHANGED);
             if (RT_FAILURE(vrc))
             {
-                Log(("VBoxGuest::vboxguestwinInit: Could not init device extension, rc = %Rrc!\n", vrc));
+                Log(("VBoxGuest::vbgdNtInit: Could not init device extension, rc = %Rrc!\n", vrc));
                 rc = STATUS_DEVICE_CONFIGURATION_ERROR;
             }
         }
         else
-            Log(("VBoxGuest::vboxguestwinInit: Could not map physical address of VMMDev, rc = 0x%x!\n", rc));
+            Log(("VBoxGuest::vbgdNtInit: Could not map physical address of VMMDev, rc = 0x%x!\n", rc));
     }
 
@@ -415,5 +430,5 @@
         if (RT_FAILURE(vrc))
         {
-            Log(("VBoxGuest::vboxguestwinInit: Alloc for pPowerStateRequest failed, rc = %Rrc\n", vrc));
+            Log(("VBoxGuest::vbgdNtInit: Alloc for pPowerStateRequest failed, rc = %Rrc\n", vrc));
             rc = STATUS_UNSUCCESSFUL;
         }
@@ -425,7 +440,7 @@
          * Register DPC and ISR.
          */
-        Log(("VBoxGuest::vboxguestwinInit: Initializing DPC/ISR ...\n"));
-
-        IoInitializeDpcRequest(pDevExt->win.s.pDeviceObject, vboxguestwinDpcHandler);
+        Log(("VBoxGuest::vbgdNtInit: Initializing DPC/ISR ...\n"));
+
+        IoInitializeDpcRequest(pDevExt->win.s.pDeviceObject, vbgdNtDpcHandler);
 #ifdef TARGET_NT4
         ULONG uInterruptVector;
@@ -436,5 +451,5 @@
             || pDevExt->win.s.interruptVector)
         {
-            Log(("VBoxGuest::vboxguestwinInit: Getting interrupt vector (HAL): Bus: %u, IRQL: %u, Vector: %u\n",
+            Log(("VBoxGuest::vbgdNtInit: Getting interrupt vector (HAL): Bus: %u, IRQL: %u, Vector: %u\n",
                  pDevExt->win.s.busNumber, pDevExt->win.s.interruptLevel, pDevExt->win.s.interruptVector));
 
@@ -445,46 +460,46 @@
                                                      &irqLevel,
                                                      &pDevExt->win.s.interruptAffinity);
-            Log(("VBoxGuest::vboxguestwinInit: HalGetInterruptVector returns vector %u\n", uInterruptVector));
+            Log(("VBoxGuest::vbgdNtInit: HalGetInterruptVector returns vector %u\n", uInterruptVector));
             if (uInterruptVector == 0)
-                Log(("VBoxGuest::vboxguestwinInit: No interrupt vector found!\n"));
+                Log(("VBoxGuest::vbgdNtInit: No interrupt vector found!\n"));
         }
         else
-            Log(("VBoxGuest::vboxguestwinInit: Device does not provide an interrupt!\n"));
+            Log(("VBoxGuest::vbgdNtInit: Device does not provide an interrupt!\n"));
 #endif
         if (pDevExt->win.s.interruptVector)
         {
-            Log(("VBoxGuest::vboxguestwinInit: Connecting interrupt ...\n"));
-
-            rc = IoConnectInterrupt(&pDevExt->win.s.pInterruptObject,          /* Out: interrupt object. */
-                                    (PKSERVICE_ROUTINE)vboxguestwinIsrHandler, /* Our ISR handler. */
-                                    pDevExt,                                   /* Device context. */
-                                    NULL,                                      /* Optional spinlock. */
+            Log(("VBoxGuest::vbgdNtInit: Connecting interrupt ...\n"));
+
+            rc = IoConnectInterrupt(&pDevExt->win.s.pInterruptObject,         /* Out: interrupt object. */
+                                    (PKSERVICE_ROUTINE)vbgdNtIsrHandler,      /* Our ISR handler. */
+                                    pDevExt,                                  /* Device context. */
+                                    NULL,                                     /* Optional spinlock. */
 #ifdef TARGET_NT4
-                                    uInterruptVector,                          /* Interrupt vector. */
-                                    irqLevel,                                  /* Interrupt level. */
-                                    irqLevel,                                  /* Interrupt level. */
+                                    uInterruptVector,                         /* Interrupt vector. */
+                                    irqLevel,                                 /* Interrupt level. */
+                                    irqLevel,                                 /* Interrupt level. */
 #else
-                                    pDevExt->win.s.interruptVector,            /* Interrupt vector. */
-                                    (KIRQL)pDevExt->win.s.interruptLevel,      /* Interrupt level. */
-                                    (KIRQL)pDevExt->win.s.interruptLevel,      /* Interrupt level. */
-#endif
-                                    pDevExt->win.s.interruptMode,              /* LevelSensitive or Latched. */
-                                    TRUE,                                      /* Shareable interrupt. */
-                                    pDevExt->win.s.interruptAffinity,          /* CPU affinity. */
-                                    FALSE);                                    /* Don't save FPU stack. */
+                                    pDevExt->win.s.interruptVector,           /* Interrupt vector. */
+                                    (KIRQL)pDevExt->win.s.interruptLevel,     /* Interrupt level. */
+                                    (KIRQL)pDevExt->win.s.interruptLevel,     /* Interrupt level. */
+#endif
+                                    pDevExt->win.s.interruptMode,             /* LevelSensitive or Latched. */
+                                    TRUE,                                     /* Shareable interrupt. */
+                                    pDevExt->win.s.interruptAffinity,         /* CPU affinity. */
+                                    FALSE);                                   /* Don't save FPU stack. */
             if (NT_ERROR(rc))
-                Log(("VBoxGuest::vboxguestwinInit: Could not connect interrupt, rc = 0x%x\n", rc));
+                Log(("VBoxGuest::vbgdNtInit: Could not connect interrupt, rc = 0x%x\n", rc));
         }
         else
-            Log(("VBoxGuest::vboxguestwinInit: No interrupt vector found!\n"));
+            Log(("VBoxGuest::vbgdNtInit: No interrupt vector found!\n"));
     }
 
 
 #ifdef VBOX_WITH_HGCM
-    Log(("VBoxGuest::vboxguestwinInit: Allocating kernel session data ...\n"));
+    Log(("VBoxGuest::vbgdNtInit: Allocating kernel session data ...\n"));
     int vrc = VBoxGuestCreateKernelSession(pDevExt, &pDevExt->win.s.pKernelSession);
     if (RT_FAILURE(vrc))
     {
-        Log(("VBoxGuest::vboxguestwinInit: Failed to allocated kernel session data! rc = %Rrc\n", rc));
+        Log(("VBoxGuest::vbgdNtInit: Failed to allocated kernel session data! rc = %Rrc\n", rc));
         rc = STATUS_UNSUCCESSFUL;
     }
@@ -494,7 +509,6 @@
     {
         ULONG ulValue = 0;
-        NTSTATUS s = vboxguestwinRegistryReadDWORD(RTL_REGISTRY_SERVICES, L"VBoxGuest", L"LoggingEnabled",
-                                                   &ulValue);
-        if (NT_SUCCESS(s))
+        NTSTATUS rcNt = vbgdNtRegistryReadDWORD(RTL_REGISTRY_SERVICES, L"VBoxGuest", L"LoggingEnabled", &ulValue);
+        if (NT_SUCCESS(rcNt))
         {
             pDevExt->fLoggingEnabled = ulValue >= 0xFF;
@@ -504,5 +518,5 @@
 
         /* Ready to rumble! */
-        Log(("VBoxGuest::vboxguestwinInit: Device is ready!\n"));
+        Log(("VBoxGuest::vbgdNtInit: Device is ready!\n"));
         VBOXGUEST_UPDATE_DEVSTATE(pDevExt, WORKING);
     }
@@ -512,5 +526,5 @@
     }
 
-    Log(("VBoxGuest::vboxguestwinInit: Returned with rc = 0x%x\n", rc));
+    Log(("VBoxGuest::vbgdNtInit: Returned with rc = 0x%x\n", rc));
     return rc;
 }
@@ -523,7 +537,7 @@
  * @param   pDrvObj     Driver object.
  */
-NTSTATUS vboxguestwinCleanup(PDEVICE_OBJECT pDevObj)
-{
-    Log(("VBoxGuest::vboxguestwinCleanup\n"));
+NTSTATUS vbgdNtCleanup(PDEVICE_OBJECT pDevObj)
+{
+    Log(("VBoxGuest::vbgdNtCleanup\n"));
 
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension;
@@ -554,5 +568,5 @@
 #endif
         /* According to MSDN we have to unmap previously mapped memory. */
-        vboxguestwinUnmapVMMDevMemory(pDevExt);
+        vbgdNtUnmapVMMDevMemory(pDevExt);
     }
     return STATUS_SUCCESS;
@@ -565,9 +579,9 @@
  * @param   pDrvObj     Driver object.
  */
-static void vboxguestwinUnload(PDRIVER_OBJECT pDrvObj)
-{
-    Log(("VBoxGuest::vboxguestwinGuestUnload\n"));
+static void vbgdNtUnload(PDRIVER_OBJECT pDrvObj)
+{
+    Log(("VBoxGuest::vbgdNtGuestUnload\n"));
 #ifdef TARGET_NT4
-    vboxguestwinCleanup(pDrvObj->DeviceObject);
+    vbgdNtCleanup(pDrvObj->DeviceObject);
 
     /* Destroy device extension and clean up everything else. */
@@ -590,5 +604,5 @@
 #endif
 
-    Log(("VBoxGuest::vboxguestwinGuestUnload: returning\n"));
+    Log(("VBoxGuest::vbgdNtGuestUnload: returning\n"));
 }
 
@@ -600,5 +614,5 @@
  * @param   pIrp        Request packet.
  */
-static NTSTATUS vboxguestwinCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+static NTSTATUS vbgdNtCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp)
 {
     /** @todo AssertPtrReturn(pIrp); */
@@ -611,5 +625,5 @@
     if (pDevExt->win.s.devState != WORKING)
     {
-        Log(("VBoxGuest::vboxguestwinGuestCreate: device is not working currently: %d!\n",
+        Log(("VBoxGuest::vbgdNtGuestCreate: device is not working currently: %d!\n",
              pDevExt->win.s.devState));
         rc = STATUS_UNSUCCESSFUL;
@@ -621,5 +635,5 @@
          * (But this is possible.)
          */
-        Log(("VBoxGuest::vboxguestwinGuestCreate: Uhm, we're not a directory!\n"));
+        Log(("VBoxGuest::vbgdNtGuestCreate: Uhm, we're not a directory!\n"));
         rc = STATUS_NOT_A_DIRECTORY;
     }
@@ -629,5 +643,5 @@
         if (pFileObj)
         {
-            Log(("VBoxGuest::vboxguestwinGuestCreate: File object type = %d\n",
+            Log(("VBoxGuest::vbgdNtGuestCreate: File object type = %d\n",
                  pFileObj->Type));
 
@@ -658,5 +672,5 @@
     IoCompleteRequest(pIrp, IO_NO_INCREMENT);
 
-    Log(("VBoxGuest::vboxguestwinGuestCreate: Returning 0x%x\n", rc));
+    Log(("VBoxGuest::vbgdNtGuestCreate: Returning 0x%x\n", rc));
     return rc;
 }
@@ -669,5 +683,5 @@
  * @param   pIrp        Request packet.
  */
-static NTSTATUS vboxguestwinClose(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+static NTSTATUS vbgdNtClose(PDEVICE_OBJECT pDevObj, PIRP pIrp)
 {
     PVBOXGUESTDEVEXT   pDevExt  = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension;
@@ -675,5 +689,5 @@
     PFILE_OBJECT       pFileObj = pStack->FileObject;
 
-    Log(("VBoxGuest::vboxguestwinGuestClose: pDevExt=0x%p pFileObj=0x%p FsContext=0x%p\n",
+    Log(("VBoxGuest::vbgdNtGuestClose: pDevExt=0x%p pFileObj=0x%p FsContext=0x%p\n",
          pDevExt, pFileObj, pFileObj->FsContext));
 
@@ -700,5 +714,5 @@
  * @param   pIrp        Request packet.
  */
-static NTSTATUS vboxguestwinIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+static NTSTATUS vbgdNtIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp)
 {
     NTSTATUS            Status   = STATUS_SUCCESS;
@@ -717,5 +731,5 @@
         pSession = (PVBOXGUESTSESSION)pFileObj->FsContext;
 
-    Log(("VBoxGuest::vboxguestwinIOCtl: uCmd=%u, pDevExt=0x%p, pSession=0x%p\n",
+    Log(("VBoxGuest::vbgdNtIOCtl: uCmd=%u, pDevExt=0x%p, pSession=0x%p\n",
          uCmd, pDevExt, pSession));
 
@@ -726,5 +740,5 @@
     if (pSession == NULL)
     {
-        Log(("VBoxGuest::vboxguestwinIOCtl: Using kernel session data ...\n"));
+        Log(("VBoxGuest::vbgdNtIOCtl: Using kernel session data ...\n"));
         pSession = pDevExt->win.s.pKernelSession;
     }
@@ -740,5 +754,5 @@
         case VBOXGUEST_IOCTL_ENABLE_VRDP_SESSION:
         {
-            LogRel(("VBoxGuest::vboxguestwinIOCtl: ENABLE_VRDP_SESSION: Currently: %sabled\n",
+            LogRel(("VBoxGuest::vbgdNtIOCtl: ENABLE_VRDP_SESSION: Currently: %sabled\n",
                     pDevExt->fVRDPEnabled? "en": "dis"));
             if (!pDevExt->fVRDPEnabled)
@@ -747,5 +761,5 @@
 
                 pDevExt->fVRDPEnabled            = true;
-                LogRel(("VBoxGuest::vboxguestwinIOCtl: ENABLE_VRDP_SESSION: Current active console ID: 0x%08X\n",
+                LogRel(("VBoxGuest::vbgdNtIOCtl: ENABLE_VRDP_SESSION: Current active console ID: 0x%08X\n",
                         pSharedUserData->ActiveConsoleId));
                 pDevExt->ulOldActiveConsoleId    = pSharedUserData->ActiveConsoleId;
@@ -757,5 +771,5 @@
         case VBOXGUEST_IOCTL_DISABLE_VRDP_SESSION:
         {
-            LogRel(("VBoxGuest::vboxguestwinIOCtl: DISABLE_VRDP_SESSION: Currently: %sabled\n",
+            LogRel(("VBoxGuest::vbgdNtIOCtl: DISABLE_VRDP_SESSION: Currently: %sabled\n",
                     pDevExt->fVRDPEnabled? "en": "dis"));
             if (pDevExt->fVRDPEnabled)
@@ -764,5 +778,5 @@
 
                 pDevExt->fVRDPEnabled            = false;
-                Log(("VBoxGuest::vboxguestwinIOCtl: DISABLE_VRDP_SESSION: Current active console ID: 0x%08X\n",
+                Log(("VBoxGuest::vbgdNtIOCtl: DISABLE_VRDP_SESSION: Current active console ID: 0x%08X\n",
                      pSharedUserData->ActiveConsoleId));
                 pSharedUserData->ActiveConsoleId = pDevExt->ulOldActiveConsoleId;
@@ -783,5 +797,5 @@
             int vrc = VBoxGuestCommonIOCtl(uCmd, pDevExt, pSession, pBuf, cbData, &cbDataReturned);
 
-            Log(("VBoxGuest::vboxguestwinGuestDeviceControl: rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n",
+            Log(("VBoxGuest::vbgdNtGuestDeviceControl: rc=%Rrc, pBuf=0x%p, cbData=%u, cbDataReturned=%u\n",
                  vrc, pBuf, cbData, cbDataReturned));
 
@@ -790,5 +804,5 @@
                 if (RT_UNLIKELY(cbDataReturned > cbData))
                 {
-                    Log(("VBoxGuest::vboxguestwinGuestDeviceControl: Too much output data %u - expected %u!\n", cbDataReturned, cbData));
+                    Log(("VBoxGuest::vbgdNtGuestDeviceControl: Too much output data %u - expected %u!\n", cbDataReturned, cbData));
                     cbDataReturned = cbData;
                     Status = STATUS_BUFFER_TOO_SMALL;
@@ -818,5 +832,5 @@
     IoCompleteRequest(pIrp, IO_NO_INCREMENT);
 
-    //Log(("VBoxGuest::vboxguestwinGuestDeviceControl: returned cbOut=%d rc=%#x\n", cbOut, Status));
+    //Log(("VBoxGuest::vbgdNtGuestDeviceControl: returned cbOut=%d rc=%#x\n", cbOut, Status));
     return Status;
 }
@@ -835,5 +849,5 @@
  *       has a way to do this already, see VBOXGUEST_IOCTL_GETVMMDEVPORT.
  */
-static NTSTATUS vboxguestwinInternalIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+static NTSTATUS vbgdNtInternalIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp)
 {
     NTSTATUS            Status      = STATUS_SUCCESS;
@@ -884,5 +898,5 @@
     }
 
-    return vboxguestwinIOCtl(pDevObj, pIrp);
+    return vbgdNtIOCtl(pDevObj, pIrp);
 }
 
@@ -895,9 +909,9 @@
  * @param   pIrp        IRP.
  */
-NTSTATUS vboxguestwinSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+NTSTATUS vbgdNtSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp)
 {
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension;
 
-    Log(("VBoxGuest::vboxguestwinGuestSystemControl\n"));
+    Log(("VBoxGuest::vbgdNtGuestSystemControl\n"));
 
     /* Always pass it on to the next driver. */
@@ -915,9 +929,9 @@
  * @param pIrp       IRP.
  */
-NTSTATUS vboxguestwinShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+NTSTATUS vbgdNtShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp)
 {
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension;
 
-    Log(("VBoxGuest::vboxguestwinGuestShutdown\n"));
+    Log(("VBoxGuest::vbgdNtGuestShutdown\n"));
 
     VMMDevPowerStateRequest *pReq = pDevExt->win.s.pPowerStateRequest;
@@ -930,5 +944,5 @@
         if (RT_FAILURE(rc))
         {
-            Log(("VBoxGuest::vboxguestwinGuestShutdown: Error performing request to VMMDev! "
+            Log(("VBoxGuest::vbgdNtGuestShutdown: Error performing request to VMMDev! "
                      "rc = %Rrc\n", rc));
         }
@@ -945,7 +959,7 @@
  * @param   pIrp        IRP.
  */
-NTSTATUS vboxguestwinNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp)
-{
-    Log(("VBoxGuest::vboxguestwinGuestNotSupportedStub\n"));
+NTSTATUS vbgdNtNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp)
+{
+    Log(("VBoxGuest::vbgdNtGuestNotSupportedStub\n"));
 
     pIrp->IoStatus.Information = 0;
@@ -965,8 +979,8 @@
  * @param   pContext    Context specific pointer.
  */
-void vboxguestwinDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pContext)
+void vbgdNtDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pContext)
 {
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pDevObj->DeviceExtension;
-    Log(("VBoxGuest::vboxguestwinGuestDpcHandler: pDevExt=0x%p\n", pDevExt));
+    Log(("VBoxGuest::vbgdNtGuestDpcHandler: pDevExt=0x%p\n", pDevExt));
 
     /* test & reset the counter */
@@ -985,5 +999,5 @@
 
     /* Process the wake-up list we were asked by the scheduling a DPC
-     * in vboxguestwinIsrHandler(). */
+     * in vbgdNtIsrHandler(). */
     VBoxGuestWaitDoWakeUps(pDevExt);
 }
@@ -997,5 +1011,5 @@
  * @param   pServiceContext Context specific pointer.
  */
-BOOLEAN vboxguestwinIsrHandler(PKINTERRUPT pInterrupt, PVOID pServiceContext)
+BOOLEAN vbgdNtIsrHandler(PKINTERRUPT pInterrupt, PVOID pServiceContext)
 {
     PVBOXGUESTDEVEXT pDevExt = (PVBOXGUESTDEVEXT)pServiceContext;
@@ -1003,5 +1017,5 @@
         return FALSE;
 
-    /*Log(("VBoxGuest::vboxguestwinGuestIsrHandler: pDevExt = 0x%p, pVMMDevMemory = 0x%p\n",
+    /*Log(("VBoxGuest::vbgdNtGuestIsrHandler: pDevExt = 0x%p, pVMMDevMemory = 0x%p\n",
              pDevExt, pDevExt ? pDevExt->pVMMDevMemory : NULL));*/
 
@@ -1013,9 +1027,9 @@
     if (fIRQTaken)
     {
-        Log(("VBoxGuest::vboxguestwinGuestIsrHandler: IRQ was taken! pInterrupt = 0x%p, pDevExt = 0x%p\n",
+        Log(("VBoxGuest::vbgdNtGuestIsrHandler: IRQ was taken! pInterrupt = 0x%p, pDevExt = 0x%p\n",
              pInterrupt, pDevExt));
         if (ASMAtomicUoReadU32(&pDevExt->u32MousePosChangedSeq) || !RTListIsEmpty(&pDevExt->WakeUpList))
         {
-            Log(("VBoxGuest::vboxguestwinGuestIsrHandler: Requesting DPC ...\n"));
+            Log(("VBoxGuest::vbgdNtGuestIsrHandler: Requesting DPC ...\n"));
             IoRequestDpc(pDevExt->win.s.pDeviceObject, pDevExt->win.s.pCurrentIrp, NULL);
         }
@@ -1050,6 +1064,5 @@
  *                      registry value if found.
  */
-NTSTATUS vboxguestwinRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName,
-                                       PULONG puValue)
+NTSTATUS vbgdNtRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName, PULONG puValue)
 {
     if (!pwszPath || !pwszName || !puValue)
@@ -1082,8 +1095,8 @@
  * @param pDevExt   Device extension
  */
-NTSTATUS vboxguestwinScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXT pDevExt)
+NTSTATUS vbgdNtScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXT pDevExt)
 {
     /* Enumerate the resource list. */
-    Log(("VBoxGuest::vboxguestwinScanPCIResourceList: Found %d resources\n",
+    Log(("VBoxGuest::vbgdNtScanPCIResourceList: Found %d resources\n",
          pResList->List->PartialResourceList.Count));
 
@@ -1103,5 +1116,5 @@
                 if (rangeCount < PCI_TYPE0_ADDRESSES)
                 {
-                    Log(("VBoxGuest::vboxguestwinScanPCIResourceList: I/O range: Base = %08x:%08x, Length = %08x\n",
+                    Log(("VBoxGuest::vbgdNtScanPCIResourceList: I/O range: Base = %08x:%08x, Length = %08x\n",
                             pPartialData->u.Port.Start.HighPart,
                             pPartialData->u.Port.Start.LowPart,
@@ -1118,5 +1131,5 @@
                     pBaseAddress->ResourceMapped = FALSE;
 
-                    Log(("VBoxGuest::vboxguestwinScanPCIResourceList: I/O range for VMMDev found! Base = %08x:%08x, Length = %08x\n",
+                    Log(("VBoxGuest::vbgdNtScanPCIResourceList: I/O range for VMMDev found! Base = %08x:%08x, Length = %08x\n",
                             pPartialData->u.Port.Start.HighPart,
                             pPartialData->u.Port.Start.LowPart,
@@ -1131,5 +1144,5 @@
             case CmResourceTypeInterrupt:
             {
-                Log(("VBoxGuest::vboxguestwinScanPCIResourceList: Interrupt: Level = %x, Vector = %x, Mode = %x\n",
+                Log(("VBoxGuest::vbgdNtScanPCIResourceList: Interrupt: Level = %x, Vector = %x, Mode = %x\n",
                      pPartialData->u.Interrupt.Level,
                      pPartialData->u.Interrupt.Vector,
@@ -1158,5 +1171,5 @@
                 if (rangeCount < PCI_TYPE0_ADDRESSES)
                 {
-                    Log(("VBoxGuest::vboxguestwinScanPCIResourceList: Memory range: Base = %08x:%08x, Length = %08x\n",
+                    Log(("VBoxGuest::vbgdNtScanPCIResourceList: Memory range: Base = %08x:%08x, Length = %08x\n",
                          pPartialData->u.Memory.Start.HighPart,
                          pPartialData->u.Memory.Start.LowPart,
@@ -1178,5 +1191,5 @@
                         pBaseAddress->ResourceMapped = FALSE;
 
-                        Log(("VBoxGuest::vboxguestwinScanPCIResourceList: Memory range for VMMDev found! Base = %08x:%08x, Length = %08x\n",
+                        Log(("VBoxGuest::vbgdNtScanPCIResourceList: Memory range for VMMDev found! Base = %08x:%08x, Length = %08x\n",
                              pPartialData->u.Memory.Start.HighPart,
                              pPartialData->u.Memory.Start.LowPart,
@@ -1188,5 +1201,5 @@
                     else
                     {
-                        Log(("VBoxGuest::vboxguestwinScanPCIResourceList: Ignoring memory: Flags = %08x\n",
+                        Log(("VBoxGuest::vbgdNtScanPCIResourceList: Ignoring memory: Flags = %08x\n",
                              pPartialData->Flags));
                     }
@@ -1197,5 +1210,5 @@
             default:
             {
-                Log(("VBoxGuest::vboxguestwinScanPCIResourceList: Unhandled resource found, type = %d\n", pPartialData->Type));
+                Log(("VBoxGuest::vbgdNtScanPCIResourceList: Unhandled resource found, type = %d\n", pPartialData->Type));
                 break;
             }
@@ -1220,6 +1233,6 @@
  * @param pcbMMIO           Length of mapped I/O base.
  */
-NTSTATUS vboxguestwinMapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength,
-                                     void **ppvMMIOBase, uint32_t *pcbMMIO)
+NTSTATUS vbgdNtMapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength,
+                               void **ppvMMIOBase, uint32_t *pcbMMIO)
 {
     AssertPtrReturn(pDevExt, VERR_INVALID_POINTER);
@@ -1231,8 +1244,8 @@
     {
          VMMDevMemory *pVMMDevMemory = (VMMDevMemory *)MmMapIoSpace(physicalAdr, ulLength, MmNonCached);
-         Log(("VBoxGuest::vboxguestwinMapVMMDevMemory: pVMMDevMemory = 0x%x\n", pVMMDevMemory));
+         Log(("VBoxGuest::vbgdNtMapVMMDevMemory: pVMMDevMemory = 0x%x\n", pVMMDevMemory));
          if (pVMMDevMemory)
          {
-             Log(("VBoxGuest::vboxguestwinMapVMMDevMemory: VMMDevMemory: Version = 0x%x, Size = %d\n",
+             Log(("VBoxGuest::vbgdNtMapVMMDevMemory: VMMDevMemory: Version = 0x%x, Size = %d\n",
                   pVMMDevMemory->u32Version, pVMMDevMemory->u32Size));
 
@@ -1240,9 +1253,9 @@
              if (pVMMDevMemory->u32Version != VMMDEV_MEMORY_VERSION)
              {
-                 Log(("VBoxGuest::vboxguestwinMapVMMDevMemory: Wrong version (%u), refusing operation!\n",
+                 Log(("VBoxGuest::vbgdNtMapVMMDevMemory: Wrong version (%u), refusing operation!\n",
                       pVMMDevMemory->u32Version));
 
                  /* Not our version, refuse operation and unmap the memory. */
-                 vboxguestwinUnmapVMMDevMemory(pDevExt);
+                 vbgdNtUnmapVMMDevMemory(pDevExt);
                  rc = STATUS_UNSUCCESSFUL;
              }
@@ -1254,5 +1267,5 @@
                      *pcbMMIO = pVMMDevMemory->u32Size;
 
-                 Log(("VBoxGuest::vboxguestwinMapVMMDevMemory: VMMDevMemory found and mapped! pvMMIOBase = 0x%p\n",
+                 Log(("VBoxGuest::vbgdNtMapVMMDevMemory: VMMDevMemory found and mapped! pvMMIOBase = 0x%p\n",
                       *ppvMMIOBase));
              }
@@ -1270,7 +1283,7 @@
  * @param   pDevExt     The device extension.
  */
-void vboxguestwinUnmapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt)
-{
-    Log(("VBoxGuest::vboxguestwinUnmapVMMDevMemory: pVMMDevMemory = 0x%x\n", pDevExt->pVMMDevMemory));
+void vbgdNtUnmapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt)
+{
+    Log(("VBoxGuest::vbgdNtUnmapVMMDevMemory: pVMMDevMemory = 0x%x\n", pDevExt->pVMMDevMemory));
     if (pDevExt->pVMMDevMemory)
     {
@@ -1284,18 +1297,18 @@
 
 
-VBOXOSTYPE vboxguestwinVersionToOSType(winVersion_t winVer)
+VBOXOSTYPE vbgdNtVersionToOSType(VBGDNTVER enmNtVer)
 {
     VBOXOSTYPE enmOsType;
-    switch (winVer)
-    {
-        case WINNT4:
+    switch (enmNtVer)
+    {
+        case VBGDNTVER_WINNT4:
             enmOsType = VBOXOSTYPE_WinNT4;
             break;
 
-        case WIN2K:
+        case VBGDNTVER_WIN2K:
             enmOsType = VBOXOSTYPE_Win2k;
             break;
 
-        case WINXP:
+        case VBGDNTVER_WINXP:
 #if ARCH_BITS == 64
             enmOsType = VBOXOSTYPE_WinXP_x64;
@@ -1305,5 +1318,5 @@
             break;
 
-        case WIN2K3:
+        case VBGDNTVER_WIN2K3:
 #if ARCH_BITS == 64
             enmOsType = VBOXOSTYPE_Win2k3_x64;
@@ -1313,5 +1326,5 @@
             break;
 
-        case WINVISTA:
+        case VBGDNTVER_WINVISTA:
 #if ARCH_BITS == 64
             enmOsType = VBOXOSTYPE_WinVista_x64;
@@ -1321,5 +1334,5 @@
             break;
 
-        case WIN7:
+        case VBGDNTVER_WIN7:
 #if ARCH_BITS == 64
             enmOsType = VBOXOSTYPE_Win7_x64;
@@ -1329,5 +1342,5 @@
             break;
 
-        case WIN8:
+        case VBGDNTVER_WIN8:
 #if ARCH_BITS == 64
             enmOsType = VBOXOSTYPE_Win8_x64;
@@ -1372,6 +1385,5 @@
 
 
-static void vboxguestwinTestAtomicTestAndClearBitsU32(uint32_t u32Mask, uint32_t u32Bits,
-                                                      uint32_t u32Exp)
+static void vbgdNtTestAtomicTestAndClearBitsU32(uint32_t u32Mask, uint32_t u32Bits, uint32_t u32Exp)
 {
     ULONG u32Bits2 = u32Bits;
@@ -1388,12 +1400,12 @@
 
 
-static void vboxguestwinDoTests()
-{
-    vboxguestwinTestAtomicTestAndClearBitsU32(0x00, 0x23, 0);
-    vboxguestwinTestAtomicTestAndClearBitsU32(0x11, 0, 0);
-    vboxguestwinTestAtomicTestAndClearBitsU32(0x11, 0x22, 0);
-    vboxguestwinTestAtomicTestAndClearBitsU32(0x11, 0x23, 0x1);
-    vboxguestwinTestAtomicTestAndClearBitsU32(0x11, 0x32, 0x10);
-    vboxguestwinTestAtomicTestAndClearBitsU32(0x22, 0x23, 0x22);
+static void vbgdNtDoTests(void)
+{
+    vbgdNtTestAtomicTestAndClearBitsU32(0x00, 0x23, 0);
+    vbgdNtTestAtomicTestAndClearBitsU32(0x11, 0, 0);
+    vbgdNtTestAtomicTestAndClearBitsU32(0x11, 0x22, 0);
+    vbgdNtTestAtomicTestAndClearBitsU32(0x11, 0x23, 0x1);
+    vbgdNtTestAtomicTestAndClearBitsU32(0x11, 0x32, 0x10);
+    vbgdNtTestAtomicTestAndClearBitsU32(0x22, 0x23, 0x22);
 }
 
Index: /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h	(revision 44982)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.h	(revision 44983)
@@ -1,7 +1,9 @@
+/* $Id$ */
 /** @file
- *
  * VBoxGuest - Windows specifics.
- *
- * Copyright (C) 2010-2012 Oracle Corporation
+ */
+
+/*
+ * Copyright (C) 2010-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -17,7 +19,4 @@
 #define ___VBoxGuest_win_h
 
-/*******************************************************************************
-*   Header Files                                                               *
-*******************************************************************************/
 
 #include <iprt/cdefs.h>
@@ -40,10 +39,4 @@
 
 
-/*******************************************************************************
-*   Structures and Typedefs                                                    *
-*******************************************************************************/
-
-/** Pointer to the VBoxGuest per session data. */
-typedef struct VBOXGUESTSESSION *PVBOXGUESTSESSION;
 
 /** Possible device states for our state machine. */
@@ -120,6 +113,6 @@
 
     /** Pre-allocated kernel session data. This is needed
-      * for handling kernel IOCtls. */
-    PVBOXGUESTSESSION pKernelSession;
+     * for handling kernel IOCtls. */
+    struct VBOXGUESTSESSION *pKernelSession;
 
     /** Spinlock protecting MouseNotifyCallback. Required since the consumer is
@@ -128,54 +121,63 @@
 } VBOXGUESTDEVEXTWIN, *PVBOXGUESTDEVEXTWIN;
 
-#define VBOXGUEST_UPDATE_DEVSTATE(_pDevExt, _newDevState) do {    \
-    (_pDevExt)->win.s.prevDevState =  (_pDevExt)->win.s.devState; \
-    (_pDevExt)->win.s.devState = (_newDevState);                  \
-} while (0)
+
+/** NT (windows) version identifier. */
+typedef enum VBGDNTVER
+{
+    VBGDNTVER_INVALID = 0,
+    VBGDNTVER_WINNT4,
+    VBGDNTVER_WIN2K,
+    VBGDNTVER_WINXP,
+    VBGDNTVER_WIN2K3,
+    VBGDNTVER_WINVISTA,
+    VBGDNTVER_WIN7,
+    VBGDNTVER_WIN8
+} VBGDNTVER;
+extern VBGDNTVER g_enmVbgdNtVer;
 
 
-/*******************************************************************************
-*   Defined Constants And Macros                                               *
-*******************************************************************************/
+#define VBOXGUEST_UPDATE_DEVSTATE(a_pDevExt, a_newDevState) \
+    do { \
+        (a_pDevExt)->win.s.prevDevState = (a_pDevExt)->win.s.devState; \
+        (a_pDevExt)->win.s.devState     = (a_newDevState); \
+    } while (0)
 
 /** CM_RESOURCE_MEMORY_* flags which were used on XP or earlier. */
 #define VBOX_CM_PRE_VISTA_MASK (0x3f)
 
-/** Windows version identifier. */
-typedef enum
-{
-    WINNT4   = 1,
-    WIN2K    = 2,
-    WINXP    = 3,
-    WIN2K3   = 4,
-    WINVISTA = 5,
-    WIN7     = 6,
-    WIN8     = 7
-} winVersion_t;
-extern winVersion_t winVersion;
+
+/* Include the internal header now as we've declared the internal
+   structure and stuff. */
+#include "VBoxGuestInternal.h"
 
 
-/*******************************************************************************
-*   Declared prototypes for helper routines used in both (PnP and legacy)      *
-*   driver versions.                                                           *
-*******************************************************************************/
-#include "VBoxGuestInternal.h"
+RT_C_DECLS_BEGIN
 
-RT_C_DECLS_BEGIN
 #ifdef TARGET_NT4
 NTSTATUS   vbgdNt4CreateDevice(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath);
-NTSTATUS   vboxguestwinInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath);
 #else
-NTSTATUS   vboxguestwinInit(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+NTSTATUS   vbgdNtInit(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+NTSTATUS   vbgdNtPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+NTSTATUS   vbgdNtPower(PDEVICE_OBJECT pDevObj, PIRP pIrp);
 #endif
-NTSTATUS   vboxguestwinCleanup(PDEVICE_OBJECT pDevObj);
-NTSTATUS   vboxguestwinPnP(PDEVICE_OBJECT pDevObj, PIRP pIrp);
-VOID       vboxguestwinDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pContext);
-BOOLEAN    vboxguestwinIsrHandler(PKINTERRUPT interrupt, PVOID serviceContext);
-NTSTATUS   vboxguestwinScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXT pDevExt);
-NTSTATUS   vboxguestwinMapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength,
-                                       void **ppvMMIOBase, uint32_t *pcbMMIO);
-void       vboxguestwinUnmapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt);
-VBOXOSTYPE vboxguestwinVersionToOSType(winVersion_t winVer);
-NTSTATUS   vboxguestwinPower(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+
+/** @name Common routines used in both (PnP and legacy) driver versions.
+ * @{
+ */
+#ifdef TARGET_NT4
+NTSTATUS   vbgdNtInit(PDRIVER_OBJECT pDrvObj, PDEVICE_OBJECT pDevObj, PUNICODE_STRING pRegPath);
+#else
+NTSTATUS   vbgdNtInit(PDEVICE_OBJECT pDevObj, PIRP pIrp);
+#endif
+NTSTATUS   vbgdNtCleanup(PDEVICE_OBJECT pDevObj);
+VOID       vbgdNtDpcHandler(PKDPC pDPC, PDEVICE_OBJECT pDevObj, PIRP pIrp, PVOID pContext);
+BOOLEAN    vbgdNtIsrHandler(PKINTERRUPT interrupt, PVOID serviceContext);
+NTSTATUS   vbgdNtScanPCIResourceList(PCM_RESOURCE_LIST pResList, PVBOXGUESTDEVEXT pDevExt);
+NTSTATUS   vbgdNtMapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt, PHYSICAL_ADDRESS physicalAdr, ULONG ulLength,
+                                 void **ppvMMIOBase, uint32_t *pcbMMIO);
+void       vbgdNtUnmapVMMDevMemory(PVBOXGUESTDEVEXT pDevExt);
+VBOXOSTYPE vbgdNtVersionToOSType(VBGDNTVER enmNtVer);
+/** @}  */
+
 RT_C_DECLS_END
 
@@ -185,8 +187,9 @@
  * on NT4, so... The same for ExAllocatePool.
  */
-#undef ExAllocatePool
-#undef ExFreePool
+# undef ExAllocatePool
+# undef ExFreePool
 #endif
 
-#endif /* ___VBoxGuest_win_h */
+#endif /* !___VBoxGuest_win_h */
 
+
Index: /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h	(revision 44982)
+++ /trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h	(revision 44983)
@@ -182,5 +182,8 @@
     VBoxGuestMouseSetNotifyCallback MouseNotifyCallback;
 
-    /** Windows part. */
+    /** Windows part.
+     * @todo r=bird: Entirely wrong approach. You should create
+     *       VBOXGUESTDEVEXTWIN as a super structure to VBOXGUESTDEVEXT. If they
+     *       were classes, class VBOXGUESTDEVEXTWIN : public VBOXGUESTDEVEXT ... */
     union
     {
