Cygwin: disk device: stop using SetFilePointer

This is a really old and crappy API, as the previous commit shows.
Use NtQueryInformationFile(FilePositionInformation) here instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2019-02-09 18:41:47 +01:00
parent 0be0b8f033
commit 52d91f112e

View File

@ -384,9 +384,12 @@ fhandler_dev_floppy::dup (fhandler_base *child, int flags)
inline off_t inline off_t
fhandler_dev_floppy::get_current_position () fhandler_dev_floppy::get_current_position ()
{ {
LARGE_INTEGER off = { QuadPart: 0LL }; IO_STATUS_BLOCK io;
off.LowPart = SetFilePointer (get_handle (), 0, &off.HighPart, FILE_CURRENT); FILE_POSITION_INFORMATION fpi = { { QuadPart : 0LL } };
return off.QuadPart;
NtQueryInformationFile (get_handle (), &io, &fpi, sizeof fpi,
FilePositionInformation);
return fpi.CurrentByteOffset.QuadPart;
} }
void __reg3 void __reg3