Re: Wineboot command line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'll be forgetting my own head next.

The attach patch is against my previous patch. Nothing major. Just causing it to compile.

Shachar


Shachar Shemesh wrote:


P.S.
I am getting spam to the email address I use for sending the code. Things are defenitely getting from bad to worse here.


Changelog:
Shachar Shemesh <winecode@sun.consumer.org.il>
programs/wineboot/wineboot.c

   * 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

   * Update the winebootup entry to bring it into the millenium of the
     fruitbat.
         o Change name.
         o Document the need of packagers to start the session, and how.

------------------------------------------------------------------------

Index: documentation/packaging.sgml
===================================================================
RCS file: /home/sun/sources/cvs/wine/documentation/packaging.sgml,v
retrieving revision 1.14
diff -u -r1.14 packaging.sgml
--- documentation/packaging.sgml	28 Jan 2003 01:06:50 -0000	1.14
+++ documentation/packaging.sgml	11 Mar 2003 06:06:48 -0000
@@ -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>
Index: programs/wineboot/wineboot.c
===================================================================
RCS file: /home/sun/sources/cvs/wine/programs/wineboot/wineboot.c,v
retrieving revision 1.7
diff -u -r1.7 wineboot.c
--- programs/wineboot/wineboot.c	12 Feb 2003 01:14:08 -0000	1.7
+++ programs/wineboot/wineboot.c	11 Mar 2003 05:58:18 -0000
@@ -522,8 +522,22 @@
    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},
+    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 @@
        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");





--
Shachar Shemesh
Open Source integration consultant
Home page & resume - http://www.shemesh.biz/

--- programs/wineboot/wineboot.c.orig	2003-03-11 17:50:19.000000000 +0200
+++ programs/wineboot/wineboot.c	2003-03-11 17:50:38.000000000 +0200
@@ -532,8 +532,8 @@
 };
 
 static const struct op_mask SESSION_START={FALSE, FALSE, TRUE, TRUE, TRUE, TRUE},
-    SETUP={FALSE, FALSE, FALSE, TRUE, TRUE, TRUE},
-    DEFAULT=SESSION_START;
+    SETUP={FALSE, FALSE, FALSE, TRUE, TRUE, TRUE};
+#define DEFAULT SESSION_START
 
 int main( int argc, char *argv[] )
 {

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux