diff --git a/volatility/framework/objects/utility.py b/volatility/framework/objects/utility.py index 187cf515a..fc70c1ce4 100644 --- a/volatility/framework/objects/utility.py +++ b/volatility/framework/objects/utility.py @@ -29,15 +29,15 @@ def pointer_to_string(pointer: objects.Pointer, return char.cast("string", max_length = count, errors = errors) -def array_of_pointers(array: objects.Array, +def array_of_pointers(array: interfaces.objects.ObjectInterface, count: int, - subtype: templates.ObjectTemplate = None, + subtype: typing.Optional[typing.Union[str, templates.ObjectTemplate]] = None, context: interfaces.context.ContextInterface = None) -> interfaces.objects.ObjectInterface: """Takes an object, and recasts it as an array of pointers to subtype""" if isinstance(subtype, str) and context is not None: subtype = context.symbol_space.get_type(subtype) if not isinstance(subtype, templates.ObjectTemplate) or subtype is None: - raise TypeError("Subtype must be a valid object template") + raise TypeError("Subtype must be a valid object template (or string name of an object template)") subtype_pointer = objects.templates.ObjectTemplate(objects.Pointer, type_name = 'pointer', subtype = subtype) return array.cast("array", count = count, subtype = subtype_pointer) diff --git a/volatility/framework/symbols/windows/extensions/__init__.py b/volatility/framework/symbols/windows/extensions/__init__.py index 4e3965db8..459982fce 100644 --- a/volatility/framework/symbols/windows/extensions/__init__.py +++ b/volatility/framework/symbols/windows/extensions/__init__.py @@ -182,7 +182,7 @@ class _MMVAD_SHORT(objects.Struct): if hasattr(self, "u1") and hasattr(self.u1, "VadFlags1"): return self.u1.VadFlags1.CommitCharge - if hasattr(self, "u") and hasattr(self.u, "VadFlags"): + elif hasattr(self, "u") and hasattr(self.u, "VadFlags"): return self.u.VadFlags.CommitCharge elif hasattr(self, "Core"): @@ -193,14 +193,18 @@ class _MMVAD_SHORT(objects.Struct): def get_private_memory(self): """Get the VAD's private memory setting""" - if hasattr(self, "u1") and hasattr(self.u1, "VadFlags1"): + if hasattr(self, "u1") and hasattr(self.u1, "VadFlags1") and hasattr(self.u1.VadFlags1, "PrivateMemory"): return self.u1.VadFlags1.PrivateMemory - if hasattr(self, "u") and hasattr(self.u, "VadFlags"): + elif hasattr(self, "u") and hasattr(self.u, "VadFlags") and hasattr(self.u.VadFlags, "PrivateMemory"): return self.u.VadFlags.PrivateMemory elif hasattr(self, "Core"): - return self.Core.u1.VadFlags1.PrivateMemory + if hasattr(self.Core, "u1") and hasattr(self.Core.u1, "VadFlags1") and hasattr(self.Core.u1.VadFlags1, "PrivateMemory"): + return self.Core.u1.VadFlags1.PrivateMemory + + elif hasattr(self.Core, "u") and hasattr(self.Core.u, "VadFlags") and hasattr(self.Core.u.VadFlags, "PrivateMemory"): + return self.Core.u.VadFlags.PrivateMemory raise AttributeError("Unable to find the private memory member")