mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 10:43:38 +00:00
win32u: Move NtUserDisplayConfigGetDeviceInfo implementation from user32.
This commit is contained in:
parent
62f66c3da5
commit
162101bcb3
|
@ -1300,112 +1300,7 @@ done:
|
|||
*/
|
||||
LONG WINAPI DisplayConfigGetDeviceInfo(DISPLAYCONFIG_DEVICE_INFO_HEADER *packet)
|
||||
{
|
||||
LONG ret = ERROR_GEN_FAILURE;
|
||||
HANDLE mutex;
|
||||
HDEVINFO devinfo;
|
||||
SP_DEVINFO_DATA device_data = {sizeof(device_data)};
|
||||
DWORD index = 0, type;
|
||||
LUID gpu_luid;
|
||||
|
||||
TRACE("(%p)\n", packet);
|
||||
|
||||
if (!packet || packet->size < sizeof(*packet))
|
||||
return ERROR_GEN_FAILURE;
|
||||
wait_graphics_driver_ready();
|
||||
|
||||
switch (packet->type)
|
||||
{
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME:
|
||||
{
|
||||
DISPLAYCONFIG_SOURCE_DEVICE_NAME *source_name = (DISPLAYCONFIG_SOURCE_DEVICE_NAME *)packet;
|
||||
WCHAR device_name[CCHDEVICENAME];
|
||||
LONG source_id;
|
||||
|
||||
TRACE("DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME\n");
|
||||
|
||||
if (packet->size < sizeof(*source_name))
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
mutex = get_display_device_init_mutex();
|
||||
devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_MONITOR, L"DISPLAY", NULL, DIGCF_PRESENT);
|
||||
if (devinfo == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
release_display_device_init_mutex(mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
while (SetupDiEnumDeviceInfo(devinfo, index++, &device_data))
|
||||
{
|
||||
if (!SetupDiGetDevicePropertyW(devinfo, &device_data, &DEVPROPKEY_MONITOR_GPU_LUID,
|
||||
&type, (BYTE *)&gpu_luid, sizeof(gpu_luid), NULL, 0))
|
||||
continue;
|
||||
|
||||
if ((source_name->header.adapterId.LowPart != gpu_luid.LowPart) ||
|
||||
(source_name->header.adapterId.HighPart != gpu_luid.HighPart))
|
||||
continue;
|
||||
|
||||
/* QueryDisplayConfig() derives the source ID from the adapter name. */
|
||||
if (!SetupDiGetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_ADAPTERNAME,
|
||||
&type, (BYTE *)device_name, sizeof(device_name), NULL, 0))
|
||||
continue;
|
||||
|
||||
source_id = wcstol(device_name + lstrlenW(L"\\\\.\\DISPLAY"), NULL, 10);
|
||||
source_id--;
|
||||
if (source_name->header.id != source_id)
|
||||
continue;
|
||||
|
||||
lstrcpyW(source_name->viewGdiDeviceName, device_name);
|
||||
ret = ERROR_SUCCESS;
|
||||
break;
|
||||
}
|
||||
SetupDiDestroyDeviceInfoList(devinfo);
|
||||
release_display_device_init_mutex(mutex);
|
||||
return ret;
|
||||
}
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME:
|
||||
{
|
||||
DISPLAYCONFIG_TARGET_DEVICE_NAME *target_name = (DISPLAYCONFIG_TARGET_DEVICE_NAME *)packet;
|
||||
|
||||
FIXME("DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME: stub\n");
|
||||
|
||||
if (packet->size < sizeof(*target_name))
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE:
|
||||
{
|
||||
DISPLAYCONFIG_TARGET_PREFERRED_MODE *preferred_mode = (DISPLAYCONFIG_TARGET_PREFERRED_MODE *)packet;
|
||||
|
||||
FIXME("DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE: stub\n");
|
||||
|
||||
if (packet->size < sizeof(*preferred_mode))
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME:
|
||||
{
|
||||
DISPLAYCONFIG_ADAPTER_NAME *adapter_name = (DISPLAYCONFIG_ADAPTER_NAME *)packet;
|
||||
|
||||
FIXME("DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME: stub\n");
|
||||
|
||||
if (packet->size < sizeof(*adapter_name))
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
|
||||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
case DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL:
|
||||
default:
|
||||
FIXME("Unimplemented packet type: %u\n", packet->type);
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
return RtlNtStatusToDosError(NtUserDisplayConfigGetDeviceInfo(packet));
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -139,6 +139,7 @@ static void * const syscalls[] =
|
|||
NtUserDestroyWindow,
|
||||
NtUserDisableThreadIme,
|
||||
NtUserDispatchMessage,
|
||||
NtUserDisplayConfigGetDeviceInfo,
|
||||
NtUserDragDetect,
|
||||
NtUserDrawIconEx,
|
||||
NtUserEmptyClipboard,
|
||||
|
|
|
@ -5491,3 +5491,88 @@ ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NtUserDisplayConfigGetDeviceInfo (win32u.@)
|
||||
*/
|
||||
NTSTATUS WINAPI NtUserDisplayConfigGetDeviceInfo( DISPLAYCONFIG_DEVICE_INFO_HEADER *packet )
|
||||
{
|
||||
NTSTATUS ret = STATUS_UNSUCCESSFUL;
|
||||
|
||||
TRACE( "packet %p.\n", packet );
|
||||
|
||||
if (!packet || packet->size < sizeof(*packet))
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
|
||||
switch (packet->type)
|
||||
{
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME:
|
||||
{
|
||||
DISPLAYCONFIG_SOURCE_DEVICE_NAME *source_name = (DISPLAYCONFIG_SOURCE_DEVICE_NAME *)packet;
|
||||
struct adapter *adapter;
|
||||
|
||||
TRACE( "DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME.\n" );
|
||||
|
||||
if (packet->size < sizeof(*source_name))
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
if (!lock_display_devices()) return STATUS_UNSUCCESSFUL;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(adapter, &adapters, struct adapter, entry)
|
||||
{
|
||||
if (source_name->header.id != adapter->id) continue;
|
||||
if (memcmp( &source_name->header.adapterId, &adapter->gpu_luid, sizeof(adapter->gpu_luid) )) continue;
|
||||
|
||||
lstrcpyW( source_name->viewGdiDeviceName, adapter->dev.device_name );
|
||||
ret = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
unlock_display_devices();
|
||||
return ret;
|
||||
}
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME:
|
||||
{
|
||||
DISPLAYCONFIG_TARGET_DEVICE_NAME *target_name = (DISPLAYCONFIG_TARGET_DEVICE_NAME *)packet;
|
||||
|
||||
FIXME( "DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME stub.\n" );
|
||||
|
||||
if (packet->size < sizeof(*target_name))
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE:
|
||||
{
|
||||
DISPLAYCONFIG_TARGET_PREFERRED_MODE *preferred_mode = (DISPLAYCONFIG_TARGET_PREFERRED_MODE *)packet;
|
||||
|
||||
FIXME( "DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE stub.\n" );
|
||||
|
||||
if (packet->size < sizeof(*preferred_mode))
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME:
|
||||
{
|
||||
DISPLAYCONFIG_ADAPTER_NAME *adapter_name = (DISPLAYCONFIG_ADAPTER_NAME *)packet;
|
||||
|
||||
FIXME( "DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME stub.\n" );
|
||||
|
||||
if (packet->size < sizeof(*adapter_name))
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
case DISPLAYCONFIG_DEVICE_INFO_SET_TARGET_PERSISTENCE:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_BASE_TYPE:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_SUPPORT_VIRTUAL_RESOLUTION:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_SET_SUPPORT_VIRTUAL_RESOLUTION:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_ADVANCED_COLOR_INFO:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_SET_ADVANCED_COLOR_STATE:
|
||||
case DISPLAYCONFIG_DEVICE_INFO_GET_SDR_WHITE_LEVEL:
|
||||
default:
|
||||
FIXME( "Unimplemented packet type %u.\n", packet->type );
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -675,6 +675,25 @@ static void test_timer(void)
|
|||
DestroyWindow( hwnd );
|
||||
}
|
||||
|
||||
static void test_NtUserDisplayConfigGetDeviceInfo(void)
|
||||
{
|
||||
DISPLAYCONFIG_SOURCE_DEVICE_NAME source_name;
|
||||
NTSTATUS status;
|
||||
|
||||
source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
|
||||
source_name.header.size = sizeof(source_name.header);
|
||||
status = NtUserDisplayConfigGetDeviceInfo(&source_name.header);
|
||||
ok(status == STATUS_INVALID_PARAMETER, "got %#lx.\n", status);
|
||||
|
||||
source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
|
||||
source_name.header.size = sizeof(source_name);
|
||||
source_name.header.adapterId.LowPart = 0xFFFF;
|
||||
source_name.header.adapterId.HighPart = 0xFFFF;
|
||||
source_name.header.id = 0;
|
||||
status = NtUserDisplayConfigGetDeviceInfo(&source_name.header);
|
||||
ok(status == STATUS_UNSUCCESSFUL || status == STATUS_NOT_SUPPORTED, "got %#lx.\n", status);
|
||||
}
|
||||
|
||||
START_TEST(win32u)
|
||||
{
|
||||
/* native win32u.dll fails if user32 is not loaded, so make sure it's fully initialized */
|
||||
|
@ -692,4 +711,5 @@ START_TEST(win32u)
|
|||
test_timer();
|
||||
|
||||
test_NtUserCloseWindowStation();
|
||||
test_NtUserDisplayConfigGetDeviceInfo();
|
||||
}
|
||||
|
|
|
@ -840,7 +840,7 @@
|
|||
@ stdcall -syscall NtUserDisableThreadIme(long)
|
||||
@ stub NtUserDiscardPointerFrameMessages
|
||||
@ stdcall -syscall NtUserDispatchMessage(ptr)
|
||||
@ stub NtUserDisplayConfigGetDeviceInfo
|
||||
@ stdcall -syscall NtUserDisplayConfigGetDeviceInfo(ptr)
|
||||
@ stub NtUserDisplayConfigSetDeviceInfo
|
||||
@ stub NtUserDoSoundConnect
|
||||
@ stub NtUserDoSoundDisconnect
|
||||
|
|
|
@ -125,6 +125,7 @@
|
|||
SYSCALL_ENTRY( NtUserDestroyWindow ) \
|
||||
SYSCALL_ENTRY( NtUserDisableThreadIme ) \
|
||||
SYSCALL_ENTRY( NtUserDispatchMessage ) \
|
||||
SYSCALL_ENTRY( NtUserDisplayConfigGetDeviceInfo ) \
|
||||
SYSCALL_ENTRY( NtUserDragDetect ) \
|
||||
SYSCALL_ENTRY( NtUserDrawIconEx ) \
|
||||
SYSCALL_ENTRY( NtUserEmptyClipboard ) \
|
||||
|
|
|
@ -4077,3 +4077,10 @@ NTSTATUS WINAPI wow64_NtUserWindowFromPoint( UINT *args )
|
|||
|
||||
return HandleToUlong( NtUserWindowFromPoint( x, y ));
|
||||
}
|
||||
|
||||
NTSTATUS WINAPI wow64_NtUserDisplayConfigGetDeviceInfo( UINT *args )
|
||||
{
|
||||
DISPLAYCONFIG_DEVICE_INFO_HEADER *packet = get_ptr( &args );
|
||||
|
||||
return NtUserDisplayConfigGetDeviceInfo( packet );
|
||||
}
|
||||
|
|
|
@ -677,6 +677,7 @@ BOOL WINAPI NtUserDestroyMenu( HMENU menu );
|
|||
BOOL WINAPI NtUserDestroyWindow( HWND hwnd );
|
||||
BOOL WINAPI NtUserDisableThreadIme( DWORD thread_id );
|
||||
LRESULT WINAPI NtUserDispatchMessage( const MSG *msg );
|
||||
NTSTATUS WINAPI NtUserDisplayConfigGetDeviceInfo( DISPLAYCONFIG_DEVICE_INFO_HEADER *packet );
|
||||
BOOL WINAPI NtUserDragDetect( HWND hwnd, int x, int y );
|
||||
BOOL WINAPI NtUserDrawCaptionTemp( HWND hwnd, HDC hdc, const RECT *rect, HFONT font,
|
||||
HICON icon, const WCHAR *str, UINT flags );
|
||||
|
|
Loading…
Reference in a new issue