public void inject(string fname) { Int16 ofs = 0x7430; Int16 myOfs = 0x62EB; //Int16 fofs = 0x1B; //Int16[] replaces = new Int16[] { 0x27DF };//0x26d6,0x2763 FileStream fs = new FileStream(catfile, FileMode.Open); byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); fs.Close(); byte[] icod = InjectCode.getCode(); byte[] rules = getRUles((UInt16)(0x62EB + icod.Length)); Int16 addpar = (Int16)((icod.Length + rules.Length) / 512 + 1); byte[] ndata = new byte[data.Length + addpar * 512]; Array.Copy(data, ndata, data.Length); addpar += 0x6C; setInt16(ndata, 4, addpar); byte[] xres = InjectCode.getRUnCOde(); setInt16(xres, 1, (Int16)((myOfs + 1) - 0x2B30)); Array.Copy(xres, 0, ndata, 0x2B30 + ofs, xres.Length); //foreach (Int16 i in replaces) // setInt16(ndata, ofs + i + 1, (Int16)((myOfs + 1) - i)); //Int16 xofs = (Int16)(0x2D9D - (myOfs + fofs+1)); //setInt16(icod, fofs, xofs); Array.Copy(icod, 0, ndata, data.Length, icod.Length); Array.Copy(rules, 0, ndata, data.Length + icod.Length, rules.Length); fs = new FileStream(fname, FileMode.Create); fs.Write(ndata, 0, ndata.Length); fs.Close(); }
public void AddLetter(string str) { AddLetter(InjectCode.bytesFromString(str.Substring(2))); }