[PATCH] [ImageHlp]: MapAndLoad

Alexandre Julliard julliard at winehq.org
Tue Jan 2 12:40:27 CST 2007


Eric Pouech <eric.pouech at wanadoo.fr> writes:

> @@ -199,7 +204,10 @@ BOOL WINAPI MapAndLoad(LPSTR pszImageNam
>          ((LPBYTE) &pNtHeader->OptionalHeader +
>           pNtHeader->FileHeader.SizeOfOptionalHeader);
>      pLoadedImage->NumberOfSections =3D pNtHeader->FileHeader.NumberOfSec=
> tions;
> -    pLoadedImage->SizeOfImage      =3D pNtHeader->OptionalHeader.SizeOfI=
> mage;
> +    /* we need to return the size of image which has been mapped */
> +    pLoadedImage->SizeOfImage      =3D pNtHeader->OptionalHeader.SizeOfH=
> eaders;
> +    for (i =3D 0; i < pLoadedImage->NumberOfSections; i++)
> +        pLoadedImage->SizeOfImage  +=3D pLoadedImage->Sections[i].SizeOf=
> RawData;

There's no reason that the SizeOfRawData fields would add up to the
size of the mapping. You have to use GetFileSize() if you need the
true size.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list