[PATCH 1/3] user32: Add nulldrv TRACE messages.

Rémi Bernon rbernon at codeweavers.com
Thu Apr 15 06:46:39 CDT 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

Identifying failures caused by the graphics driver from failures caused
by some user32 bug is difficult, especially as X11 behavior changes
depending on the WM.

So the idea here is to make it easier to use the nulldrv driver, and try
improving it so that we can run the user32 tests with it.

 dlls/user32/driver.c | 54 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c
index 7ac77141696..68c10bf4d9a 100644
--- a/dlls/user32/driver.c
+++ b/dlls/user32/driver.c
@@ -35,6 +35,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(user);
 WINE_DECLARE_DEBUG_CHANNEL(winediag);
+WINE_DECLARE_DEBUG_CHANNEL(nulldrv);
 
 static USER_DRIVER null_driver, lazy_load_driver;
 
@@ -189,11 +190,13 @@ void USER_unload_driver(void)
 
 static HKL CDECL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags )
 {
+    TRACE_(nulldrv)("layout %p, flags %x.\n", layout, flags);
     return 0;
 }
 
 static void CDECL nulldrv_Beep(void)
 {
+    TRACE_(nulldrv)("\n");
 }
 
 static UINT CDECL nulldrv_GetKeyboardLayoutList( INT size, HKL *layouts )
@@ -204,6 +207,8 @@ static UINT CDECL nulldrv_GetKeyboardLayoutList( INT size, HKL *layouts )
     ULONG_PTR baselayout;
     LANGID langid;
 
+    TRACE_(nulldrv)("size %d, layouts %p.\n", size, layouts);
+
     baselayout = GetUserDefaultLCID();
     langid = PRIMARYLANGID(LANGIDFROMLCID(baselayout));
     if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN)
@@ -255,47 +260,57 @@ static UINT CDECL nulldrv_GetKeyboardLayoutList( INT size, HKL *layouts )
 
 static INT CDECL nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
 {
+    TRACE_(nulldrv)("lparam %d, buffer %p, size %d.\n", lparam, buffer, size);
     return 0;
 }
 
 static HKL CDECL nulldrv_GetKeyboardLayout( DWORD thread_id )
 {
+    TRACE_(nulldrv)("thread_id %u.\n", thread_id);
     return 0;
 }
 
 static BOOL CDECL nulldrv_GetKeyboardLayoutName( LPWSTR name )
 {
+    TRACE_(nulldrv)("name %p.\n", name);
     return FALSE;
 }
 
 static HKL CDECL nulldrv_LoadKeyboardLayout( LPCWSTR name, UINT flags )
 {
+    TRACE_(nulldrv)("name %p, flags %x.\n", name, flags);
     return 0;
 }
 
 static UINT CDECL nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
 {
+    TRACE_(nulldrv)("code %u, type %u, layout %p.\n", code, type, layout);
     return 0;
 }
 
 static BOOL CDECL nulldrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
 {
+    TRACE_(nulldrv)("hwnd %p, modifiers %u, vk %u.\n", hwnd, modifiers, vk);
     return TRUE;
 }
 
 static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str,
                                       int size, UINT flags, HKL layout )
 {
+    TRACE_(nulldrv)("virt %u, scan %u, state %p, str %p, size %d, flags %x, layout %p.\n",
+                    virt, scan, state, str, size, flags, layout);
     return 0;
 }
 
 static BOOL CDECL nulldrv_UnloadKeyboardLayout( HKL layout )
 {
+    TRACE_(nulldrv)("layout %p.\n", layout);
     return 0;
 }
 
 static void CDECL nulldrv_UnregisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
 {
+    TRACE_(nulldrv)("hwnd %p, modifiers %u, vk %u.\n", hwnd, modifiers, vk);
 }
 
 static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
@@ -307,49 +322,59 @@ static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
         0x258, 0x259, 0x25a, 0x01b, 0x2dc, 0x2dd, 0x336, 0x3bd
     };
 
