亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hellodev.cpp

?? WDM的驅動程序實例,可供自學開發WDM者參考,其是在VC和COMPUWARE下的.
?? CPP
字號:
// Code for device class of most basic driver
//=============================================================================
//
// Compuware Corporation
// NuMega Lab
// 9 Townsend West
// Nashua, NH 03060  USA
//
// Copyright (c) 1998 Compuware Corporation. All Rights Reserved.
// Unpublished - rights reserved under the Copyright laws of the
// United States.
//
//=============================================================================

#include <vdw.h>
#include "HelloWdm.h"	
#include "HelloDev.h"
#include "HelloDI.h"

GUID HelloDevGuid = HELLO_CLASS_GUID;

///////////////////////////////////////////////////////////////////////////////
// Constructor for subclass of KPnpDevice
//
SimpleWdmDevice::SimpleWdmDevice(PDEVICE_OBJECT Pdo, ULONG Unit) :
	KPnpDevice(
		Pdo,
		KUnitizedName(L"HelloWdm", Unit),
		FILE_DEVICE_UNKNOWN, 
		&HelloDevGuid,
		0,
		DO_POWER_PAGABLE
		)
{
    T << "entered SimpleWdmDevice constructor\n";

	// check for succes of base class construction

	if ( ! NT_SUCCESS(m_ConstructorStatus) )
	{
		T	<< TraceError 
			<< "Failed to create device, status=" 
			<< ULONG(m_ConstructorStatus)
			<< "\n";

		return;
	}

	// Attach the PDO as a lower device

	m_Pdo.Initialize(this, Pdo);

	// Establish m_Pdo as the lower device object

	SetLowerDevice(&m_Pdo);

	// Take the standard PnP Policy

	SetPnpPolicy();

	// Take the standard Power Policy

	SetPowerPolicy();

	// Adjust the standard Power Policy.  The standard policy
	// requests the device to power ON only when a new IO
	// request is received.  For this sample device driver,
	// the policy will be adjusted to power up the device
	// when the system is powered ON.
	m_PowerPolicies.m_GeneralPolicy.m_PowerUpOnS0 = TRUE;

}

///////////////////////////////////////////////////////////////////////////////

// 
NTSTATUS SimpleWdmDevice::Create(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

	T << "entered the Create handler\n";

// An application (or other driver) is opening the device. The driver can
// store handle specific data at I.FileObject()->FsContext if required.

// TODO: Add driver specific create handling code here

// Complete the request. By using PnpComplete rather than simply Complete,
// we keep track of outstanding requests. If we get a remove notification,
// we can defer deletion of the device object until all requests complete.

	return I.PnpComplete(this, status, IO_NO_INCREMENT);
}


///////////////////////////////////////////////////////////////////
// Close handler
// 
NTSTATUS SimpleWdmDevice::Close(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

	T << "entered the Close handler\n";

// Complete the request

	return I.PnpComplete(this, status, IO_NO_INCREMENT);
}


///////////////////////////////////////////////////////////////////
// DeviceControl handler
// 
NTSTATUS SimpleWdmDevice::DeviceControl(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

	T << "entered DeviceControl(), code = " << I.IoctlCode() << "\n";

	switch (I.IoctlCode())
	{
#pragma warning(disable:4060)
	// add case stmts here
	}

	I.Information() = 0;

// It is important to complete the IRP with PnpComplete rather than
// Complete, because doing so enables the base class to track outstanding
// IRPs. This is required for safe removal and clean up.

	return I.PnpComplete(this, status);
}

///////////////////////////////////////////////////////////////////
// OnStartDevice
//
// This call instructs the device to initialize itself
//
NTSTATUS SimpleWdmDevice::OnStartDevice(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

	T << "entered OnStartDevice()\n";

	I.Information() = 0;

// The base class handles passing the IRP to the PDO, and will
// not call this routine if the PDO indicates a failure occurred.
// In addition, our PnP policy is set up to automatically enable
// the device interface when the device is started.

// If the device has hardware resources, make the following call

//	PCM_RESOURCE_LIST pResList = I.TranslatedResources();
//
// Then use pResList to initialize the resources. Refer to the PCI/WDM
// example to see how this is done.

// The base class will handle completion

	return status;
}


