mirror of
https://github.com/reactos/reactos.git
synced 2024-10-07 18:04:41 +00:00
Fix for DeviceIoControl masking FILE_DEVICE_FILE_SYSTEM incorrectly.
Anybody familiar with this module please review. svn path=/trunk/; revision=3608
This commit is contained in:
parent
445f205034
commit
feef5457b3
|
@ -1,4 +1,4 @@
|
|||
/* $Id: deviceio.c,v 1.9 2002/09/08 10:22:41 chorns Exp $
|
||||
/* $Id: deviceio.c,v 1.10 2002/10/03 19:09:04 robd Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -13,6 +13,7 @@
|
|||
#include <windows.h>
|
||||
|
||||
#define NDEBUG
|
||||
//#define DBG
|
||||
#include <kernel32/kernel32.h>
|
||||
#include <kernel32/error.h>
|
||||
|
||||
|
@ -37,16 +38,34 @@ DeviceIoControl(
|
|||
|
||||
WINBOOL bFsIoControlCode = FALSE;
|
||||
|
||||
DPRINT("DeviceIoControl(hDevice %x dwIoControlCode %d lpInBuffer %x "
|
||||
"nInBufferSize %d lpOutBuffer %x nOutBufferSize %d "
|
||||
"lpBytesReturned %x lpOverlapped %x)\n",
|
||||
hDevice,dwIoControlCode,lpInBuffer,nInBufferSize,lpOutBuffer,
|
||||
nOutBufferSize,lpBytesReturned,lpOverlapped);
|
||||
|
||||
if (lpBytesReturned == NULL)
|
||||
{
|
||||
DPRINT("DeviceIoControl() - returning STATUS_INVALID_PARAMETER\n");
|
||||
SetLastErrorByStatus (STATUS_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
//
|
||||
// TODO: Review and approve this change by RobD. IoCtrls for Serial.sys were
|
||||
// going to NtFsControlFile instead of NtDeviceIoControlFile.
|
||||
// Don't know at this point if anything else is affected by this change.
|
||||
//
|
||||
// if (((dwIoControlCode >> 16) & FILE_DEVICE_FILE_SYSTEM) == FILE_DEVICE_FILE_SYSTEM) {
|
||||
//
|
||||
|
||||
if ((dwIoControlCode >> 16) == FILE_DEVICE_FILE_SYSTEM) {
|
||||
|
||||
if (((dwIoControlCode >> 16) & FILE_DEVICE_FILE_SYSTEM) == FILE_DEVICE_FILE_SYSTEM)
|
||||
bFsIoControlCode = TRUE;
|
||||
else
|
||||
DPRINT("DeviceIoControl() - FILE_DEVICE_FILE_SYSTEM == TRUE %x %x\n", dwIoControlCode, dwIoControlCode >> 16);
|
||||
} else {
|
||||
bFsIoControlCode = FALSE;
|
||||
DPRINT("DeviceIoControl() - FILE_DEVICE_FILE_SYSTEM == FALSE %x %x\n", dwIoControlCode, dwIoControlCode >> 16);
|
||||
}
|
||||
|
||||
if(lpOverlapped != NULL)
|
||||
{
|
||||
|
@ -88,16 +107,19 @@ DeviceIoControl(
|
|||
|
||||
if (errCode == STATUS_PENDING)
|
||||
{
|
||||
DPRINT("DeviceIoControl() - STATUS_PENDING\n");
|
||||
if (NtWaitForSingleObject(hDevice,FALSE,NULL) < 0)
|
||||
{
|
||||
*lpBytesReturned = IoStatusBlock->Information;
|
||||
SetLastErrorByStatus (errCode);
|
||||
DPRINT("DeviceIoControl() - STATUS_PENDING wait failed.\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (!NT_SUCCESS(errCode))
|
||||
{
|
||||
SetLastErrorByStatus (errCode);
|
||||
DPRINT("DeviceIoControl() - ERROR: %x\n", errCode);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue