@@ -170,13 +170,13 @@ CFunction::CFunction(unsigned long ulAddr, object oCallingConvention, object oAr
170
170
}
171
171
172
172
CFunction::CFunction (unsigned long ulAddr, Convention_t eCallingConvention,
173
- int iCallingConvention, ICallingConvention* pCallingConvention, tuple tArgs,
174
- DataType_t eReturnType, object oConverter)
173
+ int iCallingConvention, tuple tArgs, DataType_t eReturnType, object oConverter)
175
174
:CPointer(ulAddr)
176
175
{
177
176
m_eCallingConvention = eCallingConvention;
178
177
m_iCallingConvention = iCallingConvention;
179
- m_pCallingConvention = pCallingConvention;
178
+ m_pCallingConvention = NULL ;
179
+ m_oCallingConvention = object ();
180
180
181
181
// We didn't allocate the calling convention, someone else is responsible for it.
182
182
m_bAllocatedCallingConvention = false ;
@@ -218,6 +218,16 @@ bool CFunction::IsHooked()
218
218
return GetHookManager ()->FindHook ((void *) m_ulAddr) != NULL ;
219
219
}
220
220
221
+ CFunction* CFunction::GetTrampoline ()
222
+ {
223
+ CHook* pHook = GetHookManager ()->FindHook ((void *) m_ulAddr);
224
+ if (!pHook)
225
+ BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Function was not hooked." )
226
+
227
+ return new CFunction ((unsigned long ) pHook->m_pTrampoline , m_eCallingConvention,
228
+ m_iCallingConvention, m_tArgs, m_eReturnType, m_oConverter);
229
+ }
230
+
221
231
template <class ReturnType , class Function >
222
232
ReturnType CallHelper (Function func, DCCallVM* vm, unsigned long addr)
223
233
{
@@ -312,35 +322,14 @@ object CFunction::Call(tuple args, dict kw)
312
322
return object ();
313
323
}
314
324
315
- object CFunction::CallTrampoline (tuple args, dict kw)
316
- {
317
- if (!IsCallable ())
318
- BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Function is not callable." )
319
-
320
- Validate ();
321
- CHook* pHook = GetHookManager ()->FindHook ((void *) m_ulAddr);
322
- if (!pHook)
323
- BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Function was not hooked." )
324
-
325
- return CFunction ((unsigned long ) pHook->m_pTrampoline , m_eCallingConvention,
326
- m_iCallingConvention, m_pCallingConvention, m_tArgs, m_eReturnType, m_oConverter).Call (args, kw);
327
- }
328
-
329
325
object CFunction::SkipHooks (tuple args, dict kw)
330
- {
331
- if (IsHooked ())
332
- return CallTrampoline (args, kw);
333
-
334
- return Call (args, kw);
335
- }
336
-
337
- unsigned long CFunction::GetTrampolineAddress ()
338
326
{
339
327
CHook* pHook = GetHookManager ()->FindHook ((void *) m_ulAddr);
340
- if (!pHook)
341
- BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Function was not hooked." )
328
+ if (pHook)
329
+ return CFunction ((unsigned long ) pHook->m_pTrampoline , m_eCallingConvention,
330
+ m_iCallingConvention, m_tArgs, m_eReturnType, m_oConverter).Call (args, kw);
342
331
343
- return ( unsigned long ) pHook-> m_pTrampoline ;
332
+ return Call (args, kw) ;
344
333
}
345
334
346
335
CHook* HookFunctionHelper (void * addr, ICallingConvention* pConv)
0 commit comments