wineboot: Add a --init option used when launched automatically at startup.
Don't execute Run entries in that case.
This commit is contained in:
parent
9d3dcae1fb
commit
1d6d080d4b
|
@ -790,7 +790,7 @@ static HANDLE start_wineboot(void)
|
||||||
}
|
}
|
||||||
if (GetLastError() != ERROR_ALREADY_EXISTS) /* we created it */
|
if (GetLastError() != ERROR_ALREADY_EXISTS) /* we created it */
|
||||||
{
|
{
|
||||||
static const WCHAR command_line[] = {'\\','w','i','n','e','b','o','o','t','.','e','x','e',0};
|
static const WCHAR command_line[] = {'\\','w','i','n','e','b','o','o','t','.','e','x','e',' ','-','-','i','n','i','t',0};
|
||||||
STARTUPINFOW si;
|
STARTUPINFOW si;
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
WCHAR cmdline[MAX_PATH + sizeof(command_line)/sizeof(WCHAR)];
|
WCHAR cmdline[MAX_PATH + sizeof(command_line)/sizeof(WCHAR)];
|
||||||
|
|
|
@ -666,18 +666,20 @@ static void usage(void)
|
||||||
WINE_MESSAGE( " -h,--help Display this help message\n" );
|
WINE_MESSAGE( " -h,--help Display this help message\n" );
|
||||||
WINE_MESSAGE( " -e,--end-session End the current session cleanly\n" );
|
WINE_MESSAGE( " -e,--end-session End the current session cleanly\n" );
|
||||||
WINE_MESSAGE( " -f,--force Force exit for processes that don't exit cleanly\n" );
|
WINE_MESSAGE( " -f,--force Force exit for processes that don't exit cleanly\n" );
|
||||||
|
WINE_MESSAGE( " -i,--init Perform initialization for first Wine instance\n" );
|
||||||
WINE_MESSAGE( " -k,--kill Kill running processes without any cleanup\n" );
|
WINE_MESSAGE( " -k,--kill Kill running processes without any cleanup\n" );
|
||||||
WINE_MESSAGE( " -r,--restart Restart only, don't do normal startup operations\n" );
|
WINE_MESSAGE( " -r,--restart Restart only, don't do normal startup operations\n" );
|
||||||
WINE_MESSAGE( " -s,--shutdown Shutdown only, don't reboot\n" );
|
WINE_MESSAGE( " -s,--shutdown Shutdown only, don't reboot\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char short_options[] = "efhkrs";
|
static const char short_options[] = "efhikrs";
|
||||||
|
|
||||||
static const struct option long_options[] =
|
static const struct option long_options[] =
|
||||||
{
|
{
|
||||||
{ "help", 0, 0, 'h' },
|
{ "help", 0, 0, 'h' },
|
||||||
{ "end-session", 0, 0, 'e' },
|
{ "end-session", 0, 0, 'e' },
|
||||||
{ "force", 0, 0, 'f' },
|
{ "force", 0, 0, 'f' },
|
||||||
|
{ "init" , 0, 0, 'i' },
|
||||||
{ "kill", 0, 0, 'k' },
|
{ "kill", 0, 0, 'k' },
|
||||||
{ "restart", 0, 0, 'r' },
|
{ "restart", 0, 0, 'r' },
|
||||||
{ "shutdown", 0, 0, 's' },
|
{ "shutdown", 0, 0, 's' },
|
||||||
|
@ -691,7 +693,7 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
/* First, set the current directory to SystemRoot */
|
/* First, set the current directory to SystemRoot */
|
||||||
int optc;
|
int optc;
|
||||||
int end_session = 0, force = 0, kill = 0, restart = 0, shutdown = 0;
|
int end_session = 0, force = 0, init = 0, kill = 0, restart = 0, shutdown = 0;
|
||||||
HANDLE event;
|
HANDLE event;
|
||||||
|
|
||||||
GetWindowsDirectoryW( windowsdir, MAX_PATH );
|
GetWindowsDirectoryW( windowsdir, MAX_PATH );
|
||||||
|
@ -705,8 +707,9 @@ int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
switch(optc)
|
switch(optc)
|
||||||
{
|
{
|
||||||
case 'e': end_session = 1; break;
|
case 'e': end_session = kill = 1; break;
|
||||||
case 'f': force = 1; break;
|
case 'f': force = 1; break;
|
||||||
|
case 'i': init = 1; break;
|
||||||
case 'k': kill = 1; break;
|
case 'k': kill = 1; break;
|
||||||
case 'r': restart = 1; break;
|
case 'r': restart = 1; break;
|
||||||
case 's': shutdown = 1; break;
|
case 's': shutdown = 1; break;
|
||||||
|
@ -720,7 +723,7 @@ int main( int argc, char *argv[] )
|
||||||
if (!shutdown_close_windows( force )) return 1;
|
if (!shutdown_close_windows( force )) return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end_session || kill) kill_processes( shutdown );
|
if (kill) kill_processes( shutdown );
|
||||||
|
|
||||||
if (shutdown) return 0;
|
if (shutdown) return 0;
|
||||||
|
|
||||||
|
@ -732,13 +735,14 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
ProcessWindowsFileProtection();
|
ProcessWindowsFileProtection();
|
||||||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE );
|
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE );
|
||||||
if (!restart)
|
if (init || (kill && !restart))
|
||||||
{
|
{
|
||||||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE );
|
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE );
|
||||||
start_services();
|
start_services();
|
||||||
}
|
}
|
||||||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE );
|
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE );
|
||||||
if (!restart)
|
|
||||||
|
if (!init && !restart)
|
||||||
{
|
{
|
||||||
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], FALSE, FALSE );
|
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], FALSE, FALSE );
|
||||||
ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], FALSE, FALSE );
|
ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], FALSE, FALSE );
|
||||||
|
@ -751,6 +755,6 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
/* FIXME: the wait is needed to keep services running */
|
/* FIXME: the wait is needed to keep services running */
|
||||||
/* it should be removed once we have a proper services.exe */
|
/* it should be removed once we have a proper services.exe */
|
||||||
WaitForSingleObject( __wine_make_process_system(), INFINITE );
|
if (!restart) WaitForSingleObject( __wine_make_process_system(), INFINITE );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue