Commit 496603cf authored by Shachar Shemesh's avatar Shachar Shemesh Committed by Alexandre Julliard

- 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.
parent 8cf24b7d
......@@ -330,16 +330,20 @@
</listitem>
</varlistentry>
<varlistentry><term><filename>winebootup</filename></term>
<varlistentry><term><filename>wineboot</filename></term>
<listitem>
<para>
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".
</para>
</listitem>
</varlistentry>
......
......@@ -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");
......
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