[ros-diffs] [janderwald] 37791: - revert 37497 - use FindFirstFileW to obtain to original filename which is passed to CreateProcess - fixes bug 3875

janderwald at svn.reactos.org janderwald at svn.reactos.org
Mon Dec 1 15:57:35 CET 2008


Author: janderwald
Date: Mon Dec  1 08:57:34 2008
New Revision: 37791

URL: http://svn.reactos.org/svn/reactos?rev=37791&view=rev
Log:
- revert 37497
- use FindFirstFileW to obtain to original filename which is passed to CreateProcess
- fixes bug 3875

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

Modified: trunk/reactos/base/shell/cmd/where.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/where.c?rev=37791&r1=37790&r2=37791&view=diff
==============================================================================
--- trunk/reactos/base/shell/cmd/where.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/where.c [iso-8859-1] Mon Dec  1 08:57:34 2008
@@ -141,10 +141,12 @@
 BOOL
 SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
 {
-	static TCHAR pszDefaultPathExt[] = _T(".com;.exe;.bat;.cmd");
+	static TCHAR pszDefaultPathExt[] = _T(".COM;.EXE;.BAT;.CMD");
 	LPTSTR pszPathExt, pszPath;
 	LPTSTR pCh;
 	DWORD  dwBuffer;
+	HANDLE hFile;
+	WIN32_FIND_DATAW FindData;
 	TRACE ("SearchForExecutable: \'%s\'\n", debugstr_aw(pFileName));
 
 	/* load environment varable PATHEXT */
@@ -154,20 +156,21 @@
 	{
 		pszPathExt = (LPTSTR)cmd_realloc (pszPathExt, dwBuffer * sizeof (TCHAR));
 		GetEnvironmentVariable (_T("PATHEXT"), pszPathExt, dwBuffer);
-		_tcslwr(pszPathExt);
 	}
 	else if (0 == dwBuffer)
 	{
 		_tcscpy(pszPathExt, pszDefaultPathExt);
-	}
-	else
-	{
-		_tcslwr(pszPathExt);
 	}
 
 	/* Check if valid directly on specified path */
 	if (SearchForExecutableSingle(pFileName, pFullName, pszPathExt, NULL))
 	{
+		hFile = FindFirstFileW(pFullName, &FindData);
+		if (hFile)
+		{
+			_tcscpy(pFullName, FindData.cFileName);
+		}
+		FindClose(hFile);
 		cmd_free(pszPathExt);
 		return TRUE;
 	}
@@ -196,6 +199,12 @@
 	{
 		if (SearchForExecutableSingle(pFileName, pFullName, pszPathExt, pCh))
 		{
+			hFile = FindFirstFileW(pFullName, &FindData);
+			if (hFile)
+			{
+				_tcscpy(pFullName, FindData.cFileName);
+			}
+			FindClose(hFile);
 			cmd_free(pszPath);
 			cmd_free(pszPathExt);
 			return TRUE;



More information about the Ros-diffs mailing list