From 496603cf8656306a6093afeb50054219cebacb6b Mon Sep 17 00:00:00 2001 From: Shachar Shemesh Date: Wed, 12 Mar 2003 20:15:15 +0000 Subject: [PATCH] - Implement finer grained control over what gets run. - Implement command line to control presets of said control for various scenarios: o start - session startup - run everything. o restart - session close (presumeably after reboot) - only perform *once operations. --- documentation/packaging.sgml | 10 ++++-- programs/wineboot/wineboot.c | 63 ++++++++++++++++++++++++++++-------- 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/documentation/packaging.sgml b/documentation/packaging.sgml index 8393992347e..e9623c9eeaa 100644 --- a/documentation/packaging.sgml +++ b/documentation/packaging.sgml @@ -330,16 +330,20 @@ - winebootup + wineboot Winelib app to be found in programs/. - It'll be called by the winelauncher wine wrapper startup - script for every first-time wine invocation. Its purpose is to process all Windows startup autorun mechanisms, such as wininit.ini, win.ini Load=/Run=, registry keys: RenameFiles/Run/RunOnce*/RunServices*, Startup folders. + It'll be called by Wine automatically when an application + requests a restart of the system (presumeably - after + installation). + It should also be called once when a session starts to + run the various session start utilities (will not happen + automatically). To start a session, invoke "wineboot start". diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 2f76856861c..4e523e06053 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -522,8 +522,22 @@ end: return res==ERROR_SUCCESS?TRUE:FALSE; } +struct op_mask { + BOOL w9xonly; /* Perform only operations done on Windows 9x */ + BOOL ntonly; /* Perform only operations done on Windows NT */ + BOOL startup; /* Perform the operations that are performed every boot */ + BOOL preboot; /* Perform file renames typically done before the system starts */ + BOOL prelogin; /* Perform the operations typically done before the user logs in */ + BOOL postlogin; /* Operations done after login */ +}; + +static const struct op_mask SESSION_START={FALSE, FALSE, TRUE, TRUE, TRUE, TRUE}, + SETUP={FALSE, FALSE, FALSE, TRUE, TRUE, TRUE}; +#define DEFAULT SESSION_START + int main( int argc, char *argv[] ) { + struct op_mask ops; /* Which of the ops do we want to perform? */ /* First, set the current directory to SystemRoot */ TCHAR gen_path[MAX_PATH]; DWORD res; @@ -552,19 +566,42 @@ int main( int argc, char *argv[] ) return 100; } - /* Perform the operations by order, stopping if one fails */ - res=wininit()&& - pendingRename() && - ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], - TRUE, FALSE ) && - ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], - FALSE, FALSE ) && - ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], - TRUE, TRUE ) && - ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], - FALSE, FALSE ) && - ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], - FALSE, FALSE ); + if( argc>1 ) + { + switch( argv[1][0] ) + { + case 'r': /* Restart */ + ops=SETUP; + break; + case 's': /* Full start */ + ops=SESSION_START; + break; + default: + ops=DEFAULT; + break; + } + } else + ops=DEFAULT; + + /* Perform the ops by order, stopping if one fails, skipping if necessary */ + /* Shachar: Sorry for the perl syntax */ + res=(ops.ntonly || !ops.preboot || wininit())&& + (ops.w9xonly || !ops.preboot || pendingRename()) && + (ops.ntonly || !ops.prelogin || + ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], + TRUE, FALSE )) && + (ops.ntonly || !ops.prelogin || !ops.startup || + ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], + FALSE, FALSE )) && + (!ops.postlogin || + ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], + TRUE, TRUE )) && + (!ops.postlogin || !ops.startup || + ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], + FALSE, FALSE )) && + (!ops.postlogin || !ops.startup || + ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], + FALSE, FALSE )); WINE_TRACE("Operation done\n");