mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 09:00:17 +02:00
WinAPI/IO: Fix handling of end of file offset in SetFilePointerEx
This just means the end of the file is being used as the base offset. Also note that according to the documentation for SetFilePositionEx, that setting the position beyond the current file size is not considered an error as far as the API is concerned.
This commit is contained in:
1 parent
12baceb859
commit
f5ae888597
1 file changed
+12
-3
@@ -147,9 +147,18 @@ DLLEXPORT_FUNC(WINBOOL, SetFilePointerEx, (HANDLE hFile, LARGE_INTEGER liDistanc
|
||||
}
|
||||
|
||||
switch (dwMoveMethod) {
|
||||
case FILE_BEGIN: PositionInfo.CurrentByteOffset = liDistanceToMove; break;
|
||||
case FILE_CURRENT: PositionInfo.CurrentByteOffset.QuadPart += liDistanceToMove.QuadPart; break;
|
||||
case FILE_END: PositionInfo.CurrentByteOffset = StandardInfo.EndOfFile; break;
|
||||
case FILE_BEGIN: {
|
||||
PositionInfo.CurrentByteOffset = liDistanceToMove;
|
||||
break;
|
||||
}
|
||||
case FILE_CURRENT: {
|
||||
PositionInfo.CurrentByteOffset.QuadPart += liDistanceToMove.QuadPart;
|
||||
break;
|
||||
}
|
||||
case FILE_END: {
|
||||
PositionInfo.CurrentByteOffset.QuadPart = StandardInfo.EndOfFile.QuadPart + liDistanceToMove.QuadPart;
|
||||
break;
|
||||
}
|
||||
default: UNIMPLEMENTED();
|
||||
}
|
||||
if (NTSTATUS Status = NtSetInformationFile(hFile, &IOSB, &PositionInfo, sizeof(PositionInfo), FilePositionInformation); Status) {
|
||||
|
||||
Reference in new issue
Block a user