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
9e1fda18
Commit
9e1fda18
authored
Dec 03, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed WINPROC_GetPtr() to always pass the start of the block to
HeapValidate().
parent
cc7aef32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
18 deletions
+16
-18
winproc.c
windows/winproc.c
+16
-18
No files found.
windows/winproc.c
View file @
9e1fda18
...
...
@@ -260,32 +260,30 @@ static WINDOWPROC *WINPROC_GetPtr( WNDPROC16 handle )
BYTE
*
ptr
;
WINDOWPROC
*
proc
;
/* ptr cannot be < 64K */
if
(
!
HIWORD
(
handle
))
return
NULL
;
/* Check for a linear pointer */
if
(
handle
&&
HeapValidate
(
WinProcHeap
,
0
,
(
LPVOID
)
handle
))
{
ptr
=
(
BYTE
*
)
handle
;
/* First check if it is the jmp address */
if
(
*
ptr
==
0xe9
/* jmp */
)
ptr
-=
(
int
)
&
((
WINDOWPROC
*
)
0
)
->
jmp
-
(
int
)
&
((
WINDOWPROC
*
)
0
)
->
thunk
;
/* Now it must be the thunk address */
if
(
*
ptr
==
0x58
/* popl eax */
)
ptr
-=
(
int
)
&
((
WINDOWPROC
*
)
0
)
->
thunk
;
/* Now we have a pointer to the WINDOWPROC struct */
if
(((
WINDOWPROC
*
)
ptr
)
->
magic
==
WINPROC_MAGIC
)
return
(
WINDOWPROC
*
)
ptr
;
}
ptr
=
(
BYTE
*
)
handle
;
/* First check if it is the jmp address */
proc
=
(
WINDOWPROC
*
)(
ptr
-
(
int
)
&
((
WINDOWPROC
*
)
0
)
->
jmp
);
if
(
HeapValidate
(
WinProcHeap
,
0
,
proc
)
&&
(
proc
->
magic
==
WINPROC_MAGIC
))
return
proc
;
/* Now it must be the thunk address */
proc
=
(
WINDOWPROC
*
)(
ptr
-
(
int
)
&
((
WINDOWPROC
*
)
0
)
->
thunk
);
if
(
HeapValidate
(
WinProcHeap
,
0
,
proc
)
&&
(
proc
->
magic
==
WINPROC_MAGIC
))
return
proc
;
/* Check for a segmented pointer */
if
(
!
IsBadReadPtr16
(
(
SEGPTR
)
handle
,
sizeof
(
WINDOWPROC
)
-
sizeof
(
proc
->
thunk
)
))
if
(
!
IsBadReadPtr16
(
(
SEGPTR
)
handle
,
sizeof
(
proc
->
thunk
)
))
{
ptr
=
(
BYTE
*
)
PTR_SEG_TO_LIN
(
handle
);
if
(
!
HeapValidate
(
WinProcHeap
,
0
,
ptr
))
return
NULL
;
/* It must be the thunk address */
if
(
*
ptr
==
0x58
/* popl eax */
)
ptr
-=
(
int
)
&
((
WINDOWPROC
*
)
0
)
->
thunk
;
/* Now we have a pointer to the WINDOWPROC struct */
if
(((
WINDOWPROC
*
)
ptr
)
->
magic
==
WINPROC_MAGIC
)
return
(
WINDOWPROC
*
)
ptr
;
proc
=
(
WINDOWPROC
*
)(
ptr
-
(
int
)
&
((
WINDOWPROC
*
)
0
)
->
thunk
);
if
(
HeapValidate
(
WinProcHeap
,
0
,
proc
)
&&
(
proc
->
magic
==
WINPROC_MAGIC
))
return
proc
;
}
return
NULL
;
...
...
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