+    TRACE_(nulldrv)("ch %s, layout %p.\n", wine_dbgstr_wn(&ch, 1), layout);
     return ch < ARRAY_SIZE(ctrl_vks) ? ctrl_vks[ch] : -1;
 }
 
 static void CDECL nulldrv_DestroyCursorIcon( HCURSOR cursor )
 {
+    TRACE_(nulldrv)("cursor %p.\n", cursor);
 }
 
 static void CDECL nulldrv_SetCursor( HCURSOR cursor )
 {
+    TRACE_(nulldrv)("cursor %p.\n", cursor);
 }
 
 static BOOL CDECL nulldrv_GetCursorPos( LPPOINT pt )
 {
+    TRACE_(nulldrv)("pt %p.\n", pt);
     return FALSE;
 }
 
 static BOOL CDECL nulldrv_SetCursorPos( INT x, INT y )
 {
+    TRACE_(nulldrv)("x %d, y %d.\n", x, y);
     return FALSE;
 }
 
 static BOOL CDECL nulldrv_ClipCursor( LPCRECT clip )
 {
+    TRACE_(nulldrv)("clip %s.\n", wine_dbgstr_rect(clip));
     return FALSE;
 }
 
 static void CDECL nulldrv_UpdateClipboard(void)
 {
+    TRACE_(nulldrv)("\n");
 }
 
 static LONG CDECL nulldrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
                                              DWORD flags, LPVOID lparam )
 {
+    TRACE_(nulldrv)("name %s, mode %p, hwnd %p, flags %x, lparam %p.\n", wine_dbgstr_w(name), mode, hwnd, flags, lparam);
     return DISP_CHANGE_FAILED;
 }
 
 static BOOL CDECL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
 {
+    TRACE_(nulldrv)("name %s, num %#x, mode %p, flags %x.\n", wine_dbgstr_w(name), num, mode, flags);
     return FALSE;
 }
 
 static BOOL CDECL nulldrv_CreateDesktopWindow( HWND hwnd )
 {
+    TRACE_(nulldrv)("hwnd %p.\n", hwnd);
     return TRUE;
 }
 
@@ -369,37 +394,46 @@ static BOOL CDECL nodrv_CreateWindow( HWND hwnd )
 
 static BOOL CDECL nulldrv_CreateWindow( HWND hwnd )
 {
+    TRACE_(nulldrv)("hwnd %p.\n", hwnd);
     return TRUE;
 }
 
 static void CDECL nulldrv_DestroyWindow( HWND hwnd )
 {
+    TRACE_(nulldrv)("hwnd %p.\n", hwnd);
 }
 
 static void CDECL nulldrv_FlashWindowEx( FLASHWINFO *info )
 {
+    TRACE_(nulldrv)("info %p.\n", info);
 }
 
 static void CDECL nulldrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
                                  const RECT *top_rect, DWORD flags )
 {
+    TRACE_(nulldrv)("hdc %p, hwnd %p, top_win %p, win_rect %s, top_rect %s, flags %x.\n",
+                    hdc, hwnd, top_win, wine_dbgstr_rect(win_rect), wine_dbgstr_rect(top_rect),
+                    flags);
 }
 
 static DWORD CDECL nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
                                                         DWORD mask, DWORD flags )
 {
+    TRACE_(nulldrv)("count %u, handles %p, timeout %u, mask %u, flags %x.\n", count, handles, timeout, mask, flags);
     return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL,
                                      timeout, flags & MWMO_ALERTABLE );
 }
 
 static void CDECL nulldrv_ReleaseDC( HWND hwnd, HDC hdc )
 {
+    TRACE_(nulldrv)("hwnd %p, hdc %p.\n", hwnd, hdc);
 }
 
 static BOOL CDECL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
 {
     RECT rect;
 
+    TRACE_(nulldrv)("hdc %p, dx %d, dy %d, update %p.\n", hdc, dx, dy, update);
     GetClipBox( hdc, &rect );
     return BitBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
                    hdc, rect.left - dx, rect.top - dy, SRCCOPY );
@@ -407,54 +441,66 @@ static BOOL CDECL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
 
 static void CDECL nulldrv_SetCapture( HWND hwnd, UINT flags )
 {
+    TRACE_(nulldrv)("hwnd %p, flags %x.\n", hwnd, flags);
 }
 
 static void CDECL nulldrv_SetFocus( HWND hwnd )
 {
+    TRACE_(nulldrv)("hwnd %p.\n", hwnd);
 }
 
 static void CDECL nulldrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
 {
+    TRACE_(nulldrv)("hwnd %p, key %u, alpha %d, flags %x.\n", hwnd, key, alpha, flags);
 }
 
 static void CDECL nulldrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
 {
+    TRACE_(nulldrv)("hwnd %p, parent %p, old_parent %p.\n", hwnd, parent, old_parent);
 }
 
 static void CDECL nulldrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
 {
+    TRACE_(nulldrv)("hwnd %p, hrgn %p, redraw %d.\n", hwnd, hrgn, redraw);
 }
 
 static void CDECL nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
 {
+    TRACE_(nulldrv)("hwnd %p, type %u, icon %p.\n", hwnd, type, icon);
 }
 
 static void CDECL nulldrv_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style )
 {
+    TRACE_(nulldrv)("hwnd %p, offset %d, style %p.\n", hwnd, offset, style);
 }
 
 static void CDECL nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
 {
+    TRACE_(nulldrv)("hwnd %p, text %p.\n", hwnd, text);
 }
 
 static UINT CDECL nulldrv_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
 {
+    TRACE_(nulldrv)("hwnd %p, cmd %d, rect %s, swp %u.\n", hwnd, cmd, wine_dbgstr_rect(rect), swp);
     return swp;
 }
 
 static LRESULT CDECL nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
 {
+    TRACE_(nulldrv)("hwnd %p, wparam %lu, lparam %ld.\n", hwnd, wparam, lparam);
     return -1;
 }
 
 static BOOL CDECL nulldrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
                                                const RECT *window_rect )
 {
+    TRACE_(nulldrv)("hwnd %p, info %p, window_rect %s.\n", hwnd, info, wine_dbgstr_rect(window_rect));
     return TRUE;
 }
 
 static LRESULT CDECL nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
 {
+    TRACE_(nulldrv)("hwnd %p, msg %u, wparam %lu, lparam %ld.\n", hwnd, msg, wparam, lparam);
     return 0;
 }
 
@@ -462,6 +508,9 @@ static void CDECL nulldrv_WindowPosChanging( HWND hwnd, HWND insert_after, UINT
                                              const RECT *window_rect, const RECT *client_rect,
                                              RECT *visible_rect, struct window_surface **surface )
 {
+    TRACE_(nulldrv)("hwnd %p, insert_after %p, swp_flags %x, window_rect %s, client_rect %s, visible_rect %s, surface %p.\n",
+                    hwnd, insert_after, swp_flags, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect),
+                    wine_dbgstr_rect(visible_rect), surface);
 }
 
 static void CDECL nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
@@ -469,15 +518,20 @@ static void CDECL nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT s
                                             const RECT *visible_rect, const RECT *valid_rects,
                                             struct window_surface *surface )
 {
+    TRACE_(nulldrv)("hwnd %p, insert_after %p, swp_flags %x, window_rect %s, client_rect %s, visible_rect %s, valid_rects %s, surface %p.\n",
+                    hwnd, insert_after, swp_flags, wine_dbgstr_rect(window_rect), wine_dbgstr_rect(client_rect), wine_dbgstr_rect(visible_rect),
+                    wine_dbgstr_rect(valid_rects), surface);
 }
 
 static BOOL CDECL nulldrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, UINT flags )
 {
+    TRACE_(nulldrv)("action %u, int_param %u, ptr_param %p, flags %x.\n", action, int_param, ptr_param, flags);
     return FALSE;
 }
 
 static void CDECL nulldrv_ThreadDetach( void )
 {
+    TRACE_(nulldrv)("\n");
 }
 
 static USER_DRIVER null_driver =
-- 
2.31.0




More information about the wine-devel mailing list