queuecontainer.h

来自「关于远程网络监视程序的源码」· C头文件 代码 · 共 84 行

H
84
字号
//---------------------------------------------------------------------------
//
// QueueContainer.h
//
// SUBSYSTEM: 
//              Monitoring process creation and termination  
//				
// MODULE:    
//              Implement a multithreaded thread safe queue
// 
// DESCRIPTION:
//
// AUTHOR:		Ivo Ivanov
//                                                                         
//---------------------------------------------------------------------------

#if !defined(_QUEUECONTAINER_H_)
#define _QUEUECONTAINER_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

//---------------------------------------------------------------------------
//
// Includes
//
//---------------------------------------------------------------------------

#include "common.h"
#include "CallbackHandler.h"
#include "RetrievalThread.h"
#include "ThreadMonitor.h"
#include <assert.h>
#include <deque>
using namespace std;

//---------------------------------------------------------------------------
//
// class CQueueContainer
//
//---------------------------------------------------------------------------
class CQueueContainer
{
public:
	CQueueContainer(CCallbackHandler* pHandler);
	virtual ~CQueueContainer();

	// Insert data into the queue
	BOOL Append(const QUEUED_ITEM& element);

	// Set an external parameter, thus we could take the advantage 
	// of it later on in the callback routine
	void SetExternalParam(PVOID pvParam);

private:
	// Thread that gets all queued event items 
	CQueueReadThread* m_pQueueReadThread;

	// A thread for receiving notification from the kernel-mode driver
	CDrvEventThread* m_pMonitorThread;

	// Underlying STL container
	deque<QUEUED_ITEM> m_Queue;

	// Monitor mutex
	HANDLE m_mtxMonitor;

	// Callback handler
	CCallbackHandler* m_pHandler;

	// Pointer to anything
	PVOID m_pvParam;

public:
	// Implement specific behavior when kernel mode driver notifies the user-mode app
	void DoOnProcessCreatedTerminated();

	BOOL StartMonitor(void);
	void StopMonitor(void);
};

#endif // !defined(_QUEUECONTAINER_H_)
//----------------------------End of the file -------------------------------

⌨️ 快捷键说明

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