Index: trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp	(revision 31687)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.cpp	(revision 31713)
@@ -3484,4 +3484,5 @@
                 CONST D3DDDI_SURFACEINFO* pSurf = &pResource->pSurfList[0];
                 IDirect3DTexture9 *pD3DIfTex;
+                HANDLE hSharedHandle = NULL;
 #if 0
                 hr = pDevice->pDevice9If->CreateTexture(pSurf->Width,
@@ -3503,5 +3504,5 @@
                                             vboxDDI2D3DPool(pResource->Pool),
                                             &pD3DIfTex,
-                                            NULL /* HANDLE* pSharedHandle */,
+                                            pResource->Flags.SharedResource ? &hSharedHandle : NULL,
                                             pResource->Pool == D3DDDIPOOL_SYSTEMMEM ? pRc->aAllocations[0].pvMem : NULL);
 #endif
@@ -3512,4 +3513,6 @@
                     pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE;
                     pAllocation->pD3DIf = pD3DIfTex;
+                    Assert(!!(pResource->Flags.SharedResource) == !!(hSharedHandle));
+                    pAllocation->hSharedHandle = hSharedHandle;
 #if 0
                     if (pResource->Pool == D3DDDIPOOL_SYSTEMMEM)
@@ -3723,4 +3726,5 @@
                 {
                     D3DDDI_ALLOCATIONINFO *pDdiAllocI = &pDdiAllocate->pAllocationInfo[i];
+                    PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i];
                     Assert(pDdiAllocI->pPrivateDriverData);
                     Assert(pDdiAllocI->PrivateDriverDataSize == sizeof (VBOXWDDM_ALLOCINFO));
@@ -3740,4 +3744,5 @@
                     pAllocInfo->enmType = VBOXWDDM_ALLOC_TYPE_UMD_RC_GENERIC;
                     pAllocInfo->fFlags = pResource->Flags;
+                    pAllocInfo->hSharedHandle = pAllocation->hSharedHandle;
                     pAllocInfo->SurfDesc.width = pSurf->Width;
                     pAllocInfo->SurfDesc.height = pSurf->Height;
@@ -5177,9 +5182,7 @@
         else
         {
-            Assert(0); /* <-- need to test that */
-
             /* this is a "generic" resource whose creation is initiaded by the UMD */
             Assert(pData->PrivateDriverDataSize == sizeof (VBOXWDDM_RCINFO));
-            if (pData->PrivateDriverDataSize >= sizeof (VBOXWDDM_RCINFO))
+            if (pData->PrivateDriverDataSize == sizeof (VBOXWDDM_RCINFO))
             {
                 VBOXWDDM_RCINFO *pRcInfo = (VBOXWDDM_RCINFO*)pData->pPrivateDriverData;
@@ -5189,4 +5192,59 @@
                 pRc->RcDesc = pRcInfo->RcDesc;
                 pRc->cAllocations = pData->NumAllocations;
+
+                for (UINT i = 0; i < pData->NumAllocations; ++i)
+                {
+                    PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[i];
+                    D3DDDI_OPENALLOCATIONINFO* pOAI = pData->pOpenAllocationInfo;
+                    Assert(pOAI->PrivateDriverDataSize == sizeof (VBOXWDDM_ALLOCINFO));
+                    if (pOAI->PrivateDriverDataSize != sizeof (VBOXWDDM_ALLOCINFO))
+                    {
+                        hr = E_INVALIDARG;
+                        break;
+                    }
+                    Assert(pOAI->pPrivateDriverData);
+                    PVBOXWDDM_ALLOCINFO pAllocInfo = (PVBOXWDDM_ALLOCINFO)pOAI->pPrivateDriverData;
+                    pAllocation->hAllocation = pOAI->hAllocation;
+                    pAllocation->enmType = pAllocInfo->enmType;
+                    pAllocation->hSharedHandle = pAllocInfo->hSharedHandle;
+                    pAllocation->SurfDesc = pAllocInfo->SurfDesc;
+                    Assert(pAllocation->hSharedHandle);
+                }
+
+                Assert(pRc->RcDesc.fFlags.SharedResource);
+                if (pRc->RcDesc.fFlags.Texture)
+                {
+                    Assert(pDevice->pDevice9If);
+
+                    PVBOXWDDMDISP_ALLOCATION pAllocation = &pRc->aAllocations[0];
+                    IDirect3DTexture9 *pD3DIfTex;
+                    HANDLE hSharedHandle = pAllocation->hSharedHandle;
+                    Assert(pAllocation->hSharedHandle);
+
+                    hr = pDevice->pAdapter->D3D.pfnVBoxWineExD3DDev9CreateTexture((IDirect3DDevice9Ex *)pDevice->pDevice9If,
+                                                pAllocation->SurfDesc.width,
+                                                pAllocation->SurfDesc.height,
+                                                pRc->cAllocations,
+                                                vboxDDI2D3DUsage(pRc->RcDesc.fFlags),
+                                                vboxDDI2D3DFormat(pRc->RcDesc.enmFormat),
+                                                vboxDDI2D3DPool(pRc->RcDesc.enmPool),
+                                                &pD3DIfTex,
+                                                &hSharedHandle,
+                                                NULL);
+                    Assert(hr == S_OK);
+                    if (hr == S_OK)
+                    {
+                        Assert(pD3DIfTex);
+                        pAllocation->enmD3DIfType = VBOXDISP_D3DIFTYPE_TEXTURE;
+                        pAllocation->pD3DIf = pD3DIfTex;
+                        Assert(pAllocation->hSharedHandle == hSharedHandle);
+                        Assert(pAllocation->hSharedHandle);
+                    }
+                }
+                else
+                {
+                    /* impl */
+                    Assert(0);
+                }
             }
             else
Index: trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h	(revision 31687)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Display/wddm/VBoxDispD3D.h	(revision 31713)
@@ -151,4 +151,5 @@
     IUnknown *pD3DIf;
     VBOXDISP_D3DIFTYPE enmD3DIfType;
+    HANDLE hSharedHandle;
     VBOXWDDMDISP_LOCKINFO LockInfo;
     VBOXWDDM_DIRTYREGION DirtyRegion; /* <- dirty region to notify host about */
Index: trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h	(revision 31687)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Miniport/wddm/VBoxVideoIf.h	(revision 31713)
@@ -71,4 +71,5 @@
     VBOXWDDM_ALLOC_TYPE enmType;
     D3DDDI_RESOURCEFLAGS fFlags;
+    HANDLE hSharedHandle;
     VBOXWDDM_SURFACE_DESC SurfDesc;
 } VBOXWDDM_ALLOCINFO, *PVBOXWDDM_ALLOCINFO;
