OpenGL/DirectX 钩子 - 类似于 FRAPS [英] OpenGL/DirectX Hook - Similar to FRAPS

查看:46
本文介绍了OpenGL/DirectX 钩子 - 类似于 FRAPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以像 FRAPS 那样检测哪些应用程序正在使用 OpenGL 或 DirectX?(可能使用某种形式的钩子)?我可能不需要实际绘制到窗口,我只需要知道目前哪些进程正在执行某种形式的 3D 渲染.

Is it possible to detect what applications are using OpenGL or DirectX similar to what FRAPS does? (Possibly using some form of hook)? I probably won't need to actually draw to the window, I just need to know what processes are doing some form of 3D rendering for the time being.

()如果您不熟悉它,FRAPS 是一个可用于在 3D 应用程序上绘制每秒帧数"计数器的程序.FRAPS 会自行查找所有正在运行的 3D 应用程序,而无需您指定进程名称.

() In case you are not familiar with it, FRAPS is a program that can be used to draw a "Frame-per-second" counter on a 3D application. FRAPS finds all running 3D applications by itself without needing you to specify the process name.

绘制到外部游戏的每秒帧数"计数器示例:

Example of "Frame Per second" counter drawn to external game:

推荐答案

可能最简单的方法是检查 OpenGL 和 DirectX 核心库是否存在,在驱动程序中添加 OGL dll 可能也是一个好主意(例如 nvogl),这可以通过 EnumProcesses &EnumProcessModulesEx,使用 p/invoke,这至少会为您提供可能使用 OGL 或 DX 的一组起始流程.

Probably the simplest way is to check for the presence of the OpenGL and DirectX core libraries, probably also a good idea to add in the driver OGL dlls in too (such as nvogl), this can be done via EnumProcesses & EnumProcessModulesEx, using p/invoke, this will at least give you a starting set of processes possibly using OGL or DX.

当然,有些应用程序加载了这两个 API 并且只使用了一个,或者只是有条件地使用GFX API 之一(尽管后者只出现在专用工具等中),为此,IMO,检查的最佳方法是执行某种形式的注入或者像调试器一样附加到进程,然后为 DX 连接 Present 或为 OGL 连接 wglSwapBuffers.

Of course some applications load both of the API's and use only one, or only conditionally use one of the GFX API's (though the latter only occurs with specialized tools and the like), for this, IMO, the best way to check is to perform some form of injection or attaching to the process like a debugger would, then hooking either Present for DX or wglSwapBuffers for OGL.

通过枚举 GDI 句柄并寻找 DXGI 或 OGL 渲染上下文,您可能会逃避不使用钩子,我不知道这有多可行.

You might be about to get away with not using a hook by enumerating the GDI handles and looking for the DXGI or OGL render contexts, how viable this is, I don't know.

这篇关于OpenGL/DirectX 钩子 - 类似于 FRAPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