📄 vbus.cpp
字号:
// Vbus.cpp
//
// Generated by DriverWizard version DriverStudio 2.7.0 (Build 554)
// Requires Compuware's DriverWorks classes
//
#define VDW_MAIN
#include <vdw.h>
#include "vbus.h"
#include "vbusdev.h"
#pragma hdrstop("vbus.pch")
// Generated by DriverWizard version DriverStudio 2.7.0 (Build 554)
// Set a default 32-bit tag value to be stored with each heap block
// allocated by operator new. Use BoundsChecker to view the memory pool.
// This value can be overridden using the global function SetPoolTag().
POOLTAG DefaultPoolTag('subV');
// Create the global driver trace object
// TODO: Use KDebugOnlyTrace if you want trace messages
// to appear only in debug builds. Use KTrace if
// you want trace messages to always appear.
KDebugOnlyTrace t("VBus");
/////////////////////////////////////////////////////////////////////
// Begin INIT section
#pragma code_seg("INIT")
DECLARE_DRIVER_CLASS(VBusDriver, NULL)
/////////////////////////////////////////////////////////////////////
// VBusDriver::DriverEntry
//
// Routine Description:
// This is the first entry point called by the system when the
// driver is loaded.
//
// Parameters:
// RegistryPath - String used to find driver parameters in the
// registry. To locate VBusDriver look for:
// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VBus
//
// Return Value:
// NTSTATUS - Return STATUS_SUCCESS if no errors are encountered.
// Any other indicates to the system that an error has occured.
//
// Comments:
//
NTSTATUS VBusDriver::DriverEntry(PUNICODE_STRING RegistryPath)
{
t << "In DriverEntry Compiled at " __TIME__ " on " __DATE__ "\n";
m_Unit = 0;
EnableDispatchFilter(true);
return STATUS_SUCCESS;
UNREFERENCED_PARAMETER(RegistryPath);
}
// End INIT section
/////////////////////////////////////////////////////////////////////
#pragma code_seg()
/////////////////////////////////////////////////////////////////////
// VBusDriver::AddDevice
//
// Routine Description:
// Called when the system detects a device for which this
// driver is responsible.
//
// Parameters:
// Pdo - Physical Device Object. This is a pointer to a system device
// object that represents the physical device.
//
// Return Value:
// NTSTATUS - Success or failure code.
//
// Comments:
// This function creates the Functional Device Object, or FDO. The FDO
// enables this driver to handle requests for the physical device.
//
NTSTATUS VBusDriver::AddDevice(PDEVICE_OBJECT Pdo)
{
t << "AddDevice called\n";
NTSTATUS status = STATUS_INSUFFICIENT_RESOURCES;
// Create the device object. Note that we used a form of "placement" new,
// that is a member operator of KDevice. This form will use storage
// allocated by the system in the device object's device to store our
// class instance.
VBusDevice* pDevice = new (
NULL,
FILE_DEVICE_BUS_EXTENDER,
NULL,
FILE_DEVICE_SECURE_OPEN,
DO_BUFFERED_IO | DO_POWER_PAGABLE
)
VBusDevice(Pdo);
if ( pDevice )
{
status = pDevice->ConstructorStatus();
if ( NT_SUCCESS(status) )
{
m_Unit++;
pDevice->ReportNewDevicePowerState(PowerDeviceD0);
}
else
{
t << "Error constructing device VBusDevice" << m_Unit << " status " << status << EOL;
delete pDevice;
}
}
else
{
t << "Error creating device VBusDevice" << m_Unit << EOL;
}
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -