Commit 4654c321 authored by Andreas Mohr's avatar Andreas Mohr Committed by Alexandre Julliard

It seems to be GetModuleFileName16 that checks exe version on whether

to return long or short paths, not GetModuleFileNameA.
parent ec7d7fa3
......@@ -1296,6 +1296,11 @@ HMODULE WINAPI GetModuleHandleW(LPCWSTR module)
/***********************************************************************
* GetModuleFileNameA (KERNEL32.235)
*
* GetModuleFileNameA seems to *always* return the long path;
* it's only GetModuleFileName16 that decides between short/long path
* by checking if exe version >= 4.0.
* (SDK docu doesn't mention this)
*/
DWORD WINAPI GetModuleFileNameA(
HMODULE hModule, /* [in] module handle (32bit) */
......@@ -1307,10 +1312,7 @@ DWORD WINAPI GetModuleFileNameA(
if (!wm) /* can happen on start up or the like */
return 0;
if (PE_HEADER(wm->module)->OptionalHeader.MajorOperatingSystemVersion >= 4.0)
lstrcpynA( lpFileName, wm->filename, size );
else
lstrcpynA( lpFileName, wm->short_filename, size );
lstrcpynA( lpFileName, wm->filename, size );
TRACE("%s\n", lpFileName );
return strlen(lpFileName);
......
......@@ -1388,6 +1388,8 @@ WORD WINAPI GetExpWinVer16( HMODULE16 hModule )
/**********************************************************************
* GetModuleFileName16 (KERNEL.49)
*
* Comment: see GetModuleFileNameA
*/
INT16 WINAPI GetModuleFileName16( HINSTANCE16 hModule, LPSTR lpFileName,
INT16 nSize )
......@@ -1396,7 +1398,10 @@ INT16 WINAPI GetModuleFileName16( HINSTANCE16 hModule, LPSTR lpFileName,
if (!hModule) hModule = GetCurrentTask();
if (!(pModule = NE_GetPtr( hModule ))) return 0;
lstrcpynA( lpFileName, NE_MODULE_NAME(pModule), nSize );
if (pModule->expected_version >= 0x400)
GetLongPathNameA(NE_MODULE_NAME(pModule), lpFileName, nSize);
else
lstrcpynA( lpFileName, NE_MODULE_NAME(pModule), nSize );
TRACE("%s\n", lpFileName );
return strlen(lpFileName);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment