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

📄 wrsync.h

📁 实现了隐藏进程,使进程对任务管理器和进程查看器均不可见,使文件对资源管理器不可见 是驱动编程入门的好例子
💻 H
字号:
#if !defined(AFX_WRSYNC_H__05C0774C_D377_40E2_976A_2C8DF4676B46__INCLUDED_)
#define AFX_WRSYNC_H__05C0774C_D377_40E2_976A_2C8DF4676B46__INCLUDED_

#include "common.h"
/************************************************************************/
/* wrSync class used for threads synchronization.                       */
/************************************************************************/
class wrSync 
{
public:
	wrSync();
	~wrSync();

	VOID WaitToRead();        // Call this to gain shared read access
	VOID WaitToWrite();       // Call this to gain exclusive write access
	VOID Done();              // Call this when done accessing the resource

private:
	KSPIN_LOCK	m_SpinLock;    // Permits exclusive access to other members
	KSEMAPHORE	m_hsemReaders; // Readers wait on this if a writer has access
	KSEMAPHORE	m_hsemWriters; // Writers wait on this if a reader has access
	int    m_nWaitingReaders;	// Number of readers waiting for access
	int    m_nWaitingWriters;	// Number of writers waiting for access
	int    m_nActive;			// Number of threads currently with access
								//   (0=no threads, >0=# of readers, -1=1 writer)
};

#endif // !defined(AFX_WRSYNC_H__05C0774C_D377_40E2_976A_2C8DF4676B46__INCLUDED_)

⌨️ 快捷键说明

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