How to find and replace certain hex value within a compiled exe : <p>I am trying to create a C# application that will patch a certain application. As an example, I have 8 files, all 8 need to be patched in a similar fashion, (they have the same hex values to replace, but at different offsets). I need my program to find where these hex values are, and replace them. I cannot figure out a way to get my program to search for the hex values. Any help would be greatly appreciated. Currently, <strong>this</strong> is my code:</p>

<pre><code>private const string SoftwareDirectory = @"C:\Program Files\ExampleSoftware";
private const string HexCode = "C8 49 73 B9";
private const string IgnoreEXE = "ignoreMe.exe";

static void Main(string[] args)
    {
        List&lt;string&gt; allTheFiles = FindFiles(SoftwareDirectory, "*.exe", SearchOption.AllDirectories, IgnoreEXE);
        allTheFiles.ForEach((string s) =&gt;
        {
            // Find and replace hex value here, Hex value defined by HexCode, and modified version is C7 49 73 C6, as an example
        });
        Console.ReadLine();
    }

static List&lt;string&gt; FindFiles(string directory, string searchPattern, SearchOption searchOption, string ignoreFiles = null)
    {
        List&lt;string&gt; files = new List&lt;string&gt;();
        foreach (string file in Directory.EnumerateFiles(directory, searchPattern, searchOption))
        {
            if (!file.Contains(ignoreFiles))
            {
                files.Add(file);
            }
        }
        return files;
    }
</code></pre>
