Author: gedmurphy
Date: Mon Jul 21 14:54:50 2008
New Revision: 34644
URL:
http://svn.reactos.org/svn/reactos?rev=34644&view=rev
Log:
- Fix NeedCurrentDirectoryForExePath. Based on Wine code
- Passes all kernel32:path winetests
Modified:
trunk/reactos/dll/win32/kernel32/file/dir.c
Modified: trunk/reactos/dll/win32/kernel32/file/dir.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/di…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/file/dir.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/file/dir.c [iso-8859-1] Mon Jul 21 14:54:50 2008
@@ -1268,8 +1268,23 @@
BOOL STDCALL
NeedCurrentDirectoryForExePathW(LPCWSTR ExeName)
{
- return (wcschr(ExeName,
- L'\\') != NULL);
+ static const WCHAR env_name[] =
{'N','o','D','e','f','a','u','l','t',
+
'C','u','r','r','e','n','t',
+
'D','i','r','e','c','t','o','r','y',
+
'I','n','E','x','e','P','a','t','h',0};
+ WCHAR env_val;
+
+ /* MSDN mentions some 'registry location'. We do not use registry. */
+ FIXME("(%s): partial stub\n", debugstr_w(ExeName));
+
+ if (wcschr(ExeName, L'\\'))
+ return TRUE;
+
+ /* Check the existence of the variable, not value */
+ if (!GetEnvironmentVariableW( env_name, &env_val, 1 ))
+ return TRUE;
+
+ return FALSE;
}
@@ -1279,8 +1294,12 @@
BOOL STDCALL
NeedCurrentDirectoryForExePathA(LPCSTR ExeName)
{
- return (strchr(ExeName,
- '\\') != NULL);
+ WCHAR *ExeNameW;
+
+ if (!(ExeNameW = FilenameA2W(ExeName, FALSE)))
+ return TRUE;
+
+ return NeedCurrentDirectoryForExePathW(ExeNameW);
}