3

突然我不能使用我在.h头文件中写的新函数和我写的旧函数我可以使用它,我不敢相信:S

标准数据文件

#include "function.h"

钩子.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);

    }
}

函数.h

LPVOID MemoryCopy(DWORD destination, DWORD source, int length);

函数.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': 找不到标识符*

4

1 回答 1

2

这通常发生在您编译不会导致重新构建预编译头文件的单个文件时。如果您重建解决方案,它将重新创建标题。您还可以关闭预编译的标头,而不必处理它。

于 2013-02-22T19:51:08.567 回答