mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-05 14:18:19 +00:00
Converted to the new debugging interface (done with the help of the
script written by Patrik Stridvall). Some changes to the initialisation sequence for 32-bit processes.
This commit is contained in:
parent
06c275a643
commit
e8c6a08cd9
|
@ -33,7 +33,7 @@
|
|||
#include "winsock.h"
|
||||
#include "thread.h"
|
||||
#include "syslevel.h"
|
||||
#include "debug.h"
|
||||
#include "debugtools.h"
|
||||
#include "dosexe.h"
|
||||
#include "dde_proc.h"
|
||||
#include "server.h"
|
||||
|
@ -250,7 +250,7 @@ static void TASK_CallToStart(void)
|
|||
|
||||
if (pModule->flags & NE_FFLAGS_WIN32)
|
||||
{
|
||||
ERR( task, "Called for Win32 task!\n" );
|
||||
ERR_(task)("Called for Win32 task!\n" );
|
||||
ExitProcess( 1 );
|
||||
}
|
||||
else if (pModule->dos_image)
|
||||
|
@ -283,14 +283,14 @@ static void TASK_CallToStart(void)
|
|||
ECX_reg(&context) = pModule->heap_size;
|
||||
EDI_reg(&context) = context.SegDs;
|
||||
|
||||
TRACE(task, "Starting main program: cs:ip=%04lx:%04x ds=%04lx ss:sp=%04x:%04x\n",
|
||||
TRACE_(task)("Starting main program: cs:ip=%04lx:%04x ds=%04lx ss:sp=%04x:%04x\n",
|
||||
CS_reg(&context), IP_reg(&context), DS_reg(&context),
|
||||
SELECTOROF(pTask->thdb->cur_stack),
|
||||
OFFSETOF(pTask->thdb->cur_stack) );
|
||||
|
||||
Callbacks->CallRegisterShortProc( &context, 0 );
|
||||
/* This should never return */
|
||||
ERR( task, "Main program returned! (should never happen)\n" );
|
||||
ERR_(task)("Main program returned! (should never happen)\n" );
|
||||
ExitProcess( 1 );
|
||||
}
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ BOOL TASK_Create( THDB *thdb, NE_MODULE *pModule, HINSTANCE16 hInstance,
|
|||
|
||||
pTask->thdb->teb.htask16 = pTask->thdb->process->task = hTask;
|
||||
|
||||
TRACE(task, "module='%s' cmdline='%s' task=%04x\n",
|
||||
TRACE_(task)("module='%s' cmdline='%s' task=%04x\n",
|
||||
name, cmd_line, hTask );
|
||||
|
||||
return TRUE;
|
||||
|
@ -471,7 +471,7 @@ void TASK_StartTask( HTASK16 hTask )
|
|||
TASK_LinkTask( hTask );
|
||||
SYSLEVEL_LeaveWin16Lock();
|
||||
|
||||
TRACE(task, "linked task %04x\n", hTask );
|
||||
TRACE_(task)("linked task %04x\n", hTask );
|
||||
|
||||
/* If requested, add entry point breakpoint */
|
||||
|
||||
|
@ -492,12 +492,6 @@ void TASK_StartTask( HTASK16 hTask )
|
|||
else
|
||||
EVENT_WakeUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* To start a 32-bit task, we spawn its initial thread. */
|
||||
|
||||
SYSDEPS_SpawnThread( pTask->thdb );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -556,7 +550,7 @@ void TASK_KillTask( HTASK16 hTask )
|
|||
return;
|
||||
}
|
||||
|
||||
TRACE(task, "Killing task %04x\n", hTask );
|
||||
TRACE_(task)("Killing task %04x\n", hTask );
|
||||
|
||||
/* Delete active sockets */
|
||||
|
||||
|
@ -584,7 +578,7 @@ void TASK_KillTask( HTASK16 hTask )
|
|||
|
||||
if (nTaskCount <= 1)
|
||||
{
|
||||
TRACE(task, "this is the last task, exiting\n" );
|
||||
TRACE_(task)("this is the last task, exiting\n" );
|
||||
USER_ExitWindows();
|
||||
}
|
||||
|
||||
|
@ -651,13 +645,13 @@ void TASK_KillCurrentTask( INT16 exitCode )
|
|||
{
|
||||
if ( !THREAD_IsWin16( THREAD_Current() ) )
|
||||
{
|
||||
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
FIXME_(task)("called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(hCurrentTask == GetCurrentTask());
|
||||
|
||||
TRACE(task, "Killing current task %04x\n", hCurrentTask );
|
||||
TRACE_(task)("Killing current task %04x\n", hCurrentTask );
|
||||
|
||||
TASK_KillTask( 0 );
|
||||
|
||||
|
@ -665,7 +659,7 @@ void TASK_KillCurrentTask( INT16 exitCode )
|
|||
|
||||
/* We should never return from this Yield() */
|
||||
|
||||
ERR(task,"Return of the living dead %04x!!!\n", hCurrentTask);
|
||||
ERR_(task)("Return of the living dead %04x!!!\n", hCurrentTask);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -718,7 +712,7 @@ BOOL TASK_Reschedule(void)
|
|||
to global variables (most notably the task list) are protected. */
|
||||
assert(hCurrentTask == GetCurrentTask());
|
||||
|
||||
TRACE(task, "entered with hTask %04x (pid %d)\n", hCurrentTask, getpid());
|
||||
TRACE_(task)("entered with hTask %04x (pid %d)\n", hCurrentTask, getpid());
|
||||
|
||||
#ifdef CONFIG_IPC
|
||||
/* FIXME: What about the Win16Lock ??? */
|
||||
|
@ -758,7 +752,7 @@ BOOL TASK_Reschedule(void)
|
|||
{
|
||||
pNewTask = (TDB *)GlobalLock16( hTask );
|
||||
|
||||
TRACE(task, "\ttask = %04x, events = %i\n", hTask, pNewTask->nEvents);
|
||||
TRACE_(task)("\ttask = %04x, events = %i\n", hTask, pNewTask->nEvents);
|
||||
|
||||
if (pNewTask->nEvents) break;
|
||||
hTask = pNewTask->hNext;
|
||||
|
@ -789,11 +783,11 @@ BOOL TASK_Reschedule(void)
|
|||
SYSLEVEL_ReleaseWin16Lock();
|
||||
SYSLEVEL_RestoreWin16Lock();
|
||||
|
||||
TRACE(task, "returning to the current task(%04x)\n", hTask );
|
||||
TRACE_(task)("returning to the current task(%04x)\n", hTask );
|
||||
return FALSE; /* Nothing to do */
|
||||
}
|
||||
pNewTask = (TDB *)GlobalLock16( hTask );
|
||||
TRACE(task, "Switching to task %04x (%.8s)\n",
|
||||
TRACE_(task)("Switching to task %04x (%.8s)\n",
|
||||
hTask, pNewTask->module_name );
|
||||
|
||||
/* Make the task the last in the linked list (round-robin scheduling) */
|
||||
|
@ -848,7 +842,7 @@ static void TASK_YieldToSystem( void )
|
|||
{
|
||||
if ( !THREAD_IsWin16( THREAD_Current() ) )
|
||||
{
|
||||
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
FIXME_(task)("called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -955,7 +949,7 @@ BOOL16 WINAPI WaitEvent16( HTASK16 hTask )
|
|||
|
||||
if ( !THREAD_IsWin16( THREAD_Current() ) )
|
||||
{
|
||||
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
FIXME_(task)("called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -985,7 +979,7 @@ void WINAPI PostEvent16( HTASK16 hTask )
|
|||
|
||||
if ( !THREAD_IsWin16( pTask->thdb ) )
|
||||
{
|
||||
FIXME( task, "called for Win32 thread (%04x)!\n", pTask->thdb->teb_sel );
|
||||
FIXME_(task)("called for Win32 thread (%04x)!\n", pTask->thdb->teb_sel );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1049,7 +1043,7 @@ void WINAPI OldYield16(void)
|
|||
|
||||
if ( !THREAD_IsWin16( THREAD_Current() ) )
|
||||
{
|
||||
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
FIXME_(task)("called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1068,16 +1062,16 @@ void WINAPI DirectedYield16( HTASK16 hTask )
|
|||
|
||||
if ( !THREAD_IsWin16( THREAD_Current() ) )
|
||||
{
|
||||
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
FIXME_(task)("called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
|
||||
return;
|
||||
}
|
||||
|
||||
TRACE(task, "%04x: DirectedYield(%04x)\n", pCurTask->hSelf, hTask );
|
||||
TRACE_(task)("%04x: DirectedYield(%04x)\n", pCurTask->hSelf, hTask );
|
||||
|
||||
pCurTask->hYieldTo = hTask;
|
||||
OldYield16();
|
||||
|
||||
TRACE(task, "%04x: back from DirectedYield(%04x)\n", pCurTask->hSelf, hTask );
|
||||
TRACE_(task)("%04x: back from DirectedYield(%04x)\n", pCurTask->hSelf, hTask );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -1099,7 +1093,7 @@ HTASK16 WINAPI KERNEL_490( HTASK16 someTask )
|
|||
{
|
||||
if ( !someTask ) return 0;
|
||||
|
||||
FIXME( task, "(%04x): stub\n", someTask );
|
||||
FIXME_(task)("(%04x): stub\n", someTask );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1106,7 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
|
|||
SEGPTR thunkaddr;
|
||||
|
||||
if (!func) {
|
||||
ERR(task, "Ouch ! MakeProcInstance called with func == NULL !\n");
|
||||
ERR_(task)("Ouch ! MakeProcInstance called with func == NULL !\n");
|
||||
return (FARPROC16)0; /* Windows seems to do the same */
|
||||
}
|
||||
if (!hInstance) hInstance = CURRENT_DS;
|
||||
|
@ -1121,12 +1115,12 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
|
|||
thunk = PTR_SEG_TO_LIN( thunkaddr );
|
||||
lfunc = PTR_SEG_TO_LIN( func );
|
||||
|
||||
TRACE(task, "(%08lx,%04x): got thunk %08lx\n",
|
||||
TRACE_(task)("(%08lx,%04x): got thunk %08lx\n",
|
||||
(DWORD)func, hInstance, (DWORD)thunkaddr );
|
||||
if (((lfunc[0]==0x8c) && (lfunc[1]==0xd8)) ||
|
||||
((lfunc[0]==0x1e) && (lfunc[1]==0x58))
|
||||
) {
|
||||
FIXME(task,"thunk would be useless for %p, overwriting with nop;nop;\n", func );
|
||||
FIXME_(task)("thunk would be useless for %p, overwriting with nop;nop;\n", func );
|
||||
lfunc[0]=0x90; /* nop */
|
||||
lfunc[1]=0x90; /* nop */
|
||||
}
|
||||
|
@ -1145,7 +1139,7 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
|
|||
*/
|
||||
void WINAPI FreeProcInstance16( FARPROC16 func )
|
||||
{
|
||||
TRACE(task, "(%08lx)\n", (DWORD)func );
|
||||
TRACE_(task)("(%08lx)\n", (DWORD)func );
|
||||
TASK_FreeThunk( GetCurrentTask(), (SEGPTR)func );
|
||||
}
|
||||
|
||||
|
@ -1322,7 +1316,7 @@ HANDLE WINAPI GetFastQueue16( void )
|
|||
Callout.InitThreadInput16( 0, THREAD_IsWin16(thdb)? 4 : 5 );
|
||||
|
||||
if (!thdb->teb.queue)
|
||||
FIXME( task, "(): should initialize thread-local queue, expect failure!\n" );
|
||||
FIXME_(task)("(): should initialize thread-local queue, expect failure!\n" );
|
||||
|
||||
return (HANDLE)thdb->teb.queue;
|
||||
}
|
||||
|
@ -1339,7 +1333,7 @@ void WINAPI SwitchStackTo16( WORD seg, WORD ptr, WORD top )
|
|||
|
||||
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return;
|
||||
if (!(pData = (INSTANCEDATA *)GlobalLock16( seg ))) return;
|
||||
TRACE(task, "old=%04x:%04x new=%04x:%04x\n",
|
||||
TRACE_(task)("old=%04x:%04x new=%04x:%04x\n",
|
||||
SELECTOROF( pTask->thdb->cur_stack ),
|
||||
OFFSETOF( pTask->thdb->cur_stack ), seg, ptr );
|
||||
|
||||
|
@ -1386,10 +1380,10 @@ void WINAPI SwitchStackBack16( CONTEXT *context )
|
|||
return;
|
||||
if (!pData->old_ss_sp)
|
||||
{
|
||||
WARN( task, "No previous SwitchStackTo\n" );
|
||||
WARN_(task)("No previous SwitchStackTo\n" );
|
||||
return;
|
||||
}
|
||||
TRACE(task, "restoring stack %04x:%04x\n",
|
||||
TRACE_(task)("restoring stack %04x:%04x\n",
|
||||
SELECTOROF(pData->old_ss_sp), OFFSETOF(pData->old_ss_sp) );
|
||||
|
||||
oldFrame = THREAD_STACK16( pTask->thdb );
|
||||
|
@ -1605,7 +1599,7 @@ FARPROC16 WINAPI SetTaskSignalProc( HTASK16 hTask, FARPROC16 proc )
|
|||
WORD WINAPI SetSigHandler16( FARPROC16 newhandler, FARPROC16* oldhandler,
|
||||
UINT16 *oldmode, UINT16 newmode, UINT16 flag )
|
||||
{
|
||||
FIXME(task,"(%p,%p,%p,%d,%d), unimplemented.\n",
|
||||
FIXME_(task)("(%p,%p,%p,%d,%d), unimplemented.\n",
|
||||
newhandler,oldhandler,oldmode,newmode,flag );
|
||||
|
||||
if (flag != 1) return 0;
|
||||
|
@ -1724,7 +1718,7 @@ BOOL16 WINAPI TaskNext16( TASKENTRY *lpte )
|
|||
TDB *pTask;
|
||||
INSTANCEDATA *pInstData;
|
||||
|
||||
TRACE(toolhelp, "(%p): task=%04x\n", lpte, lpte->hNext );
|
||||
TRACE_(toolhelp)("(%p): task=%04x\n", lpte, lpte->hNext );
|
||||
if (!lpte->hNext) return FALSE;
|
||||
pTask = (TDB *)GlobalLock16( lpte->hNext );
|
||||
if (!pTask || pTask->magic != TDB_MAGIC) return FALSE;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "task.h"
|
||||
#include "server.h"
|
||||
#include "callback.h"
|
||||
#include "debug.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
DECLARE_DEBUG_CHANNEL(process)
|
||||
DECLARE_DEBUG_CHANNEL(relay)
|
||||
|
@ -322,6 +322,7 @@ static BOOL PROCESS_CreateEnvDB(void)
|
|||
CLIENT_SendRequest( REQ_INIT_PROCESS, -1, 1, &req, sizeof(req) );
|
||||
if (CLIENT_WaitSimpleReply( &reply, sizeof(reply), NULL )) return FALSE;
|
||||
|
||||
#if 0
|
||||
/* Allocate the env DB */
|
||||
|
||||
if (!(env_db = HeapAlloc( pdb->heap, HEAP_ZERO_MEMORY, sizeof(ENVDB) )))
|
||||
|
@ -333,6 +334,9 @@ static BOOL PROCESS_CreateEnvDB(void)
|
|||
if (!(startup = HeapAlloc( pdb->heap, HEAP_ZERO_MEMORY, sizeof(STARTUPINFOA) )))
|
||||
return FALSE;
|
||||
pdb->env_db->startup_info = startup;
|
||||
#else
|
||||
startup = pdb->env_db->startup_info;
|
||||
#endif
|
||||
startup->dwFlags = reply.start_flags;
|
||||
pdb->env_db->hStdin = startup->hStdInput = reply.hstdin;
|
||||
pdb->env_db->hStdout = startup->hStdOutput = reply.hstdout;
|
||||
|
@ -448,7 +452,6 @@ BOOL PROCESS_Init(void)
|
|||
*/
|
||||
void PROCESS_Start(void)
|
||||
{
|
||||
DWORD size, commit;
|
||||
UINT cmdShow = 0;
|
||||
LPTHREAD_START_ROUTINE entry;
|
||||
THDB *thdb = THREAD_Current();
|
||||
|
@ -456,6 +459,10 @@ void PROCESS_Start(void)
|
|||
TDB *pTask = (TDB *)GlobalLock16( pdb->task );
|
||||
NE_MODULE *pModule = NE_GetPtr( pTask->hModule );
|
||||
OFSTRUCT *ofs = (OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo);
|
||||
IMAGE_OPTIONAL_HEADER *header = &PE_HEADER(pModule->module32)->OptionalHeader;
|
||||
|
||||
/* Setup process flags */
|
||||
if (header->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI) pdb->flags |= PDB32_CONSOLE_PROC;
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0, 0 ); /* for initial thread */
|
||||
|
||||
|
@ -466,15 +473,16 @@ void PROCESS_Start(void)
|
|||
#if 0
|
||||
/* Create the heap */
|
||||
|
||||
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapReserve;
|
||||
commit = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapCommit;
|
||||
if (!(pdb->heap = HeapCreate( HEAP_GROWABLE, size, commit ))) goto error;
|
||||
if (!(pdb->heap = HeapCreate( HEAP_GROWABLE, header->SizeOfHeapReserve,
|
||||
header->SizeOfHeapCommit ))) goto error;
|
||||
pdb->heap_list = pdb->heap;
|
||||
#endif
|
||||
|
||||
/* Create the environment db */
|
||||
|
||||
if (!PROCESS_CreateEnvDB()) goto error;
|
||||
|
||||
#if 0
|
||||
if (pdb->env_db->startup_info->dwFlags & STARTF_USESHOWWINDOW)
|
||||
cmdShow = pdb->env_db->startup_info->wShowWindow;
|
||||
if (!TASK_Create( thdb, pModule, 0, 0, cmdShow )) goto error;
|
||||
|
@ -505,15 +513,15 @@ void PROCESS_Start(void)
|
|||
|
||||
/* Now call the entry point */
|
||||
|
||||
EnterCriticalSection( &PROCESS_Current()->crit_section );
|
||||
MODULE_DllProcessAttach( PROCESS_Current()->exe_modref, (LPVOID)1 );
|
||||
LeaveCriticalSection( &PROCESS_Current()->crit_section );
|
||||
EnterCriticalSection( &pdb->crit_section );
|
||||
MODULE_DllProcessAttach( pdb->exe_modref, (LPVOID)1 );
|
||||
LeaveCriticalSection( &pdb->crit_section );
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_RUNNING, 0, 0 );
|
||||
|
||||
entry = (LPTHREAD_START_ROUTINE)RVA_PTR(pModule->module32,
|
||||
OptionalHeader.AddressOfEntryPoint);
|
||||
TRACE(relay, "(entryproc=%p)\n", entry );
|
||||
TRACE_(relay)("(entryproc=%p)\n", entry );
|
||||
ExitProcess( entry(NULL) );
|
||||
|
||||
error:
|
||||
|
@ -568,79 +576,82 @@ PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
|
|||
info->hProcess = reply.handle;
|
||||
info->dwProcessId = (DWORD)pdb->server_pid;
|
||||
|
||||
/* Setup process flags */
|
||||
|
||||
if ( !pModule->module32 )
|
||||
pdb->flags |= PDB32_WIN16_PROC;
|
||||
|
||||
else if ( PE_HEADER(pModule->module32)->OptionalHeader.Subsystem
|
||||
== IMAGE_SUBSYSTEM_WINDOWS_CUI )
|
||||
pdb->flags |= PDB32_CONSOLE_PROC;
|
||||
|
||||
/* Create the heap */
|
||||
|
||||
if (pModule->module32)
|
||||
{
|
||||
/* Create the heap */
|
||||
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapReserve;
|
||||
commit = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfHeapCommit;
|
||||
if (!(pdb->heap = HeapCreate( HEAP_GROWABLE, size, commit ))) goto error;
|
||||
pdb->heap_list = pdb->heap;
|
||||
|
||||
/* 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 );
|
||||
|
||||
/* 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 );
|
||||
}
|
||||
else
|
||||
else /* Create a 16-bit process */
|
||||
{
|
||||
/* Setup process flags */
|
||||
pdb->flags |= PDB32_WIN16_PROC;
|
||||
|
||||
/* Create the heap */
|
||||
size = 0x10000;
|
||||
commit = 0;
|
||||
if (!(pdb->heap = HeapCreate( HEAP_GROWABLE, size, commit ))) goto error;
|
||||
pdb->heap_list = pdb->heap;
|
||||
|
||||
/* 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 );
|
||||
|
||||
/* Create the main thread */
|
||||
if (!(thdb = THREAD_Create( pdb, 0L, 0, hInstance == 0, tsa, &server_thandle )))
|
||||
goto error;
|
||||
info->hThread = server_thandle;
|
||||
info->dwThreadId = (DWORD)thdb->server_tid;
|
||||
thdb->startup = PROCESS_Start;
|
||||
|
||||
/* Duplicate the standard handles */
|
||||
if ((!(pdb->env_db->startup_info->dwFlags & STARTF_USESTDHANDLES)) && !inherit)
|
||||
{
|
||||
DuplicateHandle( GetCurrentProcess(), pdb->parent->env_db->hStdin,
|
||||
info->hProcess, &pdb->env_db->hStdin, 0, TRUE, DUPLICATE_SAME_ACCESS );
|
||||
DuplicateHandle( GetCurrentProcess(), pdb->parent->env_db->hStdout,
|
||||
info->hProcess, &pdb->env_db->hStdout, 0, TRUE, DUPLICATE_SAME_ACCESS );
|
||||
DuplicateHandle( GetCurrentProcess(), pdb->parent->env_db->hStderr,
|
||||
info->hProcess, &pdb->env_db->hStderr, 0, TRUE, DUPLICATE_SAME_ACCESS );
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
/* Map system DLLs into this process (from initial process) */
|
||||
/* FIXME: this is a hack */
|
||||
pdb->modref_list = PROCESS_Initial()->modref_list;
|
||||
|
||||
/* Start the task */
|
||||
TASK_StartTask( pdb->task );
|
||||
}
|
||||
if (!(pdb->heap = HeapCreate( HEAP_GROWABLE, size, commit ))) goto error;
|
||||
pdb->heap_list = pdb->heap;
|
||||
|
||||
/* 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 );
|
||||
|
||||
/* Create the main thread */
|
||||
|
||||
if (pModule->module32)
|
||||
size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfStackReserve;
|
||||
else
|
||||
size = 0;
|
||||
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;
|
||||
|
||||
/* Duplicate the standard handles */
|
||||
|
||||
if ((!(pdb->env_db->startup_info->dwFlags & STARTF_USESTDHANDLES)) && !inherit)
|
||||
{
|
||||
DuplicateHandle( GetCurrentProcess(), pdb->parent->env_db->hStdin,
|
||||
info->hProcess, &pdb->env_db->hStdin, 0, TRUE, DUPLICATE_SAME_ACCESS );
|
||||
DuplicateHandle( GetCurrentProcess(), pdb->parent->env_db->hStdout,
|
||||
info->hProcess, &pdb->env_db->hStdout, 0, TRUE, DUPLICATE_SAME_ACCESS );
|
||||
DuplicateHandle( GetCurrentProcess(), pdb->parent->env_db->hStderr,
|
||||
info->hProcess, &pdb->env_db->hStderr, 0, TRUE, DUPLICATE_SAME_ACCESS );
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
||||
/* Map system DLLs into this process (from initial process) */
|
||||
/* FIXME: this is a hack */
|
||||
pdb->modref_list = PROCESS_Initial()->modref_list;
|
||||
|
||||
|
||||
/* Start the task */
|
||||
|
||||
TASK_StartTask( pdb->task );
|
||||
|
||||
return pdb;
|
||||
|
||||
|
@ -692,7 +703,7 @@ DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset )
|
|||
TDB *pTask;
|
||||
DWORD x, y;
|
||||
|
||||
TRACE( win32, "(%ld, %d)\n", dwProcessID, offset );
|
||||
TRACE_(win32)("(%ld, %d)\n", dwProcessID, offset );
|
||||
if ( !process ) return 0;
|
||||
|
||||
switch ( offset )
|
||||
|
@ -755,7 +766,7 @@ DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset )
|
|||
return process->process_dword;
|
||||
|
||||
default:
|
||||
ERR( win32, "Unknown offset %d\n", offset );
|
||||
ERR_(win32)("Unknown offset %d\n", offset );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -768,7 +779,7 @@ void WINAPI SetProcessDword( DWORD dwProcessID, INT offset, DWORD value )
|
|||
{
|
||||
PDB *process = PROCESS_IdToPDB( dwProcessID );
|
||||
|
||||
TRACE( win32, "(%ld, %d)\n", dwProcessID, offset );
|
||||
TRACE_(win32)("(%ld, %d)\n", dwProcessID, offset );
|
||||
if ( !process ) return;
|
||||
|
||||
switch ( offset )
|
||||
|
@ -787,7 +798,7 @@ void WINAPI SetProcessDword( DWORD dwProcessID, INT offset, DWORD value )
|
|||
case GPD_STARTF_FLAGS:
|
||||
case GPD_PARENT:
|
||||
case GPD_FLAGS:
|
||||
ERR( win32, "Not allowed to modify offset %d\n", offset );
|
||||
ERR_(win32)("Not allowed to modify offset %d\n", offset );
|
||||
break;
|
||||
|
||||
case GPD_USERDATA:
|
||||
|
@ -795,7 +806,7 @@ void WINAPI SetProcessDword( DWORD dwProcessID, INT offset, DWORD value )
|
|||
break;
|
||||
|
||||
default:
|
||||
ERR( win32, "Unknown offset %d\n", offset );
|
||||
ERR_(win32)("Unknown offset %d\n", offset );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -986,7 +997,7 @@ DWORD WINAPI GetProcessFlags( DWORD processid )
|
|||
BOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess,DWORD minset,
|
||||
DWORD maxset)
|
||||
{
|
||||
FIXME(process,"(0x%08x,%ld,%ld): stub - harmless\n",hProcess,minset,maxset);
|
||||
FIXME_(process)("(0x%08x,%ld,%ld): stub - harmless\n",hProcess,minset,maxset);
|
||||
if(( minset == -1) && (maxset == -1)) {
|
||||
/* Trim the working set to zero */
|
||||
/* Swap the process out of physical RAM */
|
||||
|
@ -1000,7 +1011,7 @@ BOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess,DWORD minset,
|
|||
BOOL WINAPI GetProcessWorkingSetSize(HANDLE hProcess,LPDWORD minset,
|
||||
LPDWORD maxset)
|
||||
{
|
||||
FIXME(process,"(0x%08x,%p,%p): stub\n",hProcess,minset,maxset);
|
||||
FIXME_(process)("(0x%08x,%p,%p): stub\n",hProcess,minset,maxset);
|
||||
/* 32 MB working set size */
|
||||
if (minset) *minset = 32*1024*1024;
|
||||
if (maxset) *maxset = 32*1024*1024;
|
||||
|
@ -1028,7 +1039,7 @@ BOOL WINAPI SetProcessShutdownParameters(DWORD level,DWORD flags)
|
|||
shutdown_priority = level;
|
||||
else
|
||||
{
|
||||
ERR(process,"invalid priority level 0x%08lx\n", level);
|
||||
ERR_(process)("invalid priority level 0x%08lx\n", level);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1051,7 +1062,7 @@ BOOL WINAPI GetProcessShutdownParameters( LPDWORD lpdwLevel,
|
|||
*/
|
||||
BOOL WINAPI SetProcessPriorityBoost(HANDLE hprocess,BOOL disableboost)
|
||||
{
|
||||
FIXME(process,"(%d,%d): stub\n",hprocess,disableboost);
|
||||
FIXME_(process)("(%d,%d): stub\n",hprocess,disableboost);
|
||||
/* Say we can do it. I doubt the program will notice that we don't. */
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1120,7 +1131,7 @@ BOOL WINAPI GetExitCodeProcess(
|
|||
* GetProcessHeaps [KERNEL32.376]
|
||||
*/
|
||||
DWORD WINAPI GetProcessHeaps(DWORD nrofheaps,HANDLE *heaps) {
|
||||
FIXME(win32,"(%ld,%p), incomplete implementation.\n",nrofheaps,heaps);
|
||||
FIXME_(win32)("(%ld,%p), incomplete implementation.\n",nrofheaps,heaps);
|
||||
|
||||
if (nrofheaps) {
|
||||
heaps[0] = GetProcessHeap();
|
||||
|
|
Loading…
Reference in a new issue