/// <summary> /// Called when the scan updates. /// </summary> /// <param name="cancellationToken">The cancellation token for handling canceled tasks.</param> protected override void OnUpdate(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ValidatedPointers validatedPointers = new ValidatedPointers(); Int64 processedPointers = 0; // Enumerate all discovered pointers and determine if they have a valid target address foreach (PointerItem pointerItem in this.DiscoveredPointers) { pointerItem.Update(); if (pointerItem.CalculatedAddress.ToUInt64() == this.TargetAddress) { validatedPointers.Pointers.Add(pointerItem); } // Update scan progress if (Interlocked.Increment(ref processedPointers) % 1024 == 0) { this.UpdateProgress(processedPointers, this.DiscoveredPointers.Count.ToInt64(), canFinalize: false); } } this.DiscoveredPointers = validatedPointers; }
/// <summary> /// Called when the scan updates. /// </summary> /// <param name="cancellationToken">The cancellation token for handling canceled tasks.</param> protected override void OnUpdate(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ValidatedPointers validatedPointers = new ValidatedPointers(); Int64 processedPointers = 0; // Enumerate all discovered pointers and determine if they have a valid target address foreach (PointerItem pointerItem in this.DiscoveredPointers) { pointerItem.Update(); // TODO: This is not particularly sustainable/performant. This will fall apart for floats/doubles where we want nearly-equal values (ie 3.4444 and 3.4443) // Ideally we want something similar to how we do scans with the SnapShotElementIterator with the call to Compare(). // One solution would be to create a snapshot from all of the discovered pointers so that we could leverage the SnapshotElementIterator compare functions, // But this creates the technical challenge of associating the pointer item with an element in the snapshot. // Also, we need to update the data type of these pointer items to match the current pointer scan results data times. if (pointerItem.AddressValue?.Equals(this.Value) ?? false) { validatedPointers.Pointers.Add(pointerItem); } // Update scan progress if (Interlocked.Increment(ref processedPointers) % 1024 == 0) { this.UpdateProgress(processedPointers, this.DiscoveredPointers.Count.ToInt64(), canFinalize: false); } } this.DiscoveredPointers = validatedPointers; }
/// <summary> /// Called when the scan updates. /// </summary> /// <param name="cancellationToken">The cancellation token for handling canceled tasks.</param> protected override void OnUpdate(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ValidatedPointers validatedPointers = new ValidatedPointers(); Int32 processedPointers = 0; Snapshot snapshot = SnapshotManagerViewModel.GetInstance().GetSnapshot(SnapshotManagerViewModel.SnapshotRetrievalMode.FromUserModeMemory); // Enumerate all discovered pointers and determine if they have a valid target address foreach (PointerItem pointerItem in this.DiscoveredPointers) { pointerItem.Update(); if (pointerItem.CalculatedAddress != IntPtr.Zero && snapshot.ContainsAddress(pointerItem.CalculatedAddress.ToUInt64())) { validatedPointers.Pointers.Add(pointerItem); } // Update scan progress if (Interlocked.Increment(ref processedPointers) % 1024 == 0) { this.UpdateProgress(processedPointers, this.DiscoveredPointers.Count.ToInt32(), canFinalize: false); } } this.DiscoveredPointers = validatedPointers; }
/// <summary> /// Called when the scan updates. /// </summary> /// <param name="cancellationToken">The cancellation token for handling canceled tasks.</param> protected override void OnUpdate(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ValidatedPointers validatedPointers = new ValidatedPointers(); // Enumerate all discovered pointers and determine if they have a valid target address foreach (PointerItem pointerItem in this.DiscoveredPointers) { if (pointerItem.CalculatedAddress.ToUInt64() == this.TargetAddress) { validatedPointers.Pointers.Add(pointerItem); } } this.DiscoveredPointers = validatedPointers; }