/// <summary> /// enumerates all Addresses that satisfy this condition: /// +interpreted as the Address of a Python Type Object, the Member tp_type points to the Object itself. /// /// instead of reusing the PyObject class, this method uses a more specialized implementation to achieve lower runtime cost. /// /// the method assumes the objects to be 32Bit aligned. /// </summary> /// <param name="MemoryReader"></param> /// <returns></returns> static public IEnumerable <UInt32> FindCandidatesTypeObjectTypeAddress( IMemoryReader MemoryReader) { var CandidatesAddress = new List <UInt32>(); for (Int64 BlockAddress = 0; BlockAddress < int.MaxValue; BlockAddress += Specialisation_RuntimeCost_BlockSize) { var BlockValues32 = MemoryReader.ReadArray <UInt32>(BlockAddress, Specialisation_RuntimeCost_BlockSize); if (null == BlockValues32) { continue; } for (int InBlockIndex = 0; InBlockIndex < BlockValues32.Length; InBlockIndex++) { var CandidatePointerInBlockAddress = InBlockIndex * 4; var CandidatePointerAddress = BlockAddress + CandidatePointerInBlockAddress; var CandidatePointer = BlockValues32[InBlockIndex]; if (CandidatePointerAddress == Offset_ob_type + CandidatePointer) { yield return(CandidatePointer); } } } }
public PyDictEntry( Int64 BaseAddress, IMemoryReader MemoryReader) { this.BaseAddress = BaseAddress; var Array = MemoryReader.ReadArray <UInt32>(BaseAddress, 12); if (null == Array) { return; } if (0 < Array.Length) { me_hash = Array[0]; } if (1 < Array.Length) { me_key = Array[1]; KeyAsStr = new PyStr(me_key.Value, MemoryReader); } if (2 < Array.Length) { me_value = Array[2]; } }
public static IEnumerable <long> AddressesHoldingValue32Aligned32(this IMemoryReader memoryReader, uint searchedValue, long searchedRegionBegin, long searchedRegionEnd) { if (memoryReader == null) { yield break; } long firstBlockAddress = searchedRegionBegin / 4096 * 4096; long lastBlockAddress = searchedRegionEnd / 4096 * 4096; for (long blockAddress = firstBlockAddress; blockAddress <= lastBlockAddress; blockAddress += 4096) { uint[] blockValues = memoryReader.ReadArray <uint>(blockAddress, 4096); if (blockValues == null) { continue; } for (int inBlockIndex = 0; inBlockIndex < blockValues.Length; inBlockIndex++) { long address = blockAddress + inBlockIndex * 4; if (address >= searchedRegionBegin && searchedRegionEnd >= address && searchedValue == blockValues[inBlockIndex]) { yield return(address); } } } }
public RPC_PROTSEQ_ENDPOINT[] GetProtSeq(IMemoryReader reader) { if (RpcProtseqEndpoint == IntPtr.Zero || RpcProtseqEndpointCount == 0) { return(new RPC_PROTSEQ_ENDPOINT[0]); } return(reader.ReadArray <RPC_PROTSEQ_ENDPOINT>(RpcProtseqEndpoint, RpcProtseqEndpointCount)); }
public MIDL_SYNTAX_INFO[] GetSyntaxInfo(IMemoryReader reader) { if (nCount == IntPtr.Zero || pSyntaxInfo == IntPtr.Zero) { return(new MIDL_SYNTAX_INFO[0]); } return(reader.ReadArray <MIDL_SYNTAX_INFO>(pSyntaxInfo, nCount.ToInt32())); }
public IntPtr[] GetDispatchTable(IMemoryReader reader, int dispatch_count) { if (DispatchTable == IntPtr.Zero) { return(new IntPtr[dispatch_count]); } return(reader.ReadArray <IntPtr>(DispatchTable, dispatch_count)); }
public PyList( Int64 BaseAddress, IMemoryReader MemoryReader) : base(BaseAddress, MemoryReader) { ob_item = MemoryReader.ReadUInt32(BaseAddress + Offset_ob_item); if (ob_item.HasValue && ob_size.HasValue) { Items = MemoryReader.ReadArray <UInt32>(ob_item.Value, (int)ob_size.Value * 4); } }
public static uint?ReadUInt32(this IMemoryReader memoryReader, long address) { if (memoryReader == null) { return(null); } uint[] array = memoryReader.ReadArray <uint>(address, 4); if (array == null) { return(null); } if (array.Length < 1) { return(null); } return(array[0]); }
/// <summary> /// enumerates all Addresses which are aligned to 32Bits and hold the value <paramref name="SearchedValue"/>. /// </summary> /// <param name="MemoryReader"></param> /// <param name="SearchedValue"></param> /// <param name="SearchedRegionBegin"></param> /// <param name="SearchedRegionEnd"></param> /// <returns></returns> static public IEnumerable <Int64> AddressesHoldingValue32Aligned32( this IMemoryReader MemoryReader, UInt32 SearchedValue, Int64 SearchedRegionBegin, Int64 SearchedRegionEnd) { if (null == MemoryReader) { yield break; } var FirstBlockAddress = (SearchedRegionBegin / Static.Specialisation_RuntimeCost_BlockSize) * Static.Specialisation_RuntimeCost_BlockSize; var LastBlockAddress = (SearchedRegionEnd / Static.Specialisation_RuntimeCost_BlockSize) * Static.Specialisation_RuntimeCost_BlockSize; for (Int64 BlockAddress = FirstBlockAddress; BlockAddress <= LastBlockAddress; BlockAddress += Static.Specialisation_RuntimeCost_BlockSize) { var BlockValues = MemoryReader.ReadArray <UInt32>(BlockAddress, Static.Specialisation_RuntimeCost_BlockSize); if (null == BlockValues) { continue; } for (int InBlockIndex = 0; InBlockIndex < BlockValues.Length; InBlockIndex++) { var Address = BlockAddress + (InBlockIndex * 4); if (Address < SearchedRegionBegin || SearchedRegionEnd < Address) { continue; } if (SearchedValue == BlockValues[InBlockIndex]) { yield return(Address); } } } }
public void ReadArray <T>(long pos, T[] value, int offset, int count) where T : struct { reader.ReadArray(pos + this.offset, value, offset, count); }
public IntPtr[] GetDispatchTable(IMemoryReader reader) { return(reader.ReadArray <IntPtr>(DispatchTable, DispatchTableCount)); }