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

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

?? usbsoftlockdevice.cpp

?? XILINX USB程序
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
 // USBSoftLockDevice.cpp
// Implementation of USBSoftLockDevice device class
//
// Generated by DriverWizard version DriverStudio 2.7.0 (Build 562)
// Requires Compuware's DriverWorks classes
//

#pragma warning(disable:4065) // Allow switch statement with no cases
		  
#include <vdw.h>
#include <kusb.h>

#include "USBSoftLock.h"
#include "USBSoftLockDevice.h"
#include "..\USBSoftLockioctl.h"

#pragma hdrstop("USBSoftLock.pch")

extern KTrace t;			// Global driver trace object	

////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::USBSoftLockDevice
//
//	Routine Description:
//		This is the constructor for the Functional Device Object, or FDO.
//		It is derived from KPnpDevice, which builds in automatic
//	    dispatching of subfunctions of IRP_MJ_POWER and IRP_MJ_PNP to
//		virtual member functions.
//
//	Parameters:
//		Pdo - Physical Device Object - this is a pointer to a system
//			device object that represents the physical device.
//
//		Unit - Unit number. This is a number to append to the device's
//			base device name to form the Logical Device Object's name
//
//	Return Value:
//		None   
//
//	Comments:
//		The object being constructed contains a data member (m_Lower) of type
//		KPnpLowerDevice. By initializing it, the driver binds the FDO to the
//		PDO and creates an interface to the upper edge of the system class driver.
//

USBSoftLockDevice::USBSoftLockDevice(PDEVICE_OBJECT Pdo, ULONG Unit) :
	KPnpDevice(Pdo, NULL)
{
	t << "Entering USBSoftLockDevice::USBSoftLockDevice (constructor)\n";


	// Check constructor status
    if ( ! NT_SUCCESS(m_ConstructorStatus) )
	{
	    return;
	}

	// Remember our unit number
	m_Unit = Unit;

	// Initialize the lower device
	m_Lower.Initialize(this, Pdo);

	// Initialize the interface object.  The wizard generates code 
	// to support a single interface.  You may create and add additional 
	// interfaces.  By default, the wizard uses InterfaceNumber 0 (the 
	// first interface descriptor), ConfigurationValue 1 (the first
	// configuration descriptor), and initial interface alternate
	// setting of 0.  If your device has multiple interfaces or alternate
	// settings for an interface, you can add additional KUsbInterface
	// objects or adjust the parameters passed to this function.
	m_Interface.Initialize(
					m_Lower, //KUsbLowerDevice
					0,		 //InterfaceNumber
					1,		 //ConfigurationValue 
					0		 //Initial Interface Alternate Setting
					); 

	// Initialize each Pipe object
	m_Endpoint1IN.Initialize(m_Lower, 0x81, 4); 
	m_Endpoint1OUT.Initialize(m_Lower, 0x1, 4); 
	m_Endpoint2IN.Initialize(m_Lower, 0x82, 164); 
	m_Endpoint2OUT.Initialize(m_Lower, 0x2, 64); 

    // Inform the base class of the lower edge device object
	SetLowerDevice(&m_Lower);

	// Initialize the PnP Policy settings to the "standard" policy
	SetPnpPolicy();

// TODO:	Customize the PnP Policy for this device by setting
//			flags in m_Policies.

	// Initialize the Power Policy settings to the "standard" policy
	SetPowerPolicy();

// TODO:	Customize the Power Policy for this device by setting
//			flags in m_PowerPolicies.

}


////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::~USBSoftLockDevice
//
//	Routine Description:
//		This is the destructor for the Functional Device Object, or FDO.
//
//	Parameters:
//		None
//
//	Return Value:
//		None
//
//	Comments:
//		None
//

USBSoftLockDevice::~USBSoftLockDevice()
{
	t << "Entering USBSoftLockDevice::~USBSoftLockDevice() (destructor)\n";
}

////////////////////////////////////////////////////////////////////////
//  PNPMinorFunctionName
//
//	Routine Description:
//		Return a string describing the Plug and Play minor function	
//
//	Parameters:
//		mn - Minor function code
//
//	Return Value:
//		char * - Ascii name of minor function
//
//	Comments:
//		This function is used for tracing the IRPs.  Remove the function,
//		or conditionalize it for debug-only builds, if you want to save
//		space in the driver image.
//
	
