internal unsafe static NativeReader GetNativeReaderForBlob(IntPtr module, ReflectionMapBlob blob)
        {
            NativeReader reader;

            if (TryGetNativeReaderForBlob(module, blob, out reader))
            {
                return(reader);
            }

            Debug.Assert(false);
            return(default(NativeReader));
        }
Example #2
0
 internal unsafe bool TryFindBlob(ReflectionMapBlob blobId, out byte *pBlob, out uint cbBlob)
 {
     pBlob  = null;
     cbBlob = 0;
     fixed(byte **ppBlob = &pBlob)
     {
         fixed(uint *pcbBlob = &cbBlob)
         {
             return(RuntimeAugments.FindBlob(Handle, (int)blobId, new IntPtr(ppBlob), new IntPtr(pcbBlob)));
         }
     }
 }
        private unsafe static bool TryGetNativeReaderForBlob(IntPtr module, ReflectionMapBlob blob, out NativeReader reader)
        {
            byte *pBlob;
            uint  cbBlob;

            if (RuntimeAugments.FindBlob(module, (int)blob, (IntPtr)(&pBlob), (IntPtr)(&cbBlob)))
            {
                reader = new NativeReader(pBlob, cbBlob);
                return(true);
            }

            reader = default(NativeReader);
            return(false);
        }
Example #4
0
        private unsafe bool Initialize(NativeFormatModuleInfo module, ReflectionMapBlob blobId)
        {
            byte *pBlob;
            uint  cbBlob;

            if (!module.TryFindBlob(blobId, out pBlob, out cbBlob))
            {
                _elements      = IntPtr.Zero;
                _elementsCount = 0;
                return(false);
            }

            _elements      = (IntPtr)pBlob;
            _elementsCount = (uint)(cbBlob / sizeof(uint));

            return(true);
        }
        private unsafe bool Initialize(IntPtr moduleHandle, ReflectionMapBlob blobId)
        {
            _moduleHandle = moduleHandle;

            byte* pBlob;
            uint cbBlob;
            if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
            {
                _RVAs = IntPtr.Zero;
                _RVAsCount = 0;
                return false;
            }

            _RVAs = (IntPtr)pBlob;
            _RVAsCount = (uint)(cbBlob / sizeof(IntPtr));
            return true;
        }
        private unsafe bool Initialize(TypeManagerHandle typeManager, ReflectionMapBlob blobId)
        {
            byte *pBlob;
            uint  cbBlob;

            if (!RuntimeAugments.FindBlob(typeManager, (int)blobId, (IntPtr)(void *)&pBlob, (IntPtr)(void *)&cbBlob))
            {
                _elements      = IntPtr.Zero;
                _elementsCount = 0;
                return(false);
            }

            _elements      = (IntPtr)pBlob;
            _elementsCount = (uint)(cbBlob / sizeof(uint));

            return(true);
        }
Example #7
0
        // get the generics hash table and external references table for a module
        // TODO multi-file: consider whether we want to cache this info
        private unsafe bool GetHashtableFromBlob(NativeFormatModuleInfo module, ReflectionMapBlob blobId, out NativeHashtable hashtable, out ExternalReferencesTable externalReferencesLookup)
        {
            byte* pBlob;
            uint cbBlob;

            hashtable = default(NativeHashtable);
            externalReferencesLookup = default(ExternalReferencesTable);

            if (!module.TryFindBlob(blobId, out pBlob, out cbBlob))
                return false;

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            hashtable = new NativeHashtable(parser);

            return externalReferencesLookup.InitializeNativeReferences(module);
        }
        private unsafe bool Initialize(IntPtr moduleHandle, ReflectionMapBlob blobId)
        {
            _moduleHandle = moduleHandle;

            byte *pBlob;
            uint  cbBlob;

            if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
            {
                _elements      = IntPtr.Zero;
                _elementsCount = 0;
                return(false);
            }

            _elements      = (IntPtr)pBlob;
            _elementsCount = (uint)(cbBlob / sizeof(TableElement));
            return(true);
        }
Example #9
0
        // get the generics hash table and external references table for a module
        // TODO multi-file: consider whether we want to cache this info
        private unsafe bool GetHashtableFromBlob(IntPtr moduleHandle, ReflectionMapBlob blobId, out NativeHashtable hashtable, out ExternalReferencesTable externalReferencesLookup)
        {
            byte* pBlob;
            uint cbBlob;

            hashtable = default(NativeHashtable);
            externalReferencesLookup = default(ExternalReferencesTable);

            if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
                return false;

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            hashtable = new NativeHashtable(parser);

            return externalReferencesLookup.InitializeNativeReferences(moduleHandle);
        }
            unsafe public ExternalReferencesTable(IntPtr moduleHandle, ReflectionMapBlob blobId)
            {
                _moduleHandle = moduleHandle;

                uint *pBlob;
                uint  cbBlob;

                if (RuntimeAugments.FindBlob(moduleHandle, (int)blobId, (IntPtr)(&pBlob), (IntPtr)(&cbBlob)))
                {
                    _count = cbBlob / sizeof(uint);
                    _base  = pBlob;
                }
                else
                {
                    _count = 0;
                    _base  = null;
                }
            }
            public MetadataTable(IntPtr moduleHandle, ReflectionMapBlob blobId, int elementSize)
            {
                Debug.Assert(elementSize != 0);

                _elementSize = elementSize;

                byte *pBlob;
                uint  cbBlob;

                if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
                {
                    pBlob  = null;
                    cbBlob = 0;
                }

                Debug.Assert(cbBlob % elementSize == 0);

                _blob        = pBlob;
                ElementCount = cbBlob / (uint)elementSize;
            }
