📄 cpgpdiskdriverimpdrvnt.cpp
字号:
/*____________________________________________________________________________
Copyright (C) 2002 PGP Corporation
All rights reserved.
$Id: CPGPdiskDriverImpDrvNT.cpp,v 1.2 2002/08/06 20:09:31 dallen Exp $
____________________________________________________________________________*/
#include "pgpClassesConfig.h"
#include "UDebug.h"
#include "CDevice.h"
#include "CIrp.h"
#include "CDriverSubsystemsDrvNT.h"
#include "CPGPdiskDriverImpDrvNT.h"
#include "DriverMain.h"
#include "UMessageLog.h"
_USING_PGP
// Class CPGPdiskDriverImpDrvNT member functions
void
CPGPdiskDriverImpDrvNT::EnableUnload()
{
mDriverObject->DriverUnload = mUnloadRoutine;
}
void
CPGPdiskDriverImpDrvNT::DisableUnload()
{
mDriverObject->DriverUnload = NULL;
}
CComboError
CPGPdiskDriverImpDrvNT::Startup()
{
CComboError error;
mDriverObject = DriverMain::GetDriverObjectInitParam();
mUnloadRoutine = DriverMain::GetUnloadRoutineInitParam();
mDriverObject->MajorFunction[IRP_MJ_CLOSE] =
mDriverObject->MajorFunction[IRP_MJ_CREATE] =
mDriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] =
mDriverObject->MajorFunction[IRP_MJ_SHUTDOWN] =
mDriverObject->MajorFunction[IRP_MJ_READ] =
mDriverObject->MajorFunction[IRP_MJ_WRITE] =
mDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = MasterIrpDispatch;
EnableUnload();
return error;
}
NTSTATUS
_stdcall
CPGPdiskDriverImpDrvNT::MasterIrpDispatch(
PDEVICE_OBJECT pDeviceObject,
PIRP pIrp)
{
CIrp irp(pIrp);
NTSTATUS status = STATUS_SUCCESS;
PGPBoolean isIrpCompleted = FALSE;
__try
{
CDevice *pDevice;
pgpAssertAddrValid(pDeviceObject, DEVICE_OBJECT);
// The device extension holds the address of the CDevice object.
pDevice = static_cast<CDevice *>(pDeviceObject->DeviceExtension);
pgpAssertAddrValid(pDevice, CDevice);
// Send the IRP on its way.
status = pDevice->DispatchIrp(irp, isIrpCompleted);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
status = STATUS_DEVICE_DATA_ERROR;
UDebug::DebugOut("PGPdisk: Exception occurred while processing IRP.");
UMessageLog::Output("Exception caught");
// We don't exit with uncompleted IRPs.
if (!isIrpCompleted)
{
irp.Information() = 0;
irp.Complete(status);
}
}
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -