Skip to content

Commit 3d35071

Browse files
committed
Fixed CCallback
1 parent 9e318af commit 3d35071

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/core/modules/memory/memory_callback.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ CCallback::CCallback(object oCallback, Convention_t eConv, tuple args, ReturnTyp
7676
case SIGCHAR_STRING: pCallCallbackFunc = GET_CALLBACK_CALLER(char *); break;
7777
default: BOOST_RAISE_EXCEPTION(PyExc_ValueError, "Unknown return type.");
7878
}
79-
79+
8080
// Generate the function
8181
Assembler a;
8282

@@ -134,15 +134,16 @@ int CCallback::GetPopSize()
134134

135135
int CCallback::GetArgumentOffset(int iIndex)
136136
{
137-
int offset = 8;
137+
int offset = 4;
138138
for(int i=0; i <= iIndex; i++)
139139
{
140140
offset += GetTypeSize(extract<Argument_t>(m_Args[i]));
141141
}
142142

143143
// Subtract the this pointer on Windows
144144
#ifdef _WIN32
145-
offset -= sizeof(void *);
145+
if (m_eConv == CONV_THISCALL)
146+
offset -= sizeof(void *);
146147
#endif
147148

148149
return offset;

src/core/modules/memory/memory_tools.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ handle<> CFunction::AddHook(DynamicHooks::HookType_t eType, PyObject* pCallable)
280280

281281
// Generate the argument string
282282
char* szParams = extract<char*>(eval("lambda args, ret: ''.join(map(chr, args)) + ')' + chr(ret)")(m_Args, m_ReturnType));
283-
puts(szParams);
284283

285284
// Hook the function
286285
CHook* pHook = g_pHookMngr->HookFunction((void *) m_ulAddr, m_eConv, strdup(szParams));

0 commit comments

Comments
 (0)