Changed GetModuleFileNameA to use GetCurrentTask instead of

MODULE32_LookupHMODULE when called by a 16-bit task.
This commit is contained in:
Joshua Thielen 2002-07-05 00:16:41 +00:00 committed by Alexandre Julliard
parent 7c4cb515b6
commit 1cef2974ab
1 changed files with 11 additions and 5 deletions

View File

@ -1033,13 +1033,20 @@ DWORD WINAPI GetModuleFileNameA(
LPSTR lpFileName, /* [out] filenamebuffer */
DWORD size ) /* [in] size of filenamebuffer */
{
WINE_MODREF *wm;
RtlEnterCriticalSection( &loader_section );
lpFileName[0] = 0;
if ((wm = MODULE32_LookupHMODULE( hModule )))
lstrcpynA( lpFileName, wm->filename, size );
if (!hModule && !(NtCurrentTeb()->tibflags & TEBF_WIN32))
{
/* 16-bit task - get current NE module name */
NE_MODULE *pModule = NE_GetPtr( GetCurrentTask() );
if (pModule) GetLongPathNameA(NE_MODULE_NAME(pModule), lpFileName, size);
}
else
{
WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule );
if (wm) lstrcpynA( lpFileName, wm->filename, size );
}
RtlLeaveCriticalSection( &loader_section );
TRACE("%s\n", lpFileName );
@ -1694,4 +1701,3 @@ SEGPTR WINAPI HasGPHandler16( SEGPTR address )
return 0;
}