char *PNPMinorFunctionName(ULONG mn)
{
	static char* minors[] = {
		"IRP_MN_START_DEVICE",
		"IRP_MN_QUERY_REMOVE_DEVICE",
		"IRP_MN_REMOVE_DEVICE",
		"IRP_MN_CANCEL_REMOVE_DEVICE",
		"IRP_MN_STOP_DEVICE",
		"IRP_MN_QUERY_STOP_DEVICE",
		"IRP_MN_CANCEL_STOP_DEVICE",
		"IRP_MN_QUERY_DEVICE_RELATIONS",
		"IRP_MN_QUERY_INTERFACE",
		"IRP_MN_QUERY_CAPABILITIES",
		"IRP_MN_QUERY_RESOURCES",
		"IRP_MN_QUERY_RESOURCE_REQUIREMENTS",
		"IRP_MN_QUERY_DEVICE_TEXT",
		"IRP_MN_FILTER_RESOURCE_REQUIREMENTS",
		"<unknown minor function>",
		"IRP_MN_READ_CONFIG",
		"IRP_MN_WRITE_CONFIG",
		"IRP_MN_EJECT",
		"IRP_MN_SET_LOCK",
		"IRP_MN_QUERY_ID",
		"IRP_MN_QUERY_PNP_DEVICE_STATE",
		"IRP_MN_QUERY_BUS_INFORMATION",
		"IRP_MN_DEVICE_USAGE_NOTIFICATION",
		"IRP_MN_SURPRISE_REMOVAL",
		"IRP_MN_QUERY_LEGACY_BUS_INFORMATION"
	};

	if (mn > 0x18) // IRP_MN_QUERY_LEGACY_BUS_INFORMATION
		return "<unknown minor function>";
	else
		return minors[mn];
}

////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::DefaultPnp
//
//	Routine Description:
//		Default handler for IRP_MJ_PNP
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result returned from lower device
//
//	Comments:
//		This routine just passes the IRP through to the lower device. It is 
//		the default handler for IRP_MJ_PNP. IRPs that correspond to
//		any virtual members of KpnpDevice that handle minor functions of
//		IRP_MJ_PNP and that are not overridden get passed to this routine.
//

