Alexandre Julliard : wineboot: Simplify the unnecessarily complex code structure.

Alexandre Julliard julliard at winehq.org
Fri Dec 21 07:28:22 CST 2007


Module: wine
Branch: master
Commit: 06e888f244a6bb548017f05f03bc4b8418f53e47
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=06e888f244a6bb548017f05f03bc4b8418f53e47

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Dec 20 15:08:39 2007 +0100

wineboot: Simplify the unnecessarily complex code structure.

---

 programs/wineboot/wineboot.c |   57 ++++++++++-------------------------------
 1 files changed, 14 insertions(+), 43 deletions(-)

diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index 97c8bf5..7da4662 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -146,9 +146,6 @@ static BOOL wininit(void)
 	return FALSE;
     }
 
-    printf("Wine is finalizing your software installation. This may take a few minutes,\n");
-    printf("though it never actually does.\n");
-
     while( GetLine( hFile, buffer, sizeof(buffer) ) &&
 	    lstrcmpiA(buffer,RENAME_FILE_SECTION)!=0  )
 	; /* Read the lines until we match the rename section */
@@ -732,21 +729,8 @@ static const struct option long_options[] =
     { NULL,          0, 0, 0 }
 };
 
-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};
-
 int main( int argc, char *argv[] )
 {
-    struct op_mask ops = SESSION_START; /* Which of the ops do we want to perform? */
     /* First, set the current directory to SystemRoot */
     TCHAR gen_path[MAX_PATH];
     DWORD res;
@@ -801,33 +785,20 @@ int main( int argc, char *argv[] )
 
     if (shutdown) return 0;
 
-    if (restart) ops = SETUP;
-
-    /* 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 ||
-         ProcessWindowsFileProtection()) &&
-        (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 )) &&
-	(!ops.postlogin || !ops.startup ||
-	 ProcessStartupItems( ));
+    wininit();
+    pendingRename();
 
-    WINE_TRACE("Operation done\n");
+    ProcessWindowsFileProtection();
+    ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE );
+    if (!restart) ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE );
+    ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE );
+    if (!restart)
+    {
+        ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], FALSE, FALSE );
+        ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], FALSE, FALSE );
+        ProcessStartupItems();
+    }
 
-    return res?0:101;
+    WINE_TRACE("Operation done\n");
+    return 0;
 }




More information about the wine-cvs mailing list