BolterV2.SigScan.MaskCheck C# (CSharp) Method

MaskCheck() private method

MaskCheck Compares the current pattern byte to the current memory dump byte to check for a match. Uses wildcards to skip bytes that are deemed unneeded in the compares.
private MaskCheck ( int nOffset, byte btPattern, string strMask ) : bool
nOffset int Offset in the dump to start at.
btPattern byte Pattern to scan for.
strMask string Mask to compare against.
return bool
        private bool MaskCheck(int nOffset, byte[] btPattern, string strMask)
        {
            // Loop the pattern and compare to the mask and dump.
            for (var x = 0; x < btPattern.Length; x++)
            {
                // If the mask char is a wildcard, just continue.
                if (strMask[x] == '?')
                    continue;

                // If the mask char is not a wildcard, ensure a match is made in the pattern.
                if ((strMask[x] == 'x') && (btPattern[x] != m_vDumpedRegion[nOffset + x]))
                    return false;
            }

            // The loop was successful so we found the pattern.
            return true;
        }