[ros-diffs] [jmorlan] 40361: - Check for cmd's AutoRun registry value in HKEY_CURRENT_USER as well as HKEY_LOCAL_MACHINE. - Allow AutoRun commands to be longer than MAX_PATH.

jmorlan at svn.reactos.org jmorlan at svn.reactos.org
Sat Apr 4 19:51:56 CEST 2009


Author: jmorlan
Date: Sat Apr  4 21:51:55 2009
New Revision: 40361

URL: http://svn.reactos.org/svn/reactos?rev=40361&view=rev
Log:
- Check for cmd's AutoRun registry value in HKEY_CURRENT_USER as well as HKEY_LOCAL_MACHINE.
- Allow AutoRun commands to be longer than MAX_PATH.

Modified:
    trunk/reactos/base/shell/cmd/cmd.c

Modified: trunk/reactos/base/shell/cmd/cmd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=40361&r1=40360&r2=40361&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] Sat Apr  4 21:51:55 2009
@@ -1525,13 +1525,13 @@
 #endif
 
 static VOID
-ExecuteAutoRunFile (VOID)
-{
-    TCHAR autorun[MAX_PATH];
-	DWORD len = MAX_PATH;
+ExecuteAutoRunFile(HKEY hkeyRoot)
+{
+	TCHAR autorun[2048];
+	DWORD len = sizeof autorun;
 	HKEY hkey;
 
-    if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, 
+    if (RegOpenKeyEx(hkeyRoot,
                     _T("SOFTWARE\\Microsoft\\Command Processor"),
                     0, 
                     KEY_READ, 
@@ -1547,9 +1547,8 @@
 			if (*autorun)
 				ParseCommandLine(autorun);
 	    }
+	    RegCloseKey(hkey);
     }
-
-	RegCloseKey(hkey);
 }
 
 /* Get the command that comes after a /C or /K switch */
@@ -1756,7 +1755,10 @@
 	AddBreakHandler ();
 
 	if (AutoRun)
-		ExecuteAutoRunFile();
+	{
+		ExecuteAutoRunFile(HKEY_LOCAL_MACHINE);
+		ExecuteAutoRunFile(HKEY_CURRENT_USER);
+	}
 
 	if (*ptr)
 	{



More information about the Ros-diffs mailing list