MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / get_index_of_method

Method get_index_of_method

windows/com.py:299–306  ·  view source on GitHub ↗
(self, method)

Source from the content-addressed store, hash-verified

297 IMPLEMENT = None
298
299 def get_index_of_method(self, method):
300 # This code is horrible but not totally my fault
301 # the PyCFuncPtrObject->index is not exposed to Python..
302 # repr is: '<COM method offset 2: WinFunctionType at 0x035DDBE8>'
303 rpr = repr(method)
304 if not rpr.startswith("<COM method offset ") or ":" not in rpr:
305 raise ValueError("Could not extract offset of {0}".format(rpr))
306 return int(rpr[len("<COM method offset "): rpr.index(":")])
307
308 def extract_methods_order(self, interface):
309 index_and_method = sorted((self.get_index_of_method(m),name, m) for name, m in interface._functions_.items())

Callers 1

extract_methods_orderMethod · 0.95

Calls 1

indexMethod · 0.80

Tested by

no test coverage detected