-/* $Id: deviceio.c,v 1.7 2000/06/03 14:47:32 ea 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
#include <windows.h>
#define NDEBUG
+//#define DBG
#include <kernel32/kernel32.h>
#include <kernel32/error.h>
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)
{
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;
}