C++ C++;MVS 2012上的迂回3.0 express错误“;“未找到标识符”;

C++ C++;MVS 2012上的迂回3.0 express错误“;“未找到标识符”;,c++,detours,C++,Detours,我的编译器:Microsoft Visual Studio 2012。 我的代码在detours 2.1上运行,但我不能再使用编译器编译它了(模块对SAFESEH映像不安全)。我需要使用像MVS2005这样的旧编译器,但我不希望这样 所以我需要更新我的代码并使用detours 3.0 编辑了一些内容,出现了4个错误 error C3861: 'DetourFunction': identifier not found error C3861: 'DetourFunction': identifi

我的编译器:Microsoft Visual Studio 2012。
我的代码在detours 2.1上运行,但我不能再使用编译器编译它了(模块对SAFESEH映像不安全)。我需要使用像MVS2005这样的旧编译器,但我不希望这样

所以我需要更新我的代码并使用detours 3.0

编辑了一些内容,出现了4个错误

error C3861: 'DetourFunction': identifier not found
error C3861: 'DetourFunction': identifier not found
error C3861: 'DetourRemove': identifier not found
error C3861: 'DetourRemove': identifier not found
以下是代码块:

这里的迂回函数错误

o_NtQuerySystemInformation = (t_NtQuerySystemInformation)DetourFunction((PBYTE)GetProcAddress(GetModuleHandle("ntdll.dll"), "NtQuerySystemInformation"), (PBYTE)My_NtQuerySystemInformation);
o_ZwOpenProcess = (t_ZwOpenProcess)DetourFunction((PBYTE)GetProcAddress(GetModuleHandle("ntdll.dll"), "ZwOpenProcess"), (PBYTE)My_ZwOpenProcess);
在这里删除错误

    DetourRemove((PBYTE)o_NtQuerySystemInformation, (PBYTE)My_NtQuerySystemInformation);
    DetourRemove((PBYTE)o_ZwOpenProcess, (PBYTE)My_ZwOpenProcess);

更新


因此,我尝试将其更改为DetourAttach和DetourDetach,但我得到一个PBYTE to PVOID错误。

DetourFunction
DetourRemove
已替换为
DetourAttach
DetourDetach
。使用它们并不难,而且该库附带了一组示例,您可以从中了解如何使用这些API。您的代码应该如下所示:

BOOL APIENTRY DllMain( HANDLE hModule, 
                      DWORD  ul_reason_for_call, 
                      LPVOID lpReserved
                      )
{
   if (ul_reason_for_call == DLL_PROCESS_ATTACH)
   {
      o_NtQuerySystemInformation = (t_NtQuerySystemInformation)DetourAttach(&(PVOID&)GetProcAddress(GetModuleHandle("ntdll.dll"), "NtQuerySystemInformation"), My_NtQuerySystemInformation);
      o_ZwOpenProcess = (t_ZwOpenProcess)DetourAttach(&(PVOID&)GetProcAddress(GetModuleHandle("ntdll.dll"), "ZwOpenProcess"), My_ZwOpenProcess);

      MyModuleHandle = (HMODULE)hModule;
      MyPid = GetCurrentProcessId();
   }
   if (ul_reason_for_call == DLL_PROCESS_DETACH)
   {
      DetourDetach(&(PVOID&)o_NtQuerySystemInformation, My_NtQuerySystemInformation);
      DetourDetach(&(PVOID&)o_ZwOpenProcess, My_ZwOpenProcess);
   }

   return TRUE;
}

你从哪里得到这个错误的?显示代码。这是完整的代码:嘿,对于任何点击此页面的人,我可能有相同的pbyte/pvoid错误,可能看这里:[link]我知道此线程是一个墓地,但绕道会严重影响我的头。o_NtQuerySystemInformation指的是什么?指向ntdll.dll中t\u ntquerysystem信息的指针?这将如何定义?