Commit f6abd9d1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Implement NtUserEnumDisplayDevices.

And use it in user32. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b502a3e3
...@@ -53,12 +53,6 @@ struct dc_attr_bucket ...@@ -53,12 +53,6 @@ struct dc_attr_bucket
static struct list dc_attr_buckets = LIST_INIT( dc_attr_buckets ); static struct list dc_attr_buckets = LIST_INIT( dc_attr_buckets );
static inline const char *debugstr_us( const UNICODE_STRING *us )
{
if (!us) return "<null>";
return debugstr_wn( us->Buffer, us->Length / sizeof(WCHAR) );
}
static BOOL DC_DeleteObject( HGDIOBJ handle ); static BOOL DC_DeleteObject( HGDIOBJ handle );
static const struct gdi_obj_funcs dc_funcs = static const struct gdi_obj_funcs dc_funcs =
......
...@@ -1169,6 +1169,7 @@ static struct unix_funcs unix_funcs = ...@@ -1169,6 +1169,7 @@ static struct unix_funcs unix_funcs =
NtGdiWidenPath, NtGdiWidenPath,
NtUserActivateKeyboardLayout, NtUserActivateKeyboardLayout,
NtUserCountClipboardFormats, NtUserCountClipboardFormats,
NtUserEnumDisplayDevices,
NtUserGetDisplayConfigBufferSizes, NtUserGetDisplayConfigBufferSizes,
NtUserGetKeyNameText, NtUserGetKeyNameText,
NtUserGetKeyboardLayoutList, NtUserGetKeyboardLayoutList,
......
...@@ -640,6 +640,5 @@ extern void CDECL free_heap_bits( struct gdi_image_bits *bits ) DECLSPEC_HIDDEN; ...@@ -640,6 +640,5 @@ extern void CDECL free_heap_bits( struct gdi_image_bits *bits ) DECLSPEC_HIDDEN;
void set_gdi_client_ptr( HGDIOBJ handle, void *ptr ) DECLSPEC_HIDDEN; void set_gdi_client_ptr( HGDIOBJ handle, void *ptr ) DECLSPEC_HIDDEN;
extern SYSTEM_BASIC_INFORMATION system_info DECLSPEC_HIDDEN; extern SYSTEM_BASIC_INFORMATION system_info DECLSPEC_HIDDEN;
extern const struct user_callbacks *user_callbacks DECLSPEC_HIDDEN;
#endif /* __WINE_NTGDI_PRIVATE_H */ #endif /* __WINE_NTGDI_PRIVATE_H */
...@@ -1211,3 +1211,74 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in ...@@ -1211,3 +1211,74 @@ LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_in
TRACE( "returning %u paths %u modes\n", *num_path_info, *num_mode_info ); TRACE( "returning %u paths %u modes\n", *num_path_info, *num_mode_info );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static struct adapter *find_adapter( UNICODE_STRING *name )
{
struct adapter *adapter;
LIST_FOR_EACH_ENTRY(adapter, &adapters, struct adapter, entry)
{
if (!name || !name->Length) return adapter; /* use primary adapter */
if (!wcsnicmp( name->Buffer, adapter->dev.device_name, name->Length / sizeof(WCHAR) ) &&
!adapter->dev.device_name[name->Length / sizeof(WCHAR)])
return adapter;
}
return NULL;
}
/***********************************************************************
* NtUserEnumDisplayDevices (win32u.@)
*/
BOOL WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index,
DISPLAY_DEVICEW *info, DWORD flags )
{
struct display_device *found = NULL;
struct adapter *adapter;
struct monitor *monitor;
TRACE( "%s %u %p %#x\n", debugstr_us( device ), index, info, flags );
if (!lock_display_devices()) return FALSE;
if (!device || !device->Length)
{
/* Enumerate adapters */
LIST_FOR_EACH_ENTRY(adapter, &adapters, struct adapter, entry)
{
if (index == adapter->id)
{
found = &adapter->dev;
break;
}
}
}
else if ((adapter = find_adapter( device )))
{
/* Enumerate monitors */
LIST_FOR_EACH_ENTRY(monitor, &monitors, struct monitor, entry)
{
if (monitor->adapter == adapter && index == monitor->id)
{
found = &monitor->dev;
break;
}
}
}
if (found)
{
if (info->cb >= offsetof(DISPLAY_DEVICEW, DeviceName) + sizeof(info->DeviceName))
lstrcpyW( info->DeviceName, found->device_name );
if (info->cb >= offsetof(DISPLAY_DEVICEW, DeviceString) + sizeof(info->DeviceString))
lstrcpyW( info->DeviceString, found->device_string );
if (info->cb >= offsetof(DISPLAY_DEVICEW, StateFlags) + sizeof(info->StateFlags))
info->StateFlags = found->state_flags;
if (info->cb >= offsetof(DISPLAY_DEVICEW, DeviceID) + sizeof(info->DeviceID))
lstrcpyW( info->DeviceID, (flags & EDD_GET_DEVICE_INTERFACE_NAME)
? found->interface_name : found->device_id );
if (info->cb >= offsetof(DISPLAY_DEVICEW, DeviceKey) + sizeof(info->DeviceKey))
lstrcpyW( info->DeviceKey, found->device_key );
}
unlock_display_devices();
return !!found;
}
...@@ -875,7 +875,7 @@ ...@@ -875,7 +875,7 @@
@ stub NtUserEndDeferWindowPosEx @ stub NtUserEndDeferWindowPosEx
@ stub NtUserEndMenu @ stub NtUserEndMenu
@ stub NtUserEndPaint @ stub NtUserEndPaint
@ stub NtUserEnumDisplayDevices @ stdcall NtUserEnumDisplayDevices(ptr long ptr long)
@ stub NtUserEnumDisplayMonitors @ stub NtUserEnumDisplayMonitors
@ stub NtUserEnumDisplaySettings @ stub NtUserEnumDisplaySettings
@ stub NtUserEvent @ stub NtUserEvent
......
...@@ -44,6 +44,8 @@ struct user_callbacks ...@@ -44,6 +44,8 @@ struct user_callbacks
HWND (WINAPI *pWindowFromDC)( HDC ); HWND (WINAPI *pWindowFromDC)( HDC );
}; };
extern const struct user_callbacks *user_callbacks DECLSPEC_HIDDEN;
struct unix_funcs struct unix_funcs
{ {
/* win32u functions */ /* win32u functions */
...@@ -196,6 +198,8 @@ struct unix_funcs ...@@ -196,6 +198,8 @@ struct unix_funcs
BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc ); BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc );
HKL (WINAPI *pNtUserActivateKeyboardLayout)( HKL layout, UINT flags ); HKL (WINAPI *pNtUserActivateKeyboardLayout)( HKL layout, UINT flags );
INT (WINAPI *pNtUserCountClipboardFormats)(void); INT (WINAPI *pNtUserCountClipboardFormats)(void);
BOOL (WINAPI *pNtUserEnumDisplayDevices)( UNICODE_STRING *device, DWORD index,
DISPLAY_DEVICEW *info, DWORD flags );
LONG (WINAPI *pNtUserGetDisplayConfigBufferSizes)( UINT32 flags, UINT32 *num_path_info, LONG (WINAPI *pNtUserGetDisplayConfigBufferSizes)( UINT32 flags, UINT32 *num_path_info,
UINT32 *num_mode_info ); UINT32 *num_mode_info );
INT (WINAPI *pNtUserGetKeyNameText)( LONG lparam, WCHAR *buffer, INT size ); INT (WINAPI *pNtUserGetKeyNameText)( LONG lparam, WCHAR *buffer, INT size );
...@@ -390,4 +394,10 @@ static inline BOOL is_win9x(void) ...@@ -390,4 +394,10 @@ static inline BOOL is_win9x(void)
return NtCurrentTeb()->Peb->OSPlatformId == VER_PLATFORM_WIN32s; return NtCurrentTeb()->Peb->OSPlatformId == VER_PLATFORM_WIN32s;
} }
static inline const char *debugstr_us( const UNICODE_STRING *us )
{
if (!us) return "<null>";
return debugstr_wn( us->Buffer, us->Length / sizeof(WCHAR) );
}
#endif /* __WINE_WIN32U_PRIVATE */ #endif /* __WINE_WIN32U_PRIVATE */
...@@ -606,6 +606,12 @@ INT WINAPI NtUserCountClipboardFormats(void) ...@@ -606,6 +606,12 @@ INT WINAPI NtUserCountClipboardFormats(void)
return unix_funcs->pNtUserCountClipboardFormats(); return unix_funcs->pNtUserCountClipboardFormats();
} }
BOOL WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index,
DISPLAY_DEVICEW *info, DWORD flags )
{
return unix_funcs->pNtUserEnumDisplayDevices( device, index, info, flags );
}
LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info, LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info,
UINT32 *num_mode_info ) UINT32 *num_mode_info )
{ {
...@@ -847,7 +853,7 @@ static HWND WINAPI call_WindowFromDC( HDC hdc ) ...@@ -847,7 +853,7 @@ static HWND WINAPI call_WindowFromDC( HDC hdc )
return pWindowFromDC ? pWindowFromDC( hdc ) : NULL; return pWindowFromDC ? pWindowFromDC( hdc ) : NULL;
} }
static const struct user_callbacks user_callbacks = static const struct user_callbacks user_funcs =
{ {
call_GetDesktopWindow, call_GetDesktopWindow,
call_GetDpiForSystem, call_GetDpiForSystem,
...@@ -863,6 +869,6 @@ static const struct user_callbacks user_callbacks = ...@@ -863,6 +869,6 @@ static const struct user_callbacks user_callbacks =
extern void wrappers_init( unixlib_handle_t handle ) extern void wrappers_init( unixlib_handle_t handle )
{ {
const void *args = &user_callbacks; const void *args = &user_funcs;
if (!__wine_unix_call( handle, 1, &args )) unix_funcs = args; if (!__wine_unix_call( handle, 1, &args )) unix_funcs = args;
} }
...@@ -64,6 +64,8 @@ HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *d ...@@ -64,6 +64,8 @@ HDESK WINAPI NtUserCreateDesktopEx( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *d
ULONG heap_size ); ULONG heap_size );
HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3, HWINSTA WINAPI NtUserCreateWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK mask, ULONG arg3,
ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 ); ULONG arg4, ULONG arg5, ULONG arg6, ULONG arg7 );
BOOL WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index,
DISPLAY_DEVICEW *info, DWORD flags );
INT WINAPI NtUserGetClipboardFormatName( UINT format, WCHAR *buffer, INT maxlen ); INT WINAPI NtUserGetClipboardFormatName( UINT format, WCHAR *buffer, INT maxlen );
HWND WINAPI NtUserGetClipboardOwner(void); HWND WINAPI NtUserGetClipboardOwner(void);
DWORD WINAPI NtUserGetClipboardSequenceNumber(void); DWORD WINAPI NtUserGetClipboardSequenceNumber(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment