www.pudn.com > PCI9054.rar > PCI9054.CPP
// PCI9054.cpp // // Generated by DriverWizard version DriverStudio 2.6.0 (Build 336) // Requires Compuware's DriverWorks classes // #define VDW_MAIN #include#include "PCI9054.h" #include "PCI9054Device.h" #pragma hdrstop("PCI9054.pch") // Generated by DriverWizard version DriverStudio 2.6.0 (Build 336) // 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('9ICP'); ///////////////////////////////////////////////////////////////////// // Begin INIT section #pragma code_seg("INIT") DECLARE_DRIVER_CLASS(PCI9054, NULL) ///////////////////////////////////////////////////////////////////// // PCI9054::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 PCI9054 look for: // HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PCI9054 // // Return Value: // NTSTATUS - Return STATUS_SUCCESS if no errors are encountered. // Any other indicates to the system that an error has occured. // // Comments: // NTSTATUS PCI9054::DriverEntry(PUNICODE_STRING RegistryPath) { // 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; return STATUS_SUCCESS; } // End INIT section ///////////////////////////////////////////////////////////////////// #pragma code_seg() ///////////////////////////////////////////////////////////////////// // PCI9054::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 PCI9054::AddDevice(PDEVICE_OBJECT Pdo) { // 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. PCI9054Device * pDevice = new ( static_cast (KUnitizedName(L"PCI9054Device", m_Unit)), FILE_DEVICE_UNKNOWN, NULL, 0, DO_DIRECT_IO ) PCI9054Device(Pdo, m_Unit); if (pDevice == NULL) { return STATUS_INSUFFICIENT_RESOURCES; } NTSTATUS status = pDevice->ConstructorStatus(); if ( !NT_SUCCESS(status) ) { delete pDevice; } else { m_Unit++; } return status; }