Ejemplo n.º 1
0
        IEnumerable <IntPtr> ScanInternal(SigScanTarget target, int align)
        {
            if (_memory == null || _memory.Length != _size)
            {
                byte[] bytes;

                if (!_process.ReadBytes(_address, _size, out bytes))
                {
                    _memory = null;
                    yield break;
                }

                _memory = bytes;
            }

            foreach (SigScanTarget.Signature sig in target.Signatures)
            {
                // have to implement IEnumerator manually because you can't yield in an unsafe block...
                foreach (int off in new ScanEnumerator(_memory, align, sig))
                {
                    var ptr = _address + off + sig.Offset;
                    if (target.OnFound != null)
                    {
                        ptr = target.OnFound(_process, this, ptr);
                    }
                    yield return(ptr);
                }
            }
        }
Ejemplo n.º 2
0
        public IntPtr Scan(SigScanTarget target, int align)
        {
            if ((long)_address % align != 0)
            {
                throw new ArgumentOutOfRangeException(nameof(align), "start address must be aligned");
            }

            return(ScanAll(target, align).FirstOrDefault());
        }
Ejemplo n.º 3
0
        public IEnumerable <IntPtr> ScanAll(SigScanTarget target, int align = 1)
        {
            if ((long)_address % align != 0)
            {
                throw new ArgumentOutOfRangeException(nameof(align), "start address must be aligned");
            }

            return(ScanInternal(target, align));
        }
        public IntPtr GetSettingsPtr()
        {
            SignatureScanner signatureScanner = new SignatureScanner(process, process.MainModule.BaseAddress, process.MainModule.ModuleMemorySize);
            SigScanTarget    sigScanTarget    = new SigScanTarget("41 64 64 65 64 20 74 69 6D 65 20 66 6F 72 20 73 79 73 74 65 6D 20 65 6E 76 69 72 6F 6E 6D 65 6E 74");

            IntPtr targetPtr = signatureScanner.Scan(sigScanTarget);

            if (targetPtr != IntPtr.Zero)
            {
                return(targetPtr);
            }

            sigScanTarget = new SigScanTarget(onePercentBytes);
            targetPtr     = signatureScanner.Scan(sigScanTarget);

            return(targetPtr);
        }
Ejemplo n.º 5
0
 // backwards compat method signature
 public IntPtr Scan(SigScanTarget target)
 {
     return(Scan(target, 1));
 }