///////////////////////////////////////////////////////////////////
// OnStopDevice
//
// This call instructs the device to uninitialize itself. The system
// stops a device for the purpose of reconfiguration. It is likely
// that the device will subsequently receive an IRP_MN_START.
//
NTSTATUS SimpleWdmDevice::OnStopDevice(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

	T << "entered OnStopDevice()\n";

// TODO: Add code to disconnect interrupts, destroy memory or I/O
//       ranges, or dismantle anything else initialized in OnStartDevice.


// The base class handles disabling of the device interface and forwarding 
// to the PDO
	
	return status;
}


///////////////////////////////////////////////////////////////////
// OnRemoveDevice
//
// This call notifies the driver that the device has been removed.
// It is not necessarily preceeded by QueryRemove or Stop
//
NTSTATUS SimpleWdmDevice::OnRemoveDevice(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

    T << "entered OnRemoveDevice()\n";

	// TODO: add device specific removal code

    // Our PnP policy will take care of 
    // (1) giving the IRP to the PDO
    // (2) detaching the PDO
    // (3) deleting the device object when it is safe to do so
	
	return status;
}

///////////////////////////////////////////////////////////////////
// OnQueryRemoveDevice
//
// This call notifies the driver that the device has been removed.
//
NTSTATUS SimpleWdmDevice::OnQueryRemoveDevice(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

    T << "entered OnQueryRemoveDevice()\n";

// The default Pnp policy fails the request before even calling this
// handler if the device is open. 


// TODO: prepare to allow removal if ok to do so

// If this handler returns STATUS_SUCCESS, the default Pnp policy causes
// any subsequent I/O requests to be put into the hold queue (deferred
// request queue). 

// The PnP policy can be configured to cancel the current request
// or outstanding requests in the device queue (if any) upon successful return 
// from this handler.

// The default policy causes the IRP to be forwarded to (and completed by)
// the lower device (PDO).
	
	return status;
}

///////////////////////////////////////////////////////////////////
// DetermineNewDevicePowerState
//
// This call is made by the framework to obtain the DEVICE_POWER_STATE
// that this device should transition to in response to POWER IRPs.  When
// a SYSTEM POWER IRP is received to change system power, this call is made 
// by the framework with the system's requested SYSTEM_POWER_STATE.  The 
// default base class implementation in KPnpDevice will use the DEVICE_CAPABILITIES
// structure reported from the bus driver for the hardware.  For most real
// devices, this structure will contain the correct DEVICE_POWER_STATE's.
// However, since this sample device driver does not control hardware, the
// system reports all DEVICE_POWER_STATE's to be PowerDeviceD1.  In order to
// demonstrate the framework's behavior for different power states, this
// virtual function has been overrided so that many power state transitions
// for the device can be supported.
//
// Most device drivers will not need to implement this function.
//
DEVICE_POWER_STATE SimpleWdmDevice::DetermineNewDevicePowerState(SYSTEM_POWER_STATE SystemPowerState)
{
	DEVICE_POWER_STATE DevicePowerState;

// The system is transitioning power to SystemPowerState.  We return
// the matching device power state for the system power state.  The
// base class KPnpDevice::Power member will handle requesting device 
// POWER IRP's (if required) to change device power based on these states.
	switch(SystemPowerState)
	{
	case PowerSystemWorking:
	// This is the fully ON power state.  If the device is not already in the
	// fully ON state, the base class will handle requesting a DEVICE
	// POWER IRP to put the device in the fully ON state.
		DevicePowerState = PowerDeviceD0;
		break;

	case PowerSystemSleeping1:
		DevicePowerState = PowerDeviceD1;
		break;

	case PowerSystemSleeping2:
		DevicePowerState = PowerDeviceD2;
		break;

	case PowerSystemSleeping3:
		DevicePowerState = PowerDeviceD2;
		break;

	case PowerSystemHibernate:
		DevicePowerState = PowerDeviceD3;
		break;

	case PowerSystemShutdown:
		DevicePowerState = PowerDeviceD3;
		break;

	default:
		break;
	}

	return DevicePowerState;
}

