Commit e5131213 authored by Ivan Leo Puoti's avatar Ivan Leo Puoti Committed by Alexandre Julliard

Let DeviceIoControl call the appropriate native interface.

parent 0789483d
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "winbase.h" #include "winbase.h"
#include "winerror.h" #include "winerror.h"
#include "winternl.h" #include "winternl.h"
#include "winioctl.h"
#include "kernel_private.h" #include "kernel_private.h"
#include "wine/library.h" #include "wine/library.h"
#include "wine/unicode.h" #include "wine/unicode.h"
...@@ -359,19 +360,30 @@ BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, ...@@ -359,19 +360,30 @@ BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,
if (lpOverlapped) if (lpOverlapped)
{ {
status = NtDeviceIoControlFile(hDevice, lpOverlapped->hEvent, if (HIWORD(dwIoControlCode) == FILE_DEVICE_FILE_SYSTEM)
NULL, NULL, (PIO_STATUS_BLOCK)lpOverlapped, status = NtFsControlFile(hDevice, lpOverlapped->hEvent,
dwIoControlCode, lpvInBuffer, cbInBuffer, NULL, NULL, (PIO_STATUS_BLOCK)lpOverlapped,
lpvOutBuffer, cbOutBuffer); dwIoControlCode, lpvInBuffer, cbInBuffer,
lpvOutBuffer, cbOutBuffer);
else
status = NtDeviceIoControlFile(hDevice, lpOverlapped->hEvent,
NULL, NULL, (PIO_STATUS_BLOCK)lpOverlapped,
dwIoControlCode, lpvInBuffer, cbInBuffer,
lpvOutBuffer, cbOutBuffer);
if (lpcbBytesReturned) *lpcbBytesReturned = lpOverlapped->InternalHigh; if (lpcbBytesReturned) *lpcbBytesReturned = lpOverlapped->InternalHigh;
} }
else else
{ {
IO_STATUS_BLOCK iosb; IO_STATUS_BLOCK iosb;
status = NtDeviceIoControlFile(hDevice, NULL, NULL, NULL, &iosb, if (HIWORD(dwIoControlCode) == FILE_DEVICE_FILE_SYSTEM)
dwIoControlCode, lpvInBuffer, cbInBuffer, status = NtFsControlFile(hDevice, NULL, NULL, NULL, &iosb,
lpvOutBuffer, cbOutBuffer); dwIoControlCode, lpvInBuffer, cbInBuffer,
lpvOutBuffer, cbOutBuffer);
else
status = NtDeviceIoControlFile(hDevice, NULL, NULL, NULL, &iosb,
dwIoControlCode, lpvInBuffer, cbInBuffer,
lpvOutBuffer, cbOutBuffer);
if (lpcbBytesReturned) *lpcbBytesReturned = iosb.Information; if (lpcbBytesReturned) *lpcbBytesReturned = iosb.Information;
} }
if (status) SetLastError( RtlNtStatusToDosError(status) ); if (status) SetLastError( RtlNtStatusToDosError(status) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment