?? xunicdriver.cpp
字號:
// XunicDriver.cpp
//
// Generated by DriverWizard 3.2.0 (Build 2485)
// Requires DDK and DriverWorks
// File created on 2/8/2006
//
// This source file contains the implementation of a subclass of KDriver.
// WDM drivers implement a subclass of KDriver and override member
// function DriverEntry and AddDevice.
//
#define VDW_MAIN
#include <vdw.h>
#include "function.h"
#include "XunicDriver.h"
#include "XunicDevice.h"
#pragma hdrstop("Xunic.pch")
// Memory allocation pool tag
// Override this value using the global function SetPoolTag().
POOLTAG DefaultPoolTag('inuX');
// Global driver trace object
// TODO: Use KDebugOnlyTrace if you want trace messages
// to appear only in checked builds. Use KTrace if
// you want trace messages to always appear. Call
// method SetOutputLevel to set the output threshold.
KDebugOnlyTrace T("Xunic");
///////////////////////////////////////////////////////////////////////////////////////////////////
// Begin INIT section
#pragma code_seg("INIT")
DECLARE_DRIVER_CLASS(XunicDriver, NULL)
///////////////////////////////////////////////////////////////////////////////////////////////////
// XunicDriver::DriverEntry
// This routine is called when the driver is loaded. Drivers often
// read the registry for configurable parameters.
//
// Arguments:
// IN RegistryPath
// pointer to a unicode string representing the path to
// driver-specific key in the registry. Look for:
// HKLM\SYSTEM\CurrentControlSet\Services\Xunic
//
// Return Value:
// NTSTATUS code
//
NTSTATUS XunicDriver::DriverEntry(PUNICODE_STRING RegistryPath)
{
T.Trace(TraceInfo, __FUNCTION__"++. Compiled at " __TIME__ " on " __DATE__ "\n");
#ifdef DBG
//DbgBreakPoint();
#endif
NTSTATUS status = STATUS_SUCCESS;
m_Unit = 0;
// This macro suppresses compiler warning for unreferenced variable.
// If you reference this parameter, simply remove the macro.
UNREFERENCED_PARAMETER(RegistryPath);
T.Trace(TraceInfo, __FUNCTION__"--. STATUS %x\n", status);
return status;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma code_seg() // end INIT code
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// XunicDriver::AddDevice
// This routine is called when the system detects a device for which this
// driver is responsible. This function creates the Functional Device
// Object, or FDO. The FDO enables this driver to handle requests for
// the physical device.
//
// Arguments:
// IN Pdo
// Physical Device Object. This is a pointer to a system device
// object that represents the physical device.
//
// Return Value:
// NTSTATUS
//
NTSTATUS XunicDriver::AddDevice(PDEVICE_OBJECT Pdo)
{
T.Trace(TraceInfo, __FUNCTION__"++.\n");
NTSTATUS status = STATUS_SUCCESS;
// Create XunicDevice using a form of "placement" new
// that is a member operator of KDevice. This will use storage
// in the system device object extension to store the class instance.
XunicDevice* pDevice = new (
NULL, // no name
FILE_DEVICE_UNKNOWN,
NULL, // no name
0,
DO_DIRECT_IO
| DO_POWER_PAGABLE
)
XunicDevice(Pdo, m_Unit);
if (pDevice == NULL)
{
status = STATUS_INSUFFICIENT_RESOURCES;
}
else
{
status = pDevice->ConstructorStatus();
if (!NT_SUCCESS(status))
{
delete pDevice;
}
else
{
m_Unit++;
pDevice->ReportNewDevicePowerState(PowerDeviceD0);
}
}
T.Trace(TraceInfo, __FUNCTION__"--. STATUS %x\n", status);
return status;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// XunicDriver::Unload
// This routine is called when the driver is unloaded. Delete any
// device objects created in DriverEntry by calling base class method
// Unload(). Cleanup any allocations made for registry values in
// DriverEntry.
//
// Arguments:
// none
//
// Return Value:
// none
//
VOID XunicDriver::Unload(VOID)
{
T.Trace(TraceInfo, __FUNCTION__"++.\n");
// If you don't need to perform any functions
// except to call the base class KDriver::Unload(),
// then this entire routine may be safely deleted.
// Call base class to delete all devices.
KDriver::Unload();
T.Trace(TraceInfo, __FUNCTION__"--.\n");
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -