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
45b5bcf6
Commit
45b5bcf6
authored
Mar 07, 2000
by
Andreas Mohr
Committed by
Alexandre Julliard
Mar 07, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several fixes to MakeProcInstance.
parent
82a2b186
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
12 deletions
+38
-12
task.c
loader/task.c
+38
-12
No files found.
loader/task.c
View file @
45b5bcf6
...
@@ -930,17 +930,44 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
...
@@ -930,17 +930,44 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
BYTE
*
thunk
,
*
lfunc
;
BYTE
*
thunk
,
*
lfunc
;
SEGPTR
thunkaddr
;
SEGPTR
thunkaddr
;
if
(
!
func
)
{
TRACE
(
"(%08lx, %04x);"
,
(
DWORD
)
func
,
hInstance
);
ERR
(
"Ouch ! MakeProcInstance called with func == NULL !
\n
"
);
return
(
FARPROC16
)
0
;
/* Windows seems to do the same */
if
(
!
HIWORD
(
func
))
{
/* Win95 actually protects via SEH, but this is better for debugging */
ERR
(
"Ouch ! Called with invalid func 0x%08lx !
\n
"
,
(
DWORD
)
func
);
return
(
FARPROC16
)
0
;
}
if
(
hInstance
)
{
if
(
(
!
(
hInstance
&
4
))
||
((
hInstance
!=
0xffff
)
&&
IS_SELECTOR_FREE
(
hInstance
|
7
))
)
{
ERR
(
"Invalid hInstance (%04x) passed to MakeProcInstance !
\n
"
,
hInstance
);
return
0
;
}
}
}
if
(
GetTaskDS16
()
!=
hInstance
)
if
(
(
CURRENT_DS
!=
hInstance
)
&&
(
hInstance
!=
0
)
&&
(
hInstance
!=
0xffff
)
)
{
{
/* calling MPI with a foreign DSEG is invalid ! */
ERR
(
"Problem with hInstance? Got %04x, using %04x instead
\n
"
,
ERR
(
"Problem with hInstance? Got %04x, using %04x instead
\n
"
,
hInstance
,
GetTaskDS16
());
hInstance
,
CURRENT_DS
);
hInstance
=
GetTaskDS16
();
}
}
if
(
!
hInstance
)
hInstance
=
CURRENT_DS
;
/* Always use the DSEG that MPI was entered with.
* We used to set hInstance to GetTaskDS16(), but this should be wrong
* as CURRENT_DS provides the DSEG value we need.
* ("calling" DS, *not* "task" DS !) */
hInstance
=
CURRENT_DS
;
/* no thunking for DLLs */
if
(
NE_GetPtr
(
FarGetOwner16
(
hInstance
))
->
flags
&
NE_FFLAGS_LIBMODULE
)
return
func
;
thunkaddr
=
TASK_AllocThunk
(
GetCurrentTask
()
);
thunkaddr
=
TASK_AllocThunk
(
GetCurrentTask
()
);
if
(
!
thunkaddr
)
return
(
FARPROC16
)
0
;
if
(
!
thunkaddr
)
return
(
FARPROC16
)
0
;
thunk
=
PTR_SEG_TO_LIN
(
thunkaddr
);
thunk
=
PTR_SEG_TO_LIN
(
thunkaddr
);
...
@@ -948,12 +975,10 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
...
@@ -948,12 +975,10 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
TRACE
(
"(%08lx,%04x): got thunk %08lx
\n
"
,
TRACE
(
"(%08lx,%04x): got thunk %08lx
\n
"
,
(
DWORD
)
func
,
hInstance
,
(
DWORD
)
thunkaddr
);
(
DWORD
)
func
,
hInstance
,
(
DWORD
)
thunkaddr
);
if
(((
lfunc
[
0
]
==
0x8c
)
&&
(
lfunc
[
1
]
==
0xd8
))
||
if
(((
lfunc
[
0
]
==
0x8c
)
&&
(
lfunc
[
1
]
==
0xd8
))
||
/* movw %ds, %ax */
((
lfunc
[
0
]
==
0x1e
)
&&
(
lfunc
[
1
]
==
0x58
))
((
lfunc
[
0
]
==
0x1e
)
&&
(
lfunc
[
1
]
==
0x58
))
/* pushw %ds, popw %ax */
)
{
)
{
FIXME
(
"thunk would be useless for %p, overwriting with nop;nop;
\n
"
,
func
);
FIXME
(
"This was the (in)famous
\"
thunk useless
\"
warning. We thought we have to overwrite with nop;nop;, but this isn't true.
\n
"
);
lfunc
[
0
]
=
0x90
;
/* nop */
lfunc
[
1
]
=
0x90
;
/* nop */
}
}
*
thunk
++
=
0xb8
;
/* movw instance, %ax */
*
thunk
++
=
0xb8
;
/* movw instance, %ax */
...
@@ -962,6 +987,7 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
...
@@ -962,6 +987,7 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
*
thunk
++
=
0xea
;
/* ljmp func */
*
thunk
++
=
0xea
;
/* ljmp func */
*
(
DWORD
*
)
thunk
=
(
DWORD
)
func
;
*
(
DWORD
*
)
thunk
=
(
DWORD
)
func
;
return
(
FARPROC16
)
thunkaddr
;
return
(
FARPROC16
)
thunkaddr
;
/* CX reg indicates if thunkaddr != NULL, implement if needed */
}
}
...
...
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