| 62 | } |
| 63 | |
| 64 | bool LoadRenderDoc() |
| 65 | { |
| 66 | LONG error = ERROR_SUCCESS; |
| 67 | |
| 68 | // Open the libraries key |
| 69 | char keyPath[MAX_PATH] = { "RenderDoc.RDCCapture.1\\DefaultIcon" }; |
| 70 | HKEY iconKey; |
| 71 | error = RegOpenKeyExA(HKEY_CLASSES_ROOT, keyPath, 0, KEY_READ, &iconKey); |
| 72 | if (error != ERROR_SUCCESS) |
| 73 | return false; |
| 74 | |
| 75 | // Get the default library |
| 76 | char path[MAX_PATH]; |
| 77 | DWORD length = MAX_PATH; |
| 78 | error = RegQueryValueExA(iconKey, "", NULL, NULL, (PBYTE)path, &length); |
| 79 | RegCloseKey(iconKey); |
| 80 | if (error != ERROR_SUCCESS) |
| 81 | return false; |
| 82 | |
| 83 | if (path[0] == '\0') |
| 84 | return false; |
| 85 | |
| 86 | strcpy(strrchr(path, '\\') + 1, "renderdoc.dll"); |
| 87 | return LoadLibraryA(path) != NULL; |
| 88 | } |
| 89 | |
| 90 | void AttachDetours(); |
| 91 | void DetachDetours(); |