public static string ReadString(this Process process, IntPtr addr, ReadStringType type, int numBytes, string default_ = null) { string str; if (!process.ReadString(addr, type, numBytes, out str)) { return(default_); } return(str); }
public string DerefString(Process process, ReadStringType type, int numBytes, string default_ = null) { string str; if (!DerefString(process, type, numBytes, out str)) { str = default_; } return(str); }
public string DerefString(Process process, ReadStringType type, int len, string default_ = null) { string str; if (!this.DerefString(process, type, len, out str)) { str = default_; } return(str); }
public bool DerefString(Process process, ReadStringType type, StringBuilder sb) { IntPtr ptr; if (!DerefOffsets(process, out ptr) || !process.ReadString(ptr, type, sb)) { return(false); } return(true); }
public bool DerefString(Process process, ReadStringType type, int numBytes, out string str) { var sb = new StringBuilder(numBytes); if (!DerefString(process, type, sb)) { str = null; return(false); } str = sb.ToString(); return(true); }
public bool DerefString(Process process, ReadStringType type, StringBuilder sb) { OffsetT offset = _offsets[_offsets.Count - 1]; IntPtr ptr; if (!this.DerefOffsets(process, out ptr) || !process.ReadString(ptr + offset, type, sb)) { return(false); } return(true); }
public static bool ReadString(this Process process, IntPtr addr, ReadStringType type, int numBytes, out string str) { var sb = new StringBuilder(numBytes); if (!ReadString(process, addr, type, sb)) { str = string.Empty; return(false); } str = sb.ToString(); return(true); }
public static bool ReadString(this Process process, IntPtr addr, ReadStringType type, StringBuilder sb) { var bytes = new byte[sb.Capacity]; SizeT read; if (!WinAPI.ReadProcessMemory(process.Handle, addr, bytes, (SizeT)bytes.Length, out read) || read != (SizeT)bytes.Length) { return(false); } if (type == ReadStringType.AutoDetect) { if (read.ToUInt64() >= 2 && bytes[1] == '\x0') { sb.Append(Encoding.Unicode.GetString(bytes)); } else { sb.Append(Encoding.UTF8.GetString(bytes)); } } else if (type == ReadStringType.UTF8) { sb.Append(Encoding.UTF8.GetString(bytes)); } else if (type == ReadStringType.UTF16) { sb.Append(Encoding.Unicode.GetString(bytes)); } else { sb.Append(Encoding.ASCII.GetString(bytes)); } for (int i = 0; i < sb.Length; i++) { if (sb[i] == '\0') { sb.Remove(i, sb.Length - i); break; } } return(true); }
public StringWatcher(IntPtr address, ReadStringType type, int numBytes) : base(address) { _stringType = type; _numBytes = numBytes; }
public StringWatcher(DeepPointer pointer, ReadStringType type, int numBytes) : base(pointer) { _stringType = type; _numBytes = numBytes; }