0
를 LPVOID 내 루아 함수의 데이터 유형을 변환 할 수 없습니다 것은 그래서입니다.DetourAttach을하려고하지만
typedef void* LPVOID
invalid type conversion
어떻게하면됩니까?
를 LPVOID 내 루아 함수의 데이터 유형을 변환 할 수 없습니다 것은 그래서입니다.DetourAttach을하려고하지만
typedef void* LPVOID
invalid type conversion
어떻게하면됩니까?
당신은 DetourAttach에 대한 올바른 의미를 가지고 있지 않습니다. 첫 번째 인수는 함수 포인터로 연결되는 포인터이며, 원래 함수가 후크되도록 초기화되어야합니다. 두 번째 인수는 후크 함수를 포함하는 함수 포인터입니다.
예를 들어 This blog을 참조하십시오.
따라서 함수를 전달할 수는 없습니다. 예를 들어 변수를 초기화해야합니다 (예 :
// Declaration of LUA API function in header
const char*lua_tostring (lua_State *L, int index);
// Your hook function must have this signature to match
const char*my_tostring (lua_State *L, int index);
// Your variable
const char* (*Real_lua_tostring)(lua_State *L, int index) = lua_tostring;
// Make the call
DetourAttach(&(LPVOID&)Real_lua_tolstring, (PVOID)my_tostring);
).