| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f778975 commit 08635a3
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -316,9 +316,7 @@ class MemberFunction(Function): | |||
| 316 | 316 | def __init__(self, manager, return_type, func, this): | |
| 317 | 317 | """Initialize the instance.""" | |
| 318 | 318 | self._function = func | |
| 319 | - super().__init__( | ||
| 320 | - func.address, func.convention, func.arguments, func.return_type | ||
| 321 | - ) | ||
| 319 | + super().__init__(func) | ||
| 322 | 320 | ||
| 323 | 321 | # This should always hold a TypeManager instance | |
| 324 | 322 | self._manager = manager | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -179,6 +179,29 @@ CFunction::CFunction(unsigned long ulAddr, Convention_t eCallingConvention, | |||
| 179 | 179 | m_oConverter = oConverter; | |
| 180 | 180 | } | |
| 181 | 181 | ||
| 182 | + CFunction::CFunction(const CFunction& obj) | ||
| 183 | + :CPointer(obj) | ||
| 184 | + { | ||
| 185 | + m_tArgs = obj.m_tArgs; | ||
| 186 | + m_eReturnType = obj.m_eReturnType; | ||
| 187 | + m_oConverter = obj.m_oConverter; | ||
| 188 | + | ||
| 189 | + m_eCallingConvention = obj.m_eCallingConvention; | ||
| 190 | + m_iCallingConvention = obj.m_iCallingConvention; | ||
| 191 | + | ||
| 192 | + if (m_eCallingConvention != CONV_CUSTOM) | ||
| 193 | + { | ||
| 194 | + m_pCallingConvention = MakeDynamicHooksConvention(m_eCallingConvention, ObjectToDataTypeVector(m_tArgs), m_eReturnType); | ||
| 195 | + m_oCallingConvention = object(); | ||
| 196 | + } | ||
| 197 | + else | ||
| 198 | + { | ||
| 199 | + m_pCallingConvention = obj.m_pCallingConvention; | ||
| 200 | + m_oCallingConvention = obj.m_oCallingConvention; | ||
| 201 | + Py_INCREF(m_oCallingConvention.ptr()); | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + | ||
| 182 | 205 | CFunction::~CFunction() | |
| 183 | 206 | { | |
| 184 | 207 | if (!m_pCallingConvention) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,13 +53,15 @@ enum Convention_t | |||
| 53 | 53 | // ============================================================================ | |
| 54 | 54 | // >> CFunction | |
| 55 | 55 | // ============================================================================ | |
| 56 | - class CFunction: public CPointer, private boost::noncopyable | ||
| 56 | + class CFunction: public CPointer | ||
| 57 | 57 | { | |
| 58 | 58 | public: | |
| 59 | 59 | CFunction(unsigned long ulAddr, object oCallingConvention, object oArgs, object oReturnType); | |
| 60 | 60 | CFunction(unsigned long ulAddr, Convention_t eCallingConvention, int iCallingConvention, | |
| 61 | 61 | boost::python::tuple tArgs, DataType_t eReturnType, object oConverter); | |
| 62 | 62 | ||
| 63 | + CFunction(const CFunction& obj); | ||
| 64 | + | ||
| 63 | 65 | ~CFunction(); | |
| 64 | 66 | ||
| 65 | 67 | bool IsCallable(); | |
@@ -105,7 +107,6 @@ class CFunction: public CPointer, private boost::noncopyable | |||
| 105 | 107 | ||
| 106 | 108 | // DynamicHooks calling convention (built-in and custom) | |
| 107 | 109 | ICallingConvention* m_pCallingConvention; | |
| 108 | - bool m_bAllocatedCallingConvention; | ||
| 109 | 110 | ||
| 110 | 111 | // Custom calling convention | |
| 111 | 112 | object m_oCallingConvention; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -453,9 +453,9 @@ void export_type_info_iter(scope _memory) | |||
| 453 | 453 | // ============================================================================ | |
| 454 | 454 | void export_function(scope _memory) | |
| 455 | 455 | { | |
| 456 | - class_<CFunction, bases<CPointer>, boost::noncopyable >("Function", init<unsigned long, object, object, object>()) | ||
| 457 | - // Don't allow copies, because they will hold references to our calling convention. | ||
| 458 | - // .def(init<CFunction&>()) | ||
| 456 | + class_<CFunction, bases<CPointer> >("Function", init<unsigned long, object, object, object>()) | ||
| 457 | + .def(init<CFunction&>()) | ||
| 458 | + | ||
| 459 | 459 | .def("__call__", | |
| 460 | 460 | raw_method(&CFunction::Call), | |
| 461 | 461 | "Calls the function dynamically." | |
| Back | FazBrowse Home | New Git URL |
0 commit comments