public void Add() { const ulong COUNT = 4; IDebugMemoryContext2 result; Assert.AreEqual(VSConstants.S_OK, memoryContext.Add(COUNT, out result)); mockMemoryContextFactory.Received(1).Create(TEST_PC + COUNT, TEST_NAME); }
public byte[] ReadMemory(IDebugMemoryContext2 context, IDebugMemoryBytes2 memory, int bytes, int readStep, out int finalRead) { byte[] result = new byte[bytes]; int allRead = 0; finalRead = 0; while (allRead < bytes) { IDebugMemoryContext2 currentContext = null; if (context.Add((ulong)allRead, out currentContext) != VSConstants.S_OK) { return(null); } if (bytes - allRead < readStep) { readStep = bytes - allRead; } byte[] buffer = new byte[readStep]; uint bufferRead = 0; uint unreadable = 0; if (memory.ReadAt(currentContext, (uint)readStep, buffer, out bufferRead, ref unreadable) != VSConstants.S_OK) { return(null); } if (bufferRead == 0 && unreadable == readStep) { break; } Buffer.BlockCopy(buffer, 0, result, allRead, (int)bufferRead); allRead += (int)bufferRead; } finalRead = allRead; return(result); }
int IDebugCodeContext2.Add(ulong dwCount, out IDebugMemoryContext2 ppMemCxt) { return(IDebugMemoryContext2.Add(dwCount, out ppMemCxt)); }