Fix global hook shim referencing removed functions

* It was still pointing at old functions, which have since been removed.
This commit is contained in:
baldurk
2017-06-28 11:24:02 +01:00
parent eb5a3f64d1
commit f190f9af06
4 changed files with 29 additions and 15 deletions
+7 -3
View File
@@ -1038,9 +1038,13 @@ void Process::StartGlobalHook(const char *pathmatch, const char *logfile, const
wstring wlogfile = logfile == NULL ? L"" : StringFormat::UTF82Wide(string(logfile));
wstring wpathmatch = StringFormat::UTF82Wide(string(pathmatch));
_snwprintf_s(paramsAlloc, 2047, 2047,
L"\"%ls\" globalhook --match \"%ls\" --log \"%ls\" --capopts \"%hs\"", renderdocPath,
wpathmatch.c_str(), wlogfile.c_str(), optstr.c_str());
std::string debugLogfile = RDCGETLOGFILE();
wstring wdebugLogfile = StringFormat::UTF82Wide(debugLogfile);
_snwprintf_s(
paramsAlloc, 2047, 2047,
L"\"%ls\" globalhook --match \"%ls\" --logfile \"%ls\" --debuglog \"%ls\" --capopts \"%hs\"",
renderdocPath, wpathmatch.c_str(), wlogfile.c_str(), wdebugLogfile.c_str(), optstr.c_str());
paramsAlloc[2047] = 0;
+6 -3
View File
@@ -678,7 +678,8 @@ struct GlobalHookCommand : public Command
virtual void AddOptions(cmdline::parser &parser)
{
parser.add<string>("match", 0, "");
parser.add<string>("log", 0, "");
parser.add<string>("logfile", 0, "");
parser.add<string>("debuglog", 0, "");
parser.add<string>("capopts", 0, "");
}
virtual const char *Description() { return "Internal use only!"; }
@@ -687,7 +688,8 @@ struct GlobalHookCommand : public Command
virtual int Execute(cmdline::parser &parser, const CaptureOptions &)
{
string pathmatch = parser.get<string>("match");
string log = parser.get<string>("log");
string logfile = parser.get<string>("logfile");
string debuglog = parser.get<string>("debuglog");
CaptureOptions cmdopts;
readCapOpts(parser.get<string>("capopts").c_str(), &cmdopts);
@@ -764,7 +766,8 @@ struct GlobalHookCommand : public Command
wcsncpy_s(shimdata->pathmatchstring, wpathmatch.c_str(), _TRUNCATE);
wcsncpy_s(shimdata->rdocpath, rdocpath, _TRUNCATE);
strncpy_s(shimdata->log, log.c_str(), _TRUNCATE);
strncpy_s(shimdata->logfile, logfile.c_str(), _TRUNCATE);
strncpy_s(shimdata->debuglog, debuglog.c_str(), _TRUNCATE);
memcpy(shimdata->opts, &cmdopts, sizeof(CaptureOptions));
static_assert(sizeof(CaptureOptions) <= sizeof(shimdata->opts),
+14 -8
View File
@@ -35,8 +35,9 @@
#include <windows.h>
struct CaptureOptions;
typedef void(__cdecl *pRENDERDOC_SetCaptureOptions)(const CaptureOptions *opts);
typedef void(__cdecl *pRENDERDOC_SetLogFile)(const char *logfile);
typedef void(__cdecl *pINTERNAL_SetCaptureOptions)(const CaptureOptions *opts);
typedef void(__cdecl *pINTERNAL_SetLogFile)(const char *logfile);
typedef void(__cdecl *pRENDERDOC_SetDebugLogFile)(const char *logfile);
#if defined(RELEASE)
#define LOGPRINT(txt) \
@@ -113,16 +114,21 @@ void CheckHook()
if(mod)
{
pRENDERDOC_SetCaptureOptions setopts =
(pRENDERDOC_SetCaptureOptions)GetProcAddress(mod, "RENDERDOC_SetCaptureOptions");
pRENDERDOC_SetLogFile setlog =
(pRENDERDOC_SetLogFile)GetProcAddress(mod, "RENDERDOC_SetLogFile");
pINTERNAL_SetCaptureOptions setopts =
(pINTERNAL_SetCaptureOptions)GetProcAddress(mod, "INTERNAL_SetCaptureOptions");
pINTERNAL_SetLogFile setlogfile =
(pINTERNAL_SetLogFile)GetProcAddress(mod, "INTERNAL_SetLogFile");
pRENDERDOC_SetDebugLogFile setdebuglog =
(pRENDERDOC_SetDebugLogFile)GetProcAddress(mod, "RENDERDOC_SetDebugLogFile");
if(setopts)
setopts((const CaptureOptions *)data->opts);
if(setlog && data->log[0])
setlog(data->log);
if(setlogfile && data->logfile[0])
setlogfile(data->logfile);
if(setdebuglog && data->debuglog[0])
setdebuglog(data->debuglog);
}
}
else
+2 -1
View File
@@ -26,7 +26,8 @@ struct ShimData
{
wchar_t pathmatchstring[2048];
wchar_t rdocpath[2048];
char log[2048];
char debuglog[2048];
char logfile[2048];
unsigned char opts[512];
};