wineboot: Simplify the unnecessarily complex code structure.

This commit is contained in:
Alexandre Julliard 2007-12-20 15:08:39 +01:00
parent eb2d8458a3
commit 06e888f244

View File

@ -146,9 +146,6 @@ static BOOL wininit(void)
return FALSE; 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) ) && while( GetLine( hFile, buffer, sizeof(buffer) ) &&
lstrcmpiA(buffer,RENAME_FILE_SECTION)!=0 ) lstrcmpiA(buffer,RENAME_FILE_SECTION)!=0 )
; /* Read the lines until we match the rename section */ ; /* Read the lines until we match the rename section */
@ -732,21 +729,8 @@ static const struct option long_options[] =
{ NULL, 0, 0, 0 } { 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[] ) 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 */ /* First, set the current directory to SystemRoot */
TCHAR gen_path[MAX_PATH]; TCHAR gen_path[MAX_PATH];
DWORD res; DWORD res;
@ -801,33 +785,20 @@ int main( int argc, char *argv[] )
if (shutdown) return 0; if (shutdown) return 0;
if (restart) ops = SETUP; wininit();
pendingRename();
/* Perform the ops by order, stopping if one fails, skipping if necessary */ ProcessWindowsFileProtection();
/* Shachar: Sorry for the perl syntax */ ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE );
res=(ops.ntonly || !ops.preboot || wininit())&& if (!restart) ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE );
(ops.w9xonly || !ops.preboot || pendingRename()) && ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE );
(ops.ntonly || !ops.prelogin || if (!restart)
ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUNSERVICESONCE], {
TRUE, FALSE )) && ProcessRunKeys( HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN], FALSE, FALSE );
(ops.ntonly || !ops.prelogin || ProcessRunKeys( HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN], FALSE, FALSE );
ProcessWindowsFileProtection()) && ProcessStartupItems();
(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( ));
WINE_TRACE("Operation done\n"); WINE_TRACE("Operation done\n");
return 0;
return res?0:101;
} }