im getting 100+ errors such as these
whenever i add my file to a project i am working on.
the files being added work perfectly fine when used in other projects.
can anyone shed some light on the situation.
antihacktest.cpp code
ClientAntiHack.cpp
ClientAntiHack.h
thanks in advance.
If somethings hard to do, its not worth doing - Homer Simpson
Code:
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\../include/sstream(22) : error C2504: 'basic_streambuf' : base class undefined
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\../include/sstream(196) : see reference to class template instantiation 'std::basic_stringbuf<_E,_Tr,_A>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\../include/sstream(22) : error C2143: syntax error : missing ',' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\../include/sstream(196) : see reference to class template instantiation 'std::basic_stringbuf<_E,_Tr,_A>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\../include/sstream(22) : error C2059: syntax error : '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\../include/sstream(196) : see reference to class template instantiation 'std::basic_stringbuf<_E,_Tr,_A>' being compiled
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\../include/sstream(24) : error C2143: syntax error : missing ';' before '<'
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\../include/sstream(196) : see reference to class template instantiation 'std::basic_stringbuf<_E,_Tr,_A>' being compiled
whenever i add my file to a project i am working on.
the files being added work perfectly fine when used in other projects.
can anyone shed some light on the situation.
antihacktest.cpp code
Code:
// AntiHackTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "ClientAntiHack.h"
int main(int argc, char* argv[])
{
CClientAntiHack myAntiHack;
int i=0;
while(i<24)
{
myAntiHack.RunCheck();
bool resultant=myAntiHack.GetHackStatus();
Sleep(10000);
i++;
}
return 0;
}
ClientAntiHack.cpp
Code:
// ClientAntiHack.cpp: implementation of the CClientAntiHack class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ClientAntiHack.h"
#include <sstream>
#include <iomanip>
#pragma comment(lib, "version.lib")
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CClientAntiHack::CClientAntiHack()
{
AntiHackRunning=true;
if(!GetWindowsVersion()) FlagAntiHackFail();
HackingDetected=false;
if(AntiHackRunning) SearchProcess();
}
CClientAntiHack::~CClientAntiHack()
{
}
bool CClientAntiHack::GetWindowsVersion()
{
OSVersion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
if(!GetVersionEx(&OSVersion)) return false;
return true;
}
bool CClientAntiHack::SearchProcess()
{
if(OSVersion.dwPlatformId==VER_PLATFORM_WIN32_NT)// NT based OS
{
//load the DLL
HINSTANCE hiDLL=LoadLibrary("PSAPI.DLL");
if(hiDLL==NULL)
{
FlagAntiHackFail();
return false;
}
// PSAPI Function Pointers.
typedef BOOL (WINAPI *LPENUMPROCESSES)(DWORD *,DWORD,DWORD *);
typedef BOOL (WINAPI *LPENUMPROCESSMODULES)( HANDLE,HMODULE *,DWORD,LPDWORD);
typedef DWORD (WINAPI *LPGETMODULEFILENAMEEX)( HANDLE,HMODULE,LPTSTR,DWORD);
LPENUMPROCESSES lpfEnumProcesses = (LPENUMPROCESSES)GetProcAddress(hiDLL,"EnumProcesses");
LPENUMPROCESSMODULES lpfEnumProcessModules = (LPENUMPROCESSMODULES)GetProcAddress(hiDLL,"EnumProcessModules");
LPGETMODULEFILENAMEEX lpfGetModuleFileNameEx = (LPGETMODULEFILENAMEEX)GetProcAddress(hiDLL,"GetModuleFileNameExA");
//make sure we have function pointers
if(!lpfEnumProcesses||!lpfEnumProcessModules||!lpfGetModuleFileNameEx)
{
FlagAntiHackFail();
FreeLibrary(hiDLL);
return false;
}
//create a massive list, TODO, loop for specific list size
DWORD ProcessIDList[400],dwCb=400,dwCbNeeded,cbRet;
//fill the list with pID's
if(!lpfEnumProcesses(ProcessIDList,dwCb,&dwCbNeeded))
{
FlagAntiHackFail();
FreeLibrary(hiDLL);
return false;
}
HANDLE hProcess;
HMODULE hModule[50];
char ModuleFileName[256];
DWORD i=0;
while(i<dwCbNeeded/sizeof(DWORD))
{
hProcess=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ|PROCESS_TERMINATE,0,ProcessIDList[i++]);
if(hProcess)
{
//we have a valid process handle
if(!lpfEnumProcessModules(hProcess,hModule,50,&cbRet))
{
//an error do something
}
if(!lpfGetModuleFileNameEx(hProcess,hModule[0],ModuleFileName,256))
{
//an error do something
}
//we have made it this far, lets see if the original filename is on the ban list
if(CheckFilters(ModuleFileName))
{
//name is recognised, close process and report error
TerminateProcess(hProcess,0);
HackingDetected=true;
}
CloseHandle(hProcess);
}
}
FreeLibrary(hiDLL);
if(HackingDetected) return true;
}
else if(OSVersion.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)// Win 9x
{
}
else
{
//should never come here
}
return false;
}
void CClientAntiHack::FlagAntiHackFail()
{
AntiHackRunning=false;
}
bool CClientAntiHack::CheckFilters(char *FileName)
{
unsigned char *resource_data_;
version_nmsp::language *language_information_;
std::string app_name=FileName;
TCHAR buf[MAX_PATH] = "";
// Get version info
DWORD h = 0;
DWORD resource_size = ::GetFileVersionInfoSize(const_cast<char*>(app_name.c_str()), &h);
if(resource_size)
{
resource_data_ = new unsigned char[resource_size];
if(resource_data_)
{
if(::GetFileVersionInfo(const_cast<char*>(app_name.c_str()),0,resource_size,static_cast<LPVOID>(resource_data_)) != FALSE)
{
UINT size = 0;
// Get language information
::VerQueryValue(static_cast<LPVOID>(resource_data_),"\\VarFileInfo\\Translation",reinterpret_cast<LPVOID*>(&language_information_),&size);
std::stringstream t;
LPVOID value = 0;
// Build query string
t << "\\StringFileInfo\\" << std::setw(4) << std::setfill('0') << std::hex
<< language_information_->language_ << std::setw(4) << std::hex
<< language_information_->code_page_ << "\\InternalName";
::VerQueryValue(static_cast<LPVOID>(resource_data_), const_cast<LPTSTR>(t.str().c_str()),static_cast<LPVOID*>(&value),&size);
sprintf(buf,static_cast<LPTSTR>(value));
if(!_strnicmp(buf,"tsearch",8) || !_strnicmp(buf,"artmoney",8))
{
delete [] resource_data_;
return true;
}
}
}
delete [] resource_data_;
}
return false;
}
void CClientAntiHack::RunCheck()
{
//reset the variable
HackingDetected=false;
//do search
if(AntiHackRunning) SearchProcess();
}
bool CClientAntiHack::GetHackStatus()
{
if(HackingDetected) return true;
return false;
}
ClientAntiHack.h
Code:
// ClientAntiHack.h: interface for the CClientAntiHack class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_CLIENTANTIHACK_H__7E4D60C9_07AF_49AC_A06B_E536C4B4D051__INCLUDED_)
#define AFX_CLIENTANTIHACK_H__7E4D60C9_07AF_49AC_A06B_E536C4B4D051__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "windows.h"
namespace version_nmsp
{
struct language
{
WORD language_;
WORD code_page_;
language()
{
language_ = 0;
code_page_ = 0;
}
};
}
class CClientAntiHack
{
public:
bool GetHackStatus();
void RunCheck();
bool HackingDetected;
bool CheckFilters(char *FileName);
void FlagAntiHackFail();
bool SearchProcess();
bool AntiHackRunning;
OSVERSIONINFO OSVersion;
bool GetWindowsVersion();
CClientAntiHack();
virtual ~CClientAntiHack();
};
#endif // !defined(AFX_CLIENTANTIHACK_H__7E4D60C9_07AF_49AC_A06B_E536C4B4D051__INCLUDED_)
thanks in advance.
If somethings hard to do, its not worth doing - Homer Simpson