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

📄 comfilntdevice.h

📁 一个2000系统上的虚拟串口驱动程序
💻 H
字号:
// ComfilntDevice.h
//
// Generated by DriverWizard version DriverStudio 2.5.0 (Build 240)
// Requires Compuware's DriverWorks classes
//
#include <ntddser.h>

#ifndef __ComfilntDevice_h__
#define __ComfilntDevice_h__
//
// These defines are used to set the line control register.
//
#define SERIAL_5_DATA       ((UCHAR)0x00)
#define SERIAL_6_DATA       ((UCHAR)0x01)
#define SERIAL_7_DATA       ((UCHAR)0x02)
#define SERIAL_8_DATA       ((UCHAR)0x03)
#define SERIAL_DATA_MASK    ((UCHAR)0x03)

#define SERIAL_1_STOP       ((UCHAR)0x00)
#define SERIAL_1_5_STOP     ((UCHAR)0x04) // Only valid for 5 data bits
#define SERIAL_2_STOP       ((UCHAR)0x04) // Not valid for 5 data bits
#define SERIAL_STOP_MASK    ((UCHAR)0x04)

#define SERIAL_NONE_PARITY  ((UCHAR)0x00)
#define SERIAL_ODD_PARITY   ((UCHAR)0x08)
#define SERIAL_EVEN_PARITY  ((UCHAR)0x18)
#define SERIAL_MARK_PARITY  ((UCHAR)0x28)
#define SERIAL_SPACE_PARITY ((UCHAR)0x38)
#define SERIAL_PARITY_MASK  ((UCHAR)0x38)

#define EV_RXCHAR           0x0001  // Any Character received
#define EV_RXFLAG           0x0002  // Received certain character
#define EV_TXEMPTY          0x0004  // Transmitt Queue Empty
#define EV_CTS              0x0008  // CTS changed state
#define EV_DSR              0x0010  // DSR changed state
#define EV_RLSD             0x0020  // RLSD changed state
#define EV_BREAK            0x0040  // BREAK received
#define EV_ERR              0x0080  // Line status error occurred
#define EV_RING             0x0100  // Ring signal detected
#define EV_PERR             0x0200  // Printer error occured
#define EV_RX80FULL         0x0400  // Receive buffer is 80 percent full
#define EV_EVENT1           0x0800  // Provider specific event 1
#define EV_EVENT2           0x1000  // Provider specific event 2

/*
typedef struct _READWRITE_FIFO{
	KFifo<UCHAR> PipeA;
	KFifo<UCHAR> PipeB;
	KFifo<UCHAR> BytePipe;
} RW_FIFO;
	RW_FIFO rw_fifo[5];
*/
class ComfilntDevice : public KDevice
{
	// Constructors
public:
	SAFE_DESTRUCTORS;
	ComfilntDevice(ULONG Unit,PRW pRW);
	~ComfilntDevice();
//	KFifo<UCHAR> BytePipe(0x100, NonPagedPool);
//	KFifo<UCHAR> BytePipe;
//
//	RW_FIFO rw_fifo[5];
// This structure is used to get the current error and
// general status of the driver.
//
/*
typedef struct _SERIAL_STATUS {
    ULONG Errors;
    ULONG HoldReasons;
    ULONG AmountInInQueue;
    ULONG AmountInOutQueue;
    BOOLEAN EofReceived;
    BOOLEAN WaitForImmediate;
    } SERIAL_STATUS,*PSERIAL_STATUS;
*/
SERIAL_STATUS CommStatus;

	// Member Functions
public:
	ULONG m_IsOpened;
//	KFifo <UCHAR>* m_PipeB;
//	KFifo <UCHAR>* m_PipeA;
	PRW m_pRW;
	DEVMEMBER_DISPATCHERS

#ifdef __COMMENT_ONLY
		// The following member functions are actually defined by the
		// a DEVMEMBER_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 Developer Studio using the class browser.

	virtual NTSTATUS CleanUp(KIrp I); 				// COMMENT_ONLY
	virtual NTSTATUS Close(KIrp I);					// COMMENT_ONLY
	virtual NTSTATUS Create(KIrp I); 				// COMMENT_ONLY
	virtual NTSTATUS DeviceControl(KIrp I);			// COMMENT_ONLY
	virtual NTSTATUS FlushBuffers(KIrp I);		   	// COMMENT_ONLY
	virtual NTSTATUS Read(KIrp I);			  		// COMMENT_ONLY
	virtual NTSTATUS Write(KIrp I);					// COMMENT_ONLY
#endif
	virtual VOID IoctlGetCommStatus(SERIAL_STATUS& Status);
	virtual VOID IoctlGetBaudRate(SERIAL_BAUD_RATE& BaudRate);
	virtual NTSTATUS IoctlSetHandFlow(SERIAL_HANDFLOW& HandFlow);
	virtual VOID IoctlGetTimeOuts(SERIAL_TIMEOUTS& TimeOuts);
	virtual VOID IoctlSetTimeOuts(SERIAL_TIMEOUTS& TimeOuts);
	virtual VOID IoctlGetSpecialCharacters(SERIAL_CHARS& Chars);
	virtual VOID IoctlSetSpecialCharacters(SERIAL_CHARS& Chars);
	virtual VOID IoctlGetStatistics(SERIALPERF_STATS& Stats);
	virtual VOID IoctlClearStatistics(void);
	virtual ULONG IoctlGetWaitMask(void);
	virtual NTSTATUS IoctlSetWaitMask(ULONG mask);
	virtual VOID IoctlGetProperties(SERIAL_COMMPROP& Properties);
	virtual ULONG IoctlGetModemStatus(void);
//	virtual VOID IoctlGetCommStatus(SERIAL_STATUS& CommStatus);
	virtual VOID IoctlPurge(ULONG PurgeMask);
	virtual NTSTATUS IoctlSetQueueSize(SERIAL_QUEUE_SIZE& QueueSizes);
	virtual VOID IoctlGetHandFlow(SERIAL_HANDFLOW& HandFlow);
	virtual VOID IoctlSetBaudRate(SERIAL_BAUD_RATE& BaudRate);
	virtual VOID IoctlGetLineControl(SERIAL_LINE_CONTROL& LineControl);
	virtual NTSTATUS IoctlSetLineControl(SERIAL_LINE_CONTROL& LineControl);
	// Member Data
protected:
		// Unit number for this device instance
	ULONG				m_Unit;
		// Used in constructor/destructor to hold registry path
	KUnitizedName *		m_RegPath;
	ULONG				m_SupportedEvents;
#if NTVERSION > 351
	SERIALPERF_STATS	m_Statistics;
#endif
	SERIAL_BAUD_RATE	m_BaudRate;
	SERIAL_HANDFLOW		m_Handflow;
	SERIAL_CHARS		m_Chars;
	UCHAR				m_LineControl;
	ULONG				m_WaitMask;
	ULONG				m_WriteCount;
	ULONG				m_EventState;
	SERIAL_TIMEOUTS		m_Timeouts;
	ULONG				m_ErrorState;
	ULONG				m_EvenMask;
//
// All allowed purge flags
//
#define VALID_PURGE_MASK (	\
	SERIAL_PURGE_TXABORT|	\
	SERIAL_PURGE_RXABORT|	\
	SERIAL_PURGE_TXCLEAR|	\
	SERIAL_PURGE_RXCLEAR)
};


#endif		// __ComfilntDevice_h__

⌨️ 快捷键说明

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