Add a new function to return a path with correct casing.  Remove the get[short/long]pathname hack that was there before to do it.
Modified: trunk/reactos/subsys/system/cmd/cmd.h
Modified: trunk/reactos/subsys/system/cmd/internal.c
Modified: trunk/reactos/subsys/system/cmd/misc.c

Modified: trunk/reactos/subsys/system/cmd/cmd.h
--- trunk/reactos/subsys/system/cmd/cmd.h	2005-10-30 17:30:53 UTC (rev 18888)
+++ trunk/reactos/subsys/system/cmd/cmd.h	2005-10-30 17:50:03 UTC (rev 18889)
@@ -300,6 +300,7 @@
 BOOL   IsExistingFile (LPCTSTR);
 BOOL   IsExistingDirectory (LPCTSTR);
 BOOL   FileGetString (HANDLE, LPTSTR, INT);
+VOID   GetPathCase(TCHAR *, TCHAR *);
 
 #define PROMPT_NO    0
 #define PROMPT_YES   1

Modified: trunk/reactos/subsys/system/cmd/internal.c
--- trunk/reactos/subsys/system/cmd/internal.c	2005-10-30 17:30:53 UTC (rev 18888)
+++ trunk/reactos/subsys/system/cmd/internal.c	2005-10-30 17:50:03 UTC (rev 18889)
@@ -241,8 +241,8 @@
   /* The use of both of these together will correct the case of a path
      where as one alone or GetFullPath will not.  Exameple:
 	  c:\windows\SYSTEM32 => C:\WINDOWS\system32 */
-  GetShortPathName(OutPathTemp, OutPathTemp2, MAX_PATH);
-  GetLongPathName(OutPathTemp2, OutPath, MAX_PATH);  
+  GetFullPathName(OutPathTemp, MAX_PATH, OutPathTemp2, NULL);
+  GetPathCase(OutPathTemp2, OutPath);
 
   fail = SetCurrentDirectory(OutPath);
   if (!fail) 
@@ -395,19 +395,19 @@
 		_tcscat(szFinalPath,f.cFileName);      
 		
 		if ((f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ==  FILE_ATTRIBUTE_DIRECTORY)
-    {  		       
+		{  		       
 			if(!SetRootPath(szFinalPath))
 			{
 				/* Change for /D */
 				if(bChangeDrive)
-        {   
-           _tcsupr(szFinalPath); 
-           GetLongPathName(szFinalPath, szPath, MAX_PATH);  
-					 SetCurrentDirectory(szPath);
-        }
+				{   
+					_tcsupr(szFinalPath);   
+					GetPathCase(szFinalPath, szPath);
+					SetCurrentDirectory(szPath);
+				}
 				return 0;
 			}
-      
+
 		}
 	}while(FindNextFile (hFile, &f));
  

Modified: trunk/reactos/subsys/system/cmd/misc.c
--- trunk/reactos/subsys/system/cmd/misc.c	2005-10-30 17:30:53 UTC (rev 18888)
+++ trunk/reactos/subsys/system/cmd/misc.c	2005-10-30 17:50:03 UTC (rev 18889)
@@ -68,7 +68,47 @@
 #endif /* _UNICODE */
 }
 
+/*
+ * Takes a path in and returns it with the correct case of the letters
+ */
+VOID GetPathCase( TCHAR * Path, TCHAR * OutPath)
+{
+	INT i = 0;
+	_tcscpy(OutPath, _T(""));
+	TCHAR TempPath[MAX_PATH];  
+	WIN32_FIND_DATA FindFileData;
+	HANDLE hFind;
+	_tcscpy(TempPath, _T(""));
 
+	
+	for(i = 0; i < _tcslen(Path); i++)
+	{
+		if(Path[i] != _T('\\'))
+		{
+			_tcsncat(TempPath, &Path[i], 1);
+			if(i != _tcslen(Path) - 1)
+				continue;
+		}
+		/* Handle the base part of the path different.
+		   Because if you put it into findfirstfile, it will
+		   return your current folder */
+		if(_tcslen(TempPath) == 2 && TempPath[1] == _T(':'))
+		{
+			_tcscat(OutPath, TempPath);
+			_tcscat(OutPath, _T("\\"));
+			_tcscat(TempPath, _T("\\"));
+		}
+		else
+		{
+			hFind = FindFirstFile(TempPath,&FindFileData);
+			_tcscat(TempPath, _T("\\"));
+			_tcscat(OutPath, FindFileData.cFileName);
+			_tcscat(OutPath, _T("\\"));
+			CloseHandle(hFind);
+		}
+	}
+}
+
 /*
  * Check if Ctrl-Break was pressed during the last calls
  */