Dmitry Timoshkov <dmitry(a)codeweavers.com> writes:
> + if (!ReadFile(hfile, &dos, sizeof(dos), NULL, NULL))
> + goto errexit;
> +
> + if (dos.e_magic != IMAGE_DOS_SIGNATURE)
> + goto errexit;
> +
> + if (SetFilePointer(hfile, dos.e_lfanew, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
> + goto errexit;
> +
> + if (!ReadFile(hfile, &os2, sizeof(os2), NULL, NULL))
> + goto errexit;
Again that's inefficient, you don't want to read it bit by bit. You
should read the whole file in one go, or use a memory mapping. If using
ReadFile you also have to check the returned size.
--
Alexandre Julliard
julliard(a)winehq.org