///////////////////////////////////////////////////////////////////
// DefaultPnp
// 
NTSTATUS SimpleWdmDevice::DefaultPnp(KIrp I)
{
    T << "entered DefaultPnp() \n";

	I.ForceReuseOfCurrentStackLocationInCalldown();
	return m_Pdo.PnpCall(this, I);
}

///////////////////////////////////////////////////////////////////
// DefaultPower
// 
NTSTATUS SimpleWdmDevice::DefaultPower(KIrp I)
{
    T << "entered DefaultPower() \n";

	I.IndicatePowerIrpProcessed();
	I.CopyParametersDown();
	return m_Pdo.PnpPowerCall(this, I);
}

////////////////////////////////////////////////////////////////////////////////
// SystemControl
//
// This routine just passes the IRP through to the next device since this driver
// is not a WMI provider.
//
NTSTATUS SimpleWdmDevice::SystemControl(KIrp I) 
{
    T << "entered SystemControl() \n";

	I.ForceReuseOfCurrentStackLocationInCalldown();
	return m_Pdo.PnpCall(this, I);
}


///////////////////////////////////////////////////////////////////
// OnDeviceSleep
// 
NTSTATUS SimpleWdmDevice::OnDeviceSleep(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

    T << "entered OnDeviceSleep() \n";

	//The framework will call this function when the device transitions
	//from a higher power state to a lower power state, i.e. in response
	//to an IRP_MJ_POWER with minor function IRP_MN_SET_POWER.  This function
	//is called before forwarding this IRP to the next device in the
	//device stack.  For transitions out of the fully powered state PowerDeviceD0,
	//this means that power is still applied to the device and the 
	//hardware can be accessed.

	//a real driver would save context to the hardware so that it can be
	//restored when the device is powered up

	return status;
}

///////////////////////////////////////////////////////////////////
// OnDevicePowerUp
// 
NTSTATUS SimpleWdmDevice::OnDevicePowerUp(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

    T << "entered OnDevicePowerUp() \n";

	//The framework will call this function when the device transitions
	//from a lower power state to a higher power state, i.e. in response
	//to an IRP_MJ_POWER with minor function IRP_MN_SET_POWER.  This function
	//is called when this IRP is completed which means that power has been
	//applied to the device and the hardware can be accessed.

	//a real driver would restore context to the hardware previously saved
	//when the device powered down

	return status;
}


////////////////////////////////////////////////////////////////////////
// SimpleWdmDevice::OnQueryPower 
//
// handler for IRP_MN_QUERY_POWER 
//
// Input
//		I			Current IRP
//
// Output
//		NTSTATUS	
//
// Notes
//		This function is implemented to display trace messages indicating
//		when this type of IRP is received.  Since the base class Power handler
//		takes care of forwarding the IRP to the lower device and requesting
//		any device power state changes, most drivers do not need to implement
//		this method.
//
NTSTATUS SimpleWdmDevice::OnQueryPower(KIrp I) 
{
	NTSTATUS status = STATUS_SUCCESS;

	T	<< "entered OnQueryPower()\n" ;

	switch ( I.PowerStateType() ) 
	{
 	case SystemPowerState:
		T << "    " << "SystemPowerState " << (UCHAR)I.PowerStateSetting().SystemState << "\n" ;
		break;

 	case DevicePowerState:
		T << "    " << "DevicePowerState " << (UCHAR)I.PowerStateSetting().DeviceState << "\n" ;
		break;
	}

	return status;
}

