win-capture: Hook Reset/ResetEx in Present* funcs

The virtual address table values for Reset/ResetEx can sometimes point
to functions that are in libraries outside of D3D8.dll and D3D9.dll, and
will cause a crash if used.  Instead, just hook Reset/ResetEx when one
of the Present* functions are called.
This commit is contained in:
jp9000
2015-11-20 09:32:44 -08:00
parent d1cbb2742e
commit 1755511b2f
8 changed files with 55 additions and 40 deletions

View File

@@ -76,7 +76,6 @@ void get_d3d8_offsets(struct d3d8_offsets *offsets)
if (success) {
offsets->present = vtable_offset(info.module, info.device, 15);
offsets->reset = vtable_offset(info.module, info.device, 14);
}
d3d8_free(info);

View File

@@ -87,11 +87,8 @@ void get_d3d9_offsets(struct d3d9_offsets *offsets)
if (success) {
offsets->present = vtable_offset(info.module, info.device, 17);
offsets->reset = vtable_offset(info.module, info.device, 16);
offsets->present_ex = vtable_offset(info.module, info.device,
121);
offsets->reset_ex = vtable_offset(info.module, info.device,
132);
offsets->present_swap = vtable_offset(info.module, info.swap,
3);
}

View File

@@ -27,13 +27,10 @@ int main(int argc, char *argv[])
printf("[d3d8]\n");
printf("present=0x%"PRIx32"\n", d3d8.present);
printf("reset=0x%"PRIx32"\n", d3d8.reset);
printf("[d3d9]\n");
printf("present=0x%"PRIx32"\n", d3d9.present);
printf("present_ex=0x%"PRIx32"\n", d3d9.present_ex);
printf("present_swap=0x%"PRIx32"\n", d3d9.present_swap);
printf("reset=0x%"PRIx32"\n", d3d9.reset);
printf("reset_ex=0x%"PRIx32"\n", d3d9.reset_ex);
printf("[dxgi]\n");
printf("present=0x%"PRIx32"\n", dxgi.present);
printf("resize=0x%"PRIx32"\n", dxgi.resize);