(sz=None, indata=None)
| 440 | PMEMORYMODULE = POINTER(MEMORYMODULE) |
| 441 | |
| 442 | def 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 | |
| 459 | def create_unsigned_buffer(sz, indata): |
| 460 | res = as_unsigned_buffer(sz)() |
no outgoing calls
no test coverage detected