mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 13:27:35 +00:00
Send USIG_PROCESS_CREATE signal.
Bugfix: GetProcessDword offset -8 should return parent process ID.
This commit is contained in:
parent
af50474298
commit
2e658768dc
5 changed files with 31 additions and 26 deletions
|
@ -136,7 +136,7 @@ typedef struct _PDB
|
|||
#define GPD_STARTF_SIZE (-20)
|
||||
#define GPD_STARTF_POSITION (-16)
|
||||
#define GPD_STARTF_FLAGS (-12)
|
||||
#define GPD_PARENT_PDB (- 8)
|
||||
#define GPD_PARENT (- 8)
|
||||
#define GPD_FLAGS (- 4)
|
||||
#define GPD_USERDATA ( 0)
|
||||
|
||||
|
@ -154,7 +154,7 @@ extern PDB *PROCESS_Current(void);
|
|||
extern BOOL PROCESS_IsCurrent( HANDLE handle );
|
||||
extern PDB *PROCESS_Initial(void);
|
||||
extern PDB *PROCESS_IdToPDB( DWORD id );
|
||||
extern void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule );
|
||||
extern void PROCESS_CallUserSignalProc( UINT uCode, DWORD dwThreadOrProcessId, HMODULE hModule );
|
||||
extern PDB *PROCESS_Create( struct _NE_MODULE *pModule,
|
||||
LPCSTR cmd_line, LPCSTR env,
|
||||
HINSTANCE16 hInstance, HINSTANCE16 hPrevInstance,
|
||||
|
|
|
@ -1091,7 +1091,7 @@ static BOOL16 NE_FreeModule( HMODULE16 hModule, BOOL call_wep )
|
|||
pTask->userhandler( hModule, USIG16_DLL_UNLOAD, 0,
|
||||
pTask->hInstance, pTask->hQueue );
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_DLL_UNLOAD_WIN16, hModule );
|
||||
PROCESS_CallUserSignalProc( USIG_DLL_UNLOAD_WIN16, 0, hModule );
|
||||
}
|
||||
else
|
||||
call_wep = FALSE; /* We are freeing a task -> no more WEPs */
|
||||
|
|
|
@ -239,10 +239,10 @@ static void TASK_CallToStart(void)
|
|||
memset(THREAD_STACK16( pTask->thdb ), '\0', sizeof(STACK16FRAME));
|
||||
|
||||
/* Call USER signal proc */
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0 ); /* for initial thread */
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_LOADED, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_RUNNING, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0, 0 ); /* for initial thread */
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_LOADED, 0, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_RUNNING, 0, 0 );
|
||||
|
||||
if (pModule->flags & NE_FFLAGS_WIN32)
|
||||
{
|
||||
|
@ -574,9 +574,9 @@ void TASK_KillTask( HTASK16 hTask )
|
|||
pTask->userhandler( hTask, USIG16_TERMINATION, 0,
|
||||
pTask->hInstance, pTask->hQueue );
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_EXIT, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, 0 ); /* FIXME */
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_DESTROY, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_EXIT, 0, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, 0, 0 ); /* FIXME */
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_DESTROY, 0, 0 );
|
||||
|
||||
if (nTaskCount <= 1)
|
||||
{
|
||||
|
|
|
@ -172,11 +172,11 @@ PDB *PROCESS_IdToPDB( DWORD id )
|
|||
* USIG_FLAGS_FAULT
|
||||
* The signal is being sent due to a fault.
|
||||
*/
|
||||
void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule )
|
||||
void PROCESS_CallUserSignalProc( UINT uCode, DWORD dwThreadOrProcessId, HMODULE hModule )
|
||||
{
|
||||
PDB *pdb = PROCESS_Current();
|
||||
STARTUPINFOA *startup = pdb->env_db? pdb->env_db->startup_info : NULL;
|
||||
DWORD dwFlags = 0, dwThreadOrProcessID;
|
||||
DWORD dwFlags = 0;
|
||||
|
||||
/* Determine dwFlags */
|
||||
|
||||
|
@ -201,10 +201,11 @@ void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule )
|
|||
|
||||
/* Get thread or process ID */
|
||||
|
||||
if ( uCode == USIG_THREAD_INIT || uCode == USIG_THREAD_EXIT )
|
||||
dwThreadOrProcessID = GetCurrentThreadId();
|
||||
else
|
||||
dwThreadOrProcessID = GetCurrentProcessId();
|
||||
if ( dwThreadOrProcessId == 0 )
|
||||
if ( uCode == USIG_THREAD_INIT || uCode == USIG_THREAD_EXIT )
|
||||
dwThreadOrProcessId = GetCurrentThreadId();
|
||||
else
|
||||
dwThreadOrProcessId = GetCurrentProcessId();
|
||||
|
||||
/* Convert module handle to 16-bit */
|
||||
|
||||
|
@ -214,7 +215,7 @@ void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule )
|
|||
/* Call USER signal proc */
|
||||
|
||||
if ( Callout.UserSignalProc )
|
||||
Callout.UserSignalProc( uCode, dwThreadOrProcessID, dwFlags, hModule );
|
||||
Callout.UserSignalProc( uCode, dwThreadOrProcessId, dwFlags, hModule );
|
||||
}
|
||||
|
||||
|
||||
|
@ -450,7 +451,7 @@ void PROCESS_Start(void)
|
|||
NE_MODULE *pModule = NE_GetPtr( pTask->hModule );
|
||||
OFSTRUCT *ofs = (OFSTRUCT *)((char*)(pModule) + (pModule)->fileinfo);
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0 ); /* for initial thread */
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0, 0 ); /* for initial thread */
|
||||
|
||||
#if 0
|
||||
/* Initialize the critical section */
|
||||
|
@ -474,7 +475,7 @@ void PROCESS_Start(void)
|
|||
|
||||
#endif
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_INIT, 0, 0 );
|
||||
|
||||
/* Map system DLLs into this process (from initial process) */
|
||||
/* FIXME: this is a hack */
|
||||
|
@ -483,7 +484,7 @@ void PROCESS_Start(void)
|
|||
/* Create 32-bit MODREF */
|
||||
if (!PE_CreateModule( pModule->module32, ofs, 0, FALSE )) goto error;
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_LOADED, 0 ); /* FIXME: correct location? */
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_LOADED, 0, 0 ); /* FIXME: correct location? */
|
||||
|
||||
/* Initialize thread-local storage */
|
||||
|
||||
|
@ -496,7 +497,7 @@ void PROCESS_Start(void)
|
|||
|
||||
MODULE_InitializeDLLs( 0, DLL_PROCESS_ATTACH, (LPVOID)1 );
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_RUNNING, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_PROCESS_RUNNING, 0, 0 );
|
||||
|
||||
entry = (LPTHREAD_START_ROUTINE)RVA_PTR(pModule->module32,
|
||||
OptionalHeader.AddressOfEntryPoint);
|
||||
|
@ -587,6 +588,10 @@ PDB *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
|
|||
|
||||
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)
|
||||
|
@ -730,8 +735,8 @@ DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset )
|
|||
case GPD_STARTF_FLAGS:
|
||||
return process->env_db->startup_info->dwFlags;
|
||||
|
||||
case GPD_PARENT_PDB:
|
||||
return (DWORD)process->parent;
|
||||
case GPD_PARENT:
|
||||
return (DWORD)process->parent->server_pid;
|
||||
|
||||
case GPD_FLAGS:
|
||||
return process->flags;
|
||||
|
@ -770,7 +775,7 @@ void WINAPI SetProcessDword( DWORD dwProcessID, INT offset, DWORD value )
|
|||
case GPD_STARTF_SIZE:
|
||||
case GPD_STARTF_POSITION:
|
||||
case GPD_STARTF_FLAGS:
|
||||
case GPD_PARENT_PDB:
|
||||
case GPD_PARENT:
|
||||
case GPD_FLAGS:
|
||||
ERR( win32, "Not allowed to modify offset %d\n", offset );
|
||||
break;
|
||||
|
|
|
@ -154,7 +154,7 @@ void THREAD_FreeTHDB( THDB *thdb )
|
|||
{
|
||||
THDB **pptr = &THREAD_First;
|
||||
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_EXIT, 0, 0 );
|
||||
|
||||
CloseHandle( thdb->event );
|
||||
while (*pptr && (*pptr != thdb)) pptr = &(*pptr)->next;
|
||||
|
@ -279,7 +279,7 @@ static void THREAD_Start(void)
|
|||
{
|
||||
THDB *thdb = THREAD_Current();
|
||||
LPTHREAD_START_ROUTINE func = (LPTHREAD_START_ROUTINE)thdb->entry_point;
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0 );
|
||||
PROCESS_CallUserSignalProc( USIG_THREAD_INIT, 0, 0 );
|
||||
PE_InitTls();
|
||||
MODULE_InitializeDLLs( 0, DLL_THREAD_ATTACH, NULL );
|
||||
ExitThread( func( thdb->entry_arg ) );
|
||||
|
|
Loading…
Reference in a new issue