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
a95c58b8
Commit
a95c58b8
authored
May 09, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user: Separate Get/SetWindowLong16 implementation from the 32-bit one.
parent
feb7276c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
20 deletions
+66
-20
win.c
dlls/user/win.c
+66
-20
No files found.
dlls/user/win.c
View file @
a95c58b8
...
...
@@ -1888,24 +1888,6 @@ static LONG_PTR WIN_GetWindowLong( HWND hwnd, INT offset, WINDOWPROCTYPE type )
{
if
(
offset
>
(
int
)(
wndPtr
->
cbWndExtra
-
sizeof
(
LONG
)))
{
/*
* Some programs try to access last element from 16 bit
* code using illegal offset value. Hopefully this is
* what those programs really expect.
*/
if
(
type
==
WIN_PROC_16
&&
wndPtr
->
cbWndExtra
>=
4
&&
offset
==
wndPtr
->
cbWndExtra
-
sizeof
(
WORD
))
{
INT
offset2
=
wndPtr
->
cbWndExtra
-
sizeof
(
LONG
);
ERR
(
"- replaced invalid offset %d with %d
\n
"
,
offset
,
offset2
);
retvalue
=
*
(
LONG_PTR
*
)(((
char
*
)
wndPtr
->
wExtra
)
+
offset2
);
WIN_ReleasePtr
(
wndPtr
);
return
retvalue
;
}
WARN
(
"Invalid offset %d
\n
"
,
offset
);
WIN_ReleasePtr
(
wndPtr
);
SetLastError
(
ERROR_INVALID_INDEX
);
...
...
@@ -2144,7 +2126,47 @@ static LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, LONG_PTR newval,
*/
LONG
WINAPI
GetWindowLong16
(
HWND16
hwnd
,
INT16
offset
)
{
return
WIN_GetWindowLong
(
WIN_Handle32
(
hwnd
),
offset
,
WIN_PROC_16
);
WND
*
wndPtr
;
LONG_PTR
retvalue
;
BOOL
is_winproc
=
(
offset
==
GWLP_WNDPROC
);
if
(
offset
>=
0
)
{
if
(
!
(
wndPtr
=
WIN_GetPtr
(
WIN_Handle32
(
hwnd
)
)))
{
SetLastError
(
ERROR_INVALID_WINDOW_HANDLE
);
return
0
;
}
if
(
wndPtr
!=
WND_OTHER_PROCESS
&&
wndPtr
!=
WND_DESKTOP
)
{
if
(
offset
>
(
int
)(
wndPtr
->
cbWndExtra
-
sizeof
(
LONG
)))
{
/*
* Some programs try to access last element from 16 bit
* code using illegal offset value. Hopefully this is
* what those programs really expect.
*/
if
(
wndPtr
->
cbWndExtra
>=
4
&&
offset
==
wndPtr
->
cbWndExtra
-
sizeof
(
WORD
))
{
INT
offset2
=
wndPtr
->
cbWndExtra
-
sizeof
(
LONG
);
ERR
(
"- replaced invalid offset %d with %d
\n
"
,
offset
,
offset2
);
offset
=
offset2
;
}
else
{
WARN
(
"Invalid offset %d
\n
"
,
offset
);
WIN_ReleasePtr
(
wndPtr
);
SetLastError
(
ERROR_INVALID_INDEX
);
return
0
;
}
}
is_winproc
=
((
offset
==
DWLP_DLGPROC
)
&&
(
wndPtr
->
flags
&
WIN_ISDIALOG
));
WIN_ReleasePtr
(
wndPtr
);
}
}
retvalue
=
GetWindowLongA
(
WIN_Handle32
(
hwnd
),
offset
);
if
(
is_winproc
)
retvalue
=
(
LONG_PTR
)
WINPROC_GetProc
(
(
WNDPROC
)
retvalue
,
WIN_PROC_16
);
return
retvalue
;
}
...
...
@@ -2171,7 +2193,31 @@ LONG WINAPI GetWindowLongW( HWND hwnd, INT offset )
*/
LONG
WINAPI
SetWindowLong16
(
HWND16
hwnd
,
INT16
offset
,
LONG
newval
)
{
return
WIN_SetWindowLong
(
WIN_Handle32
(
hwnd
),
offset
,
newval
,
WIN_PROC_16
);
WND
*
wndPtr
;
BOOL
is_winproc
=
(
offset
==
GWLP_WNDPROC
);
if
(
offset
==
DWLP_DLGPROC
)
{
if
(
!
(
wndPtr
=
WIN_GetPtr
(
WIN_Handle32
(
hwnd
)
)))
{
SetLastError
(
ERROR_INVALID_WINDOW_HANDLE
);
return
0
;
}
if
(
wndPtr
!=
WND_OTHER_PROCESS
&&
wndPtr
!=
WND_DESKTOP
)
{
is_winproc
=
((
wndPtr
->
cbWndExtra
-
sizeof
(
LONG_PTR
)
>=
DWLP_DLGPROC
)
&&
(
wndPtr
->
flags
&
WIN_ISDIALOG
));
WIN_ReleasePtr
(
wndPtr
);
}
}
if
(
is_winproc
)
{
WNDPROC
new_proc
=
WINPROC_AllocProc
(
(
WNDPROC
)
newval
,
WIN_PROC_16
);
WNDPROC
old_proc
=
(
WNDPROC
)
SetWindowLongA
(
WIN_Handle32
(
hwnd
),
offset
,
(
LONG_PTR
)
new_proc
);
return
(
LONG
)
WINPROC_GetProc
(
(
WNDPROC
)
old_proc
,
WIN_PROC_16
);
}
else
return
SetWindowLongA
(
WIN_Handle32
(
hwnd
),
offset
,
newval
);
}
...
...
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