当前位置: 首页>>代码示例>>C++>>正文


C++ HookData::Rehook方法代码示例

本文整理汇总了C++中HookData::Rehook方法的典型用法代码示例。如果您正苦于以下问题:C++ HookData::Rehook方法的具体用法?C++ HookData::Rehook怎么用?C++ HookData::Rehook使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HookData的用法示例。


在下文中一共展示了HookData::Rehook方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CheckDDrawCapture

void CheckDDrawCapture()
{
    EnterCriticalSection(&ddrawMutex);
    ddrawSurfaceUnlock.Rehook(true);
    ddrawSurfaceFlip.Rehook(true);
    ddrawSurfaceBlt.Rehook(true);
    LeaveCriticalSection(&ddrawMutex);
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:8,代码来源:DDrawCapture.cpp

示例2: HookAll

void HookAll()
{
    ddrawSurfaceCreate.Rehook();
    ddrawSurfaceRestore.Rehook();
    ddrawSurfaceRelease.Rehook();
    ddrawSurfaceSetPalette.Rehook();
    ddrawPaletteSetEntries.Rehook();
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:8,代码来源:DDrawCapture.cpp

示例3: InitD3D11Capture

bool InitD3D11Capture()
{
    bool bSuccess = false;

    HMODULE hD3D11Dll = GetModuleHandle(TEXT("d3d11.dll"));
    if(hD3D11Dll)
    {
        D3D11CREATEPROC d3d11Create = (D3D11CREATEPROC)GetProcAddress(hD3D11Dll, "D3D11CreateDeviceAndSwapChain");
        if(d3d11Create)
        {
            DXGI_SWAP_CHAIN_DESC swapDesc;
            ZeroMemory(&swapDesc, sizeof(swapDesc));
            swapDesc.BufferCount = 2;
            swapDesc.BufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
            swapDesc.BufferDesc.Width  = 2;
            swapDesc.BufferDesc.Height = 2;
            swapDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
            swapDesc.OutputWindow = hwndSender;
            swapDesc.SampleDesc.Count = 1;
            swapDesc.Windowed = TRUE;

            IDXGISwapChain *swap;
            ID3D11Device *device;
            ID3D11DeviceContext *context;

            D3D_FEATURE_LEVEL desiredLevel = D3D_FEATURE_LEVEL_11_0;
            D3D_FEATURE_LEVEL receivedLevel;

            HRESULT hErr;
            if(SUCCEEDED(hErr = (*d3d11Create)(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &desiredLevel, 1, D3D11_SDK_VERSION, &swapDesc, &swap, &device, &receivedLevel, &context)))
            {
                bSuccess = true;

                UPARAM *vtable = *(UPARAM**)swap;
                gi11swapPresent.Hook((FARPROC)*(vtable+(32/4)), ConvertClassProcToFarproc((CLASSPROC)&D3D11Override::SwapPresentHook));
                gi11swapResizeBuffers.Hook((FARPROC)*(vtable+(52/4)), ConvertClassProcToFarproc((CLASSPROC)&D3D11Override::SwapResizeBuffersHook));

                SafeRelease(swap);
                SafeRelease(device);
                SafeRelease(context);

                gi11swapPresent.Rehook();
                gi11swapResizeBuffers.Rehook();
            }
        }
    }

    return bSuccess;
}
开发者ID:Erowlin,项目名称:OBS,代码行数:49,代码来源:D3D11Capture.cpp

示例4: Blt

HRESULT STDMETHODCALLTYPE Blt(LPDIRECTDRAWSURFACE7 surface, LPRECT lpDestRect, LPDIRECTDRAWSURFACE7 lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
{
    //logOutput << CurrentTimeString() << "Hooked Blt()" << endl;

    EnterCriticalSection(&ddrawMutex);

    ddrawSurfaceBlt.Unhook();
    HRESULT hr = surface->Blt(lpDestRect, lpDDSrcSurface, lpSrcRect, dwFlags, lpDDBltFx);
    ddrawSurfaceBlt.Rehook();

    if (SUCCEEDED(hr))
    {
        if (!g_bUseFlipMethod)
        {
            if (getFrontSurface(surface))
            {
                CaptureDDraw();
            }
        }
    }

    LeaveCriticalSection(&ddrawMutex);

    return hr;
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:25,代码来源:DDrawCapture.cpp

示例5: CreateSurface

HRESULT STDMETHODCALLTYPE CreateSurface(IDirectDraw7* ddInterface, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE7 *lplpDDSurface, IUnknown *pUnkOuter)
{
    //logOutput << CurrentTimeString() << "Hooked CreateSurface()" << endl;

    if (!g_ddInterface)
    {
        if (ddInterface->QueryInterface(IID_IDirectDraw, (LPVOID*)&g_ddInterface) == S_OK)
        {
            logOutput << CurrentTimeString() << "IDirectDraw::CreateSurface: got DDInterface pointer" << endl;
        }
        else
        {
            logOutput << CurrentTimeString() << "IDirectDraw::CreateSurface: could not query DirectDraw interface" << endl;
        }
    }

    ddrawSurfaceCreate.Unhook();
    HRESULT hRes = ddInterface->CreateSurface(lpDDSurfaceDesc, lplpDDSurface, pUnkOuter);
    ddrawSurfaceCreate.Rehook();

    if (hRes == DD_OK)
    {
        if (lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
        {
            logOutput << CurrentTimeString() << "IDirectDraw::CreateSurface: Primary surface created at 0x" << *lplpDDSurface << endl;
            getFrontSurface(*lplpDDSurface);
        }
    }
    else
        printDDrawError(hRes, "CreateSurface");

    return hRes;
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:33,代码来源:DDrawCapture.cpp

示例6: wglDeleteContextHook

BOOL WINAPI wglDeleteContextHook(HGLRC hRC)
{
    HandleGLSceneDestroy();

    glHookDeleteContext.Unhook();
    BOOL bResult = jimglDeleteContext(hRC);
    glHookDeleteContext.Rehook();

    return bResult;
}
开发者ID:Erowlin,项目名称:OBS,代码行数:10,代码来源:OpenGLCapture.cpp

示例7: SwapBuffersHook

BOOL WINAPI SwapBuffersHook(HDC hDC)
{
    HandleGLSceneUpdate(hDC);

    glHookSwapBuffers.Unhook();
    BOOL bResult = SwapBuffers(hDC);
    glHookSwapBuffers.Rehook(); 

    return bResult;
}
开发者ID:Erowlin,项目名称:OBS,代码行数:10,代码来源:OpenGLCapture.cpp

示例8: wglSwapLayerBuffersHook

BOOL WINAPI wglSwapLayerBuffersHook(HDC hDC, UINT fuPlanes)
{
    HandleGLSceneUpdate(hDC);

    glHookSwapLayerBuffers.Unhook();
    BOOL bResult = jimglSwapLayerBuffers(hDC, fuPlanes);
    glHookSwapLayerBuffers.Rehook();

    return bResult;
}
开发者ID:Erowlin,项目名称:OBS,代码行数:10,代码来源:OpenGLCapture.cpp

示例9: UnlockSurface

inline HRESULT STDMETHODCALLTYPE UnlockSurface(LPDIRECTDRAWSURFACE7 surface, LPRECT data)
{
    //logOutput << CurrentTimeString() << "Called UnlockSurface" << endl;

    // standard handler
    if (!bTargetAcquired)
    {
        ddrawSurfaceUnlock.Unhook();
        HRESULT hr = surface->Unlock(data);
        ddrawSurfaceUnlock.Rehook();
        return hr;
    }

    // use mutex lock to prevent memory corruption when calling Unhook/Rehook from multiple threads
    HANDLE mutex = OpenMutex(SYNCHRONIZE, FALSE, mutexName);
    if (!mutex)
    {
        logOutput << CurrentTimeString() << "Could not open mutex - Error(" << GetLastError() << ')' << endl;
        return DDERR_GENERIC;
    }

    DWORD ret = WaitForSingleObject(mutex, INFINITE);
    if (ret == WAIT_OBJECT_0)
    {
        ddrawSurfaceUnlock.Unhook();
        HRESULT hr = surface->Unlock(data);
        ddrawSurfaceUnlock.Rehook();

        ReleaseMutex(mutex);
        CloseHandle(mutex);
        return hr;
    }
    else
    {
        logOutput << CurrentTimeString() << "error while waiting for unlock-mutex to get signaled" << endl;
        logOutput << CurrentTimeString() << "GetLastError: " << GetLastError() << endl;
        CloseHandle(mutex);
        return DDERR_GENERIC;
    }
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:40,代码来源:DDrawCapture.cpp

示例10: ReloadPrimarySurfacePaletteEntries

    void ReloadPrimarySurfacePaletteEntries()
    {
        if (!primary_surface_palette_ref)
            return;

        HRESULT err;
        ddrawPaletteSetEntries.Unhook();
        if (FAILED(err = primary_surface_palette_ref->SetEntries(0, 0, numEntries, entries)))
        {
            logOutput << CurrentTimeString() << "ReloadPrimarySurfacePaletteEntries(): could not set entires" << endl;
            printDDrawError(err);
        }
        ddrawPaletteSetEntries.Rehook();
    }
开发者ID:CasperGemini,项目名称:OBS,代码行数:14,代码来源:DDrawCapture.cpp

示例11: SetPalette

HRESULT STDMETHODCALLTYPE SetPalette(LPDIRECTDRAWSURFACE7 surface, LPDIRECTDRAWPALETTE lpDDPalette)
{
    //logOutput << CurrentTimeString() << "Hooked SetPalette()" << endl;

    ddrawSurfaceSetPalette.Unhook();
    HRESULT hr = surface->SetPalette(lpDDPalette);
    ddrawSurfaceSetPalette.Rehook();

    if (getFrontSurface(surface))
    {
        if (lpDDPalette)
            lpDDPalette->AddRef();
        SetupPalette(lpDDPalette);
    }

    return hr;
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:17,代码来源:DDrawCapture.cpp

示例12: SwapResizeBuffersHook

    HRESULT STDMETHODCALLTYPE SwapResizeBuffersHook(UINT bufferCount, UINT width, UINT height, DXGI_FORMAT giFormat, UINT flags)
    {
        IDXGISwapChain *swap = (IDXGISwapChain*)this;

        gi11swapResizeBuffers.Unhook();
        HRESULT hRes = swap->ResizeBuffers(bufferCount, width, height, giFormat, flags);
        gi11swapResizeBuffers.Rehook();

        if(lpCurrentSwap == NULL && !bTargetAcquired)
        {
            lpCurrentSwap = swap;
            bTargetAcquired = true;
        }

        if(lpCurrentSwap == swap)
            SetupD3D11(swap);

        return hRes;
    }
开发者ID:Erowlin,项目名称:OBS,代码行数:19,代码来源:D3D11Capture.cpp

示例13: PaletteSetEntries

HRESULT STDMETHODCALLTYPE PaletteSetEntries(LPDIRECTDRAWPALETTE palette, DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries)
{
    //logOutput << CurrentTimeString() << "Hooked SetEntries()" << endl;

    ddrawPaletteSetEntries.Unhook();
    HRESULT hr = palette->SetEntries(dwFlags, dwStartingEntry, dwCount, lpEntries);
    ddrawPaletteSetEntries.Rehook();

    // update buffer palette
    if (SUCCEEDED(hr))
    {
        if (g_CurrentPalette.bInitialized)
        {
            memcpy(g_CurrentPalette.entries + dwStartingEntry, lpEntries, 4 * dwCount); // each entry is 4 bytes if DDCAPS_8BITENTRIES flag is not set
        }
    }

    return hr;
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:19,代码来源:DDrawCapture.cpp

示例14:

HRESULT STDMETHODCALLTYPE D3D11SwapResizeBuffersHook(IDXGISwapChain *swap, UINT bufferCount, UINT width, UINT height, DXGI_FORMAT giFormat, UINT flags)
{
    ClearD3D11Data();
    lpCurrentSwap = NULL;
    lpCurrentDevice = NULL;
    bTargetAcquired = false;

    gi11swapResizeBuffers.Unhook();
    HRESULT hRes = swap->ResizeBuffers(bufferCount, width, height, giFormat, flags);
    gi11swapResizeBuffers.Rehook();

    /*if(lpCurrentSwap == NULL && !bTargetAcquired)
    {
        lpCurrentSwap = swap;
        bTargetAcquired = true;
    }

    if(lpCurrentSwap == swap)
        SetupD3D11(swap);*/

    return hRes;
}
开发者ID:choupachupss,项目名称:OBS,代码行数:22,代码来源:D3D11Capture.cpp

示例15: Restore

HRESULT STDMETHODCALLTYPE Restore(LPDIRECTDRAWSURFACE7 surface)
{
    //logOutput << CurrentTimeString() << "Hooked Restore()" << endl;

    ddrawSurfaceRestore.Unhook();
    HRESULT hr = surface->Restore();

    if (bHasTextures)
    {
        if (surface == g_frontSurface)
        {
            logOutput << CurrentTimeString() << "SurfaceRestore: restoring offscreen buffers" << endl;
            bool success = true;
            for (UINT i = 0; i < NUM_BUFFERS; i++)
            {
                HRESULT err;
                if (FAILED(err = ddCaptures[i]->Restore()))
                {
                    logOutput << CurrentTimeString() << "SurfaceRestore: error restoring offscreen buffer" << endl;
                    printDDrawError(err, "Restore");
                    success = false;
                }
            }
            if (!success)
            {
                CleanUpDDraw();
            }
        }
    }
    ddrawSurfaceRestore.Rehook();

    if (!bHasTextures)
    {
        getFrontSurface(surface);
    }

    return hr;
}
开发者ID:CasperGemini,项目名称:OBS,代码行数:38,代码来源:DDrawCapture.cpp


注:本文中的HookData::Rehook方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。