user32: Store class instance as UINT_PTR.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-03-04 14:28:59 +01:00 committed by Alexandre Julliard
parent dc1f9a114b
commit 7acd2f1ced
2 changed files with 9 additions and 8 deletions

View File

@ -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;

View File

@ -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 */