Moved a few more initialisations to the new process context.
This commit is contained in:
parent
1c4c409f04
commit
64ae5a57cf
|
@ -456,8 +456,7 @@ void PROCESS_Start(void)
|
||||||
LPTHREAD_START_ROUTINE entry;
|
LPTHREAD_START_ROUTINE entry;
|
||||||
THDB *thdb = THREAD_Current();
|
THDB *thdb = THREAD_Current();
|
||||||
PDB *pdb = thdb->process;
|
PDB *pdb = thdb->process;
|
||||||
TDB *pTask = (TDB *)GlobalLock16( pdb->task );
|
NE_MODULE *pModule = NE_GetPtr( pdb->module );
|
||||||
NE_MODULE *pModule = NE_GetPtr( pTask->hModule );
|
|
||||||
OFSTRUCT *ofs = (OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo);
|
OFSTRUCT *ofs = (OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo);
|
||||||
IMAGE_OPTIONAL_HEADER *header = &PE_HEADER(pModule->module32)->OptionalHeader;
|
IMAGE_OPTIONAL_HEADER *header = &PE_HEADER(pModule->module32)->OptionalHeader;
|
||||||
|
|
||||||
|
@ -467,7 +466,6 @@ void PROCESS_Start(void)
|
||||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0, 0 ); /* for initial thread */
|
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0, 0 ); /* for initial thread */
|
||||||
|
|
||||||
/* Initialize the critical section */
|
/* Initialize the critical section */
|
||||||
|
|
||||||
InitializeCriticalSection( &pdb->crit_section );
|
InitializeCriticalSection( &pdb->crit_section );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -479,15 +477,15 @@ void PROCESS_Start(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create the environment db */
|
/* Create the environment db */
|
||||||
|
|
||||||
if (!PROCESS_CreateEnvDB()) goto error;
|
if (!PROCESS_CreateEnvDB()) goto error;
|
||||||
|
|
||||||
#if 0
|
/* Create a task for this process */
|
||||||
if (pdb->env_db->startup_info->dwFlags & STARTF_USESHOWWINDOW)
|
if (pdb->env_db->startup_info->dwFlags & STARTF_USESHOWWINDOW)
|
||||||
cmdShow = pdb->env_db->startup_info->wShowWindow;
|
cmdShow = pdb->env_db->startup_info->wShowWindow;
|
||||||
if (!TASK_Create( thdb, pModule, 0, 0, cmdShow )) goto error;
|
if (!TASK_Create( thdb, pModule, 0, 0, cmdShow )) goto error;
|
||||||
|
|
||||||
#endif
|
/* Link the task in the task list */
|
||||||
|
TASK_StartTask( pdb->task );
|
||||||
|
|
||||||
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0, 0 );
|
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0, 0 );
|
||||||
|
|
||||||
|
@ -499,8 +497,8 @@ void PROCESS_Start(void)
|
||||||
if (!PE_CreateModule( pModule->module32, ofs, 0, FALSE )) goto error;
|
if (!PE_CreateModule( pModule->module32, ofs, 0, FALSE )) goto error;
|
||||||
|
|
||||||
/* Increment EXE refcount */
|
/* Increment EXE refcount */
|
||||||
assert( PROCESS_Current()->exe_modref );
|
assert( pdb->exe_modref );
|
||||||
PROCESS_Current()->exe_modref->refCount++;
|
pdb->exe_modref->refCount++;
|
||||||
|
|
||||||
PROCESS_CallUserSignalProc( USIG_PROCESS_LOADED, 0, 0 ); /* FIXME: correct location? */
|
PROCESS_CallUserSignalProc( USIG_PROCESS_LOADED, 0, 0 ); /* FIXME: correct location? */
|
||||||
|
|
||||||
|
@ -576,8 +574,19 @@ PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
|
||||||
info->hProcess = reply.handle;
|
info->hProcess = reply.handle;
|
||||||
info->dwProcessId = (DWORD)pdb->server_pid;
|
info->dwProcessId = (DWORD)pdb->server_pid;
|
||||||
|
|
||||||
|
/* Call USER signal proc */
|
||||||
|
PROCESS_CallUserSignalProc( USIG_PROCESS_CREATE, info->dwProcessId, 0 );
|
||||||
|
|
||||||
if (pModule->module32)
|
if (pModule->module32)
|
||||||
{
|
{
|
||||||
|
/* Create the main thread */
|
||||||
|
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfStackReserve;
|
||||||
|
if (!(thdb = THREAD_Create( pdb, 0L, size, TRUE, tsa, &server_thandle )))
|
||||||
|
goto error;
|
||||||
|
info->hThread = server_thandle;
|
||||||
|
info->dwThreadId = (DWORD)thdb->server_tid;
|
||||||
|
thdb->startup = PROCESS_Start;
|
||||||
|
|
||||||
/* Create the heap */
|
/* Create the heap */
|
||||||
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapReserve;
|
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapReserve;
|
||||||
commit = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapCommit;
|
commit = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapCommit;
|
||||||
|
@ -587,23 +596,8 @@ PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
|
||||||
/* Inherit the env DB from the parent */
|
/* Inherit the env DB from the parent */
|
||||||
if (!PROCESS_InheritEnvDB( pdb, cmd_line, env, inherit, startup )) goto error;
|
if (!PROCESS_InheritEnvDB( pdb, cmd_line, env, inherit, startup )) goto error;
|
||||||
|
|
||||||
/* Call USER signal proc */
|
/* Set the process module (FIXME: hack) */
|
||||||
PROCESS_CallUserSignalProc( USIG_PROCESS_CREATE, info->dwProcessId, 0 );
|
pdb->module = pModule->self;
|
||||||
|
|
||||||
/* Create the main thread */
|
|
||||||
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfStackReserve;
|
|
||||||
if (!(thdb = THREAD_Create( pdb, 0L, size, hInstance == 0, tsa, &server_thandle )))
|
|
||||||
goto error;
|
|
||||||
info->hThread = server_thandle;
|
|
||||||
info->dwThreadId = (DWORD)thdb->server_tid;
|
|
||||||
thdb->startup = PROCESS_Start;
|
|
||||||
|
|
||||||
/* Create a Win16 task for this process */
|
|
||||||
if (startup->dwFlags & STARTF_USESHOWWINDOW) cmdShow = startup->wShowWindow;
|
|
||||||
if (!TASK_Create( thdb, pModule, hInstance, hPrevInstance, cmdShow )) goto error;
|
|
||||||
|
|
||||||
/* Start the task */
|
|
||||||
TASK_StartTask( pdb->task );
|
|
||||||
SYSDEPS_SpawnThread( thdb );
|
SYSDEPS_SpawnThread( thdb );
|
||||||
}
|
}
|
||||||
else /* Create a 16-bit process */
|
else /* Create a 16-bit process */
|
||||||
|
@ -620,9 +614,6 @@ PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
|
||||||
/* Inherit the env DB from the parent */
|
/* Inherit the env DB from the parent */
|
||||||
if (!PROCESS_InheritEnvDB( pdb, cmd_line, env, inherit, startup )) goto error;
|
if (!PROCESS_InheritEnvDB( pdb, cmd_line, env, inherit, startup )) goto error;
|
||||||
|
|
||||||
/* Call USER signal proc */
|
|
||||||
PROCESS_CallUserSignalProc( USIG_PROCESS_CREATE, info->dwProcessId, 0 );
|
|
||||||
|
|
||||||
/* Create the main thread */
|
/* Create the main thread */
|
||||||
if (!(thdb = THREAD_Create( pdb, 0L, 0, hInstance == 0, tsa, &server_thandle )))
|
if (!(thdb = THREAD_Create( pdb, 0L, 0, hInstance == 0, tsa, &server_thandle )))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
Loading…
Reference in New Issue