Commit a37dec0c authored by Alexandre Julliard's avatar Alexandre Julliard

Pass the main exe name in the CREATE_PROCESS debug event.

parent 06bf0176
......@@ -228,7 +228,7 @@ HGLOBAL16 NE_LoadPEResource( NE_MODULE *pModule, WORD type, LPVOID bits, DWORD s
/* relay32/builtin.c */
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_dlopen( const char *name );
extern int BUILTIN32_dlclose( void *handle );
......
......@@ -170,6 +170,7 @@ struct init_process_done_request
{
IN void* module; /* main module base address */
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? */
OUT int debugged; /* being debugged? */
};
......@@ -1297,7 +1298,7 @@ enum request
REQ_NB_REQUESTS
};
#define SERVER_PROTOCOL_VERSION 14
#define SERVER_PROTOCOL_VERSION 15
/* ### make_requests end ### */
/* 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
*/
HMODULE BUILTIN32_LoadExeModule( LPCSTR *filename )
HMODULE BUILTIN32_LoadExeModule(void)
{
int i, exe = -1;
......@@ -416,8 +416,6 @@ HMODULE BUILTIN32_LoadExeModule( LPCSTR *filename )
if ( !dll_modules[exe] )
if ( !(dll_modules[exe] = BUILTIN32_DoLoadImage( builtin_dlls[exe] )) )
return 0;
*filename = builtin_dlls[exe]->filename;
return dll_modules[exe];
}
......
......@@ -338,6 +338,7 @@ static void start_process(void)
/* Signal the parent process to continue */
req->module = (void *)module;
req->entry = entry;
req->name = &pdb->exe_modref->filename;
req->gui = !console_app;
server_call( REQ_INIT_PROCESS_DONE );
debugged = req->debugged;
......@@ -386,25 +387,38 @@ static void start_process(void)
* PROCESS_Start
*
* 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, LPCSTR filename )
static void PROCESS_Start( HMODULE main_module, LPSTR filename ) WINE_NORETURN;
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 */
if (PE_HEADER(main_module)->FileHeader.Characteristics & IMAGE_FILE_DLL)
ExitProcess( ERROR_BAD_EXE_FORMAT );
/* Create 32-bit MODREF */
if (!PE_CreateModule( main_module, filename, 0, FALSE ))
ExitProcess( GetLastError() );
goto error;
free( filename );
/* allocate main thread stack */
if (!THREAD_InitStack( NtCurrentTeb(),
PE_HEADER(main_module)->OptionalHeader.SizeOfStackReserve, TRUE ))
ExitProcess( GetLastError() );
goto error;
/* switch to the new stack */
SYSDEPS_SwitchToThreadStack( start_process );
error:
ExitProcess( GetLastError() );
}
......@@ -469,13 +483,12 @@ void PROCESS_InitWine( int argc, char *argv[] )
case SCS_WOW_BINARY:
{
HMODULE main_module;
LPCSTR filename;
/* 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;
PROCESS_Current()->flags |= PDB32_WIN16_PROC;
SYSLEVEL_EnterWin16Lock();
PROCESS_Start( main_module, filename );
PROCESS_Start( main_module, NULL );
}
break;
......@@ -505,16 +518,14 @@ void PROCESS_InitWine( int argc, char *argv[] )
void PROCESS_InitWinelib( int argc, char *argv[] )
{
HMODULE main_module;
LPCSTR filename;
if (!MAIN_MainInit( argv )) exit(1);
main_exe_argv = argv;
/* 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.dbg_offset = process->exe.dbg_offset;
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;
return 1;
}
......
......@@ -817,6 +817,7 @@ DECL_HANDLER(init_process_done)
return;
}
process->exe.base = req->module;
process->exe.name = req->name;
generate_startup_debug_events( current->process, req->entry );
set_event( 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, " entry=%p,", req->entry );
fprintf( stderr, " name=%p,", req->name );
fprintf( stderr, " gui=%d", req->gui );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment