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
f3bf2a70
Commit
f3bf2a70
authored
Jul 03, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Use a proper structure for thunks instead of an array of WORDs.
parent
d8202087
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
task.c
dlls/kernel32/task.c
+18
-15
No files found.
dlls/kernel32/task.c
View file @
f3bf2a70
...
@@ -49,6 +49,14 @@ WINE_DECLARE_DEBUG_CHANNEL(toolhelp);
...
@@ -49,6 +49,14 @@ WINE_DECLARE_DEBUG_CHANNEL(toolhelp);
#include "pshpack1.h"
#include "pshpack1.h"
struct
thunk
{
BYTE
movw
;
HANDLE16
instance
;
BYTE
ljmp
;
FARPROC16
func
;
};
/* Segment containing MakeProcInstance() thunks */
/* Segment containing MakeProcInstance() thunks */
typedef
struct
typedef
struct
{
{
...
@@ -56,7 +64,7 @@ typedef struct
...
@@ -56,7 +64,7 @@ typedef struct
WORD
magic
;
/* Thunks signature */
WORD
magic
;
/* Thunks signature */
WORD
unused
;
WORD
unused
;
WORD
free
;
/* Head of the free list */
WORD
free
;
/* Head of the free list */
WORD
thunks
[
4
];
/* Each thunk is 4 words long */
struct
thunk
thunks
[
1
];
}
THUNKS
;
}
THUNKS
;
#include "poppack.h"
#include "poppack.h"
...
@@ -163,20 +171,15 @@ static void TASK_UnlinkTask( HTASK16 hTask )
...
@@ -163,20 +171,15 @@ static void TASK_UnlinkTask( HTASK16 hTask )
static
void
TASK_CreateThunks
(
HGLOBAL16
handle
,
WORD
offset
,
WORD
count
)
static
void
TASK_CreateThunks
(
HGLOBAL16
handle
,
WORD
offset
,
WORD
count
)
{
{
int
i
;
int
i
;
WORD
free
;
THUNKS
*
pThunk
;
THUNKS
*
pThunk
;
pThunk
=
(
THUNKS
*
)((
BYTE
*
)
GlobalLock16
(
handle
)
+
offset
);
pThunk
=
(
THUNKS
*
)((
BYTE
*
)
GlobalLock16
(
handle
)
+
offset
);
pThunk
->
next
=
0
;
pThunk
->
next
=
0
;
pThunk
->
magic
=
THUNK_MAGIC
;
pThunk
->
magic
=
THUNK_MAGIC
;
pThunk
->
free
=
(
int
)
&
pThunk
->
thunks
-
(
int
)
pThunk
;
pThunk
->
free
=
FIELD_OFFSET
(
THUNKS
,
thunks
);
free
=
pThunk
->
free
;
for
(
i
=
0
;
i
<
count
-
1
;
i
++
)
for
(
i
=
0
;
i
<
count
-
1
;
i
++
)
{
*
(
WORD
*
)
&
pThunk
->
thunks
[
i
]
=
FIELD_OFFSET
(
THUNKS
,
thunks
[
i
+
1
]
);
free
+=
8
;
/* Offset of next thunk */
*
(
WORD
*
)
&
pThunk
->
thunks
[
i
]
=
0
;
/* Last thunk */
pThunk
->
thunks
[
4
*
i
]
=
free
;
}
pThunk
->
thunks
[
4
*
i
]
=
0
;
/* Last thunk */
}
}
...
@@ -845,7 +848,8 @@ HTASK16 WINAPI KERNEL_490( HTASK16 someTask )
...
@@ -845,7 +848,8 @@ HTASK16 WINAPI KERNEL_490( HTASK16 someTask )
*/
*/
FARPROC16
WINAPI
MakeProcInstance16
(
FARPROC16
func
,
HANDLE16
hInstance
)
FARPROC16
WINAPI
MakeProcInstance16
(
FARPROC16
func
,
HANDLE16
hInstance
)
{
{
BYTE
*
thunk
,
*
lfunc
;
struct
thunk
*
thunk
;
BYTE
*
lfunc
;
SEGPTR
thunkaddr
;
SEGPTR
thunkaddr
;
WORD
hInstanceSelector
;
WORD
hInstanceSelector
;
...
@@ -891,11 +895,10 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
...
@@ -891,11 +895,10 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
WARN
(
"This was the (in)famous
\"
thunk useless
\"
warning. We thought we have to overwrite with nop;nop;, but this isn't true.
\n
"
);
WARN
(
"This was the (in)famous
\"
thunk useless
\"
warning. We thought we have to overwrite with nop;nop;, but this isn't true.
\n
"
);
}
}
*
thunk
++
=
0xb8
;
/* movw instance, %ax */
thunk
->
movw
=
0xb8
;
/* movw instance, %ax */
*
thunk
++
=
(
BYTE
)(
hInstanceSelector
&
0xff
);
thunk
->
instance
=
hInstanceSelector
;
*
thunk
++
=
(
BYTE
)(
hInstanceSelector
>>
8
);
thunk
->
ljmp
=
0xea
;
/* ljmp func */
*
thunk
++
=
0xea
;
/* ljmp func */
thunk
->
func
=
func
;
*
(
DWORD
*
)
thunk
=
(
DWORD
)
func
;
return
(
FARPROC16
)
thunkaddr
;
return
(
FARPROC16
)
thunkaddr
;
/* CX reg indicates if thunkaddr != NULL, implement if needed */
/* 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