Skip to content

Commit a010023

Browse files
committed
Update \CVTMHookBase\ call methods
1 parent c92619b commit a010023

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

include/dynlibutils/vthook.hpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,23 @@ class CVTMHookBase
317317
return m_storage.emplace(pVTable, std::move(vth));
318318
}
319319

320+
template<typename R, typename C, typename ...Args>
321+
R Call(C pThis, Args... args)
322+
{
323+
auto found = Find(CVirtualTable(pThis));
324+
325+
if (found.first == found.second)
326+
{
327+
return {};
328+
}
329+
330+
return found.first->second.Call(pThis, args...);
331+
}
332+
320333
// Returns a vector containing the return values from each hook’s Call() invocation,
321334
// in order of insertion. If no hooks were found for that vtable, returns an empty vector.
322335
template<typename R, typename C, typename ...Args>
323-
std::vector<R> Call(C pThis, Args... args)
336+
std::vector<R> CallAll(C pThis, Args... args)
324337
{
325338
std::vector<R> results;
326339

@@ -343,7 +356,7 @@ class CVTMHookBase
343356

344357
// Returns true if at least one hook was executed; false if no hooks were found for that vtable.
345358
template<typename C, typename ...Args>
346-
bool CallNoReturn(C pThis, Args... args)
359+
bool CallAllNoReturn(C pThis, Args... args)
347360
{
348361
auto found = Find(CVirtualTable(pThis));
349362

0 commit comments

Comments
 (0)