Skip to content

Instantly share code, notes, and snippets.

@neikeq
Created August 15, 2017 05:06
Show Gist options
  • Select an option

  • Save neikeq/2cf9981c2e019093be987eeadc88e19f to your computer and use it in GitHub Desktop.

Select an option

Save neikeq/2cf9981c2e019093be987eeadc88e19f to your computer and use it in GitHub Desktop.
def qedit__String(d, value, data):
val = d.fromNativeValue(value)
d.call('Error', val, 'resize', str(len(data) + 1))
d.setValues(val['_ptr'].extractPointer(), 'wchar_t', [ord(c) for c in data] + [ 0 ])
def qform__String():
return [SimpleFormat, SeparateFormat]
def qdump__String(d, value):
charType = d.lookupType('wchar_t')
charSize = charType.size()
data = value['_ptr']
size_raw = d.readRawMemory(data.dereference().address() - 4, 4)
size = int.from_bytes(size_raw[0:4], byteorder='little')
d.putCharArrayHelper(data.extractPointer(), size - 1, charType, d.currentItemFormat())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment