--- /dev/null
+<?php\r
+//Patcher generator 0.3\r
+//Harvie 2oo7\r
+/*\r
+This will parse output from my HexCmp tool and\r
+create the code, than can be directly pasted to\r
+my BinPatcher source.\r
+Making of patcher was never easier.\r
+*/\r
+\r
+///SETINGS///////////////////////////////////////////////////////\r
+$proc = "hexcmp orig.exe crac.exe"; //HexCmp command\r
+$fp = "bin"; //FILE pointer to handle with\r
+\r
+///CODE//////////////////////////////////////////////////////////\r
+$pp = popen($proc, "r");\r
+while(!feof($pp)) {\r
+ $line = trim(fgets($pp));\r
+ \r
+ if(ereg("Difference", $line)) {\r
+ $offset = explode("H: ", $line);\r
+ $offset = $offset[1];\r
+ echo("fseek($fp, $offset"."L, SEEK_SET); //Seek to $offset\n");\r
+ }\r
+ \r
+ if(ereg("\\\\x.", $line)) {\r
+ $bytes = substr_count($line, "\\x");\r
+ echo(" fwrite(\"$line\", $bytes, 1, $fp); //Patch $bytes bytes\n");\r
+ }\r
+\r
+}\r
+\r
+///EXAMPLE///////////////////////////////////////////////////////\r
+/*\r
+ //Example output from HexCmp:\r
+Difference @ D: 222313 H: 0x36469\r
+\x90\x90\x90\x90\x90\r
+Lenght: 5 Bytes\r
+\r
+Difference @ D: 317430 H: 0x4d7f6\r
+\x13\x37\xc0\xde\r
+Lenght: 4 Bytes\r
+\r
+ //Will be turned to something like this:\r
+fseek(bin, 0x36469L, SEEK_SET); //Seek to 0x36469\r
+ fwrite("\x90\x90\x90\x90\x90", 5, 1, bin); //Patch 5 bytes\r
+fseek(bin, 0x4d7f6L, SEEK_SET); //Seek to 0x4d7f6\r
+ fwrite("\x13\x37\xc0\xde", 4, 1, bin); //Patch 4 bytes\r
+\r
+//Just compile ;))\r
+*/\r
+?>\r