PsErr read_memory(long address, IntPtr ptr, int size) { try { byte[] buffer = target.ReadBuffer(create_address(address), size); Marshal.Copy(buffer, 0, ptr, size); } catch { return(PsErr.BadAddr); } return(PsErr.Ok); }
void create_appdomain(TargetMemoryAccess memory, TargetAddress address) { int addr_size = memory.TargetMemoryInfo.TargetAddressSize; TargetReader reader = new TargetReader ( memory.ReadMemory (address, 8 + 3 * addr_size)); int id = reader.BinaryReader.ReadInt32 (); int shadow_path_len = reader.BinaryReader.ReadInt32 (); TargetAddress shadow_path_addr = reader.ReadAddress (); string shadow_path = null; if (!shadow_path_addr.IsNull) { byte[] buffer = memory.ReadBuffer (shadow_path_addr, shadow_path_len); char[] cbuffer = new char [buffer.Length]; for (int i = 0; i < buffer.Length; i++) cbuffer [i] = (char) buffer [i]; shadow_path = new String (cbuffer); } TargetAddress domain = reader.ReadAddress (); TargetAddress setup = reader.ReadAddress (); MetadataHelper.AppDomainInfo info = MetadataHelper.GetAppDomainInfo (this, memory, setup); info.ShadowCopyPath = shadow_path; appdomain_info.Add (id, info); }