int (WINAPI *pconnect)(SOCKET s, const struct sockaddr* name, int namelen) = connect;
int WINAPI Myconnect(SOCKET s, const struct sockaddr* name, int namelen);
bool Hook::InstallHook()
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
// connect 후킹
Logger::Log("Connect : %x", connect);
DetourAttach(&(PVOID&)pconnect, Myconnect);
if (DetourTransactionCommit() == NO_ERROR)
Logger::Log("Connect Hook success");
else
{
Logger::Log("Connect Hook fail");
return false;
}
return true;
}
이걸 진행하면 ws2_32.dll 안에 있는 connect를 후킹하는게 아니라
IAT table 에 있는 connect를 후킹하는듯 한데 어떻게해야하나염
(LoadLibrary의 경우 kernel32.dll 에 있는 LoadLibraryA를 정확히 후킹함)
댓글 0