Beispiel #1
0
        public static void DecodeMemberRefParent(uint index, out MemberRefParentType tableIndex, out uint row)
        {
            tableIndex = 0;
            switch (index & MemberRefParrent)
            {
            case MemberRefParrent_TYPEDEF:
                tableIndex = MemberRefParentType.TypeDef;
                break;

            case MemberRefParrent_TYPEREF:
                tableIndex = MemberRefParentType.TypeRef;
                break;

            case MemberRefParrent_MODULEREF:
                tableIndex = MemberRefParentType.ModuleRef;
                break;

            case MemberRefParrent_METHODDEF:
                tableIndex = MemberRefParentType.MethodDef;
                break;

            case MemberRefParrent_TYPESPEC:
                tableIndex = MemberRefParentType.TypeSpec;
                break;
            }
            row = index >> 3;
        }
Beispiel #2
0
        public void LoadData(CLIFile pFile)
        {
            int token = 0;

            if (pFile.TypeDefTable.Length > MemberRefParentTypeMax16BitRows ||
                pFile.TypeRefTable.Length > MemberRefParentTypeMax16BitRows ||
                pFile.ModuleRefTable.Length > MemberRefParentTypeMax16BitRows ||
                pFile.MethodDefTable.Length > MemberRefParentTypeMax16BitRows ||
                pFile.TypeSpecTable.Length > MemberRefParentTypeMax16BitRows)
            {
                token = pFile.ReadInt32();
            }
            else
            {
                token = pFile.ReadUInt16();
            }
            Type  = (MemberRefParentType)(token & MemberRefParentTypeMask);
            token = (token >> MemberRefParentTypeBits) - 1;
            if (token >= 0)
            {
                switch (Type)
                {
                case MemberRefParentType.TypeDef: TypeDef = pFile.TypeDefTable[token]; break;

                case MemberRefParentType.TypeRef: TypeRef = pFile.TypeRefTable[token]; break;

                case MemberRefParentType.ModuleRef: ModuleRef = pFile.ModuleRefTable[token]; break;

                case MemberRefParentType.MethodDef: MethodDef = pFile.MethodDefTable[token]; break;

                case MemberRefParentType.TypeSpec: TypeSpec = pFile.TypeSpecTable[token]; break;

                default: throw new BadImageFormatException("MemberRefParent Type");
                }
            }
        }
Beispiel #3
0
		public void LoadData(CLIFile pFile)
		{
			int token = 0;
			if (pFile.TypeDefTable.Length > MemberRefParentTypeMax16BitRows ||
				pFile.TypeRefTable.Length > MemberRefParentTypeMax16BitRows ||
				pFile.ModuleRefTable.Length > MemberRefParentTypeMax16BitRows ||
				pFile.MethodDefTable.Length > MemberRefParentTypeMax16BitRows ||
				pFile.TypeSpecTable.Length > MemberRefParentTypeMax16BitRows) token = pFile.ReadInt32();
			else token = pFile.ReadUInt16();
			Type = (MemberRefParentType)(token & MemberRefParentTypeMask);
			token = (token >> MemberRefParentTypeBits) - 1;
			if (token >= 0)
			{
				switch (Type)
				{
					case MemberRefParentType.TypeDef: TypeDef = pFile.TypeDefTable[token]; break;
					case MemberRefParentType.TypeRef: TypeRef = pFile.TypeRefTable[token]; break;
					case MemberRefParentType.ModuleRef: ModuleRef = pFile.ModuleRefTable[token]; break;
					case MemberRefParentType.MethodDef: MethodDef = pFile.MethodDefTable[token]; break;
					case MemberRefParentType.TypeSpec: TypeSpec = pFile.TypeSpecTable[token]; break;
					default: throw new BadImageFormatException("MemberRefParent Type");
				}
			}
		}