easyhook报错The given 64-Bit library does not exist

在调用 RemoteHooking.Inject 时,报错

 

 

查看easyhook源代码,出错位置如下

if(!RtlFileExists(UserLibrary))
    {
    #ifdef _M_X64
        THROW(STATUS_INVALID_PARAMETER_5, L"The given 64-Bit library does not exist!");
    #else
        THROW(STATUS_INVALID_PARAMETER_4, L"The given 32-Bit library does not exist!");
    #endif
    }

 

BOOL RtlFileExists(WCHAR* InPath)
{
    HANDLE          hFile;

    if((hFile = CreateFileW(InPath, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
        return FALSE;

    CloseHandle(hFile);

    return TRUE;
}

 

 

问题源头是 CreateFileW 这里失败,但是我手动调用CreateFileW传入dllPath也没有失败啊,很奇怪

 

 

 

 

 

 

 

 

https://stackoverflow.com/questions/31762879/easyhook-the-given-32-bit-library-does-not-exist-user-library-does-not-export

 

I've had same issue but with 64 bit.

Removing my assemblies and EasyHook from GAC solved the issue.

gacutil /uf EasyHook
gacutil /uf EasyLoad64
gacutil /uf MyAssembly




I don't know exactly why it wasn't working before. Clearly the problem was that couldn't find some assemblies. After reading on the Internet I saw an example without the Config.Register function. Seems with the latest version (2.7) you don't need to register assemblies in the GAC. I just commented this function and it worked.

 

 

 

 

 

以下不靠谱

 

 

 

posted @ 2019-09-25 10:45  quanzhan  阅读(597)  评论(0编辑  收藏  举报