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
aacc7e37
Commit
aacc7e37
authored
Oct 08, 2001
by
Francois Gouget
Committed by
Alexandre Julliard
Oct 08, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_beginthread: Don't store the trampoline on the stack.
parent
d4db6821
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
thread.c
dlls/msvcrt/thread.c
+20
-7
No files found.
dlls/msvcrt/thread.c
View file @
aacc7e37
...
...
@@ -5,6 +5,7 @@
*/
#include "msvcrt.h"
#include "msvcrt/malloc.h"
#include "msvcrt/process.h"
DEFAULT_DEBUG_CHANNEL
(
msvcrt
);
...
...
@@ -21,9 +22,16 @@ typedef struct {
*/
static
DWORD
CALLBACK
_beginthread_trampoline
(
LPVOID
arg
)
{
_beginthread_trampoline_t
*
trampoline
=
arg
;
trampoline
->
start_address
(
trampoline
->
arglist
);
return
0
;
_beginthread_trampoline_t
local_trampoline
;
/* Maybe it's just being paranoid, but freeing arg right
* away seems safer.
*/
memcpy
(
&
local_trampoline
,
arg
,
sizeof
(
local_trampoline
));
MSVCRT_free
(
arg
);
local_trampoline
.
start_address
(
local_trampoline
.
arglist
);
return
0
;
}
/*********************************************************************
...
...
@@ -34,15 +42,20 @@ unsigned long _beginthread(
unsigned
int
stack_size
,
/* [in] Stack size for new thread or 0 */
void
*
arglist
)
/* [in] Argument list to be passed to new thread or NULL */
{
_beginthread_trampoline_t
trampoline
;
_beginthread_trampoline_t
*
trampoline
;
TRACE
(
"(%p, %d, %p)
\n
"
,
start_address
,
stack_size
,
arglist
);
trampoline
.
start_address
=
start_address
;
trampoline
.
arglist
=
arglist
;
/* Allocate the trampoline here so that it is still valid when the thread
* starts... typically after this function has returned.
* _beginthread_trampoline is responsible for freeing the trampoline
*/
trampoline
=
MSVCRT_malloc
(
sizeof
(
*
trampoline
));
trampoline
->
start_address
=
start_address
;
trampoline
->
arglist
=
arglist
;
/* FIXME */
return
CreateThread
(
NULL
,
stack_size
,
_beginthread_trampoline
,
&
trampoline
,
0
,
NULL
);
return
CreateThread
(
NULL
,
stack_size
,
_beginthread_trampoline
,
trampoline
,
0
,
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