NTSTATUS USBSoftLockDevice::DefaultPnp(KIrp I) 
{
	t << "Entering USBSoftLockDevice::DefaultPnp with IRP minor function="
	  << PNPMinorFunctionName(I.MinorFunction()) << EOL;

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


////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::DefaultPower
//
//	Routine Description:
//		Default handler for IRP_MJ_POWER 
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result returned from lower device
//
//	Comments:
//		This routine just passes the IRP through to the lower device. It is 
//		the default handler for IRP_MJ_POWER.
//

NTSTATUS USBSoftLockDevice::DefaultPower(KIrp I) 
{
	t << "Entering USBSoftLockDevice::DefaultPower\n";

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

////////////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::SystemControl
//
//	Routine Description:
//		Default handler for IRP_MJ_SYSTEM_CONTROL
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result returned from lower device
//
//	Comments:
//		This routine just passes the IRP through to the next device since this driver
//		is not a WMI provider.
//

NTSTATUS USBSoftLockDevice::SystemControl(KIrp I) 
{
	t << "Entering USBSoftLockDevice::SystemControl\n";

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

////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::OnStartDevice
//
//	Routine Description:
//		Handler for IRP_MJ_PNP subfcn IRP_MN_START_DEVICE
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result code
//
//	Comments:
//		Typically, the driver sends a SET CONFIGURATION request for the
//		USB device by using KUsbLowerDevice::ActivateConfiguration with
//		the ConfigurationValue to activate.  The wizard generates code to 
//		support a single configuration.  You may create and add additional 
//		configurations. 
//

NTSTATUS USBSoftLockDevice::OnStartDevice(KIrp I)
{
	t << "Entering USBSoftLockDevice::OnStartDevice\n";

	NTSTATUS status = STATUS_UNSUCCESSFUL;

	AC_STATUS acStatus = AC_SUCCESS;

	I.Information() = 0;

	// The default Pnp policy has already cleared the IRP with the lower device

	//By default, the wizard passes a ConfigurationValue of 1 to 
	//ActivateConfiguration().  This corresponds to the first configuration 
	//that the device reports in its configuration descriptor.  If the device 
	//supports multiple configurations, pass the appropriate
	//ConfigurationValue of the configuration to activate here.
	acStatus = m_Lower.ActivateConfiguration(
		1,	// ConfigurationValue 1 (the first configuration)
		);

	switch (acStatus)
	{
		case AC_SUCCESS:
			t << "USB Configuration OK\n";
			status = STATUS_SUCCESS;
			break;

		case AC_COULD_NOT_LOCATE_INTERFACE:
			t << "Could not locate interface\n";
			break;

		case AC_COULD_NOT_PRECONFIGURE_INTERFACE:
			t << "Could not get configuration descriptor\n";
			break;

		case AC_CONFIGURATION_REQUEST_FAILED:
			t << "Board did not accept configuration URB\n";
			break;

		case AC_FAILED_TO_INITIALIZE_INTERFACE_OBJECT:
			t << "Failed to initialize interface object\n";
			break;

		case AC_FAILED_TO_GET_DESCRIPTOR:
			t << "Failed to get device descriptor\n";
			break;

		case AC_FAILED_TO_OPEN_PIPE_OBJECT:
			//NOTE: this may not be an error.  It could mean that
			//the device has an endpoint for which a KUsbPipe object has
			//not been instanced.  If the intention is to not use this endpoint,
			//then it's likely not a problem.  
			status = STATUS_SUCCESS;
			t << "Failed to open pipe object\n";
			break;

		default:
			t << "Unexpected error activating USB configuration\n";
			break;
	}

   return status;  // base class completes the IRP
}


////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::OnStopDevice
//
//	Routine Description:
//		Handler for IRP_MJ_PNP subfcn IRP_MN_STOP_DEVICE
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result code
//
//	Comments:
//		The system calls this when the device is stopped.
//		The driver should release any hardware resources
//		in this routine.
//
//		The base class passes the irp to the lower device.
//

NTSTATUS USBSoftLockDevice::OnStopDevice(KIrp I)
{
	NTSTATUS status = STATUS_SUCCESS;

	t << "Entering USBSoftLockDevice::OnStopDevice\n";

	m_Lower.DeActivateConfiguration();


// TODO:	Add device-specific code to stop your device   

	return status;
	
	// The following macro simply allows compilation at Warning Level 4
	// If you reference this parameter in the function simply remove the macro.
	UNREFERENCED_PARAMETER(I);
}

////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::OnRemoveDevice
//
//	Routine Description:
//		Handler for IRP_MJ_PNP subfcn IRP_MN_REMOVE_DEVICE
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result code
//
//	Comments:
//		The system calls this when the device is removed.
//		Our PnP policy will take care of 
//			(1) giving the IRP to the lower device
//			(2) detaching the PDO
//			(3) deleting the device object
//

NTSTATUS USBSoftLockDevice::OnRemoveDevice(KIrp I)
{
	t << "Entering USBSoftLockDevice::OnRemoveDevice\n";

	// Device removed, release the system resources used by the USB lower device.
	m_Lower.ReleaseResources();




// TODO:	Add device-specific code to remove your device   

	return STATUS_SUCCESS;

	// The following macro simply allows compilation at Warning Level 4
	// If you reference this parameter in the function simply remove the macro.
	UNREFERENCED_PARAMETER(I);
}

////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::OnDevicePowerUp
//
//	Routine Description:
//		Handler for IRP_MJ_POWER with minor function IRP_MN_SET_POWER
//		for a request to go to power on state from low power state
//
//	Parameters:
//		I - IRP containing POWER request
//
//	Return Value:
//		NTSTATUS - Status code indicating success or failure
//
//	Comments:
//		This routine implements the OnDevicePowerUp function.
//		This function was called by the framework from the completion
//		routine of the IRP_MJ_POWER dispatch handler in KPnpDevice.
//		The bus driver has completed the IRP and this driver can now
//		access the hardware device.  
//		This routine runs at dispatch level.
//	

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

	t << "Entering USBSoftLockDevice::OnDevicePowerUp\n";

// TODO:	Service the device.
//			Restore any context to the hardware device that
//			was saved during the handling of a power down request.
//			See the OnDeviceSleep function.
//			Do NOT complete this IRP.
//
	return status;

	// The following macro simply allows compilation at Warning Level 4
	// If you reference this parameter in the function simply remove the macro.
	UNREFERENCED_PARAMETER(I);
}

////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::OnDeviceSleep
//
//	Routine Description:
//		Handler for IRP_MJ_POWER with minor function IRP_MN_SET_POWER
//		for a request to go to a low power state from a high power state
//
//	Parameters:
//		I - IRP containing POWER request
//
//	Return Value:
//		NTSTATUS - Status code indicating success or failure
//
//	Comments:
//		This routine implements the OnDeviceSleep function.
//		This function was called by the framework from the IRP_MJ_POWER 
//		dispatch handler in KPnpDevice prior to forwarding to the PDO.
//		The hardware has yet to be powered down and this driver can now
//		access the hardware device.  
//		This routine runs at passive level.
//	

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

	t << "Entering USBSoftLockDevice::OnDeviceSleep\n";

// TODO:	Service the device.
//			Save any context to the hardware device that will be required 
//			during a power up request. See the OnDevicePowerUp function.
//			Do NOT complete this IRP.  The base class handles forwarding
//			this IRP to the PDO.
//
	return status;

	// The following macro simply allows compilation at Warning Level 4
	// If you reference this parameter in the function simply remove the macro.
	UNREFERENCED_PARAMETER(I);
}

////////////////////////////////////////////////////////////////////////
//  USBSoftLockDevice::Create
//
//	Routine Description:
//		Handler for IRP_MJ_CREATE
//
//	Parameters:
//		I - Current IRP
//
//	Return Value:
//		NTSTATUS - Result code
//
//	Comments:
//

NTSTATUS USBSoftLockDevice::Create(KIrp I)
{
	NTSTATUS status;

	t << "Entering USBSoftLockDevice::Create, " << I << EOL;

// TODO: Add driver specific create handling code here

	// Generally a create IRP is targeted at our FDO, so we don't need
	// to pass it down to the PDO.  We have found for some devices, the
	// PDO is not expecting this Irp and returns an error code.
	// The default wizard code, therefore completes the Irp here using
	// PnpComplete().  The following commented code could be used instead
	// of PnpComplete() to pass the Irp to the PDO, which would complete it.
	//
//	I.ForceReuseOfCurrentStackLocationInCalldown();
//	status = m_Lower.PnpCall(this, I);

	status = I.PnpComplete(this, STATUS_SUCCESS, IO_NO_INCREMENT);

	t << "USBSoftLockDevice::Create Status " << (ULONG)status << EOL;

	return status;
}


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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区三区精品视频| 国产成人精品免费在线| 欧美午夜在线一二页| 亚洲另类一区二区| 91电影在线观看| 日日欢夜夜爽一区| 91精品国产欧美一区二区18| 九九**精品视频免费播放| 国产午夜精品一区二区三区嫩草| 国产真实乱子伦精品视频| 日本一区免费视频| 色88888久久久久久影院野外| 亚洲自拍另类综合| 欧美大片在线观看一区| 成人性生交大片免费看在线播放| 日韩理论在线观看| 欧美精品自拍偷拍| 国产一区二区三区久久久| 成人欧美一区二区三区小说| 欧美午夜电影网| 精品一区二区三区免费播放| 国产精品久久久99| 欧美日本在线看| 国产精品一区在线| 一区二区不卡在线视频 午夜欧美不卡在| 欧美日韩免费电影| 国产成人高清在线| 亚洲第一成年网| 国产日产欧美一区| 欧美日本一道本| av中文字幕不卡| 日产国产欧美视频一区精品| 国产精品久久午夜| 日韩欧美国产综合| 欧洲视频一区二区| 懂色av噜噜一区二区三区av| 亚洲一线二线三线久久久| 精品国产一区二区精华| 欧美性色黄大片| 国产成人亚洲综合a∨婷婷图片| 亚洲国产cao| 国产精品久久久久久久午夜片| 欧美一区国产二区| 色噜噜狠狠成人网p站| 国产成人综合在线观看| 图片区小说区区亚洲影院| 亚洲欧洲美洲综合色网| 精品不卡在线视频| 717成人午夜免费福利电影| 99久久综合国产精品| 狠狠色丁香婷综合久久| 日日夜夜精品视频免费| 亚洲一区二区综合| 日韩美女视频一区| 欧美国产欧美亚州国产日韩mv天天看完整| 911精品产国品一二三产区 | 日韩高清在线观看| 亚洲欧美综合色| 国产喂奶挤奶一区二区三区| 宅男噜噜噜66一区二区66| 日本高清不卡视频| 91蜜桃在线免费视频| 成人激情免费电影网址| 国产高清精品久久久久| 韩日av一区二区| 精品一区二区三区久久| 久久99热狠狠色一区二区| 奇米精品一区二区三区在线观看一| 亚洲一级二级在线| 亚洲午夜国产一区99re久久| 一区二区三区不卡视频| 亚洲黄色免费网站| 亚洲最大色网站| 亚洲图片欧美色图| 亚洲成av人片在线观看| 亚洲国产成人av好男人在线观看| 亚洲一区中文在线| 亚洲v日本v欧美v久久精品| 午夜亚洲福利老司机| 日日欢夜夜爽一区| 美女高潮久久久| 国产麻豆视频一区二区| 国产成人av电影在线播放| 成人在线视频一区二区| heyzo一本久久综合| 色综合久久中文字幕| 欧美日韩国产一区二区三区地区| 欧美日韩中字一区| 91精品福利在线一区二区三区 | 国产成人精品影视| 国产精品 日产精品 欧美精品| 国产美女在线精品| 成人精品免费网站| 日本丰满少妇一区二区三区| 欧美午夜不卡在线观看免费| 宅男噜噜噜66一区二区66| 久久蜜桃一区二区| 亚洲欧美中日韩| 亚洲一级在线观看| 久久99最新地址| 成人久久视频在线观看| 日本高清不卡视频| 日韩三级伦理片妻子的秘密按摩| xfplay精品久久| 亚洲日本韩国一区| 日韩成人av影视| 国产精品自拍av| 91福利在线导航| 精品国产一区二区三区忘忧草| 国产精品亲子乱子伦xxxx裸| 亚洲一区二区欧美日韩| 精品一区免费av| 91麻豆swag| 91精品国产美女浴室洗澡无遮挡| 久久久不卡网国产精品一区| 亚洲免费大片在线观看| 日本va欧美va精品发布| 成人高清在线视频| 337p亚洲精品色噜噜狠狠| 国产精品麻豆一区二区| 亚洲成人黄色小说| 丁香六月久久综合狠狠色| 欧美日韩视频在线观看一区二区三区| 精品成a人在线观看| 亚洲精品老司机| 国产精品一区不卡| 欧美巨大另类极品videosbest | 久久99国产精品久久99 | 欧美在线免费播放| 久久亚洲欧美国产精品乐播| 一级精品视频在线观看宜春院| 精品一区二区三区视频在线观看| 91年精品国产| 久久久国产精华| 日本特黄久久久高潮| 色综合久久综合网97色综合| 国产亚洲美州欧州综合国| 日本一区中文字幕 | 亚洲成人一区二区在线观看| 国产精华液一区二区三区| 91精品国产一区二区三区蜜臀| 亚洲私人黄色宅男| 国产 欧美在线| 日本一区二区成人| 国内精品国产成人| 欧美一区二区人人喊爽| 亚洲成人自拍偷拍| 欧美在线一区二区| 亚洲精品高清在线观看| 北条麻妃一区二区三区| 久久久久久久久97黄色工厂| 青青草精品视频| 欧美日韩国产首页| 一区二区成人在线| 色8久久精品久久久久久蜜| 亚洲桃色在线一区| 97精品视频在线观看自产线路二| 久久九九久久九九| 国产综合色在线视频区| 日韩女优毛片在线| 奇米精品一区二区三区在线观看一| 欧美日韩在线播放三区| 亚洲无线码一区二区三区| 欧美在线免费观看视频| 亚洲国产sm捆绑调教视频| 欧美亚洲国产一区二区三区va | 亚洲乱码国产乱码精品精的特点 | 欧洲日韩一区二区三区| 一区二区三区日韩精品视频| 91在线观看一区二区| 中文字幕欧美一| 99re热视频这里只精品| 亚洲欧美色图小说| 日本久久精品电影| 亚洲国产日韩a在线播放性色| 欧美亚洲动漫制服丝袜| 亚洲高清免费视频| 91精品国产综合久久精品图片| 青青国产91久久久久久| 精品久久久三级丝袜| 国产精品亚洲视频| 中文字幕一区二区三区视频| 97久久精品人人做人人爽| 一区二区高清在线| 日韩欧美一级在线播放| 国产精品综合二区| 一区在线观看免费| 欧洲精品一区二区三区在线观看| 亚洲444eee在线观看| 欧美大片国产精品| 成人小视频在线| 亚洲激情男女视频| 日韩欧美在线综合网| 国产精品亚洲а∨天堂免在线| 中文一区二区完整视频在线观看| 国产超碰在线一区| 亚洲一区二区三区视频在线播放| 欧美一区二区三区在| 成人手机在线视频| 亚洲午夜av在线|