////////////////////////////////////////////////////////////////////////
// SimpleWdmDevice::OnSetPower 
//
// handler for IRP_MN_SET_POWER 
//
// Input
//		I			Current IRP
//
// Output
//		NTSTATUS	
//
// Notes
//		This function is implemented to display trace messages indicating
//		when this type of IRP is received.  Since the base class Power handler
//		takes care of forwarding the IRP to the lower device and requesting
//		any device power state changes, most drivers do not need to implement
//		this method.
//
NTSTATUS SimpleWdmDevice::OnSetPower(KIrp I) 
{
	NTSTATUS status = STATUS_SUCCESS;

	T	<< "entered OnSetPower()\n" ;

	switch ( I.PowerStateType() ) 
	{
 	case SystemPowerState:
		T << "    " << "SystemPowerState " << (UCHAR)I.PowerStateSetting().SystemState << "\n" ;
		break;

 	case DevicePowerState:
		T << "    " << "DevicePowerState " << (UCHAR)I.PowerStateSetting().DeviceState << "\n" ;
		break;
	}

	return status;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区不卡在线播放 | 在线观看亚洲成人| 国产亚洲精品aa| 国产一区二区视频在线播放| 日韩欧美成人激情| 性久久久久久久| 欧美另类变人与禽xxxxx| 日韩福利电影在线| 精品成人a区在线观看| 国模娜娜一区二区三区| 久久精品一级爱片| 成人精品亚洲人成在线| 国产精品电影一区二区三区| 91热门视频在线观看| 亚洲制服欧美中文字幕中文字幕| 欧美午夜一区二区| 免费久久精品视频| 国产午夜精品久久久久久免费视| 成人国产亚洲欧美成人综合网| 亚洲丝袜制服诱惑| 欧美剧在线免费观看网站| 免费不卡在线观看| 国产精品久久毛片a| 欧美午夜精品一区二区蜜桃| 蜜臀av性久久久久蜜臀aⅴ | 国产精一品亚洲二区在线视频| 久久久久久久久99精品| 精品国偷自产国产一区| 国产一区二区三区| 亚洲视频你懂的| 欧美日韩高清一区| 国产精品一区在线| 亚洲影院免费观看| 欧美不卡视频一区| 91在线播放网址| 美女网站色91| 18欧美亚洲精品| 日韩欧美的一区二区| 99久久精品国产网站| 视频一区视频二区中文| 日本一区二区三区电影| 欧美乱妇15p| 91小视频免费观看| 久久不见久久见免费视频7| 亚洲欧美日本韩国| 久久婷婷综合激情| 9191成人精品久久| 91丨porny丨首页| 免费在线一区观看| 亚洲黄色免费网站| 国产亚洲一区二区三区在线观看| 色综合久久综合网| 成人精品小蝌蚪| 狠狠色狠狠色合久久伊人| 亚洲国产综合视频在线观看| 久久丝袜美腿综合| 欧美色综合久久| 国产精品一区二区在线播放 | 麻豆精品国产91久久久久久| 亚洲免费观看在线视频| 国产亚洲自拍一区| 精品国产免费人成在线观看| 91精品免费观看| 欧美精品一卡两卡| 欧美亚洲自拍偷拍| 一本一本久久a久久精品综合麻豆| 国产电影一区二区三区| 久久99国产精品久久99| 日韩精品亚洲专区| 日本视频一区二区| 午夜精品视频在线观看| 亚洲午夜免费福利视频| 亚洲蜜桃精久久久久久久| 国产精品国产三级国产a| 国产精品欧美一区喷水| 国产视频一区不卡| 中文字幕乱码日本亚洲一区二区| 久久久久久免费网| 久久九九久久九九| 国产网站一区二区三区| 欧美国产精品一区二区三区| 国产婷婷一区二区| 国产日韩精品视频一区| 国产色一区二区| 中文字幕在线不卡视频| 自拍视频在线观看一区二区| 亚洲男人天堂av| 亚洲v日本v欧美v久久精品| 石原莉奈一区二区三区在线观看| 午夜欧美视频在线观看| 免费日本视频一区| 国产毛片精品一区| 成人av网站大全| 在线观看日韩av先锋影音电影院| 欧美三级视频在线观看| 日韩视频在线一区二区| 欧美电影免费提供在线观看| 亚洲精品一区二区三区影院 | 欧美在线视频日韩| 欧美一区欧美二区| 26uuu精品一区二区在线观看| 久久久久97国产精华液好用吗| 国产精品美女久久久久av爽李琼| 一区二区成人在线| 日本v片在线高清不卡在线观看| 激情另类小说区图片区视频区| 欧美专区日韩专区| 欧美成人精品1314www| 国产精品久久久久久久岛一牛影视 | 国产精品一区二区久久不卡 | 久久久蜜桃精品| 中文字幕视频一区| 丝袜美腿亚洲色图| 国产精品一级片在线观看| www.色综合.com| 欧美精品乱码久久久久久按摩| 2023国产一二三区日本精品2022| 国产精品久久久久久久久图文区 | 欧美日韩亚洲国产综合| 26uuu国产一区二区三区| 亚洲人成网站精品片在线观看| 日日夜夜免费精品视频| 成人美女视频在线观看| 欧美人狂配大交3d怪物一区| 久久精品水蜜桃av综合天堂| 亚洲一区中文日韩| 国产精品白丝jk黑袜喷水| 欧美亚洲国产一卡| 国产午夜亚洲精品理论片色戒| 午夜精品一区二区三区免费视频| 国产+成+人+亚洲欧洲自线| 8x福利精品第一导航| 国产精品色噜噜| 免费精品99久久国产综合精品| 91免费观看视频在线| 久久久欧美精品sm网站| 日韩综合小视频| 99国产精品国产精品久久| 欧美精品一区二区三区一线天视频 | 成人激情综合网站| 欧美一级电影网站| 一区二区免费看| 丁香激情综合国产| 2021中文字幕一区亚洲| 婷婷一区二区三区| 在线一区二区观看| 国产精品欧美一区二区三区| 精品亚洲国产成人av制服丝袜| 欧美色倩网站大全免费| 成人免费在线视频观看| 高清成人免费视频| www久久精品| 免费欧美日韩国产三级电影| 欧美中文字幕一区| 一区二区三区在线不卡| 成人午夜在线免费| 欧美激情在线观看视频免费| 久久 天天综合| 日韩欧美的一区二区| 五月婷婷综合网| 欧美日韩一级黄| 亚洲午夜久久久久| 欧美日韩精品一区二区三区蜜桃| 一区二区三区免费网站| 91亚洲男人天堂| 亚洲欧美日韩一区| 色综合久久88色综合天天免费| 中文字幕在线不卡国产视频| 成人av在线电影| 亚洲视频一区二区在线| 99国产精品久久久久久久久久 | 丁香婷婷综合激情五月色| 国产亚洲精品bt天堂精选| 国产一区二区毛片| 国产婷婷色一区二区三区四区| 国产乱码精品1区2区3区| 久久婷婷成人综合色| 成人美女视频在线观看18| 中文久久乱码一区二区| zzijzzij亚洲日本少妇熟睡| 中文字幕制服丝袜成人av| 91亚洲精品乱码久久久久久蜜桃| 亚洲精品高清在线| 欧美视频你懂的| 五月天丁香久久| 欧美电视剧免费观看| 国产精品一二二区| 亚洲欧洲国产日韩| 欧美日韩在线播放一区| 偷偷要91色婷婷| 久久美女高清视频| 成人av中文字幕| 亚洲第一会所有码转帖| 日韩午夜电影在线观看| 国产成人免费av在线| 亚洲精品美国一| 精品久久久影院| 91色.com| 美女一区二区三区在线观看| 亚洲国产电影在线观看|