NTDirectoryFileSystem: Bugfix: IO requests were not cancelled on Windows Vista and later

This commit is contained in:
Tal Aloni 2019-06-04 16:21:55 +03:00
parent 01c2fe9887
commit ee67f3ecb3

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved. /* Copyright (C) 2017-2019 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
* *
* You can redistribute this program and/or modify it under the terms of * You can redistribute this program and/or modify it under the terms of
* the GNU Lesser Public License as published by the Free Software Foundation, * the GNU Lesser Public License as published by the Free Software Foundation,
@ -121,7 +121,7 @@ namespace SMBLibrary.Win32
// Available starting from Windows Vista. // Available starting from Windows Vista.
[DllImport("ntdll.dll", ExactSpelling = true, SetLastError = false)] [DllImport("ntdll.dll", ExactSpelling = true, SetLastError = false)]
private static extern NTStatus NtCancelSynchronousIoFile(IntPtr threadHandle, ref IO_STATUS_BLOCK ioRequestToCancel, out IO_STATUS_BLOCK ioStatusBlock); private static extern NTStatus NtCancelSynchronousIoFile(IntPtr threadHandle, IntPtr ioRequestToCancel, out IO_STATUS_BLOCK ioStatusBlock);
private DirectoryInfo m_directory; private DirectoryInfo m_directory;
private PendingRequestCollection m_pendingRequests = new PendingRequestCollection(); private PendingRequestCollection m_pendingRequests = new PendingRequestCollection();
@ -463,7 +463,7 @@ namespace SMBLibrary.Win32
if (Environment.OSVersion.Version.Major >= 6) if (Environment.OSVersion.Version.Major >= 6)
{ {
IO_STATUS_BLOCK ioStatusBlock; IO_STATUS_BLOCK ioStatusBlock;
status = NtCancelSynchronousIoFile(threadHandle, ref request.IOStatusBlock, out ioStatusBlock); status = NtCancelSynchronousIoFile(threadHandle, IntPtr.Zero, out ioStatusBlock);
} }
else else
{ {