Bug in MapAndLoad function

Aaron Slunt tonglebeak at gmail.com
Fri Nov 17 12:06:38 CST 2006


Adam Connell wrote:
> Greetings,
>
> While investigating why a game (Kasparov's Chessmate) didn't work,
> I think I found a bug in the implementation of imagehlp.dll in the
> the MapAndLoad function located in dlls/imagehlp/access.c lines
> 165-167. The function looks like it tries to open an uninitialized
> string szFileName instead of the passed file name "pszImageName".
>
> I think there has been a bug filed already (Bug 6099 Alien Shooter
> needs imagehlp.dll override) and I think this explains it.
>
> Wine version 0.9.25
>
> /***********************************************************************
>  *		MapAndLoad (IMAGEHLP.@)
>  */
> BOOL WINAPI MapAndLoad(
>   LPSTR pszImageName, LPSTR pszDllPath, PLOADED_IMAGE pLoadedImage,
>   BOOL bDotDll, BOOL bReadOnly)
> {
>   CHAR szFileName[MAX_PATH];
>   HANDLE hFile = NULL;
>   HANDLE hFileMapping = NULL;
>   HMODULE hModule = NULL;
>   PIMAGE_NT_HEADERS pNtHeader = NULL;
>
>   TRACE("(%s, %s, %p, %d, %d)\n", pszImageName, pszDllPath, 
> pLoadedImage,
>                                     bDotDll, bReadOnly);
>   
>   /* PathCombine(&szFileName, pszDllPath, pszImageName); */
>   /* PathRenameExtension(&szFileName, bDotDll?:"dll":"exe"); */
>
>   /* FIXME: Check if the file already loaded (use 
> IMAGEHLP_pFirstLoadedImage) */
>   if(!(hFile = CreateFileA(
>     szFileName, GENERIC_READ, 1, /* FIXME: FILE_SHARE_READ not defined 
> */
>     NULL, OPEN_EXISTING, 0, NULL)))
>     {
>       SetLastError(ERROR_FILE_NOT_FOUND);
>       goto Error;
>     }
>
> Cheers,
> Adam
>
>
>
>   

Please file a bug in bugzilla regarding this. wine-devel is not the 
place to file bug reports, much more can get done in bugzilla.

http://bugs.winehq.org

Thank you.



More information about the wine-devel mailing list