Jacek Caban : user32: Store class instance as UINT_PTR.

Alexandre Julliard julliard at winehq.org
Fri Mar 4 15:53:08 CST 2022


Module: wine
Branch: master
Commit: 7acd2f1ced4cbb8d340b3497f620606d5dc31bd5
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7acd2f1ced4cbb8d340b3497f620606d5dc31bd5

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Mar  4 14:28:59 2022 +0100

user32: Store class instance as UINT_PTR.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/class.c          | 15 ++++++++-------
 dlls/win32u/ntuser_private.h |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dlls/user32/class.c b/dlls/user32/class.c
index 5255ed1ea25..b24e72be324 100644
--- a/dlls/user32/class.c
+++ b/dlls/user32/class.c
@@ -296,9 +296,10 @@ static void CLASS_FreeClass( CLASS *classPtr )
     USER_Unlock();
 }
 
-static CLASS *find_class( HINSTANCE instance, const WCHAR *name )
+static CLASS *find_class( HINSTANCE module, const WCHAR *name )
 {
     ATOM atom = get_int_atom_value( name );
+    UINT_PTR instance = (UINT_PTR)module;
     CLASS *class;
 
     USER_Lock();
@@ -312,9 +313,9 @@ static CLASS *find_class( HINSTANCE instance, const WCHAR *name )
         {
             if (wcsicmp( class->name, name )) continue;
         }
-        if (!class->local || class->hInstance == instance)
+        if (!class->local || class->instance == instance)
         {
-            TRACE("%s %p -> %p\n", debugstr_w(name), instance, class);
+            TRACE("%s %Ix -> %p\n", debugstr_w(name), instance, class);
             return class;
         }
     }
@@ -477,7 +478,7 @@ static CLASS *CLASS_RegisterClass( LPCWSTR name, UINT basename_offset, HINSTANCE
     classPtr->local       = local;
     classPtr->cbWndExtra  = winExtra;
     classPtr->cbClsExtra  = classExtra;
-    classPtr->hInstance   = hInstance;
+    classPtr->instance    = (UINT_PTR)hInstance;
 
     /* Other non-null values must be set by caller */
 
@@ -953,7 +954,7 @@ static ULONG_PTR CLASS_GetClassLong( HWND hwnd, INT offset, UINT size,
         retvalue = class->cbClsExtra;
         break;
     case GCLP_HMODULE:
-        retvalue = (ULONG_PTR)class->hInstance;
+        retvalue = class->instance;
         break;
     case GCLP_WNDPROC:
         retvalue = (ULONG_PTR)WINPROC_GetProc( class->winproc, unicode );
@@ -1120,8 +1121,8 @@ static ULONG_PTR CLASS_SetClassLong( HWND hwnd, INT offset, LONG_PTR newval,
         break;
     case GCLP_HMODULE:
         if (!set_server_info( hwnd, offset, newval, size )) break;
-        retval = (ULONG_PTR)class->hInstance;
-        class->hInstance = (HINSTANCE)newval;
+        retval = class->instance;
+        class->instance = newval;
         break;
     case GCW_ATOM:
         if (!set_server_info( hwnd, offset, newval, size )) break;
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h
index a7f05f9c5d2..8878718d416 100644
--- a/dlls/win32u/ntuser_private.h
+++ b/dlls/win32u/ntuser_private.h
@@ -179,7 +179,7 @@ typedef struct tagCLASS
     INT              cbWndExtra;    /* Window extra bytes */
     LPWSTR           menuName;      /* Default menu name (Unicode followed by ASCII) */
     struct dce      *dce;           /* Opaque pointer to class DCE */
-    HINSTANCE        hInstance;     /* Module that created the task */
+    UINT_PTR         instance;      /* Module that created the task */
     HICON            hIcon;         /* Default icon */
     HICON            hIconSm;       /* Default small icon */
     HICON            hIconSmIntern; /* Internal small icon, derived from hIcon */




More information about the wine-cvs mailing list