/*Creates a PointerPath from the formal notation. General notation template: * [[[BaseModuleName.Extension + 0xBaseOffset] + 0xLayerOneOffset] + 0xLayerTwoOffset ] + 0xFinalValueOffset * Each encapsulation by [] represents dereferencing the inner pointer * If you wish to dereference multiple times without adding offsets simply encapsulate multiple times. */ public static PointerPath CreateFromFormalNotation(string expression, ProcessInterface callback) { expression = RemoveAll(expression, ' '); string moduleName = RemoveAllRange(expression, new char[] { '[', ']' }); moduleName = moduleName.Substring(0, moduleName.IndexOf('+')); int baseOffset = HexToInt(expression.Substring(expression.IndexOf('+') + 1, expression.IndexOf(']') - expression.IndexOf('+') - 1)); string offsets = expression.Remove(expression.IndexOf(moduleName[0]) - 1, expression.IndexOf(']') - expression.IndexOf(moduleName[0]) + 2); offsets = RemoveAll(offsets, ' '); ArrayList offsetCollection = new ArrayList(); while (offsets.Contains(']')) { if (offsets[offsets.IndexOf(']') - 1] == '[' && offsets.IndexOf('+') > offsets.IndexOf(']')) { offsetCollection.Add(0x0); offsets = offsets.Remove(offsets.IndexOf(']') - 1, 2); } else { string curOffset = offsets.Substring(offsets.IndexOf('+') + 1, offsets.IndexOf(']') - offsets.IndexOf('+') - 1); offsetCollection.Add(HexToInt(curOffset)); offsets = offsets.Remove(offsets.IndexOf(']') - curOffset.Length - 2, curOffset.Length + 3); } } int finalOffset = HexToInt(offsets.Remove(offsets.IndexOf('+'), 1)); int[] finOffsets = new int[offsetCollection.Count]; for (int i = 0; i < offsetCollection.Count; i++) { finOffsets[i] = (int)offsetCollection[i]; } return(new PointerPath(moduleName, baseOffset, finOffsets, finalOffset, callback)); }
public PointerPath(string baseModule, int baseOffset, int[] pathOffsets, int destinationOffset, ProcessInterface callback) { this.baseModule = baseModule; this.pathOffsets = pathOffsets; this.destinationOffset = destinationOffset; this.callback = callback; this.baseOffset = baseOffset; baseModuleAddress = callback.GetModuleBase(baseModule); if (baseModuleAddress == null) { throw new InvalidOperationException("the specified base module does not exist"); } }
public ExternalVariable(Address adr, ProcessInterface pi) { callback = pi; address = adr; }
public static Handle GetProcessHandle(string name, APIProxy.ProcessAccessFlags access) { Process proc = ProcessInterface.FindProcess(name); return(APIProxy.OpenProcess(access, proc.Id)); }
public Pointer(Address src, ProcessInterface callback) { this.callback = callback; source = src; destination = new Address(callback.ReadInt64(source)); }