⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 computer00usbdevice.h

📁 usb自定义设备编程
💻 H
字号:
// Computer00UsbDevice.h
//
// Generated by DriverWizard 3.2.0 (Build 2485)
// Requires DDK and DriverWorks
// File created on 8/22/2008
//
// This include file contains the definition of a subclass of KPnpDevice.
// WDM drivers declare a subclass of KPnpDevice and override member
// functions to handle requests (IRPs) from the system.
//
#ifndef __COMPUTER00USBDEVICE_H__
#define __COMPUTER00USBDEVICE_H__

class Computer00UsbDevice : public KPnpDevice
{
public:
	SAFE_DESTRUCTORS;
	Computer00UsbDevice(PDEVICE_OBJECT Pdo, ULONG Unit);
	~Computer00UsbDevice();
	VOID Invalidate(void);

	// Member functions
	DEVMEMBER_DISPATCHERS

	virtual NTSTATUS OnStartDevice(KIrp I);
	virtual NTSTATUS OnStopDevice(KIrp I);
	virtual NTSTATUS OnRemoveDevice(KIrp I);
	virtual	NTSTATUS OnQueryCapabilities(KIrp I);
	MEMBER_COMPLETEIRP(Computer00UsbDevice, OnQueryCapabilitiesComplete)
	virtual NTSTATUS OnDevicePowerUp(KIrp I);
	virtual NTSTATUS OnDeviceSleep(KIrp I);
	virtual NTSTATUS DefaultPnp(KIrp I);
	virtual NTSTATUS DefaultPower(KIrp I);

	typedef struct _USB_COMPLETION_INFO
	{
		PURB m_pUrb;
		Computer00UsbDevice* m_pClass;
	} USB_COMPLETION_INFO, *PUSB_COMPLETION_INFO;

	MEMBER_COMPLETEIRPWITHCONTEXT(USB_COMPLETION_INFO, IoComplete)
	void TestBusInterface();

	void LoadRegistryParameters();

	NTSTATUS EP1_READ_Handler(KIrp I);
	NTSTATUS EP1_WRITE_Handler(KIrp I);
	NTSTATUS EP2_READ_Handler(KIrp I);
	NTSTATUS EP2_WRITE_Handler(KIrp I);

protected:
	// Member data
	KUsbLowerDevice		m_Lower;
	KUsbInterface   	m_Interface;
	KUsbPipe			Ep1In;	// Pipe for USB endpoint address 81, type INTERRUPT
	KUsbPipe			Ep1Out;	// Pipe for USB endpoint address 1, type INTERRUPT
	KUsbPipe			Ep2In;	// Pipe for USB endpoint address 82, type BULK
	KUsbPipe			Ep2Out;	// Pipe for USB endpoint address 2, type BULK
#if (_WDM_ && (WDM_MAJORVERSION > 1 || ((WDM_MAJORVERSION == 1) && (WDM_MINORVERSION >= 0x20))))
	KUsbBusInterface	m_BusIntf;	// Direct client access to USB bus on Windows XP and above
	BOOLEAN				m_fBusIntfAvailable;
#endif
    PWSTR	DeviceName;		// Registry string variable
#ifdef __COMMENT_ONLY
		// The following member functions are actually defined by 
		// a DEVMEMBER_XXX or MEMBER_XXX macro (such as DEVMEMBER_DISPATCHERS).
		// The macro __COMMENT_ONLY never gets defined.  These comment-only
		// definitions simply allow easy navigation to the functions within
		// the Visual Studio IDE using the class browser.
	virtual NTSTATUS Create(KIrp I); 				// COMMENT_ONLY
	virtual NTSTATUS Close(KIrp I);					// COMMENT_ONLY
	virtual NTSTATUS Read(KIrp I);			  		// COMMENT_ONLY
	virtual NTSTATUS Write(KIrp I);					// COMMENT_ONLY
	virtual NTSTATUS DeviceControl(KIrp I);			// COMMENT_ONLY
	virtual NTSTATUS CleanUp(KIrp I); 				// COMMENT_ONLY
	virtual NTSTATUS SystemControl(KIrp I);			// COMMENT_ONLY
#endif // __COMMENT_ONLY
};

#endif // __COMPUTER00USBDEVICE_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -