Esempio n. 1
0
        private CompleteObjectLocator ReadCol(IntPtr metaPtrVal)
        {
            CompleteObjectLocator.MemoryStruct memoryStruct = new CompleteObjectLocator.MemoryStruct();
            processMemoryReader.ReadStruct(metaPtrVal, ref memoryStruct);

            if (memoryStruct.Signature != 0)
            {
                throw new InvalidDataException("Invalid COL signature");
            }

            Debug.Assert(memoryStruct.pTypeDescriptor != IntPtr.Zero, "pTypeDescriptor shouldn't be 0!");
            Debug.Assert(memoryStruct.pClassDescriptor != IntPtr.Zero, "pClassDescriptor shouldn't be 0!");

            CompleteObjectLocator locator = new CompleteObjectLocator(
                GetTypeDescriptor(memoryStruct.pTypeDescriptor),
                GetClassHierarchyDescriptor(memoryStruct.pClassDescriptor),
                memoryStruct.ConstructorDescriptorOffset,
                memoryStruct.ObjectRootOffset
                );

            return(locator);
        }