Some initialization sequence bugfixes:

- Initialize process crst for 16-bit processes.
- Don't crash due to uninitialized stack frames in WineLib.
- Map system DLLs before calling UserSignalProc.
- Signal USIG_PROCESS_CREATE only *after* the env_db is filled.
This commit is contained in:
Ulrich Weigand 1999-05-08 09:58:47 +00:00 committed by Alexandre Julliard
parent e6cc6fdc07
commit 1c971e3364
2 changed files with 16 additions and 10 deletions

View File

@ -243,6 +243,9 @@ static void TASK_CallToStart(void)
/* Terminate the stack frame chain */
memset(THREAD_STACK16( pTask->thdb ), '\0', sizeof(STACK16FRAME));
/* Initialize process critical section */
InitializeCriticalSection( &PROCESS_Current()->crit_section );
/* Call USER signal proc */
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0, 0 ); /* for initial thread */
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0, 0 );
@ -687,9 +690,9 @@ BOOL TASK_Reschedule(void)
{
/* We need to remove one pair of stackframes (exept for Winelib) */
STACK16FRAME *oldframe16 = CURRENT_STACK16;
STACK32FRAME *oldframe32 = oldframe16->frame32;
STACK16FRAME *newframe16 = PTR_SEG_TO_LIN( oldframe32->frame16 );
STACK32FRAME *newframe32 = newframe16->frame32;
STACK32FRAME *oldframe32 = oldframe16? oldframe16->frame32 : NULL;
STACK16FRAME *newframe16 = oldframe32? PTR_SEG_TO_LIN( oldframe32->frame16 ) : NULL;
STACK32FRAME *newframe32 = newframe16? newframe16->frame32 : NULL;
if (newframe32)
{
newframe16->entry_ip = oldframe16->entry_ip;

View File

@ -463,6 +463,10 @@ void PROCESS_Start(void)
/* Setup process flags */
if (header->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) pdb->flags |= PDB32_CONSOLE_PROC;
/* Map system DLLs into this process (from initial process) */
/* FIXME: this is a hack */
pdb->modref_list = PROCESS_Initial()->modref_list;
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0, 0 ); /* for initial thread */
/* Initialize the critical section */
@ -489,10 +493,6 @@ void PROCESS_Start(void)
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0, 0 );
/* Map system DLLs into this process (from initial process) */
/* FIXME: this is a hack */
pdb->modref_list = PROCESS_Initial()->modref_list;
/* Create 32-bit MODREF */
if (!PE_CreateModule( pModule->module32, ofs, 0, FALSE )) goto error;
@ -574,9 +574,6 @@ PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
info->hProcess = reply.handle;
info->dwProcessId = (DWORD)pdb->server_pid;
/* Call USER signal proc */
PROCESS_CallUserSignalProc( USIG_PROCESS_CREATE, info->dwProcessId, 0 );
if (pModule->module32)
{
/* Create the main thread */
@ -596,6 +593,9 @@ PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
/* Inherit the env DB from the parent */
if (!PROCESS_InheritEnvDB( pdb, cmd_line, env, inherit, startup )) goto error;
/* Call USER signal proc */
PROCESS_CallUserSignalProc( USIG_PROCESS_CREATE, info->dwProcessId, 0 );
/* Set the process module (FIXME: hack) */
pdb->module = pModule->self;
SYSDEPS_SpawnThread( thdb );
@ -632,6 +632,9 @@ PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
info->hProcess, &pdb->env_db->hStderr, 0, TRUE, DUPLICATE_SAME_ACCESS );
}
/* Call USER signal proc */
PROCESS_CallUserSignalProc( USIG_PROCESS_CREATE, info->dwProcessId, 0 );
/* 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;