📄 cqueue.h
字号:
/*
cqueue
#define TR Tilakraj Roy
960807 TR Created from scratch for vtmman
Circular fixed length queue manipulation routines.
FIFO queuesof fixed length
*/
/*
The cqueueobject
*/
#define CQUEUE_FLAGS_DYNAMICALLOC 0x01
#define CQUEUE_FLAGS_ACTIVE 0x02
#define CQUEUE_FLAGS_DYNAMICITEMBUFFER 0x04
typedef struct _CQUEUE_OBJECT
{
DWORD Size;
DWORD Flags;
DWORD ReadIndex;
DWORD WriteIndex;
DWORD ItemCount;
DWORD ItemSize;
PBYTE ItemBuffer;
DWORD Context;
} CQUEUE_OBJECT, *PCQUEUE_OBJECT;
/*
cqueueCreate
ItemCount Number of elements preallocated in the queue
ItemSize Size of each item in the queue. This size in bytes
is used to copy queue Items at the Insert, Delete and
Retrieve calls.
ItemBuffer Pointer to the preallocated item buffer which this
function can use. Specifying this paramter as NULL will
cause Create function to allocate is own item buffer
computed from ItemSize * ItemCount.
Object Address of teh location where the pointer to the
newly allocated object will be stored.
*/
BOOL cqueueCreate ( IN DWORD ItemCount, IN DWORD ItemSize,
IN PVOID ItemBuffer, OUT PVOID *Object );
/*
cqueueDestroy
Destroys the queue object, after this all references to Object are invalid.
TRUE Successful destruction of queue object
FALSE Invalid object pointer
*/
BOOL cqueueDestroy ( PVOID Object );
/*
cqueueIsEmpty
TRUE Queue is empty
FALSE Queue is not empty
Invalid object pointer
*/
BOOL cqueueIsEmpty ( PVOID Object );
/*
cqueueIsFull
TRUE Queue is full
FALSE Queue is not Full
Invalid Object Pointer
*/
BOOL cqueueIsFull ( PVOID Object );
/*
cqueueRetrieve
Retrieves the first item from the queue without deleting it
*/
BOOL cqueueRetrieve ( PVOID Object, PVOID Item );
/*
cqueueInsert
Inserts Item at the end of the queue
TRUE Successful Insertion
FALSE No room in the queue
Invalid Object Pointer
*/
BOOL cqueueInsert ( PVOID Object, PVOID Item );
/*
cqueueDelete
deletes the first item in the queue, and retrieves it in Item
*/
BOOL cqueueDelete ( PVOID Object, PVOID Item );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -