aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2019-02-09 18:41:47 +0100
committerCorinna Vinschen <corinna@vinschen.de>2019-02-09 18:41:47 +0100
commit52d91f112ec2e5dd62edd200ca547bb11e52effa (patch)
tree6555fec1fdafa253a0dc5d1187f2a3272f0f0202
parent0be0b8f0335ec0fad6188b3570dffeba4ec94fea (diff)
downloadnewlib-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.cc9
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