❓ Changing GPU info using MS Detours 3.0.
Hi everyone,
I'm trying to hook a WMI functions using the Microsoft Detours 3.0 and change the GPU information. But I have a troubles...
Information about the GPU is returned by the following method:
So I need to hook it. I tried to do this as follows:
It didn't hook anything. And I do not know why ... 
However I suppose that I chose the wrong way and there are other solutions.
Does anyone know how to hook it correct?
I'm trying to hook a WMI functions using the Microsoft Detours 3.0 and change the GPU information. But I have a troubles...

Information about the GPU is returned by the following method:
Code:
IEnumWbemClassObject::CreateInstanceEnum(_bstr_t("Win32_VideoController"),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&instanceEnum);
Code:
typedef HRESULT(WINAPI IWbemServices::*tm_CreateInstanceEnum) (const BSTR strClass, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum); tm_CreateInstanceEnum True_CreateInstanceEnum = &IWbemServices::CreateInstanceEnum;
Code:
// My function
__declspec(dllexport) HRESULT WINAPI Hooked_CreateInstanceEnum(const BSTR strClass, LONG lFlags, IWbemContext *pCtx, IEnumWbemClassObject **ppEnum)
{
MessageBox(0, L" Hooked!!!", L"Oh yeah, you did it !", MB_OK);
//return True_CreateInstanceEnum(strClass, lFlags, pCtx, ppEnum); // this is wrong
return 0;
}
Code:
BOOL APIENTRY DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
DetourRestoreAfterWith();
DetourTransactionBegin();
DetourAttach((PVOID*)&True_CreateInstanceEnum, Hooked_CreateInstanceEnum);
DetourTransactionCommit();
}
else if (dwReason == DLL_PROCESS_DETACH)
{
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourDetach((PVOID*)&True_CreateInstanceEnum, Hooked_CreateInstanceEnum);
DetourTransactionCommit();
}
{

However I suppose that I chose the wrong way and there are other solutions.
Does anyone know how to hook it correct?