diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2019-02-09 18:41:47 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2019-02-09 18:41:47 +0100 |
commit | 52d91f112ec2e5dd62edd200ca547bb11e52effa (patch) | |
tree | 6555fec1fdafa253a0dc5d1187f2a3272f0f0202 | |
parent | 0be0b8f0335ec0fad6188b3570dffeba4ec94fea (diff) | |
download | newlib-52d91f112ec2e5dd62edd200ca547bb11e52effa.zip newlib-52d91f112ec2e5dd62edd200ca547bb11e52effa.tar.gz newlib-52d91f112ec2e5dd62edd200ca547bb11e52effa.tar.bz2 |
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>
-rw-r--r-- | winsup/cygwin/fhandler_floppy.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index cca00ba..43139ac 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 |