本文整理汇总了C++中IoReleaseRemoveLock函数的典型用法代码示例。如果您正苦于以下问题:C++ IoReleaseRemoveLock函数的具体用法?C++ IoReleaseRemoveLock怎么用?C++ IoReleaseRemoveLock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IoReleaseRemoveLock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DiskDeviceControlWithLock
NTSTATUS
DiskDeviceControlWithLock(__in PDEVICE_OBJECT DeviceObject, __in PIRP Irp) {
PDokanDCB dcb;
NTSTATUS status = STATUS_NOT_IMPLEMENTED;
dcb = DeviceObject->DeviceExtension;
if (GetIdentifierType(dcb) != DCB) {
PrintIdType(dcb);
DDbgPrint(" Device is not dcb so go out here\n");
return STATUS_INVALID_PARAMETER;
}
status = IoAcquireRemoveLock(&dcb->RemoveLock, Irp);
if (!NT_SUCCESS(status)) {
DDbgPrint("IoAcquireRemoveLock failed with %#x", status);
return STATUS_INSUFFICIENT_RESOURCES;
}
if (IsDeletePending(DeviceObject)) {
DDbgPrint("Device is deleted, so go out here \n");
IoReleaseRemoveLock(&dcb->RemoveLock, Irp);
return STATUS_NO_SUCH_DEVICE;
}
status = DiskDeviceControl(DeviceObject, Irp);
IoReleaseRemoveLock(&dcb->RemoveLock, Irp);
return status;
}
示例2: DispatchControl
//========================================================================================
// Function: DispatchControl
// Purpose: This routine is the dispatch handler for the driver. It is responsible
// for processing the IRPs.
// Return Value:
// STATUS_SUCCESS if the IRP was processed successfully, otherwise an error
// indicating the reason for failure.
//========================================================================================
NTSTATUS
DispatchControl(
IN PDEVICE_OBJECT pDO, // pDO - Pointer to device object.
IN PIRP pIrp // pIrp - Pointer to the current IRP.
)
{
PDEVICE_EXTENSION dx;
PIO_STACK_LOCATION pIrpStack;
NTSTATUS Status;
PAGED_CODE();
pIrp->IoStatus.Information = 0;
dx = (PDEVICE_EXTENSION)pDO->DeviceExtension; // Get local info struct
KdPrint(("--> "__FUNCTION__"()\n"));
Status = IoAcquireRemoveLock (&dx->rmLock, NULL);
if (!NT_SUCCESS (Status))
{
pIrp->IoStatus.Information = 0;
pIrp->IoStatus.Status = Status;
IoCompleteRequest (pIrp, IO_NO_INCREMENT);
KdPrint(("<-- "__FUNCTION__"() IoAcquireRemoveLock() Status code: 0x%08x\n", Status));
return Status;
}
if (dx->DevicePnPState != Started)
{
//
// We fail all the IRPs that arrive before the device is started.
//
pIrp->IoStatus.Status = Status = STATUS_DEVICE_NOT_READY;
IoCompleteRequest(pIrp, IO_NO_INCREMENT );
IoReleaseRemoveLock(&dx->rmLock, NULL);
KdPrint(("<-- "__FUNCTION__"() - STATUS_DEVICE_NOT_READY\n"));
return Status;
}
pIrpStack = IoGetCurrentIrpStackLocation(pIrp);
pIrp->IoStatus.Information = DispatchIOCTL(
pIrpStack->Parameters.DeviceIoControl.IoControlCode,
(PUCHAR)pIrp->AssociatedIrp.SystemBuffer,
pIrpStack->Parameters.DeviceIoControl.InputBufferLength,
(PUCHAR)pIrp->AssociatedIrp.SystemBuffer,
pIrpStack->Parameters.DeviceIoControl.OutputBufferLength,
&Status
);
// We're done with I/O request. Record the status of the I/O action.
pIrp->IoStatus.Status = Status;
// Don't boost priority when returning since this took little time.
IoCompleteRequest(pIrp, IO_NO_INCREMENT);
IoReleaseRemoveLock(&dx->rmLock, NULL);
KdPrint(("<-- "__FUNCTION__"() Completion Status code: 0x%08x\n", Status));
return Status;
}
示例3: IoReleaseRemoveLockAndWait
VOID IoReleaseRemoveLockAndWait(PIO_REMOVE_LOCK lock, PVOID tag)
{
// PAGED_CODE();
lock->removing = TRUE;
IoReleaseRemoveLock(lock, tag);
IoReleaseRemoveLock(lock, NULL);
KeWaitForSingleObject(&lock->evRemove, Executive, KernelMode, FALSE, NULL);
}
示例4: YtDispatchFilterPower
NTSTATUS
YtDispatchFilterPower(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
PDEVICE_EXTENSION deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
NTSTATUS status;
if (KeGetCurrentIrql() <= DISPATCH_LEVEL)
{
status = IoAcquireRemoveLock(&deviceExtension->RemoveLock, Irp);
if(!NT_SUCCESS(status))
{
Irp->IoStatus.Status = status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return status;
}
}
PoStartNextPowerIrp(Irp);
IoSkipCurrentIrpStackLocation(Irp);
status = PoCallDriver(deviceExtension->TargetDeviceObject, Irp);
if (KeGetCurrentIrql() <= DISPATCH_LEVEL)
IoReleaseRemoveLock(&deviceExtension->RemoveLock, NULL);
return status;
}
示例5: DkDefault
NTSTATUS DkDefault(PDEVICE_OBJECT pDevObj, PIRP pIrp)
{
NTSTATUS ntStat = STATUS_SUCCESS;
PDEVICE_EXTENSION pDevExt = NULL;
PIO_STACK_LOCATION pStack = NULL;
PDEVICE_OBJECT pNextDevObj = NULL;
pDevExt = (PDEVICE_EXTENSION) pDevObj->DeviceExtension;
ntStat = IoAcquireRemoveLock(&pDevExt->removeLock, (PVOID) pIrp);
if (!NT_SUCCESS(ntStat))
{
DkDbgVal("Error acquire lock!", ntStat);
DkCompleteRequest(pIrp, ntStat, 0);
return ntStat;
}
pStack = IoGetCurrentIrpStackLocation(pIrp);
DkDbgVal("DkDefault", pStack->MajorFunction);
pNextDevObj = pDevExt->pNextDevObj;
IoSkipCurrentIrpStackLocation(pIrp);
ntStat = IoCallDriver(pNextDevObj, pIrp);
IoReleaseRemoveLock(&pDevExt->removeLock, (PVOID) pIrp);
return ntStat;
}
示例6: CompletionRoutineStartDevice
//========================================================================================
// Function: CompletionRoutineStartDevice of DispatchPnp
// Purpose: The completion routine for plug & play irps that needs to be
// processed first by the lower drivers.
// Return Value:
// NT status code
//========================================================================================
NTSTATUS
CompletionRoutineStartDevice(
IN PDEVICE_OBJECT fido, // fido - pointer to a device object.
IN PIRP irp, // irp - pointer to an I/O Request Packet.
IN PVOID Context // Context - pointer to an event object.
)
{
PDEVICE_EXTENSION dx;
UNREFERENCED_PARAMETER(Context);
dx = (PDEVICE_EXTENSION)fido->DeviceExtension;
//Must do this if we don't return STATUS_MORE_PROCESSING_REQUIRED
if (irp->PendingReturned)
IoMarkIrpPending(irp);
if (NT_SUCCESS(irp->IoStatus.Status))
{
//As we are successfully now back, we will
//first set our state to Started.
SET_NEW_PNP_STATE(dx, Started);
//On the way up inherit FILE_REMOVABLE_MEDIA during Start.
//This characteristic is available only after the driver stack is started!.
if (dx->lowerdo->Characteristics & FILE_REMOVABLE_MEDIA)
{
fido->Characteristics |= FILE_REMOVABLE_MEDIA;
}
}
IoReleaseRemoveLock(&dx->rmLock, irp);
return STATUS_SUCCESS;
}
示例7: CompletionRoutineDevUsgNotify
//========================================================================================
// Function: CompletionRoutineStartDevice of DispatchPnp
// Purpose: PNP DEVICE USAGE NOTIFICATION irp completion routine
// Return Value:
// NT status code
//========================================================================================
NTSTATUS
CompletionRoutineDevUsgNotify(
IN PDEVICE_OBJECT fido, // fido - pointer to a device object.
IN PIRP irp, // irp - pointer to an I/O Request Packet.
IN PVOID Context // Context - pointer to an event object.
)
{
PDEVICE_EXTENSION dx;
UNREFERENCED_PARAMETER(Context);
dx = (PDEVICE_EXTENSION)fido->DeviceExtension;
if (irp->PendingReturned)
IoMarkIrpPending(irp);
//On the way up, pagable might become clear. Mimic the driver below us.
if (!(dx->lowerdo->Flags & DO_POWER_PAGABLE))
{
fido->Flags &= ~DO_POWER_PAGABLE;
}
IoReleaseRemoveLock(&dx->rmLock, irp);
return STATUS_SUCCESS;
}
示例8: DispatchPower
//========================================================================================
// Function: DispatchPower
// Purpose: This routine is the dispatch routine for power irps.
// Does nothing except forwarding the IRP to the next device in the stack.
// Return Value:
// NT status code
//========================================================================================
NTSTATUS
DispatchPower(
IN PDEVICE_OBJECT fido, // fido - Pointer to the device object.
IN PIRP irp // Irp - Pointer to the request packet.
)
{
PDEVICE_EXTENSION dx;
NTSTATUS ntStatus;
dx = (PDEVICE_EXTENSION)fido->DeviceExtension;
PoStartNextPowerIrp(irp);
//acquire remove lock
ntStatus=IoAcquireRemoveLock(&dx->rmLock, irp);
if (!NT_SUCCESS(ntStatus))
{
//complete irp if cannot acquire remove lock
irp->IoStatus.Status=ntStatus;
irp->IoStatus.Information=0;
IoCompleteRequest(irp, IO_NO_INCREMENT);
return ntStatus;
}
IoSkipCurrentIrpStackLocation(irp);
ntStatus = PoCallDriver(dx->lowerdo, irp);
IoReleaseRemoveLock(&dx->rmLock, irp);
return ntStatus;
}
示例9: PassIRP
//========================================================================================
// Function: PassIRP
// Purpose: Free all the allocated resources, etc.
// Return Value:
// NT status code
//========================================================================================
NTSTATUS PassIRP(
IN PDEVICE_OBJECT fido,
IN PIRP irp // Irp - pointer to an I/O Request Packet.
)
{
PDEVICE_EXTENSION dx;
NTSTATUS ntStatus;
dx = (PDEVICE_EXTENSION)fido->DeviceExtension;
// acquire remove lock
ntStatus = IoAcquireRemoveLock(&dx->rmLock, irp);
if (!NT_SUCCESS(ntStatus))
{
//complete irp if cannot acquire remove lock
irp->IoStatus.Status=ntStatus;
irp->IoStatus.Information=0;
IoCompleteRequest(irp, IO_NO_INCREMENT);
return ntStatus;
}
IoSkipCurrentIrpStackLocation(irp);
ntStatus = IoCallDriver(dx->lowerdo, irp);
IoReleaseRemoveLock(&dx->rmLock, irp);
return ntStatus;
}
示例10: DispatchForSCSI
NTSTATUS DispatchForSCSI(IN PDEVICE_OBJECT fido, IN PIRP Irp)
{
// KdPrint((DRIVERNAME " - Enter DispatchForSCSI \n"));
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fido->DeviceExtension;
PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
// Pass request down without additional processing
NTSTATUS status;
status = IoAcquireRemoveLock(&pdx->RemoveLock, Irp);
if (!NT_SUCCESS(status))
return CompleteRequest(Irp, status, 0);
IoCopyCurrentIrpStackLocationToNext(Irp);
IoSetCompletionRoutine( Irp,
USBSCSICompletion,
NULL,
TRUE,
TRUE,
TRUE );
status = IoCallDriver(pdx->LowerDeviceObject, Irp);
IoReleaseRemoveLock(&pdx->RemoveLock, Irp);
return status;
}
示例11: V4vDispatchWmi
static NTSTATUS NTAPI
V4vDispatchWmi(PDEVICE_OBJECT fdo, PIRP irp)
{
NTSTATUS status;
PXENV4V_EXTENSION pde = V4vGetDeviceExtension(fdo);
TraceVerbose(("====> '%s'.\n", __FUNCTION__));
// We don't support WMI, so just pass it on down the stack
status = IoAcquireRemoveLock(&pde->removeLock, irp);
if (!NT_SUCCESS(status)) {
TraceError(("failed to acquire IO lock - error: 0x%x\n", status));
return V4vSimpleCompleteIrp(irp, status);
}
IoSkipCurrentIrpStackLocation(irp);
status = IoCallDriver(pde->ldo, irp);
IoReleaseRemoveLock(&pde->removeLock, irp);
TraceVerbose(("<==== '%s'.\n", __FUNCTION__));
return status;
}
示例12: VolumeFilterDispatchIrp
NTSTATUS VolumeFilterDispatchIrp (PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
VolumeFilterExtension *Extension = (VolumeFilterExtension *) DeviceObject->DeviceExtension;
PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation (Irp);
NTSTATUS status;
ASSERT (!Extension->bRootDevice && Extension->IsVolumeFilterDevice);
switch (irpSp->MajorFunction)
{
case IRP_MJ_DEVICE_CONTROL:
return DispatchControl (DeviceObject, Irp, Extension, irpSp);
case IRP_MJ_PNP:
return DispatchPnp (DeviceObject, Irp, Extension, irpSp);
case IRP_MJ_POWER:
return DispatchPower (DeviceObject, Irp, Extension, irpSp);
default:
status = IoAcquireRemoveLock (&Extension->Queue.RemoveLock, Irp);
if (!NT_SUCCESS (status))
return TCCompleteIrp (Irp, status, 0);
status = PassIrp (Extension->LowerDeviceObject, Irp);
IoReleaseRemoveLock (&Extension->Queue.RemoveLock, Irp);
return status;
}
}
示例13: YtFilterShutdownFlush
NTSTATUS
YtFilterShutdownFlush(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
PDEVICE_EXTENSION deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
NTSTATUS status;
if (KeGetCurrentIrql() <= DISPATCH_LEVEL)
{
status = IoAcquireRemoveLock(&deviceExtension->RemoveLock, Irp);
if(!NT_SUCCESS(status))
{
Irp->IoStatus.Status = status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return status;
}
}
/* DebugPrint(("YtFilterShutdownFlush: DeviceObject %X Irp %X\n",
DeviceObject, Irp));*/
//Set current stack back one.
Irp->CurrentLocation++,
Irp->Tail.Overlay.CurrentStackLocation++;
status = IoCallDriver(deviceExtension->TargetDeviceObject, Irp);
if (KeGetCurrentIrql() <= DISPATCH_LEVEL)
IoReleaseRemoveLock(&deviceExtension->RemoveLock, NULL);
return status;
}
示例14: OnCancelWrite
VOID OnCancelWrite(IN PDEVICE_OBJECT fdo, IN PIRP Irp)
{
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
CancelRequest( &pdx->dqWrite, Irp );
IoReleaseRemoveLock( &pdx->RemoveLock, Irp );
}
示例15: SwdmDispatchWrite
NTSTATUS
SwdmDispatchWrite(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
PVOID Buf; //Buffer provided by user program
ULONG BufLen; //Buffer length for user provided buffer
LONGLONG Offset;//Buffer Offset
PVOID DataBuf; //Buffer provided by Driver
ULONG DataLen; //Buffer length for Driver Data Buffer
ULONG ByteTransferred;
PIO_STACK_LOCATION pStk;
PDEVICE_EXTENSION pCtx;
//NTSTATUS status;
DbgPrintEx( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "IRP_MJ_WRITE : Begin\r\n");
//Get I/o Stack Location & Device Extension
pStk = IoGetCurrentIrpStackLocation(Irp);
pCtx = DeviceObject->DeviceExtension;
//Get User Input Buffer & Length
BufLen = pStk->Parameters.Write.Length;
Offset = pStk->Parameters.Read.ByteOffset.QuadPart;
Buf = (PUCHAR)(Irp->AssociatedIrp.SystemBuffer) + Offset;
//Get Driver Data Buffer & Length
DataBuf = pCtx->DataBuffer;
DataLen = 1024;
IoAcquireRemoveLock(&pCtx->RemoveLock, Irp);
DbgPrintEx( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "Input Buffer Length : %d\r\n", BufLen);
DbgPrintEx( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "Driver Data Length : %d\r\n", DataLen);
if (BufLen <= DataLen) {
ByteTransferred = BufLen;
} else {
ByteTransferred = DataLen;
}
ByteTransferred = BufLen;
RtlZeroMemory(
pCtx->DataBuffer,
1024);
RtlCopyMemory(
DataBuf,
Buf,
ByteTransferred);
IoReleaseRemoveLock(&pCtx->RemoveLock, Irp);
CompleteRequest(Irp, STATUS_SUCCESS, ByteTransferred);
DbgPrintEx( DPFLTR_IHVDRIVER_ID, DPFLTR_INFO_LEVEL, "IRP_MJ_WRITE : End\r\n");
return STATUS_SUCCESS;
}