Index: /trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp	(revision 42284)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3DIf.cpp	(revision 42285)
@@ -36,5 +36,4 @@
     pD3D->hD3DLib = LoadLibraryW(L"VBoxD3D9wddm.dll");
 #endif
-    Assert(pD3D->hD3DLib);
     if (!pD3D->hD3DLib)
     {
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h	(revision 42284)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Wine/vbox/libWineStub/include/wine/wined3d.h	(revision 42285)
@@ -2117,7 +2117,7 @@
 } WINED3DDISPLAYMODE;
 typedef enum _WINED3DSCANLINEORDERING {
-  WINED3DSCANLINEORDERING_UNKNOWN    = 0, 
+  WINED3DSCANLINEORDERING_UNKNOWN    = 0,
   WINED3DSCANLINEORDERING_PROGRESSIVE   = 1,
-  WINED3DSCANLINEORDERING_INTERLACED    = 2 
+  WINED3DSCANLINEORDERING_INTERLACED    = 2
 } WINED3DSCANLINEORDERING;
 typedef struct _WINED3DDISPLAYMODEEX {
@@ -2133,5 +2133,5 @@
   WINED3DDISPLAYROTATION_90         = 2,
   WINED3DDISPLAYROTATION_180        = 3,
-  WINED3DDISPLAYROTATION_270        = 4 
+  WINED3DDISPLAYROTATION_270        = 4
 } WINED3DDISPLAYROTATION;
 typedef struct _WINED3DCOLORVALUE {
@@ -9627,8 +9627,12 @@
 IWineD3DClipper * STDMETHODCALLTYPE  WineDirect3DCreateClipper(IUnknown *parent);
 
+#ifdef VBOX_WINE_NO_LOCK
+#define wined3d_mutex_lock() do {} while (0)
+#define wined3d_mutex_unlock() do {} while (0)
+#else
 void STDMETHODCALLTYPE  wined3d_mutex_lock(void);
 
 void STDMETHODCALLTYPE  wined3d_mutex_unlock(void);
-
+#endif
 /* Begin additional prototypes for all interfaces */
 
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c	(revision 42284)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c	(revision 42285)
@@ -1223,15 +1223,17 @@
         return;
 
-    /* there is a currently assigned context,
-     * 2. now increase its ref count to ensure its dtor routine is not called while making set_current(NULL).
-     * This is needed since dtor can only be run with a wined3d lock held */
-    VBoxTlsRefAddRef(old);
+//    /* there is a currently assigned context,
+//     * 2. now increase its ref count to ensure its dtor routine is not called while making set_current(NULL).
+//     * This is needed since dtor can only be run with a wined3d lock held */
+//    VBoxTlsRefAddRef(old);
+
+    /* context_tls_dtor now does only memfree, so just call it right away */
 
     /* 3. now we can call context_set_current(NULL) */
     context_set_current(NULL);
 
-    /* 4. to avoid possible deadlocks we make an asynchronous call to a worker thread to make
-     * wined3d lock - context release - wined3d unlock from there. */
-    VBoxExtReleaseContextAsync(old);
+//    /* 4. to avoid possible deadlocks we make an asynchronous call to a worker thread to make
+//     * wined3d lock - context release - wined3d unlock from there. */
+//    VBoxExtReleaseContextAsync(old);
 }
 #endif
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c	(revision 42284)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c	(revision 42285)
@@ -2057,4 +2057,5 @@
 
 static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *iface) {
+#ifndef VBOX_WITH_WDDM
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
 
@@ -2064,4 +2065,8 @@
     /* return simulated texture memory left */
     return (This->adapter->TextureRam - This->adapter->UsedTextureRam);
+#else
+    ERR("Should not be here!");
+    return 0;
+#endif
 }
 
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/directx.c
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/directx.c	(revision 42284)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/directx.c	(revision 42285)
@@ -336,4 +336,5 @@
 }
 
+#ifndef VBOX_WITH_WDDM
 /* Adjust the amount of used texture memory */
 long WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, long glram)
@@ -345,4 +346,5 @@
     return adapter->UsedTextureRam;
 }
+#endif
 
 static void wined3d_adapter_cleanup(struct wined3d_adapter *adapter)
@@ -2976,5 +2978,5 @@
 }
 
-static HRESULT WINAPI IWineD3DImpl_GetAdapterDisplayModeEx(IWineD3D *iface, 
+static HRESULT WINAPI IWineD3DImpl_GetAdapterDisplayModeEx(IWineD3D *iface,
         UINT Adapter, WINED3DDISPLAYMODEEX *pMode, WINED3DDISPLAYROTATION *pRotation)
 {
@@ -3077,4 +3079,8 @@
 static HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Adapter, DWORD Flags,
                                                    WINED3DADAPTER_IDENTIFIER* pIdentifier) {
+#ifdef VBOX_WITH_WDDM
+    ERR("Should not be here!");
+    return WINED3DERR_INVALIDCALL;
+#else
     IWineD3DImpl *This = (IWineD3DImpl *)iface;
     struct wined3d_adapter *adapter;
@@ -3136,4 +3142,5 @@
 
     return WINED3D_OK;
+#endif
 }
 
@@ -5419,5 +5426,5 @@
 
         hdc = fake_gl_ctx.dc;
-
+#ifndef VBOX_WITH_WDDM
         /* Use the VideoRamSize registry setting when set */
         if(wined3d_settings.emulated_textureram)
@@ -5427,5 +5434,5 @@
         adapter->UsedTextureRam = 0;
         TRACE("Emulating %dMB of texture ram\n", adapter->TextureRam/(1024*1024));
-
+#endif
         /* Initialize the Adapter's DeviceName which is required for ChangeDisplaySettings and friends */
         DisplayDevice.cb = sizeof(DisplayDevice);
@@ -5600,4 +5607,5 @@
     This->adapters[0].driver_info.name = "Display";
     This->adapters[0].driver_info.description = "WineD3D DirectDraw Emulation";
+#ifndef VBOX_WITH_WDDM
     if(wined3d_settings.emulated_textureram) {
         This->adapters[0].TextureRam = wined3d_settings.emulated_textureram;
@@ -5605,5 +5613,5 @@
         This->adapters[0].TextureRam = 8 * 1024 * 1024; /* This is plenty for a DDraw-only card */
     }
-
+#endif
     initPixelFormatsNoGL(&This->adapters[0].gl_info);
 
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/resource.c
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/resource.c	(revision 42284)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/resource.c	(revision 42285)
@@ -97,8 +97,8 @@
     }
 
+#ifndef VBOX_WITH_WDDM
     /* Check that we have enough video ram left */
     if (pool == WINED3DPOOL_DEFAULT)
     {
-#ifndef VBOX_WITH_WDDM
         if (size > IWineD3DDevice_GetAvailableTextureMem((IWineD3DDevice *)device))
         {
@@ -107,7 +107,7 @@
             return WINED3DERR_OUTOFVIDEOMEMORY;
         }
-#endif
         WineD3DAdapterChangeGLRam(device, size);
     }
+#endif
 
     device_resource_add(device, iface);
@@ -124,8 +124,10 @@
 
     TRACE("(%p) Cleaning up resource\n", This);
+#ifndef VBOX_WITH_WDDM
     if (This->resource.pool == WINED3DPOOL_DEFAULT) {
         TRACE("Decrementing device memory pool by %u\n", This->resource.size);
         WineD3DAdapterChangeGLRam(This->resource.device, -This->resource.size);
     }
+#endif
 
     LIST_FOR_EACH_SAFE(e1, e2, &This->resource.privateData) {
Index: /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
===================================================================
--- /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h	(revision 42284)
+++ /trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h	(revision 42285)
@@ -1547,6 +1547,8 @@
     WineD3D_PixelFormat     *cfgs;
     BOOL                    brokenStencil; /* Set on cards which only offer mixed depth+stencil */
+#ifndef VBOX_WITH_WDDM
     unsigned int            TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */
     unsigned int            UsedTextureRam;
+#endif
     LUID luid;
 
@@ -1558,5 +1560,7 @@
 BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor) DECLSPEC_HIDDEN;
 BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
+#ifndef VBOX_WITH_WDDM
 extern long WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, long glram) DECLSPEC_HIDDEN;
+#endif
 extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
 
