Skip to content

iowin32.c, invalid MySetFilePointerEx() in version 1.2.8 #128

@jvanlabeke

Description

@jvanlabeke

Code has been factored from previous versions in a MySetFilePointerEx() method which use a dwMoveMethod argument. The code always use the hard value FILE_CURRENT instead of the argument.

Version 1.2.8:
`static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod)
{

ifdef IOWIN32_USING_WINRT_API

return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);

else

LONG lHigh = pos.HighPart;
DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, `**FILE_CURRENT**`);`

should be:
`static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod)
{

ifdef IOWIN32_USING_WINRT_API

 return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);

else

LONG lHigh = pos.HighPart;
DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, `**dwMoveMethod**`);`

There is a similar issue in the win32_seek64_file_func() method when calling MySetFilePointerEx()

version 1.2.8:
if (hFile) { LARGE_INTEGER pos; pos.QuadPart = offset; if (!MySetFilePointerEx(hFile, pos, NULL,FILE_CURRENT))

should be:

if (hFile) { LARGE_INTEGER pos; pos.QuadPart = offset; if (!MySetFilePointerEx(hFile, pos, NULL,dwMoveMethod))

Regards
Julien

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions