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

📄 kinterlockedcounter.cpp

📁 尔罗斯著名黑客写的rootkit
💻 CPP
字号:
#include "KInterlockedCounter.h"

KInterlockedCounter::KInterlockedCounter(LONG nStartValue)
{
  InterlockedExchange(&m_nValue, nStartValue);
}

KInterlockedCounter::KInterlockedCounter(const KInterlockedCounter& right) 
{
  new (this) KInterlockedCounter(right.m_nValue);
}

KInterlockedCounter::~KInterlockedCounter()
{

}

KInterlockedCounter& KInterlockedCounter::operator=(const KInterlockedCounter& right)
{
  new (this) KInterlockedCounter(right.m_nValue);
  return *this;
}

KInterlockedCounter& KInterlockedCounter::operator=(const LONG nValue)
{
  new (this) KInterlockedCounter(nValue);
  return *this;
}

KInterlockedCounter& KInterlockedCounter::operator++()
{
  InterlockedIncrement(&m_nValue);
  return *this;
}

KInterlockedCounter& KInterlockedCounter::operator--()
{
  InterlockedDecrement(&m_nValue);
  return *this;
}

const KInterlockedCounter KInterlockedCounter::operator++(int)
{
  KInterlockedCounter Old = *this;
  ++(*this);
  return Old;
}

const KInterlockedCounter KInterlockedCounter::operator--(int)
{
  KInterlockedCounter Old = *this;
  --(*this);
  return Old;
}

BOOLEAN KInterlockedCounter::CompareExchange(const LONG nValueComperand, const LONG nValueExchange)
{
  #ifndef __WIN2K
  if (InterlockedCompareExchange((PVOID*)&m_nValue, (PVOID)nValueExchange, (PVOID)nValueComperand) == (PVOID)nValueComperand)
    return TRUE;
  #else
  if (InterlockedCompareExchange(&m_nValue, nValueExchange, nValueComperand) == nValueComperand)
    return TRUE;
  #endif //__WIN2K
  return FALSE;
}

⌨️ 快捷键说明

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