Pass the main exe name in the CREATE_PROCESS debug event.
This commit is contained in:
parent
06bf01768d
commit
a37dec0c7e
|
@ -228,7 +228,7 @@ HGLOBAL16 NE_LoadPEResource( NE_MODULE *pModule, WORD type, LPVOID bits, DWORD s
|
||||||
|
|
||||||
/* relay32/builtin.c */
|
/* relay32/builtin.c */
|
||||||
extern WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR name, DWORD flags);
|
extern WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR name, DWORD flags);
|
||||||
extern HMODULE BUILTIN32_LoadExeModule( LPCSTR *filename );
|
extern HMODULE BUILTIN32_LoadExeModule(void);
|
||||||
extern void BUILTIN32_UnloadLibrary(WINE_MODREF *wm);
|
extern void BUILTIN32_UnloadLibrary(WINE_MODREF *wm);
|
||||||
extern void *BUILTIN32_dlopen( const char *name );
|
extern void *BUILTIN32_dlopen( const char *name );
|
||||||
extern int BUILTIN32_dlclose( void *handle );
|
extern int BUILTIN32_dlclose( void *handle );
|
||||||
|
|
|
@ -170,6 +170,7 @@ struct init_process_done_request
|
||||||
{
|
{
|
||||||
IN void* module; /* main module base address */
|
IN void* module; /* main module base address */
|
||||||
IN void* entry; /* process entry point */
|
IN void* entry; /* process entry point */
|
||||||
|
IN void* name; /* ptr to ptr to name (in process addr space) */
|
||||||
IN int gui; /* is it a GUI process? */
|
IN int gui; /* is it a GUI process? */
|
||||||
OUT int debugged; /* being debugged? */
|
OUT int debugged; /* being debugged? */
|
||||||
};
|
};
|
||||||
|
@ -1297,7 +1298,7 @@ enum request
|
||||||
REQ_NB_REQUESTS
|
REQ_NB_REQUESTS
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SERVER_PROTOCOL_VERSION 14
|
#define SERVER_PROTOCOL_VERSION 15
|
||||||
|
|
||||||
/* ### make_requests end ### */
|
/* ### make_requests end ### */
|
||||||
/* Everything above this line is generated automatically by tools/make_requests */
|
/* Everything above this line is generated automatically by tools/make_requests */
|
||||||
|
|
|
@ -389,7 +389,7 @@ WINE_MODREF *BUILTIN32_LoadLibraryExA(LPCSTR path, DWORD flags)
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* BUILTIN32_LoadExeModule
|
* BUILTIN32_LoadExeModule
|
||||||
*/
|
*/
|
||||||
HMODULE BUILTIN32_LoadExeModule( LPCSTR *filename )
|
HMODULE BUILTIN32_LoadExeModule(void)
|
||||||
{
|
{
|
||||||
int i, exe = -1;
|
int i, exe = -1;
|
||||||
|
|
||||||
|
@ -416,8 +416,6 @@ HMODULE BUILTIN32_LoadExeModule( LPCSTR *filename )
|
||||||
if ( !dll_modules[exe] )
|
if ( !dll_modules[exe] )
|
||||||
if ( !(dll_modules[exe] = BUILTIN32_DoLoadImage( builtin_dlls[exe] )) )
|
if ( !(dll_modules[exe] = BUILTIN32_DoLoadImage( builtin_dlls[exe] )) )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*filename = builtin_dlls[exe]->filename;
|
|
||||||
return dll_modules[exe];
|
return dll_modules[exe];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -338,6 +338,7 @@ static void start_process(void)
|
||||||
/* Signal the parent process to continue */
|
/* Signal the parent process to continue */
|
||||||
req->module = (void *)module;
|
req->module = (void *)module;
|
||||||
req->entry = entry;
|
req->entry = entry;
|
||||||
|
req->name = &pdb->exe_modref->filename;
|
||||||
req->gui = !console_app;
|
req->gui = !console_app;
|
||||||
server_call( REQ_INIT_PROCESS_DONE );
|
server_call( REQ_INIT_PROCESS_DONE );
|
||||||
debugged = req->debugged;
|
debugged = req->debugged;
|
||||||
|
@ -386,25 +387,38 @@ static void start_process(void)
|
||||||
* PROCESS_Start
|
* PROCESS_Start
|
||||||
*
|
*
|
||||||
* Startup routine of a new Win32 process once the main module has been loaded.
|
* Startup routine of a new Win32 process once the main module has been loaded.
|
||||||
|
* The filename is free'd by this routine.
|
||||||
*/
|
*/
|
||||||
static void PROCESS_Start( HMODULE main_module, LPCSTR filename ) WINE_NORETURN;
|
static void PROCESS_Start( HMODULE main_module, LPSTR filename ) WINE_NORETURN;
|
||||||
static void PROCESS_Start( HMODULE main_module, LPCSTR filename )
|
static void PROCESS_Start( HMODULE main_module, LPSTR filename )
|
||||||
{
|
{
|
||||||
|
if (!filename)
|
||||||
|
{
|
||||||
|
/* if no explicit filename, use argv[0] */
|
||||||
|
if (!(filename = malloc( MAX_PATH ))) ExitProcess(1);
|
||||||
|
if (!GetFullPathNameA( argv0, MAX_PATH, filename, NULL ))
|
||||||
|
lstrcpynA( filename, argv0, MAX_PATH );
|
||||||
|
}
|
||||||
|
|
||||||
/* load main module */
|
/* load main module */
|
||||||
if (PE_HEADER(main_module)->FileHeader.Characteristics & IMAGE_FILE_DLL)
|
if (PE_HEADER(main_module)->FileHeader.Characteristics & IMAGE_FILE_DLL)
|
||||||
ExitProcess( ERROR_BAD_EXE_FORMAT );
|
ExitProcess( ERROR_BAD_EXE_FORMAT );
|
||||||
|
|
||||||
/* Create 32-bit MODREF */
|
/* Create 32-bit MODREF */
|
||||||
if (!PE_CreateModule( main_module, filename, 0, FALSE ))
|
if (!PE_CreateModule( main_module, filename, 0, FALSE ))
|
||||||
ExitProcess( GetLastError() );
|
goto error;
|
||||||
|
free( filename );
|
||||||
|
|
||||||
/* allocate main thread stack */
|
/* allocate main thread stack */
|
||||||
if (!THREAD_InitStack( NtCurrentTeb(),
|
if (!THREAD_InitStack( NtCurrentTeb(),
|
||||||
PE_HEADER(main_module)->OptionalHeader.SizeOfStackReserve, TRUE ))
|
PE_HEADER(main_module)->OptionalHeader.SizeOfStackReserve, TRUE ))
|
||||||
ExitProcess( GetLastError() );
|
goto error;
|
||||||
|
|
||||||
/* switch to the new stack */
|
/* switch to the new stack */
|
||||||
SYSDEPS_SwitchToThreadStack( start_process );
|
SYSDEPS_SwitchToThreadStack( start_process );
|
||||||
|
|
||||||
|
error:
|
||||||
|
ExitProcess( GetLastError() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -469,13 +483,12 @@ void PROCESS_InitWine( int argc, char *argv[] )
|
||||||
case SCS_WOW_BINARY:
|
case SCS_WOW_BINARY:
|
||||||
{
|
{
|
||||||
HMODULE main_module;
|
HMODULE main_module;
|
||||||
LPCSTR filename;
|
|
||||||
/* create 32-bit module for main exe */
|
/* create 32-bit module for main exe */
|
||||||
if (!(main_module = BUILTIN32_LoadExeModule( &filename ))) goto error;
|
if (!(main_module = BUILTIN32_LoadExeModule())) goto error;
|
||||||
NtCurrentTeb()->tibflags &= ~TEBF_WIN32;
|
NtCurrentTeb()->tibflags &= ~TEBF_WIN32;
|
||||||
PROCESS_Current()->flags |= PDB32_WIN16_PROC;
|
PROCESS_Current()->flags |= PDB32_WIN16_PROC;
|
||||||
SYSLEVEL_EnterWin16Lock();
|
SYSLEVEL_EnterWin16Lock();
|
||||||
PROCESS_Start( main_module, filename );
|
PROCESS_Start( main_module, NULL );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -505,16 +518,14 @@ void PROCESS_InitWine( int argc, char *argv[] )
|
||||||
void PROCESS_InitWinelib( int argc, char *argv[] )
|
void PROCESS_InitWinelib( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
HMODULE main_module;
|
HMODULE main_module;
|
||||||
LPCSTR filename;
|
|
||||||
|
|
||||||
if (!MAIN_MainInit( argv )) exit(1);
|
if (!MAIN_MainInit( argv )) exit(1);
|
||||||
|
|
||||||
main_exe_argv = argv;
|
|
||||||
|
|
||||||
/* create 32-bit module for main exe */
|
/* create 32-bit module for main exe */
|
||||||
if (!(main_module = BUILTIN32_LoadExeModule( &filename ))) ExitProcess( GetLastError() );
|
if (!(main_module = BUILTIN32_LoadExeModule())) ExitProcess( GetLastError() );
|
||||||
|
|
||||||
PROCESS_Start( main_module, filename );
|
main_exe_argv = argv;
|
||||||
|
PROCESS_Start( main_module, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ static int fill_create_process_event( struct debug_event *event, void *arg )
|
||||||
event->data.info.create_process.start = arg;
|
event->data.info.create_process.start = arg;
|
||||||
event->data.info.create_process.dbg_offset = process->exe.dbg_offset;
|
event->data.info.create_process.dbg_offset = process->exe.dbg_offset;
|
||||||
event->data.info.create_process.dbg_size = process->exe.dbg_size;
|
event->data.info.create_process.dbg_size = process->exe.dbg_size;
|
||||||
event->data.info.create_process.name = 0;
|
event->data.info.create_process.name = process->exe.name;
|
||||||
event->data.info.create_process.unicode = 0;
|
event->data.info.create_process.unicode = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -817,6 +817,7 @@ DECL_HANDLER(init_process_done)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
process->exe.base = req->module;
|
process->exe.base = req->module;
|
||||||
|
process->exe.name = req->name;
|
||||||
generate_startup_debug_events( current->process, req->entry );
|
generate_startup_debug_events( current->process, req->entry );
|
||||||
set_event( process->init_event );
|
set_event( process->init_event );
|
||||||
release_object( process->init_event );
|
release_object( process->init_event );
|
||||||
|
|
|
@ -285,6 +285,7 @@ static void dump_init_process_done_request( const struct init_process_done_reque
|
||||||
{
|
{
|
||||||
fprintf( stderr, " module=%p,", req->module );
|
fprintf( stderr, " module=%p,", req->module );
|
||||||
fprintf( stderr, " entry=%p,", req->entry );
|
fprintf( stderr, " entry=%p,", req->entry );
|
||||||
|
fprintf( stderr, " name=%p,", req->name );
|
||||||
fprintf( stderr, " gui=%d", req->gui );
|
fprintf( stderr, " gui=%d", req->gui );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue