Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
2784c1ca
Commit
2784c1ca
authored
Sep 13, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Fix Get/SetWindowWord behavior on 32-bit.
parent
7ab46c4f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
49 deletions
+26
-49
message.c
dlls/user.exe16/message.c
+1
-1
window.c
dlls/user.exe16/window.c
+18
-2
win.c
dlls/user32/tests/win.c
+0
-20
window.c
dlls/win32u/window.c
+7
-26
No files found.
dlls/user.exe16/message.c
View file @
2784c1ca
...
...
@@ -248,7 +248,7 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA
memset
(
&
context
,
0
,
sizeof
(
context
));
context
.
SegDs
=
context
.
SegEs
=
CURRENT_SS
;
if
(
!
(
context
.
Eax
=
GetWindowWord
(
HWND_32
(
hwnd
),
GWLP_HINSTANCE
)))
context
.
Eax
=
context
.
SegDs
;
if
(
!
(
context
.
Eax
=
(
WORD
)
GetWindowLongA
(
HWND_32
(
hwnd
),
GWLP_HINSTANCE
)))
context
.
Eax
=
context
.
SegDs
;
context
.
SegCs
=
SELECTOROF
(
func
);
context
.
Eip
=
OFFSETOF
(
func
);
context
.
Ebp
=
CURRENT_SP
+
FIELD_OFFSET
(
STACK16FRAME
,
bp
);
...
...
dlls/user.exe16/window.c
View file @
2784c1ca
...
...
@@ -838,7 +838,15 @@ LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
*/
WORD
WINAPI
GetWindowWord16
(
HWND16
hwnd
,
INT16
offset
)
{
return
GetWindowWord
(
WIN_Handle32
(
hwnd
),
offset
);
switch
(
offset
)
{
case
GWLP_ID
:
case
GWLP_HINSTANCE
:
case
GWLP_HWNDPARENT
:
return
GetWindowLongA
(
WIN_Handle32
(
hwnd
),
offset
);
default:
return
GetWindowWord
(
WIN_Handle32
(
hwnd
),
offset
);
}
}
...
...
@@ -847,7 +855,15 @@ WORD WINAPI GetWindowWord16( HWND16 hwnd, INT16 offset )
*/
WORD
WINAPI
SetWindowWord16
(
HWND16
hwnd
,
INT16
offset
,
WORD
newval
)
{
return
SetWindowWord
(
WIN_Handle32
(
hwnd
),
offset
,
newval
);
switch
(
offset
)
{
case
GWLP_ID
:
case
GWLP_HINSTANCE
:
case
GWLP_HWNDPARENT
:
return
SetWindowLongA
(
WIN_Handle32
(
hwnd
),
offset
,
newval
);
default:
return
SetWindowWord
(
WIN_Handle32
(
hwnd
),
offset
,
newval
);
}
}
...
...
dlls/user32/tests/win.c
View file @
2784c1ca
...
...
@@ -7090,33 +7090,25 @@ static void test_set_window_long_size(void)
retval
=
GetWindowLongPtrA
(
hwnd
,
GWLP_USERDATA
);
ok
(
retval
>
123
,
"Unexpected user data.
\n
"
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_USERDATA
);
todo_wine
ok
(
ret
==
123
,
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
SetWindowWord
(
hwnd
,
GWLP_USERDATA
,
124
);
todo_wine
ok
(
ret
==
123
,
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
GetWindowLongA
(
hwnd
,
GWLP_USERDATA
);
todo_wine
ok
(
ret
==
124
,
"Unexpected user data %#lx.
\n
"
,
ret
);
retval
=
GetWindowLongPtrA
(
hwnd
,
GWLP_USERDATA
);
todo_wine
ok
(
retval
==
124
,
"Unexpected user data.
\n
"
);
SetWindowLongA
(
hwnd
,
GWLP_USERDATA
,
(
1
<<
16
)
|
123
);
ret
=
GetWindowLongA
(
hwnd
,
GWLP_USERDATA
);
ok
(
ret
==
((
1
<<
16
)
|
123
),
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_USERDATA
);
todo_wine
ok
(
ret
==
123
,
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
SetWindowWord
(
hwnd
,
GWLP_USERDATA
,
124
);
todo_wine
ok
(
ret
==
123
,
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
GetWindowLongA
(
hwnd
,
GWLP_USERDATA
);
todo_wine
ok
(
ret
==
((
1
<<
16
)
|
124
),
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_USERDATA
);
todo_wine
ok
(
ret
==
124
,
"Unexpected user data %#lx.
\n
"
,
ret
);
/* GWLP_ID */
...
...
@@ -7138,7 +7130,6 @@ static void test_set_window_long_size(void)
ok
(
retval
>
123
,
"Unexpected id.
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_ID
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_INDEX
,
"Unexpected id %#lx.
\n
"
,
ret
);
/* GWLP_HINSTANCE */
...
...
@@ -7155,7 +7146,6 @@ static void test_set_window_long_size(void)
SetLastError
(
0xdeadbeef
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_HINSTANCE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_INDEX
,
"Unexpected instance %#lx.
\n
"
,
ret
);
SetLastError
(
0xdeadbeef
);
...
...
@@ -7181,7 +7171,6 @@ static void test_set_window_long_size(void)
SetLastError
(
0xdeadbeef
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_HWNDPARENT
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_INDEX
,
"Unexpected parent window %#lx.
\n
"
,
ret
);
DestroyWindow
(
hwnd
);
...
...
@@ -7221,16 +7210,12 @@ static void test_set_window_word_size(void)
ret
=
GetWindowLongA
(
hwnd
,
GWLP_USERDATA
);
ok
(
ret
>
123
,
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_USERDATA
);
todo_wine
ok
(
ret
==
123
,
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
SetWindowWord
(
hwnd
,
GWLP_USERDATA
,
124
);
todo_wine
ok
(
ret
==
123
,
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_USERDATA
);
todo_wine
ok
(
ret
==
124
,
"Unexpected user data %#lx.
\n
"
,
ret
);
ret
=
GetWindowLongA
(
hwnd
,
GWLP_USERDATA
);
todo_wine
ok
(
ret
==
((
1
<<
16
)
|
124
),
"Unexpected user data %#lx.
\n
"
,
ret
);
/* GWLP_ID */
...
...
@@ -7241,11 +7226,9 @@ static void test_set_window_word_size(void)
SetLastError
(
0xdeadbeef
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_ID
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_INDEX
,
"Unexpected id %#lx.
\n
"
,
ret
);
SetLastError
(
0xdeadbeef
);
ret
=
SetWindowWord
(
hwnd
,
GWLP_ID
,
2
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_INDEX
,
"Unexpected id %#lx.
\n
"
,
ret
);
/* GWLP_HINSTANCE */
...
...
@@ -7254,12 +7237,10 @@ static void test_set_window_word_size(void)
SetLastError
(
0xdeadbeef
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_HINSTANCE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_INDEX
,
"Unexpected instance %#lx.
\n
"
,
ret
);
SetLastError
(
0xdeadbeef
);
ret
=
SetWindowWord
(
hwnd
,
GWLP_HINSTANCE
,
0xdead
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_INDEX
,
"Unexpected instance %#lx.
\n
"
,
ret
);
/* GWLP_HWNDPARENT */
...
...
@@ -7268,7 +7249,6 @@ static void test_set_window_word_size(void)
SetLastError
(
0xdeadbeef
);
ret
=
GetWindowWord
(
hwnd
,
GWLP_HWNDPARENT
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_INDEX
,
"Unexpected parent window %#lx.
\n
"
,
ret
);
DestroyWindow
(
hwnd
);
...
...
dlls/win32u/window.c
View file @
2784c1ca
...
...
@@ -1101,20 +1101,10 @@ ULONG_PTR get_window_long_ptr( HWND hwnd, INT offset, BOOL ansi )
/* see GetWindowWord */
static
WORD
get_window_word
(
HWND
hwnd
,
INT
offset
)
{
switch
(
offset
)
if
(
offset
<
0
&&
offset
!=
GWLP_USERDATA
)
{
case
GWLP_ID
:
case
GWLP_HINSTANCE
:
case
GWLP_HWNDPARENT
:
break
;
default:
if
(
offset
<
0
)
{
WARN
(
"Invalid offset %d
\n
"
,
offset
);
RtlSetLastWin32Error
(
ERROR_INVALID_INDEX
);
return
0
;
}
break
;
RtlSetLastWin32Error
(
ERROR_INVALID_INDEX
);
return
0
;
}
return
get_window_long_size
(
hwnd
,
offset
,
sizeof
(
WORD
),
TRUE
);
}
...
...
@@ -1354,6 +1344,7 @@ LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOO
req
->
is_unicode
=
(
win
->
flags
&
WIN_ISUNICODE
)
!=
0
;
break
;
case
GWLP_USERDATA
:
if
(
size
==
sizeof
(
WORD
))
newval
=
MAKELONG
(
newval
,
win
->
userdata
>>
16
);
req
->
flags
=
SET_WIN_USERDATA
;
req
->
user_data
=
newval
;
break
;
...
...
@@ -1426,20 +1417,10 @@ LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval, BOO
*/
WORD
WINAPI
NtUserSetWindowWord
(
HWND
hwnd
,
INT
offset
,
WORD
newval
)
{
switch
(
offset
)
if
(
offset
<
0
&&
offset
!=
GWLP_USERDATA
)
{
case
GWLP_ID
:
case
GWLP_HINSTANCE
:
case
GWLP_HWNDPARENT
:
break
;
default:
if
(
offset
<
0
)
{
WARN
(
"Invalid offset %d
\n
"
,
offset
);
RtlSetLastWin32Error
(
ERROR_INVALID_INDEX
);
return
0
;
}
break
;
RtlSetLastWin32Error
(
ERROR_INVALID_INDEX
);
return
0
;
}
return
set_window_long
(
hwnd
,
offset
,
sizeof
(
WORD
),
newval
,
TRUE
);
}
...
...
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