1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | //***************************************************************************** |
5 | // MetaModelPub.h -- header file for Common Language Runtime metadata. |
6 | // |
7 | |
8 | // |
9 | //***************************************************************************** |
10 | |
11 | #ifndef _METAMODELPUB_H_ |
12 | #define _METAMODELPUB_H_ |
13 | |
14 | #if _MSC_VER >= 1100 |
15 | # pragma once |
16 | #endif |
17 | |
18 | #include <cor.h> |
19 | #include <stgpool.h> |
20 | |
21 | #ifndef lengthof |
22 | # define lengthof(x) (sizeof(x)/sizeof((x)[0])) |
23 | #endif |
24 | |
25 | template<class T> inline T Align4(T p) |
26 | { |
27 | LIMITED_METHOD_CONTRACT; |
28 | |
29 | INT_PTR i = (INT_PTR)p; |
30 | i = (i+(3)) & ~3; |
31 | return (T)i; |
32 | } |
33 | |
34 | typedef ULONG RID; |
35 | |
36 | // check if a rid is valid or not |
37 | #define InvalidRid(rid) ((rid) == 0) |
38 | |
39 | #ifndef METADATA_FIELDS_PROTECTION |
40 | #define METADATA_FIELDS_PROTECTION public |
41 | #endif |
42 | |
43 | //***************************************************************************** |
44 | // Record definitions. Records have some combination of fixed size fields and |
45 | // variable sized fields (actually, constant across a database, but variable |
46 | // between databases). |
47 | // |
48 | // In this section we define record definitions which include the fixed size |
49 | // fields and an enumeration of the variable sized fields. |
50 | // |
51 | // Naming is as follows: |
52 | // Given some table "Xyz": |
53 | // class XyzRec { public: |
54 | // SOMETYPE m_SomeField; |
55 | // // rest of the fixed fields. |
56 | // enum { COL_Xyz_SomeOtherField, |
57 | // // rest of the fields, enumerated. |
58 | // COL_Xyz_COUNT }; |
59 | // }; |
60 | // |
61 | // The important features are the class name (XyzRec), the enumerations |
62 | // (COL_Xyz_FieldName), and the enumeration count (COL_Xyz_COUNT). |
63 | // |
64 | // THESE NAMING CONVENTIONS ARE CARVED IN STONE! DON'T TRY TO BE CREATIVE! |
65 | // |
66 | //***************************************************************************** |
67 | // Have the compiler generate two byte alignment. Be careful to manually lay |
68 | // out the fields for proper alignment. The alignment for variable-sized |
69 | // fields will be computed at save time. |
70 | #include <pshpack2.h> |
71 | |
72 | // Non-sparse tables. |
73 | class ModuleRec |
74 | { |
75 | METADATA_FIELDS_PROTECTION: |
76 | USHORT m_Generation; // ENC generation. |
77 | public: |
78 | enum { |
79 | COL_Generation, |
80 | |
81 | COL_Name, |
82 | COL_Mvid, |
83 | COL_EncId, |
84 | COL_EncBaseId, |
85 | COL_COUNT, |
86 | COL_KEY |
87 | }; |
88 | USHORT GetGeneration() |
89 | { |
90 | LIMITED_METHOD_CONTRACT; |
91 | |
92 | return GET_UNALIGNED_VAL16(&m_Generation); |
93 | } |
94 | void SetGeneration(USHORT Generation) |
95 | { |
96 | LIMITED_METHOD_CONTRACT; |
97 | |
98 | m_Generation = VAL16(Generation); |
99 | } |
100 | }; |
101 | |
102 | class TypeRefRec |
103 | { |
104 | public: |
105 | enum { |
106 | COL_ResolutionScope, // mdModuleRef or mdAssemblyRef. |
107 | COL_Name, |
108 | COL_Namespace, |
109 | COL_COUNT, |
110 | COL_KEY |
111 | }; |
112 | }; |
113 | |
114 | class TypeDefRec |
115 | { |
116 | METADATA_FIELDS_PROTECTION: |
117 | ULONG m_Flags; // Flags for this TypeDef |
118 | public: |
119 | enum { |
120 | COL_Flags, |
121 | |
122 | COL_Name, // offset into string pool. |
123 | COL_Namespace, |
124 | COL_Extends, // coded token to typedef/typeref. |
125 | COL_FieldList, // rid of first field. |
126 | COL_MethodList, // rid of first method. |
127 | COL_COUNT, |
128 | COL_KEY |
129 | }; |
130 | ULONG GetFlags() |
131 | { |
132 | LIMITED_METHOD_CONTRACT; |
133 | |
134 | return GET_UNALIGNED_VAL32(&m_Flags); |
135 | } |
136 | void SetFlags(ULONG Flags) |
137 | { |
138 | LIMITED_METHOD_CONTRACT; |
139 | |
140 | m_Flags = VAL32(Flags); |
141 | } |
142 | void AddFlags(ULONG Flags) |
143 | { |
144 | LIMITED_METHOD_CONTRACT; |
145 | |
146 | m_Flags |= VAL32(Flags); |
147 | } |
148 | void RemoveFlags(ULONG Flags) |
149 | { |
150 | LIMITED_METHOD_CONTRACT; |
151 | |
152 | m_Flags &= ~VAL32(Flags); |
153 | } |
154 | |
155 | }; |
156 | |
157 | class FieldPtrRec |
158 | { |
159 | public: |
160 | enum { |
161 | COL_Field, |
162 | COL_COUNT, |
163 | COL_KEY |
164 | }; |
165 | }; |
166 | |
167 | class FieldRec |
168 | { |
169 | METADATA_FIELDS_PROTECTION: |
170 | USHORT m_Flags; // Flags for the field. |
171 | public: |
172 | enum { |
173 | COL_Flags, |
174 | |
175 | COL_Name, |
176 | COL_Signature, |
177 | COL_COUNT, |
178 | COL_KEY |
179 | }; |
180 | USHORT GetFlags() |
181 | { |
182 | LIMITED_METHOD_CONTRACT; |
183 | |
184 | return GET_UNALIGNED_VAL16(&m_Flags); |
185 | } |
186 | void SetFlags(ULONG Flags) |
187 | { |
188 | LIMITED_METHOD_CONTRACT; |
189 | |
190 | m_Flags = (USHORT)VAL16(Flags); |
191 | } |
192 | void AddFlags(ULONG Flags) |
193 | { |
194 | LIMITED_METHOD_CONTRACT; |
195 | |
196 | m_Flags |= (USHORT)VAL16(Flags); |
197 | } |
198 | void RemoveFlags(ULONG Flags) |
199 | { |
200 | LIMITED_METHOD_CONTRACT; |
201 | |
202 | m_Flags &= (USHORT)~VAL16(Flags); |
203 | } |
204 | |
205 | |
206 | }; |
207 | |
208 | class MethodPtrRec |
209 | { |
210 | public: |
211 | enum { |
212 | COL_Method, |
213 | COL_COUNT, |
214 | COL_KEY |
215 | }; |
216 | }; |
217 | |
218 | class MethodRec |
219 | { |
220 | METADATA_FIELDS_PROTECTION: |
221 | ULONG m_RVA; // RVA of the Method. |
222 | USHORT m_ImplFlags; // Descr flags of the Method. |
223 | USHORT m_Flags; // Flags for the Method. |
224 | public: |
225 | enum { |
226 | COL_RVA, |
227 | COL_ImplFlags, |
228 | COL_Flags, |
229 | |
230 | COL_Name, |
231 | COL_Signature, |
232 | COL_ParamList, // Rid of first param. |
233 | COL_COUNT, |
234 | COL_KEY |
235 | }; |
236 | |
237 | void Copy(MethodRec *pFrom) |
238 | { |
239 | LIMITED_METHOD_CONTRACT; |
240 | |
241 | m_RVA = pFrom->m_RVA; |
242 | m_ImplFlags = pFrom->m_ImplFlags; |
243 | m_Flags = pFrom->m_Flags; |
244 | } |
245 | |
246 | ULONG GetRVA() |
247 | { |
248 | LIMITED_METHOD_CONTRACT; |
249 | |
250 | return GET_UNALIGNED_VAL32(&m_RVA); |
251 | } |
252 | void SetRVA(ULONG RVA) |
253 | { |
254 | LIMITED_METHOD_CONTRACT; |
255 | |
256 | m_RVA = VAL32(RVA); |
257 | } |
258 | |
259 | USHORT GetImplFlags() |
260 | { |
261 | LIMITED_METHOD_CONTRACT; |
262 | |
263 | return GET_UNALIGNED_VAL16(&m_ImplFlags); |
264 | } |
265 | void SetImplFlags(USHORT ImplFlags) |
266 | { |
267 | LIMITED_METHOD_CONTRACT; |
268 | |
269 | m_ImplFlags = VAL16(ImplFlags); |
270 | } |
271 | void AddImplFlags(USHORT ImplFlags) |
272 | { |
273 | LIMITED_METHOD_CONTRACT; |
274 | |
275 | m_ImplFlags |= VAL16(ImplFlags); |
276 | } |
277 | void RemoveImplFlags(USHORT ImplFlags) |
278 | { |
279 | LIMITED_METHOD_CONTRACT; |
280 | |
281 | m_ImplFlags &= ~VAL16(ImplFlags); |
282 | } |
283 | |
284 | |
285 | USHORT GetFlags() |
286 | { |
287 | LIMITED_METHOD_CONTRACT; |
288 | |
289 | return GET_UNALIGNED_VAL16(&m_Flags); |
290 | } |
291 | void SetFlags(ULONG Flags) |
292 | { |
293 | LIMITED_METHOD_CONTRACT; |
294 | |
295 | m_Flags = (USHORT)VAL16(Flags); |
296 | } |
297 | void AddFlags(ULONG Flags) |
298 | { |
299 | LIMITED_METHOD_CONTRACT; |
300 | |
301 | m_Flags |= (USHORT)VAL16(Flags); |
302 | } |
303 | void RemoveFlags(ULONG Flags) |
304 | { |
305 | LIMITED_METHOD_CONTRACT; |
306 | |
307 | m_Flags &= (USHORT)~VAL16(Flags); |
308 | } |
309 | }; |
310 | |
311 | class ParamPtrRec |
312 | { |
313 | public: |
314 | enum { |
315 | COL_Param, |
316 | COL_COUNT, |
317 | COL_KEY |
318 | }; |
319 | }; |
320 | |
321 | class ParamRec |
322 | { |
323 | METADATA_FIELDS_PROTECTION: |
324 | USHORT m_Flags; // Flags for this Param. |
325 | USHORT m_Sequence; // Sequence # of param. 0 - return value. |
326 | public: |
327 | enum { |
328 | COL_Flags, |
329 | COL_Sequence, |
330 | |
331 | COL_Name, // Name of the param. |
332 | COL_COUNT, |
333 | COL_KEY |
334 | }; |
335 | |
336 | void Copy(ParamRec *pFrom) |
337 | { |
338 | LIMITED_METHOD_CONTRACT; |
339 | |
340 | m_Flags = pFrom->m_Flags; |
341 | m_Sequence = pFrom->m_Sequence; |
342 | } |
343 | |
344 | USHORT GetFlags() |
345 | { |
346 | LIMITED_METHOD_CONTRACT; |
347 | |
348 | return GET_UNALIGNED_VAL16(&m_Flags); |
349 | } |
350 | void SetFlags(ULONG Flags) |
351 | { |
352 | LIMITED_METHOD_CONTRACT; |
353 | |
354 | m_Flags = (USHORT)VAL16(Flags); |
355 | } |
356 | void AddFlags(ULONG Flags) |
357 | { |
358 | LIMITED_METHOD_CONTRACT; |
359 | |
360 | m_Flags |= (USHORT)VAL16(Flags); |
361 | } |
362 | void RemoveFlags(ULONG Flags) |
363 | { |
364 | LIMITED_METHOD_CONTRACT; |
365 | |
366 | m_Flags &= (USHORT)~VAL16(Flags); |
367 | } |
368 | |
369 | USHORT GetSequence() |
370 | { |
371 | LIMITED_METHOD_CONTRACT; |
372 | |
373 | return GET_UNALIGNED_VAL16(&m_Sequence); |
374 | } |
375 | void SetSequence(USHORT Sequence) |
376 | { |
377 | LIMITED_METHOD_CONTRACT; |
378 | |
379 | m_Sequence = VAL16(Sequence); |
380 | } |
381 | |
382 | }; |
383 | |
384 | class InterfaceImplRec |
385 | { |
386 | public: |
387 | enum { |
388 | COL_Class, // Rid of class' TypeDef. |
389 | COL_Interface, // Coded rid of implemented interface. |
390 | COL_COUNT, |
391 | COL_KEY = COL_Class |
392 | }; |
393 | }; |
394 | |
395 | class MemberRefRec |
396 | { |
397 | public: |
398 | enum { |
399 | COL_Class, // Rid of TypeDef. |
400 | COL_Name, |
401 | COL_Signature, |
402 | COL_COUNT, |
403 | COL_KEY |
404 | }; |
405 | }; |
406 | |
407 | class StandAloneSigRec |
408 | { |
409 | public: |
410 | enum { |
411 | COL_Signature, |
412 | COL_COUNT, |
413 | COL_KEY |
414 | }; |
415 | }; |
416 | |
417 | // Sparse tables. These contain modifiers for tables above. |
418 | class ConstantRec |
419 | { |
420 | METADATA_FIELDS_PROTECTION: |
421 | BYTE m_Type; // Type of the constant. |
422 | BYTE m_PAD1; |
423 | public: |
424 | enum { |
425 | COL_Type, |
426 | |
427 | COL_Parent, // Coded rid of object (param, field). |
428 | COL_Value, // Index into blob pool. |
429 | COL_COUNT, |
430 | COL_KEY = COL_Parent |
431 | }; |
432 | BYTE GetType() |
433 | { |
434 | LIMITED_METHOD_CONTRACT; |
435 | |
436 | return m_Type; |
437 | } |
438 | void SetType(BYTE Type) |
439 | { |
440 | LIMITED_METHOD_CONTRACT; |
441 | |
442 | m_Type = Type; |
443 | } |
444 | }; |
445 | |
446 | class CustomAttributeRec |
447 | { |
448 | public: |
449 | enum { |
450 | COL_Parent, // Coded rid of any object. |
451 | COL_Type, // TypeDef or TypeRef. |
452 | COL_Value, // Blob. |
453 | COL_COUNT, |
454 | COL_KEY = COL_Parent |
455 | }; |
456 | }; |
457 | |
458 | class FieldMarshalRec |
459 | { |
460 | public: |
461 | enum { |
462 | COL_Parent, // Coded rid of field or param. |
463 | COL_NativeType, |
464 | COL_COUNT, |
465 | COL_KEY = COL_Parent |
466 | }; |
467 | }; |
468 | |
469 | class DeclSecurityRec |
470 | { |
471 | METADATA_FIELDS_PROTECTION: |
472 | USHORT m_Action; |
473 | public: |
474 | enum { |
475 | COL_Action, |
476 | |
477 | COL_Parent, |
478 | COL_PermissionSet, |
479 | COL_COUNT, |
480 | COL_KEY = COL_Parent |
481 | }; |
482 | |
483 | void Copy(DeclSecurityRec *pFrom) |
484 | { |
485 | LIMITED_METHOD_CONTRACT; |
486 | |
487 | m_Action = pFrom->m_Action; |
488 | } |
489 | USHORT GetAction() |
490 | { |
491 | LIMITED_METHOD_CONTRACT; |
492 | |
493 | return GET_UNALIGNED_VAL16(&m_Action); |
494 | } |
495 | void SetAction(USHORT Action) |
496 | { |
497 | LIMITED_METHOD_CONTRACT; |
498 | |
499 | m_Action = VAL16(Action); |
500 | } |
501 | }; |
502 | |
503 | |
504 | class ClassLayoutRec |
505 | { |
506 | METADATA_FIELDS_PROTECTION: |
507 | USHORT m_PackingSize; |
508 | ULONG m_ClassSize; |
509 | public: |
510 | enum { |
511 | COL_PackingSize, |
512 | COL_ClassSize, |
513 | |
514 | COL_Parent, // Rid of TypeDef. |
515 | COL_COUNT, |
516 | COL_KEY = COL_Parent |
517 | }; |
518 | |
519 | void Copy(ClassLayoutRec *pFrom) |
520 | { |
521 | LIMITED_METHOD_CONTRACT; |
522 | |
523 | m_PackingSize = pFrom->m_PackingSize; |
524 | m_ClassSize = pFrom->m_ClassSize; |
525 | } |
526 | USHORT GetPackingSize() |
527 | { |
528 | LIMITED_METHOD_CONTRACT; |
529 | |
530 | return GET_UNALIGNED_VAL16(&m_PackingSize); |
531 | } |
532 | void SetPackingSize(USHORT PackingSize) |
533 | { |
534 | LIMITED_METHOD_CONTRACT; |
535 | |
536 | m_PackingSize = VAL16(PackingSize); |
537 | } |
538 | |
539 | ULONG GetClassSize() |
540 | { |
541 | LIMITED_METHOD_CONTRACT; |
542 | |
543 | return GET_UNALIGNED_VAL32(&m_ClassSize); |
544 | } |
545 | void SetClassSize(ULONG ClassSize) |
546 | { |
547 | LIMITED_METHOD_CONTRACT; |
548 | |
549 | m_ClassSize = VAL32(ClassSize); |
550 | } |
551 | }; |
552 | |
553 | class FieldLayoutRec |
554 | { |
555 | METADATA_FIELDS_PROTECTION: |
556 | ULONG m_OffSet; |
557 | public: |
558 | enum { |
559 | COL_OffSet, |
560 | |
561 | COL_Field, |
562 | COL_COUNT, |
563 | COL_KEY = COL_Field |
564 | }; |
565 | |
566 | void Copy(FieldLayoutRec *pFrom) |
567 | { |
568 | LIMITED_METHOD_CONTRACT; |
569 | |
570 | m_OffSet = pFrom->m_OffSet; |
571 | } |
572 | ULONG GetOffSet() |
573 | { |
574 | LIMITED_METHOD_CONTRACT; |
575 | |
576 | return GET_UNALIGNED_VAL32(&m_OffSet); |
577 | } |
578 | void SetOffSet(ULONG Offset) |
579 | { |
580 | LIMITED_METHOD_CONTRACT; |
581 | |
582 | m_OffSet = VAL32(Offset); |
583 | } |
584 | }; |
585 | |
586 | class EventMapRec |
587 | { |
588 | public: |
589 | enum { |
590 | COL_Parent, |
591 | COL_EventList, // rid of first event. |
592 | COL_COUNT, |
593 | COL_KEY |
594 | }; |
595 | }; |
596 | |
597 | class EventPtrRec |
598 | { |
599 | public: |
600 | enum { |
601 | COL_Event, |
602 | COL_COUNT, |
603 | COL_KEY |
604 | }; |
605 | }; |
606 | |
607 | class EventRec |
608 | { |
609 | METADATA_FIELDS_PROTECTION: |
610 | USHORT m_EventFlags; |
611 | public: |
612 | enum { |
613 | COL_EventFlags, |
614 | |
615 | COL_Name, |
616 | COL_EventType, |
617 | COL_COUNT, |
618 | COL_KEY |
619 | }; |
620 | USHORT GetEventFlags() |
621 | { |
622 | LIMITED_METHOD_CONTRACT; |
623 | |
624 | return GET_UNALIGNED_VAL16(&m_EventFlags); |
625 | } |
626 | void SetEventFlags(USHORT EventFlags) |
627 | { |
628 | LIMITED_METHOD_CONTRACT; |
629 | |
630 | m_EventFlags = VAL16(EventFlags); |
631 | } |
632 | void AddEventFlags(USHORT EventFlags) |
633 | { |
634 | LIMITED_METHOD_CONTRACT; |
635 | |
636 | m_EventFlags |= VAL16(EventFlags); |
637 | } |
638 | }; |
639 | |
640 | class PropertyMapRec |
641 | { |
642 | public: |
643 | enum { |
644 | COL_Parent, |
645 | COL_PropertyList, // rid of first property. |
646 | COL_COUNT, |
647 | COL_KEY |
648 | }; |
649 | }; |
650 | |
651 | class PropertyPtrRec |
652 | { |
653 | public: |
654 | enum { |
655 | COL_Property, |
656 | COL_COUNT, |
657 | COL_KEY |
658 | }; |
659 | }; |
660 | |
661 | class PropertyRec |
662 | { |
663 | METADATA_FIELDS_PROTECTION: |
664 | USHORT m_PropFlags; |
665 | public: |
666 | enum { |
667 | COL_PropFlags, |
668 | |
669 | COL_Name, |
670 | COL_Type, |
671 | COL_COUNT, |
672 | COL_KEY |
673 | }; |
674 | USHORT GetPropFlags() |
675 | { |
676 | LIMITED_METHOD_CONTRACT; |
677 | |
678 | return GET_UNALIGNED_VAL16(&m_PropFlags); |
679 | } |
680 | void SetPropFlags(USHORT PropFlags) |
681 | { |
682 | LIMITED_METHOD_CONTRACT; |
683 | |
684 | m_PropFlags = VAL16(PropFlags); |
685 | } |
686 | void AddPropFlags(USHORT PropFlags) |
687 | { |
688 | LIMITED_METHOD_CONTRACT; |
689 | |
690 | m_PropFlags |= VAL16(PropFlags); |
691 | } |
692 | }; |
693 | |
694 | class MethodSemanticsRec |
695 | { |
696 | METADATA_FIELDS_PROTECTION: |
697 | USHORT m_Semantic; |
698 | public: |
699 | enum { |
700 | COL_Semantic, |
701 | |
702 | COL_Method, |
703 | COL_Association, |
704 | COL_COUNT, |
705 | COL_KEY = COL_Association |
706 | }; |
707 | USHORT GetSemantic() |
708 | { |
709 | LIMITED_METHOD_CONTRACT; |
710 | |
711 | return GET_UNALIGNED_VAL16(&m_Semantic); |
712 | } |
713 | void SetSemantic(USHORT Semantic) |
714 | { |
715 | LIMITED_METHOD_CONTRACT; |
716 | |
717 | m_Semantic = VAL16(Semantic); |
718 | } |
719 | }; |
720 | |
721 | class MethodImplRec |
722 | { |
723 | public: |
724 | enum { |
725 | COL_Class, // TypeDef where the MethodBody lives. |
726 | COL_MethodBody, // MethodDef or MemberRef. |
727 | COL_MethodDeclaration, // MethodDef or MemberRef. |
728 | COL_COUNT, |
729 | COL_KEY = COL_Class |
730 | }; |
731 | }; |
732 | |
733 | class ModuleRefRec |
734 | { |
735 | public: |
736 | enum { |
737 | COL_Name, |
738 | COL_COUNT, |
739 | COL_KEY |
740 | }; |
741 | }; |
742 | |
743 | class TypeSpecRec |
744 | { |
745 | public: |
746 | enum { |
747 | COL_Signature, |
748 | COL_COUNT, |
749 | COL_KEY |
750 | }; |
751 | }; |
752 | |
753 | class ImplMapRec |
754 | { |
755 | METADATA_FIELDS_PROTECTION: |
756 | USHORT m_MappingFlags; |
757 | public: |
758 | enum { |
759 | COL_MappingFlags, |
760 | |
761 | COL_MemberForwarded, // mdField or mdMethod. |
762 | COL_ImportName, |
763 | COL_ImportScope, // mdModuleRef. |
764 | COL_COUNT, |
765 | COL_KEY = COL_MemberForwarded |
766 | }; |
767 | USHORT GetMappingFlags() |
768 | { |
769 | LIMITED_METHOD_CONTRACT; |
770 | |
771 | return GET_UNALIGNED_VAL16(&m_MappingFlags); |
772 | } |
773 | void SetMappingFlags(USHORT MappingFlags) |
774 | { |
775 | LIMITED_METHOD_CONTRACT; |
776 | |
777 | m_MappingFlags = VAL16(MappingFlags); |
778 | } |
779 | |
780 | }; |
781 | |
782 | class FieldRVARec |
783 | { |
784 | METADATA_FIELDS_PROTECTION: |
785 | ULONG m_RVA; |
786 | public: |
787 | enum{ |
788 | COL_RVA, |
789 | |
790 | COL_Field, |
791 | COL_COUNT, |
792 | COL_KEY = COL_Field |
793 | }; |
794 | |
795 | void Copy(FieldRVARec *pFrom) |
796 | { |
797 | LIMITED_METHOD_CONTRACT; |
798 | |
799 | m_RVA = pFrom->m_RVA; |
800 | } |
801 | ULONG GetRVA() |
802 | { |
803 | LIMITED_METHOD_CONTRACT; |
804 | |
805 | return GET_UNALIGNED_VAL32(&m_RVA); |
806 | } |
807 | void SetRVA(ULONG RVA) |
808 | { |
809 | LIMITED_METHOD_CONTRACT; |
810 | |
811 | m_RVA = VAL32(RVA); |
812 | } |
813 | }; |
814 | |
815 | class ENCLogRec |
816 | { |
817 | METADATA_FIELDS_PROTECTION: |
818 | ULONG m_Token; // Token, or like a token, but with (ixTbl|0x80) instead of token type. |
819 | ULONG m_FuncCode; // Function code describing the nature of ENC change. |
820 | public: |
821 | enum { |
822 | COL_Token, |
823 | COL_FuncCode, |
824 | COL_COUNT, |
825 | COL_KEY |
826 | }; |
827 | ULONG GetToken() |
828 | { |
829 | LIMITED_METHOD_CONTRACT; |
830 | |
831 | return GET_UNALIGNED_VAL32(&m_Token); |
832 | } |
833 | void SetToken(ULONG Token) |
834 | { |
835 | LIMITED_METHOD_CONTRACT; |
836 | |
837 | m_Token = VAL32(Token); |
838 | } |
839 | |
840 | ULONG GetFuncCode() |
841 | { |
842 | LIMITED_METHOD_CONTRACT; |
843 | |
844 | return GET_UNALIGNED_VAL32(&m_FuncCode); |
845 | } |
846 | void SetFuncCode(ULONG FuncCode) |
847 | { |
848 | LIMITED_METHOD_CONTRACT; |
849 | |
850 | m_FuncCode = VAL32(FuncCode); |
851 | } |
852 | }; |
853 | |
854 | class ENCMapRec |
855 | { |
856 | METADATA_FIELDS_PROTECTION: |
857 | ULONG m_Token; // Token, or like a token, but with (ixTbl|0x80) instead of token type. |
858 | public: |
859 | enum { |
860 | COL_Token, |
861 | COL_COUNT, |
862 | COL_KEY |
863 | }; |
864 | ULONG GetToken() |
865 | { |
866 | LIMITED_METHOD_CONTRACT; |
867 | |
868 | return GET_UNALIGNED_VAL32(&m_Token); |
869 | } |
870 | void SetToken(ULONG Token) |
871 | { |
872 | LIMITED_METHOD_CONTRACT; |
873 | |
874 | m_Token = VAL32(Token); |
875 | } |
876 | }; |
877 | |
878 | // Assembly tables. |
879 | |
880 | class AssemblyRec |
881 | { |
882 | METADATA_FIELDS_PROTECTION: |
883 | ULONG m_HashAlgId; |
884 | USHORT m_MajorVersion; |
885 | USHORT m_MinorVersion; |
886 | USHORT m_BuildNumber; |
887 | USHORT m_RevisionNumber; |
888 | ULONG m_Flags; |
889 | public: |
890 | enum { |
891 | COL_HashAlgId, |
892 | COL_MajorVersion, |
893 | COL_MinorVersion, |
894 | COL_BuildNumber, |
895 | COL_RevisionNumber, |
896 | COL_Flags, |
897 | |
898 | COL_PublicKey, // Public key identifying the publisher |
899 | COL_Name, |
900 | COL_Locale, |
901 | COL_COUNT, |
902 | COL_KEY |
903 | }; |
904 | |
905 | void Copy(AssemblyRec *pFrom) |
906 | { |
907 | LIMITED_METHOD_CONTRACT; |
908 | |
909 | m_HashAlgId = pFrom->m_HashAlgId; |
910 | m_MajorVersion = pFrom->m_MajorVersion; |
911 | m_MinorVersion = pFrom->m_MinorVersion; |
912 | m_BuildNumber = pFrom->m_BuildNumber; |
913 | m_RevisionNumber = pFrom->m_RevisionNumber; |
914 | m_Flags = pFrom->m_Flags; |
915 | } |
916 | |
917 | ULONG GetHashAlgId() |
918 | { |
919 | LIMITED_METHOD_CONTRACT; |
920 | |
921 | return GET_UNALIGNED_VAL32(&m_HashAlgId); |
922 | } |
923 | void SetHashAlgId (ULONG HashAlgId) |
924 | { |
925 | LIMITED_METHOD_CONTRACT; |
926 | |
927 | m_HashAlgId = VAL32(HashAlgId); |
928 | } |
929 | |
930 | USHORT GetMajorVersion() |
931 | { |
932 | LIMITED_METHOD_CONTRACT; |
933 | |
934 | return GET_UNALIGNED_VAL16(&m_MajorVersion); |
935 | } |
936 | void SetMajorVersion (USHORT MajorVersion) |
937 | { |
938 | LIMITED_METHOD_CONTRACT; |
939 | |
940 | m_MajorVersion = VAL16(MajorVersion); |
941 | } |
942 | |
943 | USHORT GetMinorVersion() |
944 | { |
945 | LIMITED_METHOD_CONTRACT; |
946 | |
947 | return GET_UNALIGNED_VAL16(&m_MinorVersion); |
948 | } |
949 | void SetMinorVersion (USHORT MinorVersion) |
950 | { |
951 | LIMITED_METHOD_CONTRACT; |
952 | |
953 | m_MinorVersion = VAL16(MinorVersion); |
954 | } |
955 | |
956 | USHORT GetBuildNumber() |
957 | { |
958 | LIMITED_METHOD_CONTRACT; |
959 | |
960 | return GET_UNALIGNED_VAL16(&m_BuildNumber); |
961 | } |
962 | void SetBuildNumber (USHORT BuildNumber) |
963 | { |
964 | LIMITED_METHOD_CONTRACT; |
965 | |
966 | m_BuildNumber = VAL16(BuildNumber); |
967 | } |
968 | |
969 | USHORT GetRevisionNumber() |
970 | { |
971 | LIMITED_METHOD_CONTRACT; |
972 | |
973 | return GET_UNALIGNED_VAL16(&m_RevisionNumber); |
974 | } |
975 | void SetRevisionNumber (USHORT RevisionNumber) |
976 | { |
977 | LIMITED_METHOD_CONTRACT; |
978 | |
979 | m_RevisionNumber = VAL16(RevisionNumber); |
980 | } |
981 | |
982 | ULONG GetFlags() |
983 | { |
984 | LIMITED_METHOD_CONTRACT; |
985 | |
986 | return GET_UNALIGNED_VAL32(&m_Flags); |
987 | } |
988 | void SetFlags (ULONG Flags) |
989 | { |
990 | LIMITED_METHOD_CONTRACT; |
991 | |
992 | m_Flags = VAL32(Flags); |
993 | } |
994 | |
995 | }; |
996 | |
997 | class AssemblyProcessorRec |
998 | { |
999 | METADATA_FIELDS_PROTECTION: |
1000 | ULONG m_Processor; |
1001 | public: |
1002 | enum { |
1003 | COL_Processor, |
1004 | |
1005 | COL_COUNT, |
1006 | COL_KEY |
1007 | }; |
1008 | ULONG GetProcessor() |
1009 | { |
1010 | LIMITED_METHOD_CONTRACT; |
1011 | |
1012 | return GET_UNALIGNED_VAL32(&m_Processor); |
1013 | } |
1014 | void SetProcessor(ULONG Processor) |
1015 | { |
1016 | LIMITED_METHOD_CONTRACT; |
1017 | |
1018 | m_Processor = VAL32(Processor); |
1019 | } |
1020 | }; |
1021 | |
1022 | class AssemblyOSRec |
1023 | { |
1024 | METADATA_FIELDS_PROTECTION: |
1025 | ULONG m_OSPlatformId; |
1026 | ULONG m_OSMajorVersion; |
1027 | ULONG m_OSMinorVersion; |
1028 | public: |
1029 | enum { |
1030 | COL_OSPlatformId, |
1031 | COL_OSMajorVersion, |
1032 | COL_OSMinorVersion, |
1033 | |
1034 | COL_COUNT, |
1035 | COL_KEY |
1036 | }; |
1037 | ULONG GetOSPlatformId() |
1038 | { |
1039 | LIMITED_METHOD_CONTRACT; |
1040 | |
1041 | return GET_UNALIGNED_VAL32(&m_OSPlatformId); |
1042 | } |
1043 | void SetOSPlatformId(ULONG OSPlatformId) |
1044 | { |
1045 | LIMITED_METHOD_CONTRACT; |
1046 | |
1047 | m_OSPlatformId = VAL32(OSPlatformId); |
1048 | } |
1049 | |
1050 | ULONG GetOSMajorVersion() |
1051 | { |
1052 | LIMITED_METHOD_CONTRACT; |
1053 | |
1054 | return GET_UNALIGNED_VAL32(&m_OSMajorVersion); |
1055 | } |
1056 | void SetOSMajorVersion(ULONG OSMajorVersion) |
1057 | { |
1058 | LIMITED_METHOD_CONTRACT; |
1059 | |
1060 | m_OSMajorVersion = VAL32(OSMajorVersion); |
1061 | } |
1062 | |
1063 | ULONG GetOSMinorVersion() |
1064 | { |
1065 | LIMITED_METHOD_CONTRACT; |
1066 | |
1067 | return GET_UNALIGNED_VAL32(&m_OSMinorVersion); |
1068 | } |
1069 | void SetOSMinorVersion(ULONG OSMinorVersion) |
1070 | { |
1071 | LIMITED_METHOD_CONTRACT; |
1072 | |
1073 | m_OSMinorVersion = VAL32(OSMinorVersion); |
1074 | } |
1075 | |
1076 | }; |
1077 | |
1078 | class AssemblyRefRec |
1079 | { |
1080 | METADATA_FIELDS_PROTECTION: |
1081 | USHORT m_MajorVersion; |
1082 | USHORT m_MinorVersion; |
1083 | USHORT m_BuildNumber; |
1084 | USHORT m_RevisionNumber; |
1085 | ULONG m_Flags; |
1086 | public: |
1087 | enum { |
1088 | COL_MajorVersion, |
1089 | COL_MinorVersion, |
1090 | COL_BuildNumber, |
1091 | COL_RevisionNumber, |
1092 | COL_Flags, |
1093 | |
1094 | COL_PublicKeyOrToken, // The public key or token identifying the publisher of the Assembly. |
1095 | COL_Name, |
1096 | COL_Locale, |
1097 | COL_HashValue, |
1098 | COL_COUNT, |
1099 | COL_KEY |
1100 | }; |
1101 | void Copy(AssemblyRefRec *pFrom) |
1102 | { |
1103 | LIMITED_METHOD_CONTRACT; |
1104 | |
1105 | m_MajorVersion = pFrom->m_MajorVersion; |
1106 | m_MinorVersion = pFrom->m_MinorVersion; |
1107 | m_BuildNumber = pFrom->m_BuildNumber; |
1108 | m_RevisionNumber = pFrom->m_RevisionNumber; |
1109 | m_Flags = pFrom->m_Flags; |
1110 | } |
1111 | USHORT GetMajorVersion() |
1112 | { |
1113 | LIMITED_METHOD_CONTRACT; |
1114 | |
1115 | return GET_UNALIGNED_VAL16(&m_MajorVersion); |
1116 | } |
1117 | void SetMajorVersion(USHORT MajorVersion) |
1118 | { |
1119 | LIMITED_METHOD_CONTRACT; |
1120 | |
1121 | m_MajorVersion = VAL16(MajorVersion); |
1122 | } |
1123 | |
1124 | USHORT GetMinorVersion() |
1125 | { |
1126 | LIMITED_METHOD_CONTRACT; |
1127 | |
1128 | return GET_UNALIGNED_VAL16(&m_MinorVersion); |
1129 | } |
1130 | void SetMinorVersion(USHORT MinorVersion) |
1131 | { |
1132 | LIMITED_METHOD_CONTRACT; |
1133 | |
1134 | m_MinorVersion = VAL16(MinorVersion); |
1135 | } |
1136 | |
1137 | USHORT GetBuildNumber() |
1138 | { |
1139 | LIMITED_METHOD_CONTRACT; |
1140 | |
1141 | return GET_UNALIGNED_VAL16(&m_BuildNumber); |
1142 | } |
1143 | void SetBuildNumber(USHORT BuildNumber) |
1144 | { |
1145 | LIMITED_METHOD_CONTRACT; |
1146 | |
1147 | m_BuildNumber = VAL16(BuildNumber); |
1148 | } |
1149 | |
1150 | USHORT GetRevisionNumber() |
1151 | { |
1152 | LIMITED_METHOD_CONTRACT; |
1153 | |
1154 | return GET_UNALIGNED_VAL16(&m_RevisionNumber); |
1155 | } |
1156 | void SetRevisionNumber(USHORT RevisionNumber) |
1157 | { |
1158 | LIMITED_METHOD_CONTRACT; |
1159 | |
1160 | m_RevisionNumber = RevisionNumber; |
1161 | } |
1162 | |
1163 | ULONG GetFlags() |
1164 | { |
1165 | LIMITED_METHOD_CONTRACT; |
1166 | |
1167 | return GET_UNALIGNED_VAL32(&m_Flags); |
1168 | } |
1169 | void SetFlags(ULONG Flags) |
1170 | { |
1171 | LIMITED_METHOD_CONTRACT; |
1172 | |
1173 | m_Flags = VAL32(Flags); |
1174 | } |
1175 | |
1176 | }; |
1177 | |
1178 | class AssemblyRefProcessorRec |
1179 | { |
1180 | METADATA_FIELDS_PROTECTION: |
1181 | ULONG m_Processor; |
1182 | public: |
1183 | enum { |
1184 | COL_Processor, |
1185 | |
1186 | COL_AssemblyRef, // mdtAssemblyRef |
1187 | COL_COUNT, |
1188 | COL_KEY |
1189 | }; |
1190 | ULONG GetProcessor() |
1191 | { |
1192 | LIMITED_METHOD_CONTRACT; |
1193 | |
1194 | return GET_UNALIGNED_VAL32(&m_Processor); |
1195 | } |
1196 | void SetProcessor(ULONG Processor) |
1197 | { |
1198 | LIMITED_METHOD_CONTRACT; |
1199 | |
1200 | m_Processor = VAL32(Processor); |
1201 | } |
1202 | }; |
1203 | |
1204 | class AssemblyRefOSRec |
1205 | { |
1206 | METADATA_FIELDS_PROTECTION: |
1207 | ULONG m_OSPlatformId; |
1208 | ULONG m_OSMajorVersion; |
1209 | ULONG m_OSMinorVersion; |
1210 | public: |
1211 | enum { |
1212 | COL_OSPlatformId, |
1213 | COL_OSMajorVersion, |
1214 | COL_OSMinorVersion, |
1215 | |
1216 | COL_AssemblyRef, // mdtAssemblyRef. |
1217 | COL_COUNT, |
1218 | COL_KEY |
1219 | }; |
1220 | ULONG GetOSPlatformId() |
1221 | { |
1222 | LIMITED_METHOD_CONTRACT; |
1223 | |
1224 | return GET_UNALIGNED_VAL32(&m_OSPlatformId); |
1225 | } |
1226 | void SetOSPlatformId(ULONG OSPlatformId) |
1227 | { |
1228 | LIMITED_METHOD_CONTRACT; |
1229 | |
1230 | m_OSPlatformId = VAL32(OSPlatformId); |
1231 | } |
1232 | |
1233 | ULONG GetOSMajorVersion() |
1234 | { |
1235 | LIMITED_METHOD_CONTRACT; |
1236 | |
1237 | return GET_UNALIGNED_VAL32(&m_OSMajorVersion); |
1238 | } |
1239 | void SetOSMajorVersion(ULONG OSMajorVersion) |
1240 | { |
1241 | LIMITED_METHOD_CONTRACT; |
1242 | |
1243 | m_OSMajorVersion = VAL32(OSMajorVersion); |
1244 | } |
1245 | |
1246 | ULONG GetOSMinorVersion() |
1247 | { |
1248 | LIMITED_METHOD_CONTRACT; |
1249 | |
1250 | return GET_UNALIGNED_VAL32(&m_OSMinorVersion); |
1251 | } |
1252 | void SetOSMinorVersion(ULONG OSMinorVersion) |
1253 | { |
1254 | LIMITED_METHOD_CONTRACT; |
1255 | |
1256 | m_OSMinorVersion = VAL32(OSMinorVersion); |
1257 | } |
1258 | }; |
1259 | |
1260 | class FileRec |
1261 | { |
1262 | METADATA_FIELDS_PROTECTION: |
1263 | ULONG m_Flags; |
1264 | public: |
1265 | enum { |
1266 | COL_Flags, |
1267 | |
1268 | COL_Name, |
1269 | COL_HashValue, |
1270 | COL_COUNT, |
1271 | COL_KEY |
1272 | }; |
1273 | void Copy(FileRec *pFrom) |
1274 | { |
1275 | LIMITED_METHOD_CONTRACT; |
1276 | |
1277 | m_Flags = pFrom->m_Flags; |
1278 | } |
1279 | ULONG GetFlags() |
1280 | { |
1281 | LIMITED_METHOD_CONTRACT; |
1282 | |
1283 | return GET_UNALIGNED_VAL32(&m_Flags); |
1284 | } |
1285 | void SetFlags(ULONG Flags) |
1286 | { |
1287 | LIMITED_METHOD_CONTRACT; |
1288 | |
1289 | m_Flags = VAL32(Flags); |
1290 | } |
1291 | }; |
1292 | |
1293 | class ExportedTypeRec |
1294 | { |
1295 | METADATA_FIELDS_PROTECTION: |
1296 | ULONG m_Flags; |
1297 | ULONG m_TypeDefId; |
1298 | public: |
1299 | enum { |
1300 | COL_Flags, |
1301 | COL_TypeDefId, |
1302 | |
1303 | COL_TypeName, |
1304 | COL_TypeNamespace, |
1305 | COL_Implementation, // mdFile or mdAssemblyRef. |
1306 | COL_COUNT, |
1307 | COL_KEY |
1308 | }; |
1309 | void Copy(ExportedTypeRec *pFrom) |
1310 | { |
1311 | LIMITED_METHOD_CONTRACT; |
1312 | |
1313 | m_Flags = pFrom->m_Flags; |
1314 | m_TypeDefId = pFrom->m_TypeDefId; |
1315 | } |
1316 | ULONG GetFlags() |
1317 | { |
1318 | LIMITED_METHOD_CONTRACT; |
1319 | |
1320 | return GET_UNALIGNED_VAL32(&m_Flags); |
1321 | } |
1322 | void SetFlags(ULONG Flags) |
1323 | { |
1324 | LIMITED_METHOD_CONTRACT; |
1325 | |
1326 | m_Flags = VAL32(Flags); |
1327 | } |
1328 | |
1329 | ULONG GetTypeDefId() |
1330 | { |
1331 | LIMITED_METHOD_CONTRACT; |
1332 | |
1333 | return GET_UNALIGNED_VAL32(&m_TypeDefId); |
1334 | } |
1335 | void SetTypeDefId(ULONG TypeDefId) |
1336 | { |
1337 | LIMITED_METHOD_CONTRACT; |
1338 | |
1339 | m_TypeDefId = VAL32(TypeDefId); |
1340 | } |
1341 | }; |
1342 | |
1343 | class ManifestResourceRec |
1344 | { |
1345 | METADATA_FIELDS_PROTECTION: |
1346 | ULONG m_Offset; |
1347 | ULONG m_Flags; |
1348 | public: |
1349 | enum { |
1350 | COL_Offset, |
1351 | COL_Flags, |
1352 | |
1353 | COL_Name, |
1354 | COL_Implementation, // mdFile or mdAssemblyRef. |
1355 | COL_COUNT, |
1356 | COL_KEY |
1357 | }; |
1358 | void Copy(ManifestResourceRec *pFrom) |
1359 | { |
1360 | LIMITED_METHOD_CONTRACT; |
1361 | |
1362 | m_Flags = pFrom->m_Flags; |
1363 | m_Offset = pFrom->m_Offset; |
1364 | } |
1365 | |
1366 | ULONG GetOffset() |
1367 | { |
1368 | LIMITED_METHOD_CONTRACT; |
1369 | |
1370 | return GET_UNALIGNED_VAL32(&m_Offset); |
1371 | } |
1372 | void SetOffset(ULONG Offset) |
1373 | { |
1374 | LIMITED_METHOD_CONTRACT; |
1375 | |
1376 | m_Offset = VAL32(Offset); |
1377 | } |
1378 | |
1379 | ULONG GetFlags() |
1380 | { |
1381 | LIMITED_METHOD_CONTRACT; |
1382 | |
1383 | return GET_UNALIGNED_VAL32(&m_Flags); |
1384 | } |
1385 | void SetFlags(ULONG Flags) |
1386 | { |
1387 | LIMITED_METHOD_CONTRACT; |
1388 | |
1389 | m_Flags = VAL32(Flags); |
1390 | } |
1391 | |
1392 | }; |
1393 | |
1394 | // End Assembly Tables. |
1395 | |
1396 | class NestedClassRec |
1397 | { |
1398 | public: |
1399 | enum { |
1400 | COL_NestedClass, |
1401 | COL_EnclosingClass, |
1402 | COL_COUNT, |
1403 | COL_KEY = COL_NestedClass |
1404 | }; |
1405 | }; |
1406 | |
1407 | // Generics |
1408 | |
1409 | |
1410 | class GenericParamRec |
1411 | { |
1412 | METADATA_FIELDS_PROTECTION: |
1413 | USHORT m_Number; // index; zero = first var |
1414 | USHORT m_Flags; // index; zero = first var |
1415 | public: |
1416 | enum { |
1417 | |
1418 | COL_Number, // index; zero = first var |
1419 | COL_Flags, // flags, for future use |
1420 | COL_Owner, // typeDef/methodDef |
1421 | COL_Name, // Purely descriptive, not used for binding purposes |
1422 | COL_COUNT, |
1423 | COL_KEY = COL_Owner |
1424 | }; |
1425 | |
1426 | USHORT GetNumber() |
1427 | { |
1428 | LIMITED_METHOD_CONTRACT; |
1429 | |
1430 | return GET_UNALIGNED_VAL16(&m_Number); |
1431 | } |
1432 | void SetNumber(USHORT Number) |
1433 | { |
1434 | LIMITED_METHOD_CONTRACT; |
1435 | |
1436 | m_Number = VAL16(Number); |
1437 | } |
1438 | |
1439 | USHORT GetFlags() |
1440 | { |
1441 | LIMITED_METHOD_CONTRACT; |
1442 | |
1443 | return GET_UNALIGNED_VAL16(&m_Flags); |
1444 | } |
1445 | void SetFlags(USHORT Flags) |
1446 | { |
1447 | LIMITED_METHOD_CONTRACT; |
1448 | |
1449 | m_Flags = VAL16(Flags); |
1450 | } |
1451 | }; |
1452 | |
1453 | // @todo: this definition is for reading the old (and wrong) GenericParamRec from a |
1454 | // Beta1 assembly. |
1455 | class GenericParamV1_1Rec |
1456 | { |
1457 | METADATA_FIELDS_PROTECTION: |
1458 | USHORT m_Number; // index; zero = first var |
1459 | USHORT m_Flags; // index; zero = first var |
1460 | public: |
1461 | enum { |
1462 | |
1463 | COL_Number, // index; zero = first var |
1464 | COL_Flags, // flags, for future use |
1465 | COL_Owner, // typeDef/methodDef |
1466 | COL_Name, // Purely descriptive, not used for binding purposes |
1467 | COL_Kind, // typeDef/Ref/Spec, reserved for future use |
1468 | COL_COUNT, |
1469 | COL_KEY = COL_Owner |
1470 | }; |
1471 | |
1472 | USHORT GetNumber() |
1473 | { |
1474 | LIMITED_METHOD_CONTRACT; |
1475 | |
1476 | return GET_UNALIGNED_VAL16(&m_Number); |
1477 | } |
1478 | void SetNumber(USHORT Number) |
1479 | { |
1480 | LIMITED_METHOD_CONTRACT; |
1481 | |
1482 | m_Number = VAL16(Number); |
1483 | } |
1484 | |
1485 | USHORT GetFlags() |
1486 | { |
1487 | LIMITED_METHOD_CONTRACT; |
1488 | |
1489 | return GET_UNALIGNED_VAL16(&m_Flags); |
1490 | } |
1491 | void SetFlags(USHORT Flags) |
1492 | { |
1493 | LIMITED_METHOD_CONTRACT; |
1494 | |
1495 | m_Flags = VAL16(Flags); |
1496 | } |
1497 | }; |
1498 | |
1499 | class MethodSpecRec |
1500 | { |
1501 | public: |
1502 | enum { |
1503 | COL_Method, // methodDef/memberRef |
1504 | COL_Instantiation, // signature |
1505 | COL_COUNT, |
1506 | COL_KEY |
1507 | }; |
1508 | }; |
1509 | |
1510 | |
1511 | class GenericParamConstraintRec |
1512 | { |
1513 | public: |
1514 | enum { |
1515 | |
1516 | COL_Owner, // GenericParam |
1517 | COL_Constraint, // typeDef/Ref/Spec |
1518 | COL_COUNT, |
1519 | COL_KEY = COL_Owner |
1520 | }; |
1521 | }; |
1522 | |
1523 | #include <poppack.h> |
1524 | |
1525 | // List of MiniMd tables. |
1526 | |
1527 | #define MiniMdTables() \ |
1528 | MiniMdTable(Module) \ |
1529 | MiniMdTable(TypeRef) \ |
1530 | MiniMdTable(TypeDef) \ |
1531 | MiniMdTable(FieldPtr) \ |
1532 | MiniMdTable(Field) \ |
1533 | MiniMdTable(MethodPtr) \ |
1534 | MiniMdTable(Method) \ |
1535 | MiniMdTable(ParamPtr) \ |
1536 | MiniMdTable(Param) \ |
1537 | MiniMdTable(InterfaceImpl) \ |
1538 | MiniMdTable(MemberRef) \ |
1539 | MiniMdTable(Constant) \ |
1540 | MiniMdTable(CustomAttribute)\ |
1541 | MiniMdTable(FieldMarshal) \ |
1542 | MiniMdTable(DeclSecurity) \ |
1543 | MiniMdTable(ClassLayout) \ |
1544 | MiniMdTable(FieldLayout) \ |
1545 | MiniMdTable(StandAloneSig) \ |
1546 | MiniMdTable(EventMap) \ |
1547 | MiniMdTable(EventPtr) \ |
1548 | MiniMdTable(Event) \ |
1549 | MiniMdTable(PropertyMap) \ |
1550 | MiniMdTable(PropertyPtr) \ |
1551 | MiniMdTable(Property) \ |
1552 | MiniMdTable(MethodSemantics)\ |
1553 | MiniMdTable(MethodImpl) \ |
1554 | MiniMdTable(ModuleRef) \ |
1555 | MiniMdTable(TypeSpec) \ |
1556 | MiniMdTable(ImplMap) \ |
1557 | MiniMdTable(FieldRVA) \ |
1558 | MiniMdTable(ENCLog) \ |
1559 | MiniMdTable(ENCMap) \ |
1560 | MiniMdTable(Assembly) \ |
1561 | MiniMdTable(AssemblyProcessor) \ |
1562 | MiniMdTable(AssemblyOS) \ |
1563 | MiniMdTable(AssemblyRef) \ |
1564 | MiniMdTable(AssemblyRefProcessor) \ |
1565 | MiniMdTable(AssemblyRefOS) \ |
1566 | MiniMdTable(File) \ |
1567 | MiniMdTable(ExportedType) \ |
1568 | MiniMdTable(ManifestResource) \ |
1569 | MiniMdTable(NestedClass) \ |
1570 | MiniMdTable(GenericParam) \ |
1571 | MiniMdTable(MethodSpec) \ |
1572 | MiniMdTable(GenericParamConstraint) \ |
1573 | |
1574 | #undef MiniMdTable |
1575 | #define MiniMdTable(x) TBL_##x, |
1576 | enum { |
1577 | MiniMdTables() |
1578 | TBL_COUNT, // Highest table. |
1579 | TBL_COUNT_V1 = TBL_NestedClass + 1, // Highest table in v1.0 database |
1580 | TBL_COUNT_V2 = TBL_GenericParamConstraint + 1 // Highest in v2.0 database |
1581 | }; |
1582 | #undef MiniMdTable |
1583 | |
1584 | // List of MiniMd coded token types. |
1585 | #define MiniMdCodedTokens() \ |
1586 | MiniMdCodedToken(TypeDefOrRef) \ |
1587 | MiniMdCodedToken(HasConstant) \ |
1588 | MiniMdCodedToken(HasCustomAttribute) \ |
1589 | MiniMdCodedToken(HasFieldMarshal) \ |
1590 | MiniMdCodedToken(HasDeclSecurity) \ |
1591 | MiniMdCodedToken(MemberRefParent) \ |
1592 | MiniMdCodedToken(HasSemantic) \ |
1593 | MiniMdCodedToken(MethodDefOrRef) \ |
1594 | MiniMdCodedToken(MemberForwarded) \ |
1595 | MiniMdCodedToken(Implementation) \ |
1596 | MiniMdCodedToken(CustomAttributeType) \ |
1597 | MiniMdCodedToken(ResolutionScope) \ |
1598 | MiniMdCodedToken(TypeOrMethodDef) \ |
1599 | |
1600 | #undef MiniMdCodedToken |
1601 | #define MiniMdCodedToken(x) CDTKN_##x, |
1602 | enum { |
1603 | MiniMdCodedTokens() |
1604 | CDTKN_COUNT |
1605 | }; |
1606 | #undef MiniMdCodedToken |
1607 | |
1608 | //***************************************************************************** |
1609 | // Meta-meta data. Constant across all MiniMds. |
1610 | //***************************************************************************** |
1611 | #ifndef _META_DATA_META_CONSTANTS_DEFINED |
1612 | #define _META_DATA_META_CONSTANTS_DEFINED |
1613 | const unsigned int iRidMax = 63; |
1614 | const unsigned int iCodedToken = 64; // base of coded tokens. |
1615 | const unsigned int iCodedTokenMax = 95; |
1616 | const unsigned int iSHORT = 96; // fixed types. |
1617 | const unsigned int iUSHORT = 97; |
1618 | const unsigned int iLONG = 98; |
1619 | const unsigned int iULONG = 99; |
1620 | const unsigned int iBYTE = 100; |
1621 | const unsigned int iSTRING = 101; // pool types. |
1622 | const unsigned int iGUID = 102; |
1623 | const unsigned int iBLOB = 103; |
1624 | |
1625 | inline int IsRidType(ULONG ix) {LIMITED_METHOD_CONTRACT; return ix <= iRidMax; } |
1626 | inline int IsCodedTokenType(ULONG ix) {LIMITED_METHOD_CONTRACT; return (ix >= iCodedToken) && (ix <= iCodedTokenMax); } |
1627 | inline int IsRidOrToken(ULONG ix) {LIMITED_METHOD_CONTRACT; return ix <= iCodedTokenMax; } |
1628 | inline int IsHeapType(ULONG ix) {LIMITED_METHOD_CONTRACT; return ix >= iSTRING; } |
1629 | inline int IsFixedType(ULONG ix) {LIMITED_METHOD_CONTRACT; return (ix < iSTRING) && (ix > iCodedTokenMax); } |
1630 | #endif |
1631 | |
1632 | |
1633 | enum MDPools { |
1634 | MDPoolStrings, // Id for the string pool. |
1635 | MDPoolGuids, // ...the GUID pool. |
1636 | MDPoolBlobs, // ...the blob pool. |
1637 | MDPoolUSBlobs, // ...the user string pool. |
1638 | |
1639 | MDPoolCount, // Count of pools, for array sizing. |
1640 | }; // enum MDPools |
1641 | |
1642 | |
1643 | struct CCodedTokenDef |
1644 | { |
1645 | ULONG m_cTokens; // Count of tokens. |
1646 | const mdToken *m_pTokens; // Array of tokens. |
1647 | const char *m_pName; // Name of the coded-token type. |
1648 | }; |
1649 | |
1650 | struct CMiniColDef |
1651 | { |
1652 | BYTE m_Type; // Type of the column. |
1653 | BYTE m_oColumn; // Offset of the column. |
1654 | BYTE m_cbColumn; // Size of the column. |
1655 | }; |
1656 | |
1657 | struct CMiniTableDef |
1658 | { |
1659 | CMiniColDef *m_pColDefs; // Array of field defs. |
1660 | BYTE m_cCols; // Count of columns in the table. |
1661 | BYTE m_iKey; // Column which is the key, if any. |
1662 | USHORT m_cbRec; // Size of the records. |
1663 | }; |
1664 | struct CMiniTableDefEx |
1665 | { |
1666 | CMiniTableDef m_Def; // Table definition. |
1667 | const char * const *m_pColNames; // Array of column names. |
1668 | const char *m_pName; // Name of the table. |
1669 | }; |
1670 | |
1671 | #endif // _METAMODELPUB_H_ |
1672 | // eof ------------------------------------------------------------------------ |
1673 | |