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

Function as_unsigned_buffer

pythonmemorymodule/__init__.py:442–457  ·  view source on GitHub ↗
(sz=None, indata=None)

Source from the content-addressed store, hash-verified

440PMEMORYMODULE = POINTER(MEMORYMODULE)
441
442def as_unsigned_buffer(sz=None, indata=None):
443 if sz is None:
444 if indata is None:
445 raise Exception('Must specify initial data or a buffer size.')
446 sz = len(indata)
447 rtype = (c_ubyte * sz)
448 if indata is None:
449 return rtype
450 else:
451 tindata = type(indata)
452 if tindata in [ int, int ]:
453 return rtype.from_address(indata)
454 elif tindata in [ c_void_p, DWORD, POINTER_TYPE ] or hasattr(indata, 'value') and type(indata.value) in [ int, int ]:
455 return rtype.from_address(indata.value)
456 else:
457 return rtype.from_address(addressof(indata))
458
459def create_unsigned_buffer(sz, indata):
460 res = as_unsigned_buffer(sz)()

Callers 1

create_unsigned_bufferFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected