编辑:由于我收到了一些关于如何实际使用 Detour API 的 PM,这里有一个简单的例子。
请注意,所使用的地址来自 WoW。对 DXDevice 使用正确的地址应该会产生相同的结果。
(Well, since Shynd released his BlackMagic library for out of process work, I figured I'd release my own little library, for in process work.
Aptly named: WhiteMagic. (My creativity is awesome isn't it?)
Anyhow... this library is aimed towards users who inject their .NET applications into processes. It provides ways to hook/detour functions, create memory patches, find patterns (via my FindPatternSharp stuff), as well as read/write memory (basic datatypes, structs, etc).
It's released under the GPLv3 license (so you silly commercial people can't just go stealing code all willy nilly like).
The API is fairly well rounded, with only 1 class instantiation required (or omitted if you choose), and you can do pretty much everything from there.
Anyhow, I'm not releasing an example with this, because... if you don't know how to use it properly... you shouldn't be using it at all.
HOWEVER, I will answer questions based on API troubles and the like. Other than that, it's up to you to figure out.
The code is commented, and will throw more than enough exceptions to make sure you code is kept in line of requirements. (Eg; proper attributes, etc)
Edit: Since I got a few PMs about how to actually use the Detour API, here's a quick example.
Please note, the addresses used, are from WoW. Using the proper addresses to your DXDevice should produce the same results.)