Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hacker <dd0t@users.sourceforge.net>2011-03-01 07:19:20 +0300
committerStefan Hacker <dd0t@users.sourceforge.net>2011-03-04 02:48:23 +0300
commit05096f71cc2c1286dd3a3bfe7b443b6d52bdf950 (patch)
tree317bd037c8b1aba2955b0fb4dbda0fe52e022c3a /overlay/d3d10.cpp
parent630d71267d77348199acf4192488231118d982d9 (diff)
Add some comments to hooking code
Diffstat (limited to 'overlay/d3d10.cpp')
-rw-r--r--overlay/d3d10.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/overlay/d3d10.cpp b/overlay/d3d10.cpp
index 0057c1bad..34d6b05e5 100644
--- a/overlay/d3d10.cpp
+++ b/overlay/d3d10.cpp
@@ -587,6 +587,11 @@ void checkDXGIHook(bool preonly) {
}
extern "C" __declspec(dllexport) void __cdecl PrepareDXGI() {
+ // This function is called by the Mumble client in Mumble's scope
+ // mainly to extract the offsets of various functions in the IDXGISwapChain
+ // and IDXGIObject interfaces that need to be hooked in target
+ // applications. The data is stored in the dxgi shared memory structure.
+
if (! dxgi)
return;
@@ -603,7 +608,7 @@ extern "C" __declspec(dllexport) void __cdecl PrepareDXGI() {
memset(&ovi, 0, sizeof(ovi));
ovi.dwOSVersionInfoSize = sizeof(ovi);
GetVersionExW(reinterpret_cast<OSVERSIONINFOW *>(&ovi));
- if ((ovi.dwMajorVersion >= 7) || ((ovi.dwMajorVersion == 6) && (ovi.dwBuildNumber >= 6001))) {
+ if ((ovi.dwMajorVersion >= 7) || ((ovi.dwMajorVersion == 6) && (ovi.dwBuildNumber >= 6001))) { // Make sure this is vista or greater as quite a number of <=WinXP users have fake DX10 libs installed
HMODULE hD3D10 = LoadLibrary("D3D10.DLL");
HMODULE hDXGI = LoadLibrary("DXGI.DLL");
@@ -660,6 +665,8 @@ extern "C" __declspec(dllexport) void __cdecl PrepareDXGI() {
if (pDevice && pSwapChain) {
HMODULE hRef;
+ // For VC++ the vtable is located at the base addr. of the object and each function entry is a single pointer. Since p.e. the base classes
+ // of IDXGISwapChain have a total of 8 functions the 8+Xth entry points to the Xth added function in the derived interface.
void ***vtbl = (void ***) pSwapChain;
void *pPresent = (*vtbl)[8];
if (! GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (char *) pPresent, &hRef)) {