From 52d91f112ec2e5dd62edd200ca547bb11e52effa Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 9 Feb 2019 18:41:47 +0100 Subject: [PATCH] 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 --- winsup/cygwin/fhandler_floppy.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index cca00bab8..43139ac2c 100644 --- a/winsup/cygwin/fhandler_floppy.cc +++ b/winsup/cygwin/fhandler_floppy.cc @@ -384,9 +384,12 @@ fhandler_dev_floppy::dup (fhandler_base *child, int flags) inline off_t fhandler_dev_floppy::get_current_position () { - LARGE_INTEGER off = { QuadPart: 0LL }; - off.LowPart = SetFilePointer (get_handle (), 0, &off.HighPart, FILE_CURRENT); - return off.QuadPart; + IO_STATUS_BLOCK io; + FILE_POSITION_INFORMATION fpi = { { QuadPart : 0LL } }; + + NtQueryInformationFile (get_handle (), &io, &fpi, sizeof fpi, + FilePositionInformation); + return fpi.CurrentByteOffset.QuadPart; } void __reg3