mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Fixed bug in DeviceIoContol().
svn path=/trunk/; revision=351
This commit is contained in:
parent
9e3fe0593a
commit
74b0d03ccc
1 changed files with 13 additions and 8 deletions
|
@ -11,6 +11,10 @@
|
|||
#include <windows.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <kernel32/kernel32.h>
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DeviceIoControl(
|
||||
|
@ -24,7 +28,6 @@ DeviceIoControl(
|
|||
LPOVERLAPPED lpOverlapped
|
||||
)
|
||||
{
|
||||
|
||||
NTSTATUS errCode = 0;
|
||||
HANDLE hEvent = NULL;
|
||||
PIO_STATUS_BLOCK IoStatusBlock;
|
||||
|
@ -41,7 +44,7 @@ DeviceIoControl(
|
|||
bFsIoControlCode = TRUE;
|
||||
else
|
||||
bFsIoControlCode = FALSE;
|
||||
|
||||
CHECKPOINT
|
||||
if(lpOverlapped != NULL) {
|
||||
hEvent = lpOverlapped->hEvent;
|
||||
lpOverlapped->Internal = STATUS_PENDING;
|
||||
|
@ -51,13 +54,13 @@ DeviceIoControl(
|
|||
IoStatusBlock = &IIosb;
|
||||
}
|
||||
|
||||
|
||||
CHECKPOINT
|
||||
if(bFsIoControlCode == TRUE) {
|
||||
errCode = NtFsControlFile(hDevice,hEvent,NULL,NULL,IoStatusBlock,dwIoControlCode,lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize );
|
||||
} else {
|
||||
errCode = NtDeviceIoControlFile(hDevice,hEvent,NULL,NULL,IoStatusBlock,dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize);
|
||||
}
|
||||
|
||||
CHECKPOINT
|
||||
if(errCode == STATUS_PENDING ) {
|
||||
|
||||
if(NtWaitForSingleObject(hDevice,FALSE,NULL) < 0) {
|
||||
|
@ -70,11 +73,13 @@ DeviceIoControl(
|
|||
SetLastError(RtlNtStatusToDosError(errCode));
|
||||
return FALSE;
|
||||
}
|
||||
*lpBytesReturned = lpOverlapped->InternalHigh;
|
||||
CHECKPOINT
|
||||
if (lpOverlapped)
|
||||
*lpBytesReturned = lpOverlapped->InternalHigh;
|
||||
else
|
||||
*lpBytesReturned = IoStatusBlock->Information;
|
||||
CHECKPOINT
|
||||
return TRUE;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue