Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9b9f97e3
Commit
9b9f97e3
authored
Mar 20, 2018
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add redirected class registration callback.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fe572072
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
19 deletions
+81
-19
comctl32.spec
dlls/comctl32/comctl32.spec
+1
-0
commctrl.c
dlls/comctl32/commctrl.c
+35
-7
class.c
dlls/user32/class.c
+42
-10
user_private.h
dlls/user32/user_private.h
+2
-1
win.c
dlls/user32/win.c
+1
-1
No files found.
dlls/comctl32/comctl32.spec
View file @
9b9f97e3
...
...
@@ -194,5 +194,6 @@
@ stdcall PropertySheet(ptr) PropertySheetA
@ stdcall PropertySheetA(ptr)
@ stdcall PropertySheetW(ptr)
@ stdcall RegisterClassNameW(wstr)
@ stdcall UninitializeFlatSB(long)
@ stdcall _TrackMouseEvent(ptr)
dlls/comctl32/commctrl.c
View file @
9b9f97e3
...
...
@@ -69,6 +69,7 @@
#include "shlwapi.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
commctrl
);
...
...
@@ -113,6 +114,40 @@ static void unregister_versioned_classes(void)
#undef VERSION
}
BOOL
WINAPI
RegisterClassNameW
(
const
WCHAR
*
class
)
{
static
const
struct
{
const
WCHAR
nameW
[
16
];
void
(
*
fn_register
)(
void
);
}
classes
[]
=
{
{
{
'B'
,
'u'
,
't'
,
't'
,
'o'
,
'n'
,
0
},
BUTTON_Register
},
{
{
'C'
,
'o'
,
'm'
,
'b'
,
'o'
,
'B'
,
'o'
,
'x'
,
0
},
COMBO_Register
},
{
{
'C'
,
'o'
,
'm'
,
'b'
,
'o'
,
'L'
,
'B'
,
'o'
,
'x'
,
0
},
COMBOLBOX_Register
},
{
{
'E'
,
'd'
,
'i'
,
't'
,
0
},
EDIT_Register
},
{
{
'L'
,
'i'
,
's'
,
't'
,
'B'
,
'o'
,
'x'
,
0
},
LISTBOX_Register
},
{
{
'S'
,
't'
,
'a'
,
't'
,
'i'
,
'c'
,
0
},
STATIC_Register
},
};
int
min
=
0
,
max
=
ARRAY_SIZE
(
classes
)
-
1
;
while
(
min
<=
max
)
{
int
res
,
pos
=
(
min
+
max
)
/
2
;
if
(
!
(
res
=
strcmpiW
(
class
,
classes
[
pos
].
nameW
)))
{
classes
[
pos
].
fn_register
();
return
TRUE
;
}
if
(
res
<
0
)
max
=
pos
-
1
;
else
min
=
pos
+
1
;
}
return
FALSE
;
}
/***********************************************************************
* DllMain [Internal]
*
...
...
@@ -172,13 +207,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
TREEVIEW_Register
();
UPDOWN_Register
();
BUTTON_Register
();
COMBO_Register
();
COMBOLBOX_Register
();
EDIT_Register
();
LISTBOX_Register
();
STATIC_Register
();
/* subclass user32 controls */
THEMING_Initialize
();
break
;
...
...
dlls/user32/class.c
View file @
9b9f97e3
...
...
@@ -320,7 +320,7 @@ static void CLASS_FreeClass( CLASS *classPtr )
USER_Unlock
();
}
const
WCHAR
*
CLASS_GetVersionedName
(
const
WCHAR
*
name
,
UINT
*
basename_offset
)
const
WCHAR
*
CLASS_GetVersionedName
(
const
WCHAR
*
name
,
UINT
*
basename_offset
,
BOOL
register_class
)
{
ACTCTX_SECTION_KEYED_DATA
data
;
struct
wndclass_redirect_data
...
...
@@ -332,7 +332,8 @@ const WCHAR *CLASS_GetVersionedName( const WCHAR *name, UINT *basename_offset )
ULONG
module_len
;
ULONG
module_offset
;
}
*
wndclass
;
const
WCHAR
*
module
;
const
WCHAR
*
module
,
*
ret
;
HMODULE
hmod
;
if
(
basename_offset
)
*
basename_offset
=
0
;
...
...
@@ -352,10 +353,42 @@ const WCHAR *CLASS_GetVersionedName( const WCHAR *name, UINT *basename_offset )
*
basename_offset
=
wndclass
->
name_len
/
sizeof
(
WCHAR
)
-
strlenW
(
name
);
module
=
(
const
WCHAR
*
)((
BYTE
*
)
data
.
lpSectionBase
+
wndclass
->
module_offset
);
if
(
!
GetModuleHandleW
(
module
))
LoadLibraryW
(
module
);
if
(
!
(
hmod
=
GetModuleHandleW
(
module
)
))
hmod
=
LoadLibraryW
(
module
);
return
(
const
WCHAR
*
)((
BYTE
*
)
wndclass
+
wndclass
->
name_offset
);
ret
=
(
const
WCHAR
*
)((
BYTE
*
)
wndclass
+
wndclass
->
name_offset
);
if
(
register_class
&&
hmod
)
{
BOOL
found
=
FALSE
;
struct
list
*
ptr
;
USER_Lock
();
LIST_FOR_EACH
(
ptr
,
&
class_list
)
{
CLASS
*
class
=
LIST_ENTRY
(
ptr
,
CLASS
,
entry
);
if
(
strcmpiW
(
class
->
name
,
ret
))
continue
;
if
(
!
class
->
local
||
class
->
hInstance
==
hmod
)
{
found
=
TRUE
;
break
;
}
}
USER_Unlock
();
if
(
!
found
)
{
BOOL
(
WINAPI
*
pRegisterClassNameW
)(
const
WCHAR
*
class
);
pRegisterClassNameW
=
(
void
*
)
GetProcAddress
(
hmod
,
"RegisterClassNameW"
);
if
(
pRegisterClassNameW
)
pRegisterClassNameW
(
name
);
}
}
return
ret
;
}
/***********************************************************************
...
...
@@ -373,7 +406,7 @@ static CLASS *CLASS_FindClass( LPCWSTR name, HINSTANCE hinstance )
if
(
!
name
)
return
NULL
;
name
=
CLASS_GetVersionedName
(
name
,
NULL
);
name
=
CLASS_GetVersionedName
(
name
,
NULL
,
TRUE
);
for
(;;)
{
...
...
@@ -409,7 +442,6 @@ static CLASS *CLASS_FindClass( LPCWSTR name, HINSTANCE hinstance )
return
NULL
;
}
/***********************************************************************
* CLASS_RegisterClass
*
...
...
@@ -646,7 +678,7 @@ ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc )
{
UINT
basename_offset
;
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
wc
->
lpszClassName
,
-
1
,
name
,
MAX_ATOM_LEN
+
1
))
return
0
;
classname
=
CLASS_GetVersionedName
(
name
,
&
basename_offset
);
classname
=
CLASS_GetVersionedName
(
name
,
&
basename_offset
,
FALSE
);
classPtr
=
CLASS_RegisterClass
(
classname
,
basename_offset
,
instance
,
!
(
wc
->
style
&
CS_GLOBALCLASS
),
wc
->
style
,
wc
->
cbClsExtra
,
wc
->
cbWndExtra
);
}
...
...
@@ -700,7 +732,7 @@ ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
}
if
(
!
(
instance
=
wc
->
hInstance
))
instance
=
GetModuleHandleW
(
NULL
);
classname
=
CLASS_GetVersionedName
(
wc
->
lpszClassName
,
&
basename_offset
);
classname
=
CLASS_GetVersionedName
(
wc
->
lpszClassName
,
&
basename_offset
,
FALSE
);
if
(
!
(
classPtr
=
CLASS_RegisterClass
(
classname
,
basename_offset
,
instance
,
!
(
wc
->
style
&
CS_GLOBALCLASS
),
wc
->
style
,
wc
->
cbClsExtra
,
wc
->
cbWndExtra
)))
return
0
;
...
...
@@ -753,7 +785,7 @@ BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance )
GetDesktopWindow
();
/* create the desktop window to trigger builtin class registration */
className
=
CLASS_GetVersionedName
(
className
,
NULL
);
className
=
CLASS_GetVersionedName
(
className
,
NULL
,
FALSE
);
SERVER_START_REQ
(
destroy_class
)
{
req
->
instance
=
wine_server_client_ptr
(
hInstance
);
...
...
dlls/user32/user_private.h
View file @
9b9f97e3
...
...
@@ -269,7 +269,8 @@ extern INT_PTR WINPROC_CallDlgProcW( DLGPROC func, HWND hwnd, UINT msg, WPARAM w
extern
BOOL
WINPROC_call_window
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
,
LRESULT
*
result
,
BOOL
unicode
,
enum
wm_char_mapping
mapping
)
DECLSPEC_HIDDEN
;
extern
const
WCHAR
*
CLASS_GetVersionedName
(
const
WCHAR
*
classname
,
UINT
*
basename_offset
)
DECLSPEC_HIDDEN
;
extern
const
WCHAR
*
CLASS_GetVersionedName
(
const
WCHAR
*
classname
,
UINT
*
basename_offset
,
BOOL
register_class
)
DECLSPEC_HIDDEN
;
/* message spy definitions */
...
...
dlls/user32/win.c
View file @
9b9f97e3
...
...
@@ -1344,7 +1344,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
CBT_CREATEWNDW
cbtc
;
CREATESTRUCTW
cbcs
;
className
=
CLASS_GetVersionedName
(
className
,
NULL
);
className
=
CLASS_GetVersionedName
(
className
,
NULL
,
TRUE
);
TRACE
(
"%s %s%s%s ex=%08x style=%08x %d,%d %dx%d parent=%p menu=%p inst=%p params=%p
\n
"
,
unicode
?
debugstr_w
(
cs
->
lpszName
)
:
debugstr_a
((
LPCSTR
)
cs
->
lpszName
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment