Pass new arguments (suspend/inherit) to the server.

This commit is contained in:
Ulrich Weigand 1999-03-16 16:28:59 +00:00 committed by Alexandre Julliard
parent 2f2898b571
commit 4526f2ec66
4 changed files with 31 additions and 21 deletions

View File

@ -112,10 +112,12 @@ extern PDB *PROCESS_Current(void);
extern BOOL PROCESS_IsCurrent( HANDLE handle );
extern PDB *PROCESS_Initial(void);
extern PDB *PROCESS_IdToPDB( DWORD id );
extern PDB *PROCESS_Create( struct _NE_MODULE *pModule, LPCSTR cmd_line,
LPCSTR env, HINSTANCE16 hInstance,
HINSTANCE16 hPrevInstance, BOOL inherit,
STARTUPINFOA *startup, PROCESS_INFORMATION *info );
extern PDB *PROCESS_Create( struct _NE_MODULE *pModule,
LPCSTR cmd_line, LPCSTR env,
HINSTANCE16 hInstance, HINSTANCE16 hPrevInstance,
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit,
STARTUPINFOA *startup, PROCESS_INFORMATION *info );
extern void PROCESS_FreePDB( PDB *pdb );
extern void PROCESS_SuspendOtherThreads(void);
extern void PROCESS_ResumeOtherThreads(void);

View File

@ -116,8 +116,9 @@ extern THDB *pCurrentThread;
/* scheduler/thread.c */
extern THDB *THREAD_CreateInitialThread( struct _PDB *pdb );
extern THDB *THREAD_Create( struct _PDB *pdb, DWORD stack_size,
BOOL alloc_stack16,
extern THDB *THREAD_Create( struct _PDB *pdb, DWORD flags,
DWORD stack_size, BOOL alloc_stack16,
LPSECURITY_ATTRIBUTES tsa, LPSECURITY_ATTRIBUTES psa,
int *server_thandle, int *server_phandle,
LPTHREAD_START_ROUTINE start_addr, LPVOID param );
extern THDB *THREAD_Current(void);

View File

@ -285,9 +285,10 @@ BOOL PROCESS_Init(void)
* Create a new process database and associated info.
*/
PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
HINSTANCE16 hInstance, HINSTANCE16 hPrevInstance,
BOOL inherit, STARTUPINFOA *startup,
PROCESS_INFORMATION *info )
HINSTANCE16 hInstance, HINSTANCE16 hPrevInstance,
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, STARTUPINFOA *startup,
PROCESS_INFORMATION *info )
{
DWORD size, commit;
int server_thandle, server_phandle;
@ -326,8 +327,9 @@ PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfStackReserve;
else
size = 0;
if (!(thdb = THREAD_Create( pdb, size, hInstance == 0,
&server_thandle, &server_phandle, NULL, NULL )))
if (!(thdb = THREAD_Create( pdb, 0L, size, hInstance == 0,
tsa, psa, &server_thandle, &server_phandle,
NULL, NULL )))
goto error;
info->hThread = server_thandle;
info->hProcess = server_phandle;

View File

@ -94,7 +94,8 @@ THDB *THREAD_IdToTHDB( DWORD id )
* Initialization of a newly created THDB.
*/
static BOOL THREAD_InitTHDB( THDB *thdb, DWORD stack_size, BOOL alloc_stack16,
int *server_thandle, int *server_phandle )
LPSECURITY_ATTRIBUTES tsa, LPSECURITY_ATTRIBUTES psa,
int *server_thandle, int *server_phandle )
{
DWORD old_prot;
@ -137,7 +138,8 @@ static BOOL THREAD_InitTHDB( THDB *thdb, DWORD stack_size, BOOL alloc_stack16,
/* Create the thread socket */
if (CLIENT_NewThread( thdb, server_thandle, server_phandle )) goto error;
if (CLIENT_NewThread( thdb, tsa, psa, server_thandle, server_phandle ))
goto error;
/* Create the thread event */
@ -246,7 +248,8 @@ THDB *THREAD_CreateInitialThread( PDB *pdb )
/* Now proceed with normal initialization */
if (!THREAD_InitTHDB( &initial_thdb, 0, TRUE, NULL, NULL )) return NULL;
if (!THREAD_InitTHDB( &initial_thdb, 0, TRUE,
NULL, NULL, NULL, NULL )) return NULL;
return &initial_thdb;
}
@ -254,7 +257,8 @@ THDB *THREAD_CreateInitialThread( PDB *pdb )
/***********************************************************************
* THREAD_Create
*/
THDB *THREAD_Create( PDB *pdb, DWORD stack_size, BOOL alloc_stack16,
THDB *THREAD_Create( PDB *pdb, DWORD flags, DWORD stack_size, BOOL alloc_stack16,
LPSECURITY_ATTRIBUTES tsa, LPSECURITY_ATTRIBUTES psa,
int *server_thandle, int *server_phandle,
LPTHREAD_START_ROUTINE start_addr, LPVOID param )
{
@ -268,6 +272,7 @@ THDB *THREAD_Create( PDB *pdb, DWORD stack_size, BOOL alloc_stack16,
thdb->teb.tls_ptr = thdb->tls_array;
thdb->teb.process = pdb;
thdb->exit_code = 0x103; /* STILL_ACTIVE */
thdb->flags = flags;
thdb->entry_point = start_addr;
thdb->entry_arg = param;
thdb->socket = -1;
@ -280,7 +285,8 @@ THDB *THREAD_Create( PDB *pdb, DWORD stack_size, BOOL alloc_stack16,
/* Do the rest of the initialization */
if (!THREAD_InitTHDB( thdb, stack_size, alloc_stack16, server_thandle, server_phandle ))
if (!THREAD_InitTHDB( thdb, stack_size, alloc_stack16,
tsa, psa, server_thandle, server_phandle ))
goto error;
thdb->next = THREAD_First;
THREAD_First = thdb;
@ -313,13 +319,12 @@ void THREAD_Start( THDB *thdb )
* CreateThread (KERNEL32.63)
*/
HANDLE WINAPI CreateThread( SECURITY_ATTRIBUTES *sa, DWORD stack,
LPTHREAD_START_ROUTINE start, LPVOID param,
DWORD flags, LPDWORD id )
LPTHREAD_START_ROUTINE start, LPVOID param,
DWORD flags, LPDWORD id )
{
int handle = -1;
BOOL inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle);
THDB *thread = THREAD_Create( PROCESS_Current(), stack,
TRUE, &handle, NULL, start, param );
THDB *thread = THREAD_Create( PROCESS_Current(), flags, stack,
TRUE, sa, NULL, &handle, NULL, start, param );
if (!thread) return INVALID_HANDLE_VALUE;
if (SYSDEPS_SpawnThread( thread ) == -1)
{