[NTOSKRNL/USERINIT/WIN32K]
[reactos.git] / reactos / base / shell / explorer / services / startup.c
index 207b4a0..ba43563 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 /* Based on the Wine "bootup" handler application
@@ -349,6 +349,7 @@ static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
     {
         printf("Couldn't allocate memory for the value names\n");
 
+        free(szCmdLine);
         res=ERROR_NOT_ENOUGH_MEMORY;
         goto end;
     }
@@ -368,6 +369,9 @@ static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
             continue;
         }
 
+        /* safe mode - force to run if prefixed with asterisk */
+        if (GetSystemMetrics(SM_CLEANBOOT) && (szValue[0] != L'*')) continue;
+
         if (bDelete && (res=RegDeleteValueW(hkRun, szValue))!=ERROR_SUCCESS)
         {
             printf("Couldn't delete value - %ld, %ld. Running command anyways.\n", i, res);
@@ -388,6 +392,8 @@ static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete,
         printf("Done processing cmd #%ld\n", i);
     }
 
+    free(szValue);
+    free(szCmdLine);
     res=ERROR_SUCCESS;
 
 end:
@@ -464,6 +470,9 @@ int startup(int argc, const char *argv[])
     } else
         ops=DEFAULT;
 
+    /* do not run certain items in Safe Mode */
+    if(GetSystemMetrics(SM_CLEANBOOT)) ops.startup = FALSE;
+
     /* Perform the ops by order, stopping if one fails, skipping if necessary */
     /* Shachar: Sorry for the perl syntax */
     res=(ops.ntonly || !ops.preboot || wininit()) &&