Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse(t, buff):
mhd = MinidumpHandleDescriptor()
mhd.Handle = t.Handle
if t.TypeNameRva != 0:
mhd.TypeName = MINIDUMP_STRING.get_from_rva(t.TypeNameRva, buff)
if t.ObjectNameRva != 0:
mhd.ObjectName = MINIDUMP_STRING.get_from_rva(t.ObjectNameRva, buff)
mhd.Attributes = t.Attributes
mhd.GrantedAccess = t.GrantedAccess
mhd.HandleCount = t.HandleCount
mhd.PointerCount = t.PointerCount
if isinstance(t, MINIDUMP_HANDLE_DESCRIPTOR_2):
if t.ObjectInfoRva is not None and t.ObjectInfoRva != 0:
MinidumpHandleDescriptor.walk_objectinfo(mhd, t.ObjectInfoRva, buff)
return mhd
def parse(dir, buff):
t = MinidumpHandleDataStream()
buff.seek(dir.Location.Rva)
chunk = io.BytesIO(buff.read(dir.Location.DataSize))
t.header = MINIDUMP_HANDLE_DATA_STREAM.parse(chunk)
for _ in range(t.header.NumberOfDescriptors):
if t.header.SizeOfDescriptor == MINIDUMP_HANDLE_DESCRIPTOR.size:
mhd = MINIDUMP_HANDLE_DESCRIPTOR.parse(chunk)
t.handles.append(MinidumpHandleDescriptor.parse(mhd, buff))
else:
mhd = MINIDUMP_HANDLE_DESCRIPTOR_2.parse(chunk)
t.handles.append(MinidumpHandleDescriptor.parse(mhd, buff))
return t
def parse(t, buff):
mhd = MinidumpHandleDescriptor()
mhd.Handle = t.Handle
if t.TypeNameRva != 0:
mhd.TypeName = MINIDUMP_STRING.get_from_rva(t.TypeNameRva, buff)
if t.ObjectNameRva != 0:
mhd.ObjectName = MINIDUMP_STRING.get_from_rva(t.ObjectNameRva, buff)
mhd.Attributes = t.Attributes
mhd.GrantedAccess = t.GrantedAccess
mhd.HandleCount = t.HandleCount
mhd.PointerCount = t.PointerCount
if isinstance(t, MINIDUMP_HANDLE_DESCRIPTOR_2):
if t.ObjectInfoRva is not None and t.ObjectInfoRva != 0:
MinidumpHandleDescriptor.walk_objectinfo(mhd, t.ObjectInfoRva, buff)
return mhd