?? usbwireless.cpp
字號:
// USBWireless.cpp
//
// Generated by DriverWizard version DriverStudio 3.1.0 (Build 1722)
// Requires Compuware's DriverWorks classes
//
#define VDW_MAIN
#include <vdw.h>
#include <kusb.h>
#include "USBWireless.h"
#include "USBWirelessDevice.h"
#pragma hdrstop("USBWireless.pch")
// Generated by DriverWizard version DriverStudio 3.1.0 (Build 1722)
// 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('WBSU');
// 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.
KTrace t("USBWireless");
/////////////////////////////////////////////////////////////////////
// Begin INIT section
#pragma code_seg("INIT")
DECLARE_DRIVER_CLASS(USBWireless, NULL)
/////////////////////////////////////////////////////////////////////
// USBWireless::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 USBWireless look for:
// HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBWireless
//
// Return Value:
// NTSTATUS - Return STATUS_SUCCESS if no errors are encountered.
// Any other indicates to the system that an error has occured.
//
// Comments:
//
NTSTATUS USBWireless::DriverEntry(PUNICODE_STRING RegistryPath)
{
t << "現在進入DriverEntry\n";
// The following macro simply allows compilation at Warning Level 4
// If you reference this parameter in the function simply remove the macro.
//手工去掉的UNREFERENCED_PARAMETER(RegistryPath);
m_Unit = 0;
t << "現在跳出DriverEntry\n";
return STATUS_SUCCESS;
}
// End INIT section
/////////////////////////////////////////////////////////////////////
#pragma code_seg()
/////////////////////////////////////////////////////////////////////
// USBWireless::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 USBWireless::AddDevice(PDEVICE_OBJECT Pdo)
{
t << "現在進入AddDevice\n";
// 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.
USBWirelessDevice * pDevice = new (
NULL,
FILE_DEVICE_UNKNOWN,
NULL,
0,
DO_EXCLUSIVE | DO_BUFFERED_IO
)
USBWirelessDevice(Pdo, m_Unit);
if (pDevice == NULL)
{
t << "Error creating device USBWirelessDevice"
<< (ULONG) m_Unit << EOL;
return STATUS_INSUFFICIENT_RESOURCES;
}
NTSTATUS status = pDevice->ConstructorStatus();
if ( !NT_SUCCESS(status) )
{
t << "Error constructing device USBWirelessDevice"
<< (ULONG) m_Unit << " status " << (ULONG) status << EOL;
delete pDevice;
}
else
{
m_Unit++;
}
t << "現在跳出AddDevice\n";
return status;
}
// EOF
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -