突然我不能使用新的功能,我写这.H头文件和我写我可以用它的老功能的使用功能,我不能相信:SC++着的.h头文件
stdafx.h中
#include "function.h"
Hook.h
#include "stdafx.h"
namespace DragoN_Hook
{
void EditOrginalCastleWar(int StartHour,int EndHour){
unsigned char lol[4] = {0x83, 0x7A, 0x08,(unsigned char)StartHour};
MemoryCopy((DWORD)0x00411A05,(DWORD)&lol,4);
}
}
函数的NH
LPVOID MemoryCopy(DWORD destination, DWORD source, int length);
function.cpp
LPVOID MemoryCopy(DWORD destination, DWORD source, int length)
{
DWORD oldSource = 0;
DWORD oldDestination = 0;
VirtualProtect((LPVOID)source,length,PAGE_EXECUTE_READWRITE,&oldSource);
VirtualProtect((LPVOID)destination,length,PAGE_EXECUTE_READWRITE,&oldDestination);
memcpy((void*)destination,(void*)source,length);
VirtualProtect((LPVOID)destination,length,oldDestination,&oldDestination);
VirtualProtect((LPVOID)source,length,oldSource,&oldSource);
return (LPVOID)destination;
};
错误 * 错误C3861: 'MemoryCopy':未找到标识 *
如果在Hook.h中放入'#include“function.h”',是否会发生同样的事情。另外,'stdafx.h'是一个预编译头文件吗? – slugonamission 2013-02-22 19:50:08
没有它的工作,如果我把它放在hook.h – 2013-02-22 19:54:38
请参阅@ rerun的答案,很可能是您的预编译头没有被重新编译。 TBH,只是禁用他们,他们不值得这个规模的项目。 – slugonamission 2013-02-22 19:55:15