ExecuteWithProtection() public method

public ExecuteWithProtection ( MemoryProtectionConstraints requestedProtection, System.Action action ) : void
requestedProtection MemoryProtectionConstraints
action System.Action
return void
Beispiel #1
0
        public void Apply()
        {
            if (IsApplied)
            {
                return;
            }

            _protector.ExecuteWithProtection(MemoryProtectionConstraints.PAGE_EXECUTE_READWRITE, () =>
            {
                _original = _memory.ReadBytes(TargetAddress, _replaceWith.Length);
                _memory.WriteBytes(TargetAddress, _replaceWith);
            });
            IsApplied = true;
        }