public void AddVariable(string Name, int Value) { if (Variables.Keys.Contains(Name)) { throw new Exception("Variable under this name is already specified"); } Variables.Add(Name, new VariableStruct(ByteOpCodes.Count, 4)); ByteOpCodes.AddRange(BitConverter.GetBytes(Value)); }
public void CloseInjection(string Name) { if (Detours.Keys.Contains(Name)) { var oldDetour = Detours[Name]; Detours[Name] = new DetoursStruct(oldDetour.InjectionPoint, oldDetour.OverridenBytes, oldDetour.MasterContainerStartLocation, ByteOpCodes.Count + 1); ByteOpCodes.Add(0xE9); ByteOpCodes.AddRange(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }); } else { throw new Exception("No detour available to close under this name: " + Name); } }
public void AddWriteToVariable(string name, int Value) { if (!Variables.Keys.Contains(name)) { throw new Exception("No variable specified"); } else { ByteOpCodes.AddRange(new byte[] { 0xC7, 0x05 }); //mov to absolute address, value Variables[name].VariableUsage.Add(ByteOpCodes.Count); ByteOpCodes.AddRange(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }); //address ByteOpCodes.AddRange(BitConverter.GetBytes(Value)); //value } }
public void AddIncrementValue(string name, byte Value) { if (!Variables.Keys.Contains(name)) { throw new Exception("No variable specified"); } else { ByteOpCodes.AddRange(new byte[] { 0x83, 0x05 }); //mov to absolute address, value Variables[name].VariableUsage.Add((IntPtr)ByteOpCodes.Count); ByteOpCodes.AddRange(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }); //address ByteOpCodes.Add(Value); //value } }
public byte[] GetBytes() { return(ByteOpCodes.ToArray()); }
public void AddByteCode(byte[] code) { ByteOpCodes.AddRange(code); }