gdi32: Implement D3DKMTDestroyDevice.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2019-06-05 23:19:09 +08:00 committed by Alexandre Julliard
parent 733a92df4b
commit 955549c4ca
6 changed files with 38 additions and 7 deletions

View File

@ -22,7 +22,7 @@
@ stub D3DKMTDestroyAllocation
@ stub D3DKMTDestroyContext
@ stdcall D3DKMTDestroyDCFromMemory(ptr) gdi32.D3DKMTDestroyDCFromMemory
@ stub D3DKMTDestroyDevice
@ stdcall D3DKMTDestroyDevice(ptr) gdi32.D3DKMTDestroyDevice
@ stub D3DKMTDestroyKeyedMutex
@ stub D3DKMTDestroyOutputDupl
@ stub D3DKMTDestroyOverlay

View File

@ -12,7 +12,7 @@
@ stub D3DKMTCreateSynchronizationObject
@ stub D3DKMTDestroyAllocation
@ stub D3DKMTDestroyContext
@ stub D3DKMTDestroyDevice
@ stdcall D3DKMTDestroyDevice(ptr) gdi32.D3DKMTDestroyDevice
@ stub D3DKMTDestroySynchronizationObject
@ stub D3DKMTEscape
@ stub D3DKMTGetContextSchedulingPriority

View File

@ -1394,3 +1394,32 @@ NTSTATUS WINAPI D3DKMTCreateDevice( D3DKMT_CREATEDEVICE *desc )
desc->hDevice = device->handle;
return STATUS_SUCCESS;
}
/******************************************************************************
* D3DKMTDestroyDevice [GDI32.@]
*/
NTSTATUS WINAPI D3DKMTDestroyDevice( const D3DKMT_DESTROYDEVICE *desc )
{
NTSTATUS status = STATUS_INVALID_PARAMETER;
struct d3dkmt_device *device;
TRACE("(%p)\n", desc);
if (!desc || !desc->hDevice)
return STATUS_INVALID_PARAMETER;
EnterCriticalSection( &driver_section );
LIST_FOR_EACH_ENTRY( device, &d3dkmt_devices, struct d3dkmt_device, entry )
{
if (device->handle == desc->hDevice)
{
list_remove( &device->entry );
heap_free( device );
status = STATUS_SUCCESS;
break;
}
}
LeaveCriticalSection( &driver_section );
return status;
}

View File

@ -84,6 +84,7 @@
@ stdcall D3DKMTCreateDCFromMemory(ptr)
@ stdcall D3DKMTCreateDevice(ptr)
@ stdcall D3DKMTDestroyDCFromMemory(ptr)
@ stdcall D3DKMTDestroyDevice(ptr)
@ stdcall D3DKMTEscape(ptr)
@ stdcall D3DKMTOpenAdapterFromGdiDisplayName(ptr)
@ stdcall D3DKMTOpenAdapterFromHdc(ptr)

View File

@ -194,9 +194,9 @@ static void test_D3DKMTCreateDevice(void)
D3DKMT_DESTROYDEVICE destroy_device_desc;
NTSTATUS status;
if (!pD3DKMTCreateDevice || pD3DKMTCreateDevice(NULL) == STATUS_PROCEDURE_NOT_FOUND || !pD3DKMTDestroyDevice)
if (!pD3DKMTCreateDevice || pD3DKMTCreateDevice(NULL) == STATUS_PROCEDURE_NOT_FOUND)
{
skip("D3DKMTCreateDevice() or D3DKMTDestroyDevice() is unavailable.\n");
win_skip("D3DKMTCreateDevice() is unavailable.\n");
return;
}
@ -240,17 +240,17 @@ static void test_D3DKMTDestroyDevice(void)
if (!pD3DKMTDestroyDevice || pD3DKMTDestroyDevice(NULL) == STATUS_PROCEDURE_NOT_FOUND)
{
skip("D3DKMTDestroyDevice() is unavailable.\n");
win_skip("D3DKMTDestroyDevice() is unavailable.\n");
return;
}
/* Invalid parameters */
status = pD3DKMTDestroyDevice(NULL);
todo_wine ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
memset(&destroy_device_desc, 0, sizeof(destroy_device_desc));
status = pD3DKMTDestroyDevice(&destroy_device_desc);
todo_wine ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
}
static void test_D3DKMTCheckVidPnExclusiveOwnership(void)

View File

@ -169,6 +169,7 @@ NTSTATUS WINAPI D3DKMTCloseAdapter(const D3DKMT_CLOSEADAPTER *desc);
NTSTATUS WINAPI D3DKMTCreateDevice(D3DKMT_CREATEDEVICE *desc);
NTSTATUS WINAPI D3DKMTCreateDCFromMemory(D3DKMT_CREATEDCFROMMEMORY *desc);
NTSTATUS WINAPI D3DKMTDestroyDCFromMemory(const D3DKMT_DESTROYDCFROMMEMORY *desc);
NTSTATUS WINAPI D3DKMTDestroyDevice(const D3DKMT_DESTROYDEVICE *desc);
NTSTATUS WINAPI D3DKMTOpenAdapterFromGdiDisplayName(D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME *desc);
#ifdef __cplusplus