- 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.

svn path=/trunk/; revision=40361
This commit is contained in:
Jeffrey Morlan 2009-04-04 17:51:55 +00:00
parent edb9b66280
commit c0fd81e39e

View file

@ -1525,13 +1525,13 @@ ShowCommands (VOID)
#endif #endif
static VOID static VOID
ExecuteAutoRunFile (VOID) ExecuteAutoRunFile(HKEY hkeyRoot)
{ {
TCHAR autorun[MAX_PATH]; TCHAR autorun[2048];
DWORD len = MAX_PATH; DWORD len = sizeof autorun;
HKEY hkey; HKEY hkey;
if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, if (RegOpenKeyEx(hkeyRoot,
_T("SOFTWARE\\Microsoft\\Command Processor"), _T("SOFTWARE\\Microsoft\\Command Processor"),
0, 0,
KEY_READ, KEY_READ,
@ -1547,10 +1547,9 @@ ExecuteAutoRunFile (VOID)
if (*autorun) if (*autorun)
ParseCommandLine(autorun); ParseCommandLine(autorun);
} }
}
RegCloseKey(hkey); RegCloseKey(hkey);
} }
}
/* Get the command that comes after a /C or /K switch */ /* Get the command that comes after a /C or /K switch */
static VOID static VOID
@ -1756,7 +1755,10 @@ Initialize()
AddBreakHandler (); AddBreakHandler ();
if (AutoRun) if (AutoRun)
ExecuteAutoRunFile(); {
ExecuteAutoRunFile(HKEY_LOCAL_MACHINE);
ExecuteAutoRunFile(HKEY_CURRENT_USER);
}
if (*ptr) if (*ptr)
{ {