📄 readwrite.c
字号:
// Read/Write request processors for evwait driver
// Copyright (C) 1999 by Walter Oney
// All rights reserved
#include "precomp.h"
#include "stddcls.h"
#include "driver.h"
///////////////////////////////////////////////////////////////////////////////
NTSTATUS DispatchCreate(PDEVICE_OBJECT fdo, PIRP Irp)
{ // DispatchCreate
//NTSTATUS status;
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(Irp);
// Claim the remove lock in Win2K so that removal waits until the
// handle closes. Don't do this in Win98, however, because this
// device might be removed by surprise with handles open, whereupon
// we'll deadlock in HandleRemoveDevice waiting for a close that
// can never happen because we can't run the user-mode code that
// would do the close.
// status = IoAcquireRemoveLock(&pdx->RemoveLock, stack->FileObject);
/*
if (NT_SUCCESS(status))
{
InterlockedIncrement(&pdx->handles);
OpenHandle(pdx, stack->FileObject);
}
*/
// InterlockedIncrement(&pdx->handles);
// OpenHandle(pdx, stack->FileObject);
return CompleteRequest(Irp, STATUS_SUCCESS, 0);
} // DispatchCreate
///////////////////////////////////////////////////////////////////////////////
NTSTATUS DispatchClose(PDEVICE_OBJECT fdo, PIRP Irp)
{ // DispatchClose
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation(Irp);
// DeregisterEvent(pdx, stack->FileObject);
// CloseHandle(pdx, stack->FileObject);
// InterlockedDecrement(&pdx->handles);
// Release the remove lock to match the acquisition done in DispatchCreate
//IoReleaseRemoveLock(&pdx->RemoveLock, stack->FileObject);
return CompleteRequest(Irp, STATUS_SUCCESS, 0);
} // DispatchClose
/*
///////////////////////////////////////////////////////////////////////////////
#pragma PAGEDCODE
NTSTATUS StartDevice(PDEVICE_OBJECT fdo, PCM_PARTIAL_RESOURCE_LIST raw, PCM_PARTIAL_RESOURCE_LIST translated)
{ // StartDevice
return STATUS_SUCCESS;
} // StartDevice
///////////////////////////////////////////////////////////////////////////////
*/
//#pragma PAGEDCODE
//VOID StopDevice(IN PDEVICE_OBJECT fdo, BOOLEAN oktouch /* = FALSE */)
// { // StopDevice
// PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
// } // StopDevice
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -