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
e4c2d6ba
Commit
e4c2d6ba
authored
Feb 22, 2005
by
Jason Edmeades
Committed by
Alexandre Julliard
Feb 22, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make RegisterClassExA check that reserved bytes is a valid value.
Tests to confirm this behaviour.
parent
dd99a50f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
+31
-4
class.c
dlls/user/tests/class.c
+24
-0
class.c
windows/class.c
+7
-4
No files found.
dlls/user/tests/class.c
View file @
e4c2d6ba
...
...
@@ -310,6 +310,7 @@ static void test_instances(void)
cls
.
lpszMenuName
=
"main_module"
;
cls
.
hInstance
=
main_module
;
ok
(
RegisterClassA
(
&
cls
),
"Failed to register local class for main module
\n
"
);
check_class
(
main_module
,
name
,
"main_module"
);
check_instance
(
name
,
main_module
,
main_module
,
main_module
);
...
...
@@ -324,6 +325,29 @@ static void test_instances(void)
check_thread_instance
(
name
,
kernel32
,
kernel32
,
kernel32
);
ok
(
UnregisterClassA
(
name
,
kernel32
),
"Unregister failed for kernel32
\n
"
);
/* Bug 2631 - Supplying an invalid number of bytes fails */
cls
.
cbClsExtra
=
0
;
cls
.
cbWndExtra
=
-
1
;
SetLastError
(
0xdeadbeef
);
ok
(
((
RegisterClassA
(
&
cls
)
==
0
)
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
)),
"Failed with invalid number of WndExtra bytes
\n
"
);
cls
.
cbClsExtra
=
-
1
;
cls
.
cbWndExtra
=
0
;
SetLastError
(
0xdeadbeef
);
ok
(
((
RegisterClassA
(
&
cls
)
==
0
)
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
)),
"Failed with invalid number of ClsExtra bytes
\n
"
);
cls
.
cbClsExtra
=
-
1
;
cls
.
cbWndExtra
=
-
1
;
SetLastError
(
0xdeadbeef
);
ok
(
((
RegisterClassA
(
&
cls
)
==
0
)
&&
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
)),
"Failed with invalid number of ClsExtra and cbWndExtra bytes
\n
"
);
cls
.
cbClsExtra
=
0
;
cls
.
cbWndExtra
=
0
;
SetLastError
(
0xdeadbeef
);
/* setting global flag doesn't change status of class */
hwnd
=
CreateWindowExA
(
0
,
name
,
"test"
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
main_module
,
0
);
SetClassLongA
(
hwnd
,
GCL_STYLE
,
CS_GLOBALCLASS
);
...
...
windows/class.c
View file @
e4c2d6ba
...
...
@@ -379,11 +379,14 @@ static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE hInstance, BOOL local,
/* Fix the extra bytes value */
if
(
classExtra
<
0
)
classExtra
=
0
;
else
if
(
classExtra
>
40
)
/* Extra bytes are limited to 40 in Win32 */
if
(
classExtra
<
0
||
winExtra
<
0
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
if
(
classExtra
>
40
)
/* Extra bytes are limited to 40 in Win32 */
WARN
(
"Class extra bytes %d is > 40
\n
"
,
classExtra
);
if
(
winExtra
<
0
)
winExtra
=
0
;
else
if
(
winExtra
>
40
)
/* Extra bytes are limited to 40 in Win32 */
if
(
winExtra
>
40
)
/* Extra bytes are limited to 40 in Win32 */
WARN
(
"Win extra bytes %d is > 40
\n
"
,
winExtra
);
classPtr
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
CLASS
)
+
classExtra
);
...
...
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