Example #12
0
        // Lazy loadings of hashtables (load on-demand only)
        private unsafe NativeHashtable LoadHashtable(IntPtr moduleHandle, ReflectionMapBlob hashtableBlobId, out ExternalReferencesTable externalFixupsTable)
        {
            // Load the common fixups table
            externalFixupsTable = default(ExternalReferencesTable);
            if (!externalFixupsTable.InitializeCommonFixupsTable(moduleHandle))
            {
                return(default(NativeHashtable));
            }

            // Load the hashtable
            byte *pBlob;
            uint  cbBlob;

            if (!RuntimeAugments.FindBlob(moduleHandle, (int)hashtableBlobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
            {
                return(default(NativeHashtable));
            }

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            return(new NativeHashtable(parser));
        }
Example #13
0
        // Lazy loadings of hashtables (load on-demand only)
        private unsafe NativeHashtable LoadHashtable(NativeFormatModuleInfo module, ReflectionMapBlob hashtableBlobId, out ExternalReferencesTable externalFixupsTable)
        {
            // Load the common fixups table
            externalFixupsTable = default(ExternalReferencesTable);
            if (!externalFixupsTable.InitializeCommonFixupsTable(module))
            {
                return(default(NativeHashtable));
            }

            // Load the hashtable
            byte *pBlob;
            uint  cbBlob;

            if (!module.TryFindBlob(hashtableBlobId, out pBlob, out cbBlob))
            {
                return(default(NativeHashtable));
            }

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            return(new NativeHashtable(parser));
        }
Example #14
0
        private unsafe bool Initialize(NativeFormatModuleInfo module, ReflectionMapBlob blobId)
        {
            if (module == null)
            {
                isDebuggerPrepared = true;
            }
            else
            {
                _moduleHandle = module.Handle;

                byte *pBlob;
                uint  cbBlob;
                if (!module.TryFindBlob(blobId, out pBlob, out cbBlob))
                {
                    _elements      = IntPtr.Zero;
                    _elementsCount = 0;
                    return(false);
                }

                _elements      = (IntPtr)pBlob;
                _elementsCount = (uint)(cbBlob / sizeof(TableElement));
            }
            return(true);
        }
Example #15
0
        private static unsafe bool TryGetNativeReaderForBlob(NativeFormatModuleInfo module, ReflectionMapBlob blob, out NativeReader reader)
        {
            byte *pBlob;
            uint  cbBlob;

            if (module.TryFindBlob((int)blob, out pBlob, out cbBlob))
            {
                reader = new NativeReader(pBlob, cbBlob);
                return(true);
            }

            reader = default(NativeReader);
            return(false);
        }
Example #16
0
        // Lazy loadings of hashtables (load on-demand only)
        private unsafe NativeHashtable LoadHashtable(IntPtr moduleHandle, ReflectionMapBlob hashtableBlobId, out ExternalReferencesTable externalFixupsTable)
        {
            // Load the common fixups table
            externalFixupsTable = default(ExternalReferencesTable);
            if (!externalFixupsTable.InitializeCommonFixupsTable(moduleHandle))
                return default(NativeHashtable);

            // Load the hashtable
            byte* pBlob;
            uint cbBlob;
            if (!RuntimeAugments.FindBlob(moduleHandle, (int)hashtableBlobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
                return default(NativeHashtable);

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);
            return new NativeHashtable(parser);
        }
        private unsafe static bool TryGetNativeReaderForBlob(IntPtr module, ReflectionMapBlob blob, out NativeReader reader)
        {
            byte* pBlob;
            uint cbBlob;

            if (RuntimeAugments.FindBlob(module, (int)blob, (IntPtr)(&pBlob), (IntPtr)(&cbBlob)))
            {
                reader = new NativeReader(pBlob, cbBlob);
                return true;
            }

            reader = default(NativeReader);
            return false;
        }
        internal unsafe static NativeReader GetNativeReaderForBlob(IntPtr module, ReflectionMapBlob blob)
        {
            NativeReader reader;
            if (TryGetNativeReaderForBlob(module, blob, out reader))
            {
                return reader;
            }

            Debug.Assert(false);
            return default(NativeReader);
        }
Example #19
0
        private static unsafe bool TryGetNativeReaderForBlob(TypeManagerHandle module, ReflectionMapBlob blob, out NativeReader reader)
        {
            byte *pBlob;
            uint  cbBlob;

            if (RuntimeImports.RhFindBlob(module, (uint)blob, &pBlob, &cbBlob))
            {
                reader = new NativeReader(pBlob, cbBlob);
                return(true);
            }

            reader = default(NativeReader);
            return(false);
        }
Example #20
0
        // get the generics hash table and external references table for a module
        // TODO multi-file: consider whether we want to cache this info
        private unsafe bool GetHashtableFromBlob(IntPtr moduleHandle, ReflectionMapBlob blobId, out NativeHashtable hashtable, out ExternalReferencesTable externalReferencesLookup)
        {
            byte* pBlob;
            uint cbBlob;

            hashtable = default(NativeHashtable);
            externalReferencesLookup = default(ExternalReferencesTable);

            if (!RuntimeAugments.FindBlob(moduleHandle, (int)blobId, new IntPtr(&pBlob), new IntPtr(&cbBlob)))
                return false;

            NativeReader reader = new NativeReader(pBlob, cbBlob);
            NativeParser parser = new NativeParser(reader, 0);

            hashtable = new NativeHashtable(parser);

            return externalReferencesLookup.InitializeNativeReferences(moduleHandle);
        }