From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/d3dkmt.c | 115 ++++++++++++++++++++++++-- dlls/win32u/tests/d3dkmt.c | 165 +++++++++++++++++++------------------ dlls/wow64win/gdi.c | 11 ++- server/protocol.def | 2 + 4 files changed, 200 insertions(+), 93 deletions(-)
diff --git a/dlls/win32u/d3dkmt.c b/dlls/win32u/d3dkmt.c index 495d42aa0b7..64d71fc45a1 100644 --- a/dlls/win32u/d3dkmt.c +++ b/dlls/win32u/d3dkmt.c @@ -42,6 +42,12 @@ struct d3dkmt_object HANDLE handle; /* process-private handle of server object */ };
+struct d3dkmt_resource +{ + struct d3dkmt_object obj; + D3DKMT_HANDLE allocation; +}; + struct d3dkmt_adapter { struct d3dkmt_object obj; /* object header */ @@ -761,8 +767,64 @@ NTSTATUS WINAPI NtGdiDdDDIShareObjects( UINT count, const D3DKMT_HANDLE *handles */ NTSTATUS WINAPI NtGdiDdDDICreateAllocation2( D3DKMT_CREATEALLOCATION *params ) { - FIXME( "params %p stub!\n", params ); - return STATUS_NOT_IMPLEMENTED; + D3DKMT_CREATESTANDARDALLOCATION *standard; + struct d3dkmt_resource *resource = NULL; + D3DDDI_ALLOCATIONINFO *alloc_info; + struct d3dkmt_object *allocation; + struct d3dkmt_device *device; + NTSTATUS status; + + FIXME( "params %p semi-stub!\n", params ); + + if (!params) return STATUS_INVALID_PARAMETER; + if (!(device = get_d3dkmt_object( params->hDevice, D3DKMT_DEVICE ))) return STATUS_INVALID_PARAMETER; + + if (!params->Flags.StandardAllocation) return STATUS_INVALID_PARAMETER; + if (params->PrivateDriverDataSize) return STATUS_INVALID_PARAMETER; + + if (params->NumAllocations != 1) return STATUS_INVALID_PARAMETER; + if (!(alloc_info = params->pAllocationInfo)) return STATUS_INVALID_PARAMETER; + + if (!(standard = params->pStandardAllocation)) return STATUS_INVALID_PARAMETER; + if (standard->Type != D3DKMT_STANDARDALLOCATIONTYPE_EXISTINGHEAP) return STATUS_INVALID_PARAMETER; + if (standard->ExistingHeapData.Size & 0xfff) return STATUS_INVALID_PARAMETER; + if (!params->Flags.ExistingSysMem) return STATUS_INVALID_PARAMETER; + if (!alloc_info->pSystemMem) return STATUS_INVALID_PARAMETER; + + if (params->Flags.CreateResource) + { + if (params->hResource && !(resource = get_d3dkmt_object( params->hResource, D3DKMT_RESOURCE ))) + return STATUS_INVALID_HANDLE; + if ((status = d3dkmt_object_alloc( sizeof(*resource), D3DKMT_RESOURCE, (void **)&resource ))) return status; + if ((status = d3dkmt_object_alloc( sizeof(*allocation), D3DKMT_ALLOCATION, (void **)&allocation ))) goto failed; + + if (!params->Flags.CreateShared) status = alloc_object_handle( &resource->obj ); + else status = d3dkmt_object_create( &resource->obj, params->Flags.NtSecuritySharing ); + if (status) goto failed; + + params->hGlobalShare = resource->obj.shared ? 0 : resource->obj.global; + params->hResource = resource->obj.local; + } + else + { + if (params->Flags.CreateShared) return STATUS_INVALID_PARAMETER; + if (params->hResource) + { + resource = get_d3dkmt_object( params->hResource, D3DKMT_RESOURCE ); + return resource ? STATUS_INVALID_PARAMETER : STATUS_INVALID_HANDLE; + } + if ((status = d3dkmt_object_alloc( sizeof(*allocation), D3DKMT_ALLOCATION, (void **)&allocation ))) return status; + params->hGlobalShare = 0; + } + + if ((status = alloc_object_handle( allocation ))) goto failed; + if (resource) resource->allocation = allocation->local; + alloc_info->hAllocation = allocation->local; + return STATUS_SUCCESS; + +failed: + if (resource) d3dkmt_object_free( &resource->obj ); + return status; }
/****************************************************************************** @@ -770,8 +832,7 @@ NTSTATUS WINAPI NtGdiDdDDICreateAllocation2( D3DKMT_CREATEALLOCATION *params ) */ NTSTATUS WINAPI NtGdiDdDDICreateAllocation( D3DKMT_CREATEALLOCATION *params ) { - FIXME( "params %p stub!\n", params ); - return STATUS_NOT_IMPLEMENTED; + return NtGdiDdDDICreateAllocation2( params ); }
/****************************************************************************** @@ -779,8 +840,37 @@ NTSTATUS WINAPI NtGdiDdDDICreateAllocation( D3DKMT_CREATEALLOCATION *params ) */ NTSTATUS WINAPI NtGdiDdDDIDestroyAllocation2( const D3DKMT_DESTROYALLOCATION2 *params ) { - FIXME( "params %p stub!\n", params ); - return STATUS_NOT_IMPLEMENTED; + struct d3dkmt_object *device, *allocation; + D3DKMT_HANDLE alloc_handle = 0; + UINT i; + + TRACE( "params %p\n", params ); + + if (!params) return STATUS_INVALID_PARAMETER; + if (!(device = get_d3dkmt_object( params->hDevice, D3DKMT_DEVICE ))) return STATUS_INVALID_PARAMETER; + + if (params->AllocationCount && !params->phAllocationList) return STATUS_INVALID_PARAMETER; + + if (params->hResource) + { + struct d3dkmt_resource *resource; + if (!(resource = get_d3dkmt_object( params->hResource, D3DKMT_RESOURCE ))) + return STATUS_INVALID_PARAMETER; + alloc_handle = resource->allocation; + d3dkmt_object_free( &resource->obj ); + } + + for (i = 0; i < params->AllocationCount; i++) + { + if (!(allocation = get_d3dkmt_object( params->phAllocationList[i], D3DKMT_ALLOCATION ))) + return STATUS_INVALID_PARAMETER; + d3dkmt_object_free( allocation ); + } + + if (alloc_handle && (allocation = get_d3dkmt_object( alloc_handle, D3DKMT_ALLOCATION ))) + d3dkmt_object_free( allocation ); + + return STATUS_SUCCESS; }
/****************************************************************************** @@ -788,8 +878,17 @@ NTSTATUS WINAPI NtGdiDdDDIDestroyAllocation2( const D3DKMT_DESTROYALLOCATION2 *p */ NTSTATUS WINAPI NtGdiDdDDIDestroyAllocation( const D3DKMT_DESTROYALLOCATION *params ) { - FIXME( "params %p stub!\n", params ); - return STATUS_NOT_IMPLEMENTED; + D3DKMT_DESTROYALLOCATION2 params2 = {0}; + + TRACE( "params %p\n", params ); + + if (!params) return STATUS_INVALID_PARAMETER; + + params2.hDevice = params->hDevice; + params2.hResource = params->hResource; + params2.phAllocationList = params->phAllocationList; + params2.AllocationCount = params->AllocationCount; + return NtGdiDdDDIDestroyAllocation2( ¶ms2 ); }
/****************************************************************************** diff --git a/dlls/win32u/tests/d3dkmt.c b/dlls/win32u/tests/d3dkmt.c index 210df1571f2..45f56f29a0b 100644 --- a/dlls/win32u/tests/d3dkmt.c +++ b/dlls/win32u/tests/d3dkmt.c @@ -1639,7 +1639,7 @@ static void test_D3DKMTCreateAllocation( void ) status = D3DKMTCreateAllocation( NULL );
status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status );
wcscpy( open_adapter.DeviceName, L"\\.\DISPLAY1" ); status = D3DKMTOpenAdapterFromGdiDisplayName( &open_adapter ); @@ -1668,34 +1668,34 @@ static void test_D3DKMTCreateAllocation( void ) allocs[0].hAllocation = create.hGlobalShare = 0x1eadbeed; create.hPrivateRuntimeResourceHandle = (HANDLE)0xdeadbeef; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create.hGlobalShare, ==, 0 ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create.hGlobalShare, ==, 0 ); ok_x4( create.hResource, ==, 0 ); - todo_wine check_d3dkmt_local( allocs[0].hAllocation, &next_local ); + check_d3dkmt_local( allocs[0].hAllocation, &next_local ); ok_ptr( create.hPrivateRuntimeResourceHandle, ==, (HANDLE)0xdeadbeef );
destroy.hDevice = create_device.hDevice; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); destroy.AllocationCount = 1; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); destroy.phAllocationList = &allocs[0].hAllocation; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); /* allocation has already been destroyed */ status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status );
/* D3DKMTCreateAllocation2 also works with the same parameters, with extra alloc info */ create.pAllocationInfo2 = allocs2; allocs2[0].hAllocation = create.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation2( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create.hGlobalShare, ==, 0 ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create.hGlobalShare, ==, 0 ); ok_x4( create.hResource, ==, 0 ); - todo_wine check_d3dkmt_local( allocs2[0].hAllocation, &next_local ); + check_d3dkmt_local( allocs2[0].hAllocation, &next_local ); ok_x4( create.PrivateRuntimeDataSize, ==, 0 ); ok_x4( create.PrivateDriverDataSize, ==, 0 ); ok_x4( allocs2[0].PrivateDriverDataSize, ==, 0 ); @@ -1703,23 +1703,23 @@ static void test_D3DKMTCreateAllocation( void )
destroy.phAllocationList = &allocs2[0].hAllocation; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); destroy.phAllocationList = &allocs[0].hAllocation;
/* D3DKMTDestroyAllocation2 works as well */ allocs[0].hAllocation = create.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create.hGlobalShare, ==, 0 ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create.hGlobalShare, ==, 0 ); ok_x4( create.hResource, ==, 0 ); - todo_wine check_d3dkmt_local( allocs[0].hAllocation, &next_local ); + check_d3dkmt_local( allocs[0].hAllocation, &next_local );
destroy2.hDevice = create_device.hDevice; destroy2.AllocationCount = 1; destroy2.phAllocationList = &allocs[0].hAllocation; status = D3DKMTDestroyAllocation2( &destroy2 ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status );
/* alloc PrivateDriverDataSize can be set */ @@ -1727,88 +1727,88 @@ static void test_D3DKMTCreateAllocation( void ) allocs[0].PrivateDriverDataSize = sizeof(expect_alloc_data); allocs[0].hAllocation = create.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create.hGlobalShare, ==, 0 ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create.hGlobalShare, ==, 0 ); ok_x4( create.hResource, ==, 0 ); - todo_wine check_d3dkmt_local( allocs[0].hAllocation, &next_local ); + check_d3dkmt_local( allocs[0].hAllocation, &next_local ); status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status );
/* PrivateRuntimeDataSize can be set */ create.pPrivateRuntimeData = expect_runtime_data; create.PrivateRuntimeDataSize = sizeof(expect_runtime_data); allocs[0].hAllocation = create.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create.hGlobalShare, ==, 0 ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create.hGlobalShare, ==, 0 ); ok_x4( create.hResource, ==, 0 ); - todo_wine check_d3dkmt_local( allocs[0].hAllocation, &next_local ); + check_d3dkmt_local( allocs[0].hAllocation, &next_local ); status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status );
/* PrivateDriverDataSize must be 0 for standard allocations */ create.PrivateDriverDataSize = 64; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.PrivateDriverDataSize = 0;
/* device handle is required */ create.hDevice = 0; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.hDevice = create_device.hDevice;
/* hResource must be valid or 0 */ create.hResource = 0x1eadbeed; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_HANDLE, status ); + ok_nt( STATUS_INVALID_HANDLE, status ); create.hResource = 0;
/* NumAllocations is required */ create.NumAllocations = 0; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.NumAllocations = 1;
/* standard.Type must be set */ standard[0].Type = 0; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); standard[0].Type = D3DKMT_STANDARDALLOCATIONTYPE_EXISTINGHEAP;
/* pSystemMem must be set */ allocs[0].pSystemMem = 0; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); allocs[0].pSystemMem = allocs2[0].pSystemMem;
/* creating multiple allocations doesn't work */ create.NumAllocations = 2; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.NumAllocations = 1;
/* ExistingHeapData.Size must be page aligned */ standard[0].ExistingHeapData.Size = 0x1100; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); standard[0].ExistingHeapData.Size = 0x10000;
/* specific flags are required for standard allocations */ create.Flags.ExistingSysMem = 0; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.Flags.ExistingSysMem = 1; create.Flags.StandardAllocation = 0; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.Flags.StandardAllocation = 1;
/* CreateShared doesn't work without CreateResource */ create.Flags.CreateShared = 1; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.Flags.CreateShared = 0;
@@ -1817,24 +1817,24 @@ static void test_D3DKMTCreateAllocation( void ) allocs[0].hAllocation = create.hGlobalShare = create.hResource = 0x1eadbeed; create.hPrivateRuntimeResourceHandle = (HANDLE)0xdeadbeef; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_HANDLE, status ); + ok_nt( STATUS_INVALID_HANDLE, status ); create.hResource = 0; /* hResource must be set to 0, even with CreateResource */ status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create.hGlobalShare, ==, 0 ); - todo_wine check_d3dkmt_local( create.hResource, &next_local ); - todo_wine check_d3dkmt_local( allocs[0].hAllocation, &next_local ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create.hGlobalShare, ==, 0 ); + check_d3dkmt_local( create.hResource, &next_local ); + check_d3dkmt_local( allocs[0].hAllocation, &next_local ); ok_ptr( create.hPrivateRuntimeResourceHandle, ==, (HANDLE)0xdeadbeef );
/* destroying the allocation doesn't destroys the resource */ status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); destroy.hResource = create.hResource; destroy.AllocationCount = 0; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); destroy.AllocationCount = 1; create.hResource = 0;
@@ -1842,28 +1842,28 @@ static void test_D3DKMTCreateAllocation( void ) create.Flags.CreateResource = 1; allocs[0].hAllocation = create.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create.hGlobalShare, ==, 0 ); - todo_wine check_d3dkmt_local( create.hResource, &next_local ); - todo_wine check_d3dkmt_local( allocs[0].hAllocation, &next_local ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create.hGlobalShare, ==, 0 ); + check_d3dkmt_local( create.hResource, &next_local ); + check_d3dkmt_local( allocs[0].hAllocation, &next_local );
/* cannot create allocations with an existing resource */ create.Flags.CreateResource = 0; create.pAllocationInfo = &allocs[1]; allocs[1].hAllocation = create.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.pAllocationInfo = &allocs[0];
/* destroying resource destroys its allocations */ destroy.hResource = create.hResource; destroy.AllocationCount = 0; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); destroy.hResource = 0; destroy.AllocationCount = 1; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.hResource = 0;
@@ -1871,7 +1871,7 @@ static void test_D3DKMTCreateAllocation( void ) create.Flags.CreateResource = 1; create.NumAllocations = 0; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); + ok_nt( STATUS_INVALID_PARAMETER, status ); create.NumAllocations = 1;
/* destroy resource at once from here */ @@ -1880,10 +1880,10 @@ static void test_D3DKMTCreateAllocation( void )
allocs[0].hAllocation = create.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create.hGlobalShare, ==, 0 ); - todo_wine check_d3dkmt_local( create.hResource, &next_local ); - todo_wine check_d3dkmt_local( allocs[0].hAllocation, &next_local ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create.hGlobalShare, ==, 0 ); + check_d3dkmt_local( create.hResource, &next_local ); + check_d3dkmt_local( allocs[0].hAllocation, &next_local );
/* D3DKMTQueryResourceInfo requires a global handle */ query.hDevice = create_device.hDevice; @@ -1899,7 +1899,7 @@ static void test_D3DKMTCreateAllocation( void )
destroy.hResource = create.hResource; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); create.hResource = 0;
@@ -1907,10 +1907,10 @@ static void test_D3DKMTCreateAllocation( void ) create.Flags.CreateShared = 1; allocs[0].hAllocation = create.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine check_d3dkmt_global( create.hGlobalShare ); - todo_wine check_d3dkmt_local( create.hResource, &next_local ); - todo_wine check_d3dkmt_local( allocs[0].hAllocation, &next_local ); + ok_nt( STATUS_SUCCESS, status ); + check_d3dkmt_global( create.hGlobalShare ); + check_d3dkmt_local( create.hResource, &next_local ); + check_d3dkmt_local( allocs[0].hAllocation, &next_local );
/* D3DKMTQueryResourceInfo works with global handle */ memset( runtime_data, 0xcd, sizeof(runtime_data) ); @@ -2000,18 +2000,19 @@ static void test_D3DKMTCreateAllocation( void ) ok_x4( open.ResourcePrivateDriverDataSize, ==, 0 ); ok_u4( open.NumAllocations, ==, 1 ); todo_wine check_d3dkmt_local( open_alloc2.hAllocation, &next_local ); + next_local = 0; ok_x4( open_alloc2.PrivateDriverDataSize, >, 0 ); todo_wine ok_x4( open_alloc2.PrivateDriverDataSize, <, sizeof(alloc_data) ); open.pOpenAllocationInfo = &open_alloc;
destroy.hResource = open.hResource; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); open.hResource = 0;
destroy.hResource = create.hResource; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); create.hResource = 0;
@@ -2020,14 +2021,14 @@ static void test_D3DKMTCreateAllocation( void ) create.Flags.CreateShared = 1; allocs[0].hAllocation = create.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create.hGlobalShare, ==, 0 ); - todo_wine check_d3dkmt_local( create.hResource, &next_local ); - todo_wine check_d3dkmt_local( allocs[0].hAllocation, &next_local ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create.hGlobalShare, ==, 0 ); + check_d3dkmt_local( create.hResource, &next_local ); + check_d3dkmt_local( allocs[0].hAllocation, &next_local );
destroy.hResource = create.hResource; status = D3DKMTDestroyAllocation( &destroy ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); create.hResource = 0;
@@ -2292,10 +2293,10 @@ static void test_D3DKMTShareObjects( void ) alloc.PrivateDriverDataSize = sizeof(expect_alloc_data); alloc.hAllocation = create_alloc.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create_alloc ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create_alloc.hGlobalShare, ==, 0 ); - todo_wine check_d3dkmt_local( create_alloc.hResource, NULL ); - todo_wine check_d3dkmt_local( alloc.hAllocation, NULL ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create_alloc.hGlobalShare, ==, 0 ); + check_d3dkmt_local( create_alloc.hResource, NULL ); + check_d3dkmt_local( alloc.hAllocation, NULL );
status = D3DKMTShareObjects( 1, &alloc.hAllocation, &attr, STANDARD_RIGHTS_READ, &handle ); todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); @@ -2305,17 +2306,17 @@ static void test_D3DKMTShareObjects( void ) destroy_alloc.hDevice = create_device.hDevice; destroy_alloc.hResource = create_alloc.hResource; status = D3DKMTDestroyAllocation( &destroy_alloc ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); create_alloc.hResource = 0;
create_alloc.Flags.CreateShared = 1; alloc.hAllocation = create_alloc.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create_alloc ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine check_d3dkmt_global( create_alloc.hGlobalShare ); - todo_wine check_d3dkmt_local( create_alloc.hResource, NULL ); - todo_wine check_d3dkmt_local( alloc.hAllocation, NULL ); + ok_nt( STATUS_SUCCESS, status ); + check_d3dkmt_global( create_alloc.hGlobalShare ); + check_d3dkmt_local( create_alloc.hResource, NULL ); + check_d3dkmt_local( alloc.hAllocation, NULL );
status = D3DKMTShareObjects( 1, &alloc.hAllocation, &attr, STANDARD_RIGHTS_READ, &handle ); todo_wine ok_nt( STATUS_INVALID_PARAMETER, status ); @@ -2324,17 +2325,17 @@ static void test_D3DKMTShareObjects( void )
destroy_alloc.hResource = create_alloc.hResource; status = D3DKMTDestroyAllocation( &destroy_alloc ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); create_alloc.hResource = 0;
create_alloc.Flags.NtSecuritySharing = 1; alloc.hAllocation = create_alloc.hGlobalShare = 0x1eadbeed; status = D3DKMTCreateAllocation( &create_alloc ); - todo_wine ok_nt( STATUS_SUCCESS, status ); - todo_wine ok_x4( create_alloc.hGlobalShare, ==, 0 ); - todo_wine check_d3dkmt_local( create_alloc.hResource, NULL ); - todo_wine check_d3dkmt_local( alloc.hAllocation, NULL ); + ok_nt( STATUS_SUCCESS, status ); + ok_x4( create_alloc.hGlobalShare, ==, 0 ); + check_d3dkmt_local( create_alloc.hResource, NULL ); + check_d3dkmt_local( alloc.hAllocation, NULL );
/* can only share resources, not allocations */ status = D3DKMTShareObjects( 1, &alloc.hAllocation, &attr, STANDARD_RIGHTS_READ, &handle ); @@ -2523,7 +2524,7 @@ static void test_D3DKMTShareObjects( void )
destroy_alloc.hResource = create_alloc.hResource; status = D3DKMTDestroyAllocation( &destroy_alloc ); - todo_wine ok_nt( STATUS_SUCCESS, status ); + ok_nt( STATUS_SUCCESS, status ); create_alloc.hResource = 0;
diff --git a/dlls/wow64win/gdi.c b/dlls/wow64win/gdi.c index cfa67e82ebb..bf5705f52a6 100644 --- a/dlls/wow64win/gdi.c +++ b/dlls/wow64win/gdi.c @@ -497,16 +497,16 @@ NTSTATUS WINAPI wow64_NtGdiDdDDICreateAllocation( UINT *args ) standard.Flags = standard32->Flags;
desc.pStandardAllocation = &standard; - desc.PrivateDriverDataSize = sizeof(standard); + desc.PrivateDriverDataSize = desc32->PrivateDriverDataSize; } desc.NumAllocations = desc32->NumAllocations; + allocs32 = UlongToPtr( desc32->pAllocationInfo ); desc.pAllocationInfo = NULL; if (desc32->pAllocationInfo && desc32->NumAllocations) { if (!(desc.pAllocationInfo = Wow64AllocateTemp( desc32->NumAllocations + sizeof(*desc.pAllocationInfo) ))) return STATUS_NO_MEMORY;
- allocs32 = UlongToPtr( desc32->pAllocationInfo ); for (i = 0; i < desc32->NumAllocations; i++) { desc.pAllocationInfo[i].hAllocation = allocs32->hAllocation; @@ -523,6 +523,8 @@ NTSTATUS WINAPI wow64_NtGdiDdDDICreateAllocation( UINT *args ) status = NtGdiDdDDICreateAllocation( &desc ); desc32->hResource = desc.hResource; desc32->hGlobalShare = desc.hGlobalShare; + for (i = 0; desc32->pAllocationInfo && i < desc32->NumAllocations; i++) + allocs32->hAllocation = desc.pAllocationInfo[i].hAllocation; return status; }
@@ -607,13 +609,13 @@ NTSTATUS WINAPI wow64_NtGdiDdDDICreateAllocation2( UINT *args ) desc.PrivateDriverDataSize = sizeof(standard); } desc.NumAllocations = desc32->NumAllocations; + allocs32 = UlongToPtr( desc32->pAllocationInfo2 ); desc.pAllocationInfo2 = NULL; if (desc32->pAllocationInfo2 && desc32->NumAllocations) { if (!(desc.pAllocationInfo2 = Wow64AllocateTemp( desc32->NumAllocations + sizeof(*desc.pAllocationInfo2) ))) return STATUS_NO_MEMORY;
- allocs32 = UlongToPtr( desc32->pAllocationInfo2 ); for (i = 0; i < desc32->NumAllocations; i++) { desc.pAllocationInfo2[i].hAllocation = allocs32->hAllocation; @@ -632,7 +634,10 @@ NTSTATUS WINAPI wow64_NtGdiDdDDICreateAllocation2( UINT *args ) desc32->hResource = desc.hResource; desc32->hGlobalShare = desc.hGlobalShare; for (i = 0; desc32->pAllocationInfo2 && i < desc32->NumAllocations; i++) + { + allocs32->hAllocation = desc.pAllocationInfo2[i].hAllocation; allocs32->GpuVirtualAddress = desc.pAllocationInfo2[i].GpuVirtualAddress; + } return status; }
diff --git a/server/protocol.def b/server/protocol.def index 8605c940d6b..e22b34ee3d2 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -976,6 +976,8 @@ enum d3dkmt_type D3DKMT_SOURCE = 3, D3DKMT_MUTEX = 4, D3DKMT_SYNC = 5, + D3DKMT_RESOURCE = 6, + D3DKMT_ALLOCATION = 7, };
/****************************************************************/