Click here to Skip to main content
15,886,639 members
Articles / Desktop Programming / Win32

Simple Serial Port Monitor

Rate me:
Please Sign up or sign in to vote.
4.94/5 (35 votes)
1 May 2012CPOL9 min read 245.4K   52.7K   123  
Very simple serial port monitor.
#ifndef __DKPORTMONQUE_H__
#define __DKPORTMONQUE_H__

#include "Wdm.h"
#include "..\Inc\Shared.h"

__drv_raisesIRQL(DISPATCH_LEVEL)
__drv_maxIRQL(DISPATCH_LEVEL)
VOID DkCsqAcquireLock(__in PIO_CSQ pCsq, __out __drv_out_deref(__drv_savesIRQL) PKIRQL pKIrql);

__drv_requiresIRQL(DISPATCH_LEVEL)
VOID DkCsqReleaseLock(__in PIO_CSQ pCsq, __in __drv_in(__drv_restoresIRQL) KIRQL kIrql);

IO_CSQ_INSERT_IRP DkCsqInsertIrp;
IO_CSQ_REMOVE_IRP DkCsqRemoveIrp;
IO_CSQ_PEEK_NEXT_IRP DkCsqPeekNextIrp;
IO_CSQ_COMPLETE_CANCELED_IRP DkCsqCompleteCanceledIrp;

VOID DkCleanUpQueue(PDEVICE_OBJECT pDevObj, PIRP pIrp);

#define DKQUE_SZ		500
#define DKQUE_BUF_SZ	512
#define DKQUE_MTAG		(ULONG)'kEdA'

typedef struct DKQUE_DAT_Tag {
	DKPORT_DAT				Dat;
	struct DKQUE_DAT_Tag	*pNext;
} DKQUE_DAT, *PDKQUE_DAT;

VOID DkQueInitialize(VOID);

BOOLEAN DkQueAdd(CONST PWCHAR pStrFuncName, ULONG ulFuncNameLen, PUCHAR pDat, ULONG ulDatLen);

PDKQUE_DAT DkQueGet(VOID);

VOID DkQueDel(PDKQUE_DAT pItem);

VOID DkQueCleanUpData(VOID);

#endif   // End of __DKPORTMONQUE_H__

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Indonesia Indonesia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions