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 | // RegMeta.h |
6 | // |
7 | |
8 | // |
9 | // This is the code for the MetaData coclass including both the emit and |
10 | // import API's. |
11 | // |
12 | // This provides an implementation of the public Metadata interfaces via the RegMeta class. It's |
13 | // primarily intended for use by tools such as compilers, debuggers, and profilers. |
14 | //***************************************************************************** |
15 | #ifndef __RegMeta__h__ |
16 | #define __RegMeta__h__ |
17 | |
18 | #include <metamodelrw.h> |
19 | #include "../inc/mdlog.h" |
20 | #include "utsem.h" |
21 | |
22 | #include "rwutil.h" |
23 | #include "mdperf.h" |
24 | |
25 | #include "sigparser.h" |
26 | |
27 | #include "winmdinterfaces.h" |
28 | |
29 | class FilterManager; |
30 | |
31 | // Support for symbol binding meta data. This is a custom value hung off of |
32 | // the Module entry. The CORDBG_SYMBOL_URL needs to be allocated on top of |
33 | // a buffer large enough to hold it. |
34 | // |
35 | #define SZ_CORDBG_SYMBOL_URL W("DebugSymbolUrlData") |
36 | |
37 | struct CORDBG_SYMBOL_URL |
38 | { |
39 | GUID FormatID; // ID of the format type. |
40 | WCHAR rcName[2]; // Variable sized name of the item. |
41 | |
42 | #ifdef _PREFAST_ |
43 | #pragma warning(push) |
44 | #pragma warning(disable:6305) // "Potential mismatch between sizeof and countof quantities" |
45 | #endif |
46 | |
47 | ULONG Size() const |
48 | { |
49 | return (ULONG)(sizeof(GUID) + ((wcslen(rcName) + 1) * 2)); |
50 | } |
51 | |
52 | #ifdef _PREFAST_ |
53 | #pragma warning(pop) |
54 | #endif |
55 | }; |
56 | |
57 | |
58 | // |
59 | // Internal open flags. |
60 | // |
61 | #define ofExternalStgDB ofReserved1 |
62 | #define IsOfExternalStgDB(x) ((x) & ofExternalStgDB) |
63 | #define ofReOpen ofReserved2 |
64 | #define IsOfReOpen(x) ((x) & ofReOpen) |
65 | |
66 | |
67 | // Set API caller type |
68 | enum SetAPICallerType |
69 | { |
70 | DEFINE_API = 0x1, |
71 | EXTERNAL_CALLER = 0x2 |
72 | }; |
73 | |
74 | // Define the record entry for the table over which ValidateMetaData iterates over. |
75 | // Add a forward declaration for RegMeta. |
76 | class RegMeta; |
77 | typedef HRESULT (RegMeta::*ValidateRecordFunction)(RID); |
78 | |
79 | // Support for security attributes. Bundles of attributes (they look much like |
80 | // custom attributes) are passed into a single API (DefineSecurityAttributeSet) |
81 | // where they're processed and written into the metadata as one or more opaque |
82 | // blobs of data. |
83 | struct CORSEC_ATTR |
84 | { |
85 | CORSEC_ATTR *pNext; // Next structure in list or NULL. |
86 | mdToken tkObj; // The object to put the value on. |
87 | mdMemberRef tkCtor; // The security attribute constructor. |
88 | mdTypeRef tkTypeRef; // Ref to the security attribute type. |
89 | mdAssemblyRef tkAssemblyRef; // Ref to the assembly containing the security attribute class. |
90 | void const *pCustomAttribute; // The custom value data. |
91 | ULONG cbCustomAttribute; // The custom value data length. |
92 | }; |
93 | |
94 | // Support for "Pseudo Custom Attributes". |
95 | struct CCustAttrHashKey |
96 | { |
97 | mdToken tkType; // Token of the custom attribute type. |
98 | int ca; // flag indicating what the ca is. |
99 | }; |
100 | |
101 | class CCustAttrHash : public CClosedHashEx<CCustAttrHashKey, CCustAttrHash> |
102 | { |
103 | typedef CCustAttrHashKey T; |
104 | |
105 | using CClosedHashEx<CCustAttrHashKey, CCustAttrHash>::Hash; |
106 | using CClosedHashEx<CCustAttrHashKey, CCustAttrHash>::Compare; |
107 | using CClosedHashEx<CCustAttrHashKey, CCustAttrHash>::Status; |
108 | using CClosedHashEx<CCustAttrHashKey, CCustAttrHash>::SetStatus; |
109 | using CClosedHashEx<CCustAttrHashKey, CCustAttrHash>::GetKey; |
110 | |
111 | public: |
112 | CCustAttrHash(int iBuckets=37) : CClosedHashEx<CCustAttrHashKey,CCustAttrHash>(iBuckets) {} |
113 | unsigned int Hash(const T *pData); |
114 | unsigned int Compare(const T *p1, T *p2); |
115 | ELEMENTSTATUS Status(T *pEntry); |
116 | void SetStatus(T *pEntry, ELEMENTSTATUS s); |
117 | void* GetKey(T *pEntry); |
118 | }; |
119 | |
120 | class MDInternalRW; |
121 | struct CaArg; |
122 | struct CaNamedArg; |
123 | |
124 | #ifdef FEATURE_METADATA_RELEASE_MEMORY_ON_REOPEN |
125 | #define REGMETA_POSSIBLE_INTERNAL_POINTER_EXPOSED() MarkUnsafeToDeleteStgdb() |
126 | #else |
127 | #define REGMETA_POSSIBLE_INTERNAL_POINTER_EXPOSED() |
128 | #endif |
129 | |
130 | // The RegMeta class implements the public metadata interfaces. |
131 | // |
132 | // Notes: |
133 | // This object is primarily consumed by tools, not the runtime itself. (The runtime should be |
134 | // using the internal metadata interfaces, not the public ones implemented here). |
135 | // The VM uses it for IMetaDataEmit* interfaces. Define* methods are not exposed to the VM |
136 | // (eg for Reflection) otherwise. |
137 | // This object is a thin veneer exposing a public interface on top of the real storage. |
138 | // The runtime also has internal interfaces to access that storage. |
139 | // |
140 | // This is included outside of md\compiler; so be very careful about using #ifdef to change class layout |
141 | // (adding removing interfaces changes class layout) |
142 | // |
143 | // This exists in both the full and standalone versions of the metadata. |
144 | // |
145 | |
146 | class RegMeta : |
147 | public IMetaDataImport2, |
148 | public IMetaDataAssemblyImport, |
149 | public IMetaDataTables2 |
150 | |
151 | , public IMetaDataInfo |
152 | |
153 | #ifdef FEATURE_METADATA_EMIT |
154 | , public IMetaDataEmit2 |
155 | , public IMetaDataAssemblyEmit |
156 | #endif |
157 | |
158 | #ifdef FEATURE_METADATA_EMIT_ALL |
159 | , public IMetaDataFilter |
160 | #endif |
161 | |
162 | #ifdef FEATURE_METADATA_INTERNAL_APIS |
163 | , public IMetaDataHelper |
164 | , public IMDInternalEmit |
165 | , public IGetIMDInternalImport |
166 | #endif |
167 | |
168 | #if defined(FEATURE_METADATA_EMIT) && defined(FEATURE_METADATA_INTERNAL_APIS) |
169 | , public IMetaDataEmitHelper |
170 | #endif |
171 | |
172 | #if defined(FEATURE_METADATA_IN_VM) && defined(FEATURE_PREJIT) |
173 | , public IMetaDataCorProfileData |
174 | , public IMDInternalMetadataReorderingOptions |
175 | #endif |
176 | , public IMDCommon |
177 | { |
178 | friend class CImportTlb; |
179 | friend class MDInternalRW; |
180 | friend class MDInternalRO; |
181 | friend HRESULT TranslateSigHelper( |
182 | IMDInternalImport* pImport, |
183 | IMDInternalImport* pAssemImport, |
184 | const void* pbHashValue, |
185 | ULONG cbHashValue, |
186 | PCCOR_SIGNATURE pbSigBlob, |
187 | ULONG cbSigBlob, |
188 | IMetaDataAssemblyEmit* pAssemEmit, |
189 | IMetaDataEmit* emit, |
190 | CQuickBytes* pqkSigEmit, |
191 | ULONG* pcbSig); |
192 | public: |
193 | //***************************************************************************** |
194 | // IUnknown methods |
195 | //***************************************************************************** |
196 | STDMETHODIMP QueryInterface(REFIID riid, void** ppv); |
197 | STDMETHODIMP_(ULONG) AddRef(void); |
198 | STDMETHODIMP_(ULONG) Release(void); |
199 | |
200 | //***************************************************************************** |
201 | // IMetaDataImport methods |
202 | //***************************************************************************** |
203 | void STDMETHODCALLTYPE CloseEnum(HCORENUM hEnum); |
204 | STDMETHODIMP CountEnum(HCORENUM hEnum, ULONG *pulCount); |
205 | STDMETHODIMP ResetEnum(HCORENUM hEnum, ULONG ulPos); |
206 | STDMETHODIMP EnumTypeDefs(HCORENUM *phEnum, mdTypeDef rTypeDefs[], |
207 | ULONG cMax, ULONG *pcTypeDefs); |
208 | STDMETHODIMP EnumInterfaceImpls(HCORENUM *phEnum, mdTypeDef td, |
209 | mdInterfaceImpl rImpls[], ULONG cMax, |
210 | ULONG* pcImpls); |
211 | STDMETHODIMP EnumTypeRefs(HCORENUM *phEnum, mdTypeRef rTypeRefs[], |
212 | ULONG cMax, ULONG* pcTypeRefs); |
213 | STDMETHODIMP FindTypeDefByName( // S_OK or error. |
214 | LPCWSTR szTypeDef, // [IN] Name of the Type. |
215 | mdToken tdEncloser, // [IN] TypeDef/TypeRef of Enclosing class. |
216 | mdTypeDef *ptd); // [OUT] Put the TypeDef token here. |
217 | |
218 | STDMETHODIMP GetScopeProps( // S_OK or error. |
219 | __out_ecount_opt (cchName) LPWSTR szName, // [OUT] Put name here. |
220 | ULONG cchName, // [IN] Size of name buffer in wide chars. |
221 | ULONG *pchName, // [OUT] Put size of name (wide chars) here. |
222 | GUID *pmvid); // [OUT] Put MVID here. |
223 | |
224 | STDMETHODIMP GetModuleFromScope( // S_OK. |
225 | mdModule *pmd); // [OUT] Put mdModule token here. |
226 | |
227 | STDMETHODIMP GetTypeDefProps( // S_OK or error. |
228 | mdTypeDef td, // [IN] TypeDef token for inquiry. |
229 | __out_ecount_opt (cchTypeDef) LPWSTR szTypeDef, // [OUT] Put name here. |
230 | ULONG cchTypeDef, // [IN] size of name buffer in wide chars. |
231 | ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here. |
232 | DWORD *pdwTypeDefFlags, // [OUT] Put flags here. |
233 | mdToken *ptkExtends); // [OUT] Put base class TypeDef/TypeRef here. |
234 | |
235 | STDMETHODIMP GetInterfaceImplProps( // S_OK or error. |
236 | mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token. |
237 | mdTypeDef *pClass, // [OUT] Put implementing class token here. |
238 | mdToken *ptkIface); // [OUT] Put implemented interface token here. |
239 | |
240 | STDMETHODIMP GetTypeRefProps( |
241 | mdTypeRef tr, // S_OK or error. |
242 | mdToken *ptkResolutionScope, // [OUT] Resolution scope, mdModuleRef or mdAssemblyRef. |
243 | __out_ecount_opt (cchName) LPWSTR szName, // [OUT] Name buffer. |
244 | ULONG cchName, // [IN] Size of Name buffer. |
245 | ULONG *pchName); // [OUT] Actual size of Name. |
246 | |
247 | // This access global shared state to looks across multiple metadata scopes that would |
248 | // otherwise be independent. |
249 | STDMETHODIMP ResolveTypeRef(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd); |
250 | |
251 | STDMETHODIMP EnumMembers( // S_OK, S_FALSE, or error. |
252 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
253 | mdTypeDef cl, // [IN] TypeDef to scope the enumeration. |
254 | mdToken rMembers[], // [OUT] Put MemberDefs here. |
255 | ULONG cMax, // [IN] Max MemberDefs to put. |
256 | ULONG *pcTokens); // [OUT] Put # put here. |
257 | |
258 | STDMETHODIMP EnumMembersWithName( // S_OK, S_FALSE, or error. |
259 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
260 | mdTypeDef cl, // [IN] TypeDef to scope the enumeration. |
261 | LPCWSTR szName, // [IN] Limit results to those with this name. |
262 | mdToken rMembers[], // [OUT] Put MemberDefs here. |
263 | ULONG cMax, // [IN] Max MemberDefs to put. |
264 | ULONG *pcTokens); // [OUT] Put # put here. |
265 | |
266 | STDMETHODIMP EnumMethods( // S_OK, S_FALSE, or error. |
267 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
268 | mdTypeDef cl, // [IN] TypeDef to scope the enumeration. |
269 | mdMethodDef rMethods[], // [OUT] Put MethodDefs here. |
270 | ULONG cMax, // [IN] Max MethodDefs to put. |
271 | ULONG *pcTokens); // [OUT] Put # put here. |
272 | |
273 | STDMETHODIMP EnumMethodsWithName( // S_OK, S_FALSE, or error. |
274 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
275 | mdTypeDef cl, // [IN] TypeDef to scope the enumeration. |
276 | LPCWSTR szName, // [IN] Limit results to those with this name. |
277 | mdMethodDef rMethods[], // [OU] Put MethodDefs here. |
278 | ULONG cMax, // [IN] Max MethodDefs to put. |
279 | ULONG *pcTokens); // [OUT] Put # put here. |
280 | |
281 | STDMETHODIMP EnumFields( // S_OK, S_FALSE, or error. |
282 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
283 | mdTypeDef cl, // [IN] TypeDef to scope the enumeration. |
284 | mdFieldDef rFields[], // [OUT] Put FieldDefs here. |
285 | ULONG cMax, // [IN] Max FieldDefs to put. |
286 | ULONG *pcTokens); // [OUT] Put # put here. |
287 | |
288 | STDMETHODIMP EnumFieldsWithName( // S_OK, S_FALSE, or error. |
289 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
290 | mdTypeDef cl, // [IN] TypeDef to scope the enumeration. |
291 | LPCWSTR szName, // [IN] Limit results to those with this name. |
292 | mdFieldDef rFields[], // [OUT] Put MemberDefs here. |
293 | ULONG cMax, // [IN] Max MemberDefs to put. |
294 | ULONG *pcTokens); // [OUT] Put # put here. |
295 | |
296 | |
297 | STDMETHODIMP EnumParams( // S_OK, S_FALSE, or error. |
298 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
299 | mdMethodDef mb, // [IN] MethodDef to scope the enumeration. |
300 | mdParamDef rParams[], // [OUT] Put ParamDefs here. |
301 | ULONG cMax, // [IN] Max ParamDefs to put. |
302 | ULONG *pcTokens); // [OUT] Put # put here. |
303 | |
304 | STDMETHODIMP EnumMemberRefs( // S_OK, S_FALSE, or error. |
305 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
306 | mdToken tkParent, // [IN] Parent token to scope the enumeration. |
307 | mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here. |
308 | ULONG cMax, // [IN] Max MemberRefs to put. |
309 | ULONG *pcTokens); // [OUT] Put # put here. |
310 | |
311 | STDMETHODIMP EnumMethodImpls( // S_OK, S_FALSE, or error |
312 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
313 | mdTypeDef td, // [IN] TypeDef to scope the enumeration. |
314 | mdToken rMethodBody[], // [OUT] Put Method Body tokens here. |
315 | mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here. |
316 | ULONG cMax, // [IN] Max tokens to put. |
317 | ULONG *pcTokens); // [OUT] Put # put here. |
318 | |
319 | STDMETHODIMP EnumPermissionSets( // S_OK, S_FALSE, or error. |
320 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
321 | mdToken tk, // [IN] if !NIL, token to scope the enumeration. |
322 | DWORD dwActions, // [IN] if !0, return only these actions. |
323 | mdPermission rPermission[], // [OUT] Put Permissions here. |
324 | ULONG cMax, // [IN] Max Permissions to put. |
325 | ULONG *pcTokens); // [OUT] Put # put here. |
326 | |
327 | STDMETHODIMP FindMember( |
328 | mdTypeDef td, // [IN] given typedef |
329 | LPCWSTR szName, // [IN] member name |
330 | PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature |
331 | ULONG cbSigBlob, // [IN] count of bytes in the signature blob |
332 | mdToken *pmb); // [OUT] matching memberdef |
333 | |
334 | STDMETHODIMP FindMethod( |
335 | mdTypeDef td, // [IN] given typedef |
336 | LPCWSTR szName, // [IN] member name |
337 | PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature |
338 | ULONG cbSigBlob, // [IN] count of bytes in the signature blob |
339 | mdMethodDef *pmb); // [OUT] matching memberdef |
340 | |
341 | STDMETHODIMP FindField( |
342 | mdTypeDef td, // [IN] given typedef |
343 | LPCWSTR szName, // [IN] member name |
344 | PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature |
345 | ULONG cbSigBlob, // [IN] count of bytes in the signature blob |
346 | mdFieldDef *pmb); // [OUT] matching memberdef |
347 | |
348 | STDMETHODIMP FindMemberRef( |
349 | mdTypeRef td, // [IN] given typeRef |
350 | LPCWSTR szName, // [IN] member name |
351 | PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature |
352 | ULONG cbSigBlob, // [IN] count of bytes in the signature blob |
353 | mdMemberRef *pmr); // [OUT] matching memberref |
354 | |
355 | STDMETHODIMP GetMethodProps( |
356 | mdMethodDef mb, // The method for which to get props. |
357 | mdTypeDef *pClass, // Put method's class here. |
358 | __out_ecount_opt (cchMethod) LPWSTR szMethod, // Put method's name here. |
359 | ULONG cchMethod, // Size of szMethod buffer in wide chars. |
360 | ULONG *pchMethod, // Put actual size here |
361 | DWORD *pdwAttr, // Put flags here. |
362 | PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data |
363 | ULONG *pcbSigBlob, // [OUT] actual size of signature blob |
364 | ULONG *pulCodeRVA, // [OUT] codeRVA |
365 | DWORD *pdwImplFlags); // [OUT] Impl. Flags |
366 | |
367 | STDMETHODIMP GetMemberRefProps( // S_OK or error. |
368 | mdMemberRef mr, // [IN] given memberref |
369 | mdToken *ptk, // [OUT] Put classref or classdef here. |
370 | __out_ecount_opt (cchMember) LPWSTR szMember, // [OUT] buffer to fill for member's name |
371 | ULONG cchMember, // [IN] the count of char of szMember |
372 | ULONG *pchMember, // [OUT] actual count of char in member name |
373 | PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value |
374 | ULONG *pbSig); // [OUT] actual size of signature blob |
375 | |
376 | STDMETHODIMP EnumProperties( // S_OK, S_FALSE, or error. |
377 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
378 | mdTypeDef td, // [IN] TypeDef to scope the enumeration. |
379 | mdProperty rProperties[], // [OUT] Put Properties here. |
380 | ULONG cMax, // [IN] Max properties to put. |
381 | ULONG *pcProperties); // [OUT] Put # put here. |
382 | |
383 | STDMETHODIMP EnumEvents( // S_OK, S_FALSE, or error. |
384 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
385 | mdTypeDef td, // [IN] TypeDef to scope the enumeration. |
386 | mdEvent rEvents[], // [OUT] Put events here. |
387 | ULONG cMax, // [IN] Max events to put. |
388 | ULONG *pcEvents); // [OUT] Put # put here. |
389 | |
390 | STDMETHODIMP GetEventProps( // S_OK, S_FALSE, or error. |
391 | mdEvent ev, // [IN] event token |
392 | mdTypeDef *pClass, // [OUT] typedef containing the event declarion. |
393 | LPCWSTR szEvent, // [OUT] Event name |
394 | ULONG cchEvent, // [IN] the count of wchar of szEvent |
395 | ULONG *pchEvent, // [OUT] actual count of wchar for event's name |
396 | DWORD *pdwEventFlags, // [OUT] Event flags. |
397 | mdToken *ptkEventType, // [OUT] EventType class |
398 | mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event |
399 | mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event |
400 | mdMethodDef *pmdFire, // [OUT] Fire method of the event |
401 | mdMethodDef rmdOtherMethod[], // [OUT] other method of the event |
402 | ULONG cMax, // [IN] size of rmdOtherMethod |
403 | ULONG *pcOtherMethod); // [OUT] total number of other method of this event |
404 | |
405 | STDMETHODIMP EnumMethodSemantics( // S_OK, S_FALSE, or error. |
406 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
407 | mdMethodDef mb, // [IN] MethodDef to scope the enumeration. |
408 | mdToken rEventProp[], // [OUT] Put Event/Property here. |
409 | ULONG cMax, // [IN] Max properties to put. |
410 | ULONG *pcEventProp); // [OUT] Put # put here. |
411 | |
412 | STDMETHODIMP GetMethodSemantics( // S_OK, S_FALSE, or error. |
413 | mdMethodDef mb, // [IN] method token |
414 | mdToken tkEventProp, // [IN] event/property token. |
415 | DWORD *pdwSemanticsFlags); // [OUT] the role flags for the method/propevent pair |
416 | |
417 | STDMETHODIMP GetClassLayout( |
418 | mdTypeDef td, // [IN] give typedef |
419 | DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16 |
420 | COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array |
421 | ULONG cMax, // [IN] size of the array |
422 | ULONG *pcFieldOffset, // [OUT] needed array size |
423 | ULONG *pulClassSize); // [OUT] the size of the class |
424 | |
425 | STDMETHODIMP GetFieldMarshal( |
426 | mdToken tk, // [IN] given a field's memberdef |
427 | PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field |
428 | ULONG *pcbNativeType); // [OUT] the count of bytes of *ppvNativeType |
429 | |
430 | STDMETHODIMP GetRVA( // S_OK or error. |
431 | mdToken tk, // Member for which to set offset |
432 | ULONG *pulCodeRVA, // The offset |
433 | DWORD *pdwImplFlags); // the implementation flags |
434 | |
435 | STDMETHODIMP GetPermissionSetProps( |
436 | mdPermission pm, // [IN] the permission token. |
437 | DWORD *pdwAction, // [OUT] CorDeclSecurity. |
438 | void const **ppvPermission, // [OUT] permission blob. |
439 | ULONG *pcbPermission); // [OUT] count of bytes of pvPermission. |
440 | |
441 | STDMETHODIMP GetSigFromToken( // S_OK or error. |
442 | mdSignature mdSig, // [IN] Signature token. |
443 | PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token. |
444 | ULONG *pcbSig); // [OUT] return size of signature. |
445 | |
446 | STDMETHODIMP GetModuleRefProps( // S_OK or error. |
447 | mdModuleRef mur, // [IN] moduleref token. |
448 | __out_ecount_opt (cchName) LPWSTR szName, // [OUT] buffer to fill with the moduleref name. |
449 | ULONG cchName, // [IN] size of szName in wide characters. |
450 | ULONG *pchName); // [OUT] actual count of characters in the name. |
451 | |
452 | STDMETHODIMP EnumModuleRefs( // S_OK or error. |
453 | HCORENUM *phEnum, // [IN|OUT] pointer to the enum. |
454 | mdModuleRef rModuleRefs[], // [OUT] put modulerefs here. |
455 | ULONG cmax, // [IN] max memberrefs to put. |
456 | ULONG *pcModuleRefs); // [OUT] put # put here. |
457 | |
458 | STDMETHODIMP GetTypeSpecFromToken( // S_OK or error. |
459 | mdTypeSpec typespec, // [IN] TypeSpec token. |
460 | PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature |
461 | ULONG *pcbSig); // [OUT] return size of signature. |
462 | |
463 | STDMETHODIMP GetNameFromToken( // S_OK or error. |
464 | mdToken tk, // [IN] Token to get name from. Must have a name. |
465 | MDUTF8CSTR *pszUtf8NamePtr); // [OUT] Return pointer to UTF8 name in heap. |
466 | |
467 | STDMETHODIMP EnumUnresolvedMethods( // S_OK, S_FALSE, or error. |
468 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
469 | mdToken rMethods[], // [OUT] Put MemberDefs here. |
470 | ULONG cMax, // [IN] Max MemberDefs to put. |
471 | ULONG *pcTokens); // [OUT] Put # put here. |
472 | |
473 | STDMETHODIMP GetUserString( // S_OK or error. |
474 | mdString stk, // [IN] String token. |
475 | __out_ecount_opt (cchString) LPWSTR szString, // [OUT] Copy of string. |
476 | ULONG cchString, // [IN] Max chars of room in szString. |
477 | ULONG *pchString); // [OUT] How many chars in actual string. |
478 | |
479 | STDMETHODIMP GetPinvokeMap( // S_OK or error. |
480 | mdToken tk, // [IN] FieldDef or MethodDef. |
481 | DWORD *pdwMappingFlags, // [OUT] Flags used for mapping. |
482 | __out_ecount_opt (cchImportName) LPWSTR szImportName, // [OUT] Import name. |
483 | ULONG cchImportName, // [IN] Size of the name buffer. |
484 | ULONG *pchImportName, // [OUT] Actual number of characters stored. |
485 | mdModuleRef *pmrImportDLL); // [OUT] ModuleRef token for the target DLL. |
486 | |
487 | STDMETHODIMP EnumSignatures( // S_OK or error. |
488 | HCORENUM *phEnum, // [IN|OUT] pointer to the enum. |
489 | mdSignature rSignatures[], // [OUT] put signatures here. |
490 | ULONG cmax, // [IN] max signatures to put. |
491 | ULONG *pcSignatures); // [OUT] put # put here. |
492 | |
493 | STDMETHODIMP EnumTypeSpecs( // S_OK or error. |
494 | HCORENUM *phEnum, // [IN|OUT] pointer to the enum. |
495 | mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here. |
496 | ULONG cmax, // [IN] max TypeSpecs to put. |
497 | ULONG *pcTypeSpecs); // [OUT] put # put here. |
498 | |
499 | STDMETHODIMP EnumUserStrings( // S_OK or error. |
500 | HCORENUM *phEnum, // [IN/OUT] pointer to the enum. |
501 | mdString rStrings[], // [OUT] put Strings here. |
502 | ULONG cmax, // [IN] max Strings to put. |
503 | ULONG *pcStrings); // [OUT] put # put here. |
504 | |
505 | STDMETHODIMP GetParamForMethodIndex( // S_OK or error. |
506 | mdMethodDef md, // [IN] Method token. |
507 | ULONG ulParamSeq, // [IN] Parameter sequence. |
508 | mdParamDef *ppd); // [IN] Put Param token here. |
509 | |
510 | STDMETHODIMP GetCustomAttributeByName( // S_OK or error. |
511 | mdToken tkObj, // [IN] Object with Custom Attribute. |
512 | LPCWSTR szName, // [IN] Name of desired Custom Attribute. |
513 | const void **ppData, // [OUT] Put pointer to data here. |
514 | ULONG *pcbData); // [OUT] Put size of data here. |
515 | |
516 | STDMETHODIMP EnumCustomAttributes( // S_OK or error. |
517 | HCORENUM *phEnum, // [IN, OUT] COR enumerator. |
518 | mdToken tk, // [IN] Token to scope the enumeration, 0 for all. |
519 | mdToken tkType, // [IN] Type of interest, 0 for all. |
520 | mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here. |
521 | ULONG cMax, // [IN] Size of rCustomAttributes. |
522 | ULONG *pcCustomAttributes); // [OUT, OPTIONAL] Put count of token values here. |
523 | |
524 | STDMETHODIMP GetCustomAttributeProps( // S_OK or error. |
525 | mdCustomAttribute cv, // [IN] CustomAttribute token. |
526 | mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here. |
527 | mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here. |
528 | void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here. |
529 | ULONG *pcbSize); // [OUT, OPTIONAL] Put size of date here. |
530 | |
531 | STDMETHODIMP FindTypeRef( // S_OK or error. |
532 | mdToken tkResolutionScope, // ResolutionScope. |
533 | LPCWSTR szName, // [IN] TypeRef name. |
534 | mdTypeRef *ptr); // [OUT] matching TypeRef. |
535 | |
536 | STDMETHODIMP GetMemberProps( |
537 | mdToken mb, // The member for which to get props. |
538 | mdTypeDef *pClass, // Put member's class here. |
539 | __out_ecount_opt (cchMember) LPWSTR szMember, // Put member's name here. |
540 | ULONG cchMember, // Size of szMember buffer in wide chars. |
541 | ULONG *pchMember, // Put actual size here |
542 | DWORD *pdwAttr, // Put flags here. |
543 | PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data |
544 | ULONG *pcbSigBlob, // [OUT] actual size of signature blob |
545 | ULONG *pulCodeRVA, // [OUT] codeRVA |
546 | DWORD *pdwImplFlags, // [OUT] Impl. Flags |
547 | DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_* |
548 | UVCP_CONSTANT *ppValue, // [OUT] constant value |
549 | ULONG *pcbValue); // [OUT] size of constant value |
550 | |
551 | STDMETHODIMP GetFieldProps( |
552 | mdFieldDef mb, // The field for which to get props. |
553 | mdTypeDef *pClass, // Put field's class here. |
554 | __out_ecount_opt (cchField) LPWSTR szField, // Put field's name here. |
555 | ULONG cchField, // Size of szField buffer in wide chars. |
556 | ULONG *pchField, // Put actual size here |
557 | DWORD *pdwAttr, // Put flags here. |
558 | PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data |
559 | ULONG *pcbSigBlob, // [OUT] actual size of signature blob |
560 | DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_* |
561 | UVCP_CONSTANT *ppValue, // [OUT] constant value |
562 | ULONG *pcbValue); // [OUT] size of constant value |
563 | |
564 | STDMETHODIMP GetPropertyProps( // S_OK, S_FALSE, or error. |
565 | mdProperty prop, // [IN] property token |
566 | mdTypeDef *pClass, // [OUT] typedef containing the property declarion. |
567 | LPCWSTR szProperty, // [OUT] Property name |
568 | ULONG cchProperty, // [IN] the count of wchar of szProperty |
569 | ULONG *pchProperty, // [OUT] actual count of wchar for property name |
570 | DWORD *pdwPropFlags, // [OUT] property flags. |
571 | PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob |
572 | ULONG *pbSig, // [OUT] count of bytes in *ppvSig |
573 | DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_* |
574 | UVCP_CONSTANT *ppDefaultValue, // [OUT] constant value |
575 | ULONG *pcbValue, // [OUT] size of constant value |
576 | mdMethodDef *pmdSetter, // [OUT] setter method of the property |
577 | mdMethodDef *pmdGetter, // [OUT] getter method of the property |
578 | mdMethodDef rmdOtherMethod[], // [OUT] other method of the property |
579 | ULONG cMax, // [IN] size of rmdOtherMethod |
580 | ULONG *pcOtherMethod); // [OUT] total number of other method of this property |
581 | |
582 | STDMETHODIMP GetParamProps( // S_OK or error. |
583 | mdParamDef tk, // [IN]The Parameter. |
584 | mdMethodDef *pmd, // [OUT] Parent Method token. |
585 | ULONG *pulSequence, // [OUT] Parameter sequence. |
586 | __out_ecount_opt (cchName) LPWSTR szName, // [OUT] Put name here. |
587 | ULONG cchName, // [OUT] Size of name buffer. |
588 | ULONG *pchName, // [OUT] Put actual size of name here. |
589 | DWORD *pdwAttr, // [OUT] Put flags here. |
590 | DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*. |
591 | UVCP_CONSTANT *ppValue, // [OUT] Constant value. |
592 | ULONG *pcbValue); // [OUT] size of constant value |
593 | |
594 | STDMETHODIMP_(BOOL) IsValidToken( // True or False. |
595 | mdToken tk); // [IN] Given token. |
596 | |
597 | STDMETHODIMP GetNestedClassProps( // S_OK or error. |
598 | mdTypeDef tdNestedClass, // [IN] NestedClass token. |
599 | mdTypeDef *ptdEnclosingClass); // [OUT] EnclosingClass token. |
600 | |
601 | STDMETHODIMP GetNativeCallConvFromSig( // S_OK or error. |
602 | void const *pvSig, // [IN] Pointer to signature. |
603 | ULONG cbSig, // [IN] Count of signature bytes. |
604 | ULONG *pCallConv); // [OUT] Put calling conv here (see CorPinvokemap). |
605 | |
606 | STDMETHODIMP IsGlobal( // S_OK or error. |
607 | mdToken pd, // [IN] Type, Field, or Method token. |
608 | int *pbGlobal); // [OUT] Put 1 if global, 0 otherwise. |
609 | |
610 | //***************************************************************************** |
611 | // IMetaDataImport2 methods |
612 | //***************************************************************************** |
613 | STDMETHODIMP GetGenericParamProps( // S_OK or error. |
614 | mdGenericParam gp, // [IN] GenericParam |
615 | ULONG *pulParamSeq, // [OUT] Index of the type parameter |
616 | DWORD *pdwParamFlags, // [OUT] Flags, for future use (e.g. variance) |
617 | mdToken *ptOwner, // [OUT] Owner (TypeDef or MethodDef) |
618 | DWORD *reserved, // [OUT] For future use (e.g. non-type parameters) |
619 | __out_ecount_opt (cchName) LPWSTR wzname, // [OUT] Put name here |
620 | ULONG cchName, // [IN] Size of buffer |
621 | ULONG *pchName); // [OUT] Put size of name (wide chars) here. |
622 | |
623 | STDMETHODIMP GetGenericParamConstraintProps( // S_OK or error. |
624 | mdGenericParamConstraint gpc, // [IN] GenericParamConstraint |
625 | mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained |
626 | mdToken *ptkConstraintType); // [OUT] TypeDef/Ref/Spec constraint |
627 | |
628 | STDMETHODIMP GetMethodSpecProps( |
629 | mdMethodSpec mi, // [IN] The method instantiation |
630 | mdToken *tkParent, // [OUT] MethodDef or MemberRef |
631 | PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data |
632 | ULONG *pcbSigBlob); // [OUT] actual size of signature blob |
633 | |
634 | STDMETHODIMP EnumGenericParams( // S_OK or error. |
635 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
636 | mdToken tk, // [IN] TypeDef or MethodDef whose generic parameters are requested |
637 | mdGenericParam rGenericParams[], // [OUT] Put GenericParams here. |
638 | ULONG cMax, // [IN] Max GenericParams to put. |
639 | ULONG *pcGenericParams); // [OUT] Put # put here. |
640 | |
641 | STDMETHODIMP EnumGenericParamConstraints( // S_OK or error. |
642 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
643 | mdGenericParam tk, // [IN] GenericParam whose constraints are requested |
644 | mdGenericParamConstraint rGenericParamConstraints[], // [OUT] Put GenericParamConstraints here. |
645 | ULONG cMax, // [IN] Max GenericParamConstraints to put. |
646 | ULONG *pcGenericParamConstraints); // [OUT] Put # put here. |
647 | |
648 | STDMETHODIMP EnumMethodSpecs( |
649 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
650 | mdToken tk, // [IN] MethodDef or MemberRef whose MethodSpecs are requested |
651 | mdMethodSpec rMethodSpecs[], // [OUT] Put MethodSpecs here. |
652 | ULONG cMax, // [IN] Max tokens to put. |
653 | ULONG *pcMethodSpecs); // [OUT] Put actual count here. |
654 | |
655 | STDMETHODIMP GetPEKind( // S_OK or error. |
656 | DWORD* pdwPEKind, // [OUT] The kind of PE (0 - not a PE) |
657 | DWORD* pdwMAchine); // [OUT] Machine as defined in NT header |
658 | |
659 | STDMETHODIMP GetVersionString( // S_OK or error. |
660 | __out_ecount_opt (cchBufSize) LPWSTR pwzBuf, // [OUT] Put version string here. |
661 | DWORD cchBufSize, // [IN] size of the buffer, in wide chars |
662 | DWORD *pchBufSize); // [OUT] Size of the version string, wide chars, including terminating nul. |
663 | |
664 | //***************************************************************************** |
665 | // IMetaDataAssemblyImport |
666 | //***************************************************************************** |
667 | STDMETHODIMP GetAssemblyProps( // S_OK or error. |
668 | mdAssembly mda, // [IN] The Assembly for which to get the properties. |
669 | const void **ppbPublicKey, // [OUT] Pointer to the public key. |
670 | ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key. |
671 | ULONG *pulHashAlgId, // [OUT] Hash Algorithm. |
672 | __out_ecount_part_opt(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with assembly's simply name. |
673 | ULONG cchName, // [IN] Size of buffer in wide chars. |
674 | ULONG *pchName, // [OUT] Actual # of wide chars in name. |
675 | ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData. |
676 | DWORD *pdwAssemblyFlags); // [OUT] Flags. |
677 | |
678 | STDMETHODIMP GetAssemblyRefProps( // S_OK or error. |
679 | mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties. |
680 | const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token. |
681 | ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token. |
682 | __out_ecount_part_opt(cchName, *pchName)LPWSTR szName, // [OUT] Buffer to fill with name. |
683 | ULONG cchName, // [IN] Size of buffer in wide chars. |
684 | ULONG *pchName, // [OUT] Actual # of wide chars in name. |
685 | ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData. |
686 | const void **ppbHashValue, // [OUT] Hash blob. |
687 | ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob. |
688 | DWORD *pdwAssemblyRefFlags); // [OUT] Flags. |
689 | |
690 | STDMETHODIMP GetFileProps( // S_OK or error. |
691 | mdFile mdf, // [IN] The File for which to get the properties. |
692 | __out_ecount_part_opt(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with name. |
693 | ULONG cchName, // [IN] Size of buffer in wide chars. |
694 | ULONG *pchName, // [OUT] Actual # of wide chars in name. |
695 | const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob. |
696 | ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob. |
697 | DWORD *pdwFileFlags); // [OUT] Flags. |
698 | |
699 | STDMETHODIMP GetExportedTypeProps( // S_OK or error. |
700 | mdExportedType mdct, // [IN] The ExportedType for which to get the properties. |
701 | __out_ecount_part_opt(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with name. |
702 | ULONG cchName, // [IN] Size of buffer in wide chars. |
703 | ULONG *pchName, // [OUT] Actual # of wide chars in name. |
704 | mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ExportedType. |
705 | mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file. |
706 | DWORD *pdwExportedTypeFlags); // [OUT] Flags. |
707 | |
708 | STDMETHODIMP GetManifestResourceProps( // S_OK or error. |
709 | mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties. |
710 | __out_ecount_part_opt(cchName, *pchName)LPWSTR szName, // [OUT] Buffer to fill with name. |
711 | ULONG cchName, // [IN] Size of buffer in wide chars. |
712 | ULONG *pchName, // [OUT] Actual # of wide chars in name. |
713 | mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ExportedType. |
714 | DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file. |
715 | DWORD *pdwResourceFlags); // [OUT] Flags. |
716 | |
717 | STDMETHODIMP EnumAssemblyRefs( // S_OK or error |
718 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
719 | mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here. |
720 | ULONG cMax, // [IN] Max AssemblyRefs to put. |
721 | ULONG *pcTokens); // [OUT] Put # put here. |
722 | |
723 | STDMETHODIMP EnumFiles( // S_OK or error |
724 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
725 | mdFile rFiles[], // [OUT] Put Files here. |
726 | ULONG cMax, // [IN] Max Files to put. |
727 | ULONG *pcTokens); // [OUT] Put # put here. |
728 | |
729 | STDMETHODIMP EnumExportedTypes( // S_OK or error |
730 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
731 | mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here. |
732 | ULONG cMax, // [IN] Max ExportedTypes to put. |
733 | ULONG *pcTokens); // [OUT] Put # put here. |
734 | |
735 | STDMETHODIMP EnumManifestResources( // S_OK or error |
736 | HCORENUM *phEnum, // [IN|OUT] Pointer to the enum. |
737 | mdManifestResource rManifestResources[], // [OUT] Put ManifestResources here. |
738 | ULONG cMax, // [IN] Max Resources to put. |
739 | ULONG *pcTokens); // [OUT] Put # put here. |
740 | |
741 | STDMETHODIMP FindExportedTypeByName( // S_OK or error |
742 | LPCWSTR szName, // [IN] Name of the ExportedType. |
743 | mdExportedType tkEnclosingType, // [IN] Enclosing ExportedType. |
744 | mdExportedType *ptkExportedType); // [OUT] Put the ExportedType token here. |
745 | |
746 | STDMETHODIMP FindManifestResourceByName(// S_OK or error |
747 | LPCWSTR szName, // [IN] Name of the ManifestResource. |
748 | mdManifestResource *ptkManifestResource); // [OUT] Put the ManifestResource token here. |
749 | |
750 | STDMETHODIMP GetAssemblyFromScope( // S_OK or error |
751 | mdAssembly *ptkAssembly); // [OUT] Put token here. |
752 | |
753 | // This uses Fusion to lookup, so it's E_NOTIMPL in the standalone versions. |
754 | STDMETHODIMP FindAssembliesByName( // S_OK or error |
755 | LPCWSTR szAppBase, // [IN] optional - can be NULL |
756 | LPCWSTR szPrivateBin, // [IN] optional - can be NULL |
757 | LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting |
758 | IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here |
759 | ULONG cMax, // [IN] The max number to put |
760 | ULONG *pcAssemblies); // [OUT] The number of assemblies returned. |
761 | |
762 | #ifdef FEATURE_METADATA_EMIT |
763 | //***************************************************************************** |
764 | // IMetaDataEmit |
765 | //***************************************************************************** |
766 | STDMETHODIMP DefineMethod( // S_OK or error. |
767 | mdTypeDef td, // Parent TypeDef |
768 | LPCWSTR szName, // Name of member |
769 | DWORD dwMethodFlags, // Member attributes |
770 | PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature |
771 | ULONG cbSigBlob, // [IN] count of bytes in the signature blob |
772 | ULONG ulCodeRVA, |
773 | DWORD dwImplFlags, |
774 | mdMethodDef *pmd); // Put member token here |
775 | |
776 | STDMETHODIMP DefineMethodImpl( // S_OK or error. |
777 | mdTypeDef td, // [IN] The class implementing the method |
778 | mdToken tkBody, // [IN] Method body, MethodDef or MethodRef |
779 | mdToken tkDecl); // [IN] Method declaration, MethodDef or MethodRef |
780 | |
781 | STDMETHODIMP SetMethodImplFlags( // [IN] S_OK or error. |
782 | mdMethodDef md, // [IN] Method for which to set impl flags |
783 | DWORD dwImplFlags); |
784 | |
785 | STDMETHODIMP SetFieldRVA( // [IN] S_OK or error. |
786 | mdFieldDef fd, // [IN] Field for which to set offset |
787 | ULONG ulRVA); // [IN] The offset |
788 | |
789 | STDMETHODIMP DefineTypeRefByName( // S_OK or error. |
790 | mdToken tkResolutionScope, // [IN] ModuleRef or AssemblyRef. |
791 | LPCWSTR szName, // [IN] Name of the TypeRef. |
792 | mdTypeRef *ptr); // [OUT] Put TypeRef token here. |
793 | |
794 | STDMETHODIMP DefineImportType( // S_OK or error. |
795 | IMetaDataAssemblyImport *pAssemImport, // [IN] Assemby containing the TypeDef. |
796 | const void *pbHashValue, // [IN] Hash Blob for Assembly. |
797 | ULONG cbHashValue, // [IN] Count of bytes. |
798 | IMetaDataImport *pImport, // [IN] Scope containing the TypeDef. |
799 | mdTypeDef tdImport, // [IN] The imported TypeDef. |
800 | IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the TypeDef is imported. |
801 | mdTypeRef *ptr); // [OUT] Put TypeRef token here. |
802 | |
803 | STDMETHODIMP DefineMemberRef( // S_OK or error |
804 | mdToken tkImport, // [IN] ClassRef or ClassDef importing a member. |
805 | LPCWSTR szName, // [IN] member's name |
806 | PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature |
807 | ULONG cbSigBlob, // [IN] count of bytes in the signature blob |
808 | mdMemberRef *pmr); // [OUT] memberref token |
809 | |
810 | STDMETHODIMP DefineImportMember( // S_OK or error. |
811 | IMetaDataAssemblyImport *pAssemImport, // [IN] Assemby containing the Member. |
812 | const void *pbHashValue, // [IN] Hash Blob for Assembly. |
813 | ULONG cbHashValue, // [IN] Count of bytes. |
814 | IMetaDataImport *pImport, // [IN] Import scope, with member. |
815 | mdToken mbMember, // [IN] Member in import scope. |
816 | IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the Member is imported. |
817 | mdToken tkImport, // [IN] Classref or classdef in emit scope. |
818 | mdMemberRef *pmr); // [OUT] Put member ref here. |
819 | |
820 | STDMETHODIMP DefineEvent( |
821 | mdTypeDef td, // [IN] the class/interface on which the event is being defined |
822 | LPCWSTR szEvent, // [IN] Name of the event |
823 | DWORD dwEventFlags, // [IN] CorEventAttr |
824 | mdToken tkEventType, // [IN] a reference (mdTypeRef or mdTypeRef(to the Event class |
825 | mdMethodDef mdAddOn, // [IN] required add method |
826 | mdMethodDef mdRemoveOn, // [IN] required remove method |
827 | mdMethodDef mdFire, // [IN] optional fire method |
828 | mdMethodDef rmdOtherMethods[], // [IN] optional array of other methods associate with the event |
829 | mdEvent *pmdEvent); // [OUT] output event token |
830 | |
831 | STDMETHODIMP SetClassLayout( |
832 | mdTypeDef td, // [IN] typedef |
833 | DWORD dwPackSize, // [IN] packing size specified as 1, 2, 4, 8, or 16 |
834 | COR_FIELD_OFFSET rFieldOffsets[], // [IN] array of layout specification |
835 | ULONG ulClassSize); // [IN] size of the class |
836 | |
837 | STDMETHODIMP DeleteClassLayout( |
838 | mdTypeDef td); // [IN] typdef token |
839 | |
840 | STDMETHODIMP SetFieldMarshal( |
841 | mdToken tk, // [IN] given a fieldDef or paramDef token |
842 | PCCOR_SIGNATURE pvNativeType, // [IN] native type specification |
843 | ULONG cbNativeType); // [IN] count of bytes of pvNativeType |
844 | |
845 | STDMETHODIMP DeleteFieldMarshal( |
846 | mdToken tk); // [IN] fieldDef or paramDef token to be deleted. |
847 | |
848 | STDMETHODIMP DefinePermissionSet( |
849 | mdToken tk, // [IN] the object to be decorated. |
850 | DWORD dwAction, // [IN] CorDeclSecurity. |
851 | void const *pvPermission, // [IN] permission blob. |
852 | ULONG cbPermission, // [IN] count of bytes of pvPermission. |
853 | mdPermission *ppm); // [OUT] returned permission token. |
854 | |
855 | STDMETHODIMP SetRVA( // [IN] S_OK or error. |
856 | mdToken md, // [IN] MethodDef for which to set offset |
857 | ULONG ulRVA); // [IN] The offset#endif |
858 | |
859 | STDMETHODIMP GetTokenFromSig( // [IN] S_OK or error. |
860 | PCCOR_SIGNATURE pvSig, // [IN] Signature to define. |
861 | ULONG cbSig, // [IN] Size of signature data. |
862 | mdSignature *pmsig); // [OUT] returned signature token. |
863 | |
864 | STDMETHODIMP DefineModuleRef( // S_OK or error. |
865 | LPCWSTR szName, // [IN] DLL name |
866 | mdModuleRef *pmur); // [OUT] returned module ref token |
867 | |
868 | STDMETHODIMP SetParent( // S_OK or error. |
869 | mdMemberRef mr, // [IN] Token for the ref to be fixed up. |
870 | mdToken tk); // [IN] The ref parent. |
871 | |
872 | STDMETHODIMP GetTokenFromTypeSpec( // S_OK or error. |
873 | PCCOR_SIGNATURE pvSig, // [IN] ArraySpec Signature to define. |
874 | ULONG cbSig, // [IN] Size of signature data. |
875 | mdTypeSpec *ptypespec); // [OUT] returned TypeSpec token. |
876 | |
877 | STDMETHODIMP SaveToMemory( // S_OK or error. |
878 | void *pbData, // [OUT] Location to write data. |
879 | ULONG cbData); // [IN] Max size of data buffer. |
880 | |
881 | STDMETHODIMP DefineUserString( // S_OK or error. |
882 | LPCWSTR szString, // [IN] User literal string. |
883 | ULONG cchString, // [IN] Length of string. |
884 | mdString *pstk); // [OUT] String token. |
885 | |
886 | STDMETHODIMP DeleteToken( // Return code. |
887 | mdToken tkObj); // [IN] The token to be deleted |
888 | |
889 | STDMETHODIMP SetTypeDefProps( // S_OK or error. |
890 | mdTypeDef td, // [IN] The TypeDef. |
891 | DWORD dwTypeDefFlags, // [IN] TypeDef flags. |
892 | mdToken tkExtends, // [IN] Base TypeDef or TypeRef. |
893 | mdToken rtkImplements[]); // [IN] Implemented interfaces. |
894 | |
895 | STDMETHODIMP DefineNestedType( // S_OK or error. |
896 | LPCWSTR szTypeDef, // [IN] Name of TypeDef |
897 | DWORD dwTypeDefFlags, // [IN] CustomAttribute flags |
898 | mdToken tkExtends, // [IN] extends this TypeDef or typeref |
899 | mdToken rtkImplements[], // [IN] Implements interfaces |
900 | mdTypeDef tdEncloser, // [IN] TypeDef token of the enclosing type. |
901 | mdTypeDef *ptd); // [OUT] Put TypeDef token here |
902 | |
903 | STDMETHODIMP SetMethodProps( // S_OK or error. |
904 | mdMethodDef md, // [IN] The MethodDef. |
905 | DWORD dwMethodFlags, // [IN] Method attributes. |
906 | ULONG ulCodeRVA, // [IN] Code RVA. |
907 | DWORD dwImplFlags); // [IN] MethodImpl flags. |
908 | |
909 | STDMETHODIMP SetEventProps( // S_OK or error. |
910 | mdEvent ev, // [IN] The event token. |
911 | DWORD dwEventFlags, // [IN] CorEventAttr. |
912 | mdToken tkEventType, // [IN] A reference (mdTypeRef or mdTypeRef) to the Event class. |
913 | mdMethodDef mdAddOn, // [IN] Add method. |
914 | mdMethodDef mdRemoveOn, // [IN] Remove method. |
915 | mdMethodDef mdFire, // [IN] Fire method. |
916 | mdMethodDef rmdOtherMethods[]); // [IN] Array of other methods associated with the event. |
917 | |
918 | STDMETHODIMP SetPermissionSetProps( // S_OK or error. |
919 | mdToken tk, // [IN] The object to be decorated. |
920 | DWORD dwAction, // [IN] CorDeclSecurity. |
921 | void const *pvPermission, // [IN] Permission blob. |
922 | ULONG cbPermission, // [IN] Count of bytes of pvPermission. |
923 | mdPermission *ppm); // [OUT] Permission token. |
924 | |
925 | STDMETHODIMP DefinePinvokeMap( // Return code. |
926 | mdToken tk, // [IN] FieldDef or MethodDef. |
927 | DWORD dwMappingFlags, // [IN] Flags used for mapping. |
928 | LPCWSTR szImportName, // [IN] Import name. |
929 | mdModuleRef mrImportDLL); // [IN] ModuleRef token for the target DLL. |
930 | |
931 | STDMETHODIMP SetPinvokeMap( // Return code. |
932 | mdToken tk, // [IN] FieldDef or MethodDef. |
933 | DWORD dwMappingFlags, // [IN] Flags used for mapping. |
934 | LPCWSTR szImportName, // [IN] Import name. |
935 | mdModuleRef mrImportDLL); // [IN] ModuleRef token for the target DLL. |
936 | |
937 | STDMETHODIMP DeletePinvokeMap( // Return code. |
938 | mdToken tk); // [IN]FieldDef or MethodDef. |
939 | |
940 | STDMETHODIMP DefineCustomAttribute( // Return code. |
941 | mdToken tkOwner, // [IN] The object to put the value on. |
942 | mdToken tkCtor, // [IN] Constructor of the CustomAttribute type (MemberRef/MethodDef). |
943 | void const *pCustomAttribute, // [IN] The custom value data. |
944 | ULONG cbCustomAttribute, // [IN] The custom value data length. |
945 | mdCustomAttribute *pcv); // [OUT] The custom value token value on return. |
946 | |
947 | STDMETHODIMP SetCustomAttributeValue( // Return code. |
948 | mdCustomAttribute pcv, // [IN] The custom value token whose value to replace. |
949 | void const *pCustomAttribute, // [IN] The custom value data. |
950 | ULONG cbCustomAttribute); // [IN] The custom value data length. |
951 | |
952 | STDMETHODIMP DefineField( // S_OK or error. |
953 | mdTypeDef td, // Parent TypeDef |
954 | LPCWSTR szName, // Name of member |
955 | DWORD dwFieldFlags, // Member attributes |
956 | PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature |
957 | ULONG cbSigBlob, // [IN] count of bytes in the signature blob |
958 | DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_* |
959 | void const *pValue, // [IN] constant value |
960 | ULONG cchValue, // [IN] size of constant value (string, in wide chars). |
961 | mdFieldDef *pmd); // [OUT] Put member token here |
962 | |
963 | STDMETHODIMP DefineProperty( |
964 | mdTypeDef td, // [IN] the class/interface on which the property is being defined |
965 | LPCWSTR szProperty, // [IN] Name of the property |
966 | DWORD dwPropFlags, // [IN] CorPropertyAttr |
967 | PCCOR_SIGNATURE pvSig, // [IN] the required type signature |
968 | ULONG cbSig, // [IN] the size of the type signature blob |
969 | DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_* |
970 | void const *pValue, // [IN] constant value |
971 | ULONG cchValue, // [IN] size of constant value (string, in wide chars). |
972 | mdMethodDef mdSetter, // [IN] optional setter of the property |
973 | mdMethodDef mdGetter, // [IN] optional getter of the property |
974 | mdMethodDef rmdOtherMethods[], // [IN] an optional array of other methods |
975 | mdProperty *pmdProp); // [OUT] output property token |
976 | |
977 | STDMETHODIMP DefineParam( |
978 | mdMethodDef md, // [IN] Owning method |
979 | ULONG ulParamSeq, // [IN] Which param |
980 | LPCWSTR szName, // [IN] Optional param name |
981 | DWORD dwParamFlags, // [IN] Optional param flags |
982 | DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_* |
983 | void const *pValue, // [IN] constant value |
984 | ULONG cchValue, // [IN] size of constant value (string, in wide chars). |
985 | mdParamDef *ppd); // [OUT] Put param token here |
986 | |
987 | STDMETHODIMP SetFieldProps( // S_OK or error. |
988 | mdFieldDef fd, // [IN] The FieldDef. |
989 | DWORD dwFieldFlags, // [IN] Field attributes. |
990 | DWORD dwCPlusTypeFlag, // [IN] Flag for the value type, selected ELEMENT_TYPE_* |
991 | void const *pValue, // [IN] Constant value. |
992 | ULONG cchValue); // [IN] size of constant value (string, in wide chars). |
993 | |
994 | STDMETHODIMP SetPropertyProps( // S_OK or error. |
995 | mdProperty pr, // [IN] Property token. |
996 | DWORD dwPropFlags, // [IN] CorPropertyAttr. |
997 | DWORD dwCPlusTypeFlag, // [IN] Flag for value type, selected ELEMENT_TYPE_* |
998 | void const *pValue, // [IN] Constant value. |
999 | ULONG cchValue, // [IN] size of constant value (string, in wide chars). |
1000 | mdMethodDef mdSetter, // [IN] Setter of the property. |
1001 | mdMethodDef mdGetter, // [IN] Getter of the property. |
1002 | mdMethodDef rmdOtherMethods[]); // [IN] Array of other methods. |
1003 | |
1004 | STDMETHODIMP SetParamProps( // Return code. |
1005 | mdParamDef pd, // [IN] Param token. |
1006 | LPCWSTR szName, // [IN] Param name. |
1007 | DWORD dwParamFlags, // [IN] Param flags. |
1008 | DWORD dwCPlusTypeFlag, // [IN] Flag for value type. selected ELEMENT_TYPE_*. |
1009 | void const *pValue, // [OUT] Constant value. |
1010 | ULONG cchValue); // [IN] size of constant value (string, in wide chars). |
1011 | |
1012 | STDMETHODIMP ApplyEditAndContinue( // S_OK or error. |
1013 | IUnknown *pImport); // [IN] Metadata from the delta PE. |
1014 | |
1015 | // Specialized Custom Attributes for security. |
1016 | STDMETHODIMP DefineSecurityAttributeSet(// Return code. |
1017 | mdToken tkObj, // [IN] Class or method requiring security attributes. |
1018 | COR_SECATTR rSecAttrs[], // [IN] Array of security attribute descriptions. |
1019 | ULONG cSecAttrs, // [IN] Count of elements in above array. |
1020 | ULONG *pulErrorAttr); // [OUT] On error, index of attribute causing problem. |
1021 | |
1022 | STDMETHODIMP TranslateSigWithScope( |
1023 | IMetaDataAssemblyImport *pAssemImport, // [IN] assembly importing interface |
1024 | const void *pbHashValue, // [IN] Hash Blob for Assembly. |
1025 | ULONG cbHashValue, // [IN] Count of bytes. |
1026 | IMetaDataImport *import, // [IN] importing interface |
1027 | PCCOR_SIGNATURE pbSigBlob, // [IN] signature in the importing scope |
1028 | ULONG cbSigBlob, // [IN] count of bytes of signature |
1029 | IMetaDataAssemblyEmit *pAssemEmti, // [IN] emit assembly interface |
1030 | IMetaDataEmit *emit, // [IN] emit interface |
1031 | PCOR_SIGNATURE pvTranslatedSig, // [OUT] buffer to hold translated signature |
1032 | ULONG cbTranslatedSigMax, |
1033 | ULONG *pcbTranslatedSig); // [OUT] count of bytes in the translated signature |
1034 | |
1035 | //***************************************************************************** |
1036 | // IMetaDataEmit2 methods |
1037 | //***************************************************************************** |
1038 | STDMETHODIMP SetModuleProps( // S_OK or error. |
1039 | LPCWSTR szName); // [IN] If not NULL, the name to set. |
1040 | |
1041 | STDMETHODIMP Save( // S_OK or error. |
1042 | LPCWSTR szFile, // [IN] The filename to save to. |
1043 | DWORD dwSaveFlags); // [IN] Flags for the save. |
1044 | |
1045 | STDMETHODIMP SaveToStream( // S_OK or error. |
1046 | IStream *pIStream, // [IN] A writable stream to save to. |
1047 | DWORD dwSaveFlags); // [IN] Flags for the save. |
1048 | |
1049 | STDMETHODIMP GetSaveSize( // S_OK or error. |
1050 | CorSaveSize fSave, // [IN] cssAccurate or cssQuick. |
1051 | DWORD *pdwSaveSize); // [OUT] Put the size here. |
1052 | |
1053 | STDMETHODIMP Merge( // S_OK or error. |
1054 | IMetaDataImport *pImport, // [IN] The scope to be merged. |
1055 | IMapToken *pHostMapToken, // [IN] Host IMapToken interface to receive token remap notification |
1056 | IUnknown *pHandler); // [IN] An object to receive to receive error notification. |
1057 | |
1058 | STDMETHODIMP MergeEnd(); // S_OK or error. |
1059 | |
1060 | STDMETHODIMP DefineMethodSpec( // S_OK or error |
1061 | mdToken tkImport, // [IN] MethodDef or MemberRef |
1062 | PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature |
1063 | ULONG cbSigBlob, // [IN] count of bytes in the signature blob |
1064 | mdMethodSpec *pmi); // [OUT] method instantiation token |
1065 | |
1066 | STDMETHODIMP DefineTypeDef( // S_OK or error. |
1067 | LPCWSTR szTypeDef, // [IN] Name of TypeDef |
1068 | DWORD dwTypeDefFlags, // [IN] CustomAttribute flags |
1069 | mdToken tkExtends, // [IN] extends this TypeDef or typeref |
1070 | mdToken rtkImplements[], // [IN] Implements interfaces |
1071 | mdTypeDef *ptd); // [OUT] Put TypeDef token here |
1072 | |
1073 | STDMETHODIMP SetHandler( // S_OK. |
1074 | IUnknown *pUnk); // [IN] The new error handler. |
1075 | |
1076 | STDMETHODIMP GetDeltaSaveSize( // S_OK or error. |
1077 | CorSaveSize fSave, // [IN] cssAccurate or cssQuick. |
1078 | DWORD *pdwSaveSize); // [OUT] Put the size here. |
1079 | |
1080 | STDMETHODIMP SaveDelta( // S_OK or error. |
1081 | LPCWSTR szFile, // [IN] The filename to save to. |
1082 | DWORD dwSaveFlags); // [IN] Flags for the save. |
1083 | |
1084 | STDMETHODIMP SaveDeltaToStream( // S_OK or error. |
1085 | IStream *pIStream, // [IN] A writable stream to save to. |
1086 | DWORD dwSaveFlags); // [IN] Flags for the save. |
1087 | |
1088 | STDMETHODIMP SaveDeltaToMemory( // S_OK or error. |
1089 | void *pbData, // [OUT] Location to write data. |
1090 | ULONG cbData); // [IN] Max size of data buffer. |
1091 | |
1092 | STDMETHODIMP ResetENCLog(); // S_OK or error. |
1093 | |
1094 | STDMETHODIMP DefineGenericParam( // S_OK or error. |
1095 | mdToken tk, // [IN] TypeDef or MethodDef |
1096 | ULONG ulParamSeq, // [IN] Index of the type parameter |
1097 | DWORD dwParamFlags, // [IN] Flags, for future use (e.g. variance) |
1098 | LPCWSTR szname, // [IN] Name |
1099 | DWORD reserved, // [IN] For future use (e.g. non-type parameters) |
1100 | mdToken rtkConstraints[], // [IN] Array of type constraints (TypeDef,TypeRef,TypeSpec) |
1101 | mdGenericParam *pgp); // [OUT] Put GenericParam token here |
1102 | |
1103 | STDMETHODIMP SetGenericParamProps( // S_OK or error. |
1104 | mdGenericParam gp, // [IN] GenericParam |
1105 | DWORD dwParamFlags, // [IN] Flags, for future use (e.g. variance) |
1106 | LPCWSTR szName, // [IN] Optional name |
1107 | DWORD reserved, // [IN] For future use (e.g. non-type parameters) |
1108 | mdToken rtkConstraints[]); // [IN] Array of type constraints (TypeDef,TypeRef,TypeSpec) |
1109 | |
1110 | //***************************************************************************** |
1111 | // IMetaDataAssemblyEmit |
1112 | //***************************************************************************** |
1113 | STDMETHODIMP DefineAssembly( // S_OK or error. |
1114 | const void *pbPublicKey, // [IN] Public key of the assembly. |
1115 | ULONG cbPublicKey, // [IN] Count of bytes in the public key. |
1116 | ULONG ulHashAlgId, // [IN] Hash Algorithm. |
1117 | LPCWSTR szName, // [IN] Name of the assembly. |
1118 | const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData. |
1119 | DWORD dwAssemblyFlags, // [IN] Flags. |
1120 | mdAssembly *pma); // [OUT] Returned Assembly token. |
1121 | |
1122 | STDMETHODIMP DefineAssemblyRef( // S_OK or error. |
1123 | const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly. |
1124 | ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token. |
1125 | LPCWSTR szName, // [IN] Name of the assembly being referenced. |
1126 | const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData. |
1127 | const void *pbHashValue, // [IN] Hash Blob. |
1128 | ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob. |
1129 | DWORD dwAssemblyRefFlags, // [IN] Token for Execution Location. |
1130 | mdAssemblyRef *pmar); // [OUT] Returned AssemblyRef token. |
1131 | |
1132 | STDMETHODIMP DefineFile( // S_OK or error. |
1133 | LPCWSTR szName, // [IN] Name of the file. |
1134 | const void *pbHashValue, // [IN] Hash Blob. |
1135 | ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob. |
1136 | DWORD dwFileFlags, // [IN] Flags. |
1137 | mdFile *pmf); // [OUT] Returned File token. |
1138 | |
1139 | STDMETHODIMP DefineExportedType( // S_OK or error. |
1140 | LPCWSTR szName, // [IN] Name of the Com Type. |
1141 | mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the ExportedType. |
1142 | mdTypeDef tkTypeDef, // [IN] TypeDef token within the file. |
1143 | DWORD dwExportedTypeFlags, // [IN] Flags. |
1144 | mdExportedType *pmct); // [OUT] Returned ExportedType token. |
1145 | |
1146 | STDMETHODIMP DefineManifestResource( // S_OK or error. |
1147 | LPCWSTR szName, // [IN] Name of the resource. |
1148 | mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource. |
1149 | DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file. |
1150 | DWORD dwResourceFlags, // [IN] Flags. |
1151 | mdManifestResource *pmmr); // [OUT] Returned ManifestResource token. |
1152 | |
1153 | STDMETHODIMP SetAssemblyProps( // S_OK or error. |
1154 | mdAssembly pma, // [IN] Assembly token. |
1155 | const void *pbPublicKey, // [IN] Public key of the assembly. |
1156 | ULONG cbPublicKey, // [IN] Count of bytes in the public key. |
1157 | ULONG ulHashAlgId, // [IN] Hash Algorithm. |
1158 | LPCWSTR szName, // [IN] Name of the assembly. |
1159 | const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData. |
1160 | DWORD dwAssemblyFlags); // [IN] Flags. |
1161 | |
1162 | STDMETHODIMP SetAssemblyRefProps( // S_OK or error. |
1163 | mdAssemblyRef ar, // [IN] AssemblyRefToken. |
1164 | const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly. |
1165 | ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token. |
1166 | LPCWSTR szName, // [IN] Name of the assembly being referenced. |
1167 | const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData. |
1168 | const void *pbHashValue, // [IN] Hash Blob. |
1169 | ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob. |
1170 | DWORD dwAssemblyRefFlags); // [IN] Token for Execution Location. |
1171 | |
1172 | STDMETHODIMP SetFileProps( // S_OK or error. |
1173 | mdFile file, // [IN] File token. |
1174 | const void *pbHashValue, // [IN] Hash Blob. |
1175 | ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob. |
1176 | DWORD dwFileFlags); // [IN] Flags. |
1177 | |
1178 | STDMETHODIMP SetExportedTypeProps( // S_OK or error. |
1179 | mdExportedType ct, // [IN] ExportedType token. |
1180 | mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the ExportedType. |
1181 | mdTypeDef tkTypeDef, // [IN] TypeDef token within the file. |
1182 | DWORD dwExportedTypeFlags); // [IN] Flags. |
1183 | |
1184 | STDMETHODIMP SetManifestResourceProps( // S_OK or error. |
1185 | mdManifestResource mr, // [IN] ManifestResource token. |
1186 | mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource. |
1187 | DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file. |
1188 | DWORD dwResourceFlags); // [IN] Flags. |
1189 | |
1190 | #endif //FEATURE_METADATA_EMIT |
1191 | |
1192 | #ifdef FEATURE_METADATA_EMIT_ALL |
1193 | //***************************************************************************** |
1194 | // IMetaDataFilter |
1195 | //***************************************************************************** |
1196 | STDMETHODIMP UnmarkAll(); // unmark everything in a module |
1197 | |
1198 | STDMETHODIMP MarkToken( |
1199 | mdToken tk); // [IN] Token to be marked |
1200 | |
1201 | STDMETHODIMP IsTokenMarked( |
1202 | mdToken tk, // [IN] Token to be checked |
1203 | BOOL *pIsMarked); // [OUT] TRUE if token is marked |
1204 | |
1205 | #endif //FEATURE_METADATA_EMIT_ALL |
1206 | |
1207 | #ifdef FEATURE_METADATA_INTERNAL_APIS |
1208 | |
1209 | //***************************************************************************** |
1210 | // IMetaDataEmitHelper |
1211 | //***************************************************************************** |
1212 | STDMETHODIMP DefineMethodSemanticsHelper( |
1213 | mdToken tkAssociation, // [IN] property or event token |
1214 | DWORD dwFlags, // [IN] semantics |
1215 | mdMethodDef md); // [IN] method to associated with |
1216 | |
1217 | STDMETHODIMP SetFieldLayoutHelper( // Return hresult. |
1218 | mdFieldDef fd, // [IN] field to associate the layout info |
1219 | ULONG ulOffset); // [IN] the offset for the field |
1220 | |
1221 | STDMETHODIMP DefineEventHelper( |
1222 | mdTypeDef td, // [IN] the class/interface on which the event is being defined |
1223 | LPCWSTR szEvent, // [IN] Name of the event |
1224 | DWORD dwEventFlags, // [IN] CorEventAttr |
1225 | mdToken tkEventType, // [IN] a reference (mdTypeRef or mdTypeRef) to the Event class |
1226 | mdEvent *pmdEvent); // [OUT] output event token |
1227 | |
1228 | STDMETHODIMP AddDeclarativeSecurityHelper( |
1229 | mdToken tk, // [IN] Parent token (typedef/methoddef) |
1230 | DWORD dwAction, // [IN] Security action (CorDeclSecurity) |
1231 | void const *pValue, // [IN] Permission set blob |
1232 | DWORD cbValue, // [IN] Byte count of permission set blob |
1233 | mdPermission*pmdPermission); // [OUT] Output permission token |
1234 | |
1235 | STDMETHODIMP SetResolutionScopeHelper( // Return hresult. |
1236 | mdTypeRef tr, // [IN] TypeRef record to update |
1237 | mdToken rs); // [IN] new ResolutionScope |
1238 | |
1239 | STDMETHODIMP SetManifestResourceOffsetHelper( // Return hresult. |
1240 | mdManifestResource mr, // [IN] The manifest token |
1241 | ULONG ulOffset); // [IN] new offset |
1242 | |
1243 | STDMETHODIMP SetTypeParent( // Return hresult. |
1244 | mdTypeDef td, // [IN] Type definition |
1245 | mdToken tkExtends); // [IN] parent type |
1246 | |
1247 | STDMETHODIMP AddInterfaceImpl( // Return hresult. |
1248 | mdTypeDef td, // [IN] Type definition |
1249 | mdToken tkInterface); // [IN] interface type |
1250 | |
1251 | //***************************************************************************** |
1252 | // IMDInternalEmit |
1253 | //***************************************************************************** |
1254 | |
1255 | STDMETHODIMP ChangeMvid( // S_OK or error. |
1256 | REFGUID newMvid); // GUID to use as the MVID |
1257 | |
1258 | STDMETHOD(SetMDUpdateMode)( |
1259 | ULONG updateMode, ULONG *pPreviousUpdateMode); |
1260 | |
1261 | //***************************************************************************** |
1262 | // IMetaDataHelper |
1263 | //***************************************************************************** |
1264 | STDMETHODIMP GetMetadata( // Result. |
1265 | ULONG ulSelect, // [IN] Selector. |
1266 | void **ppData); // [OUT] Put pointer to data here. |
1267 | |
1268 | STDMETHODIMP_(IUnknown *) GetCachedInternalInterface(BOOL fWithLock); // S_OK or error |
1269 | STDMETHODIMP SetCachedInternalInterface(IUnknown *pUnk); // S_OK or error |
1270 | STDMETHODIMP SetReaderWriterLock(UTSemReadWrite * pSem) |
1271 | { |
1272 | _ASSERTE(m_pSemReadWrite == NULL); |
1273 | m_pSemReadWrite = pSem; |
1274 | INDEBUG(m_pStgdb->m_MiniMd.Debug_SetLock(m_pSemReadWrite);) |
1275 | return NOERROR; |
1276 | } |
1277 | STDMETHODIMP_(UTSemReadWrite *) GetReaderWriterLock() { return m_pSemReadWrite; } |
1278 | |
1279 | #ifndef FEATURE_METADATA_EMIT |
1280 | // This method is also part of IMetaDataEmit interface, do not declare it twice |
1281 | STDMETHODIMP TranslateSigWithScope( |
1282 | IMetaDataAssemblyImport *pAssemImport, // [IN] assembly importing interface |
1283 | const void *pbHashValue, // [IN] Hash Blob for Assembly. |
1284 | ULONG cbHashValue, // [IN] Count of bytes. |
1285 | IMetaDataImport *import, // [IN] importing interface |
1286 | PCCOR_SIGNATURE pbSigBlob, // [IN] signature in the importing scope |
1287 | ULONG cbSigBlob, // [IN] count of bytes of signature |
1288 | IMetaDataAssemblyEmit *pAssemEmti, // [IN] emit assembly interface |
1289 | IMetaDataEmit *emit, // [IN] emit interface |
1290 | PCOR_SIGNATURE pvTranslatedSig, // [OUT] buffer to hold translated signature |
1291 | ULONG cbTranslatedSigMax, |
1292 | ULONG *pcbTranslatedSig); // [OUT] count of bytes in the translated signature |
1293 | #endif //!FEATURE_METADATA_EMIT |
1294 | |
1295 | //***************************************************************************** |
1296 | // IGetIMDInternalImport methods |
1297 | //***************************************************************************** |
1298 | STDMETHOD(GetIMDInternalImport) ( |
1299 | IMDInternalImport ** ppIMDInternalImport // [OUT] Buffer to receive IMDInternalImport* |
1300 | ); |
1301 | |
1302 | #endif //FEATURE_METADATA_INTERNAL_APIS |
1303 | |
1304 | //***************************************************************************** |
1305 | // IMetaDataTables |
1306 | //***************************************************************************** |
1307 | |
1308 | // Fills size (*pcbStringsHeapSize) of internal strings heap (#String). |
1309 | // Returns S_OK or error code. Fills *pcbStringsHeapSize with 0 on error. |
1310 | // Implements public API code:IMetaDataTables::GetStringHeapSize. |
1311 | STDMETHODIMP GetStringHeapSize( |
1312 | __out ULONG *pcbStringsHeapSize); // [OUT] Size of the string heap. |
1313 | |
1314 | // Fills size (*pcbBlobsHeapSize) of blobs heap (#Blob). |
1315 | // Returns S_OK or error code. Fills *pcbBlobsHeapSize with 0 on error. |
1316 | // Implements public API code:IMetaDataTables::GetBlobHeapSize. |
1317 | STDMETHODIMP GetBlobHeapSize( |
1318 | __out ULONG *pcbBlobsHeapSize); // [OUT] Size of the blob heap. |
1319 | |
1320 | // Fills size (*pcbGuidsHeapSize) of guids heap (#GUID). |
1321 | // Returns S_OK or error code. Fills *pcbGuidsHeapSize with 0 on error. |
1322 | // Implements public API code:IMetaDataTables::GetGuidHeapSize. |
1323 | STDMETHODIMP GetGuidHeapSize( |
1324 | __out ULONG *pcbGuidsHeapSize); // [OUT] Size of the Guid heap. |
1325 | |
1326 | // Fills size (*pcbUserStringsHeapSize) of user strings heap (#US) (referenced from IL). |
1327 | // Returns S_OK or error code. Fills *pcbUserStringsHeapSize with 0 on error. |
1328 | // Implements public API code:IMetaDataTables::GetUserStringHeapSize. |
1329 | // Backward compatibility: returns S_OK even if the string doesn't have odd number of bytes as specified |
1330 | // in CLI ECMA specification. |
1331 | STDMETHODIMP GetUserStringHeapSize( |
1332 | __out ULONG *pcbUserStringsHeapSize); // [OUT] Size of the user string heap. |
1333 | |
1334 | // Implements public API code:IMetaDataTables::GetNumTables. |
1335 | STDMETHODIMP GetNumTables( |
1336 | __out ULONG *pcTables); // [OUT] Count of tables. |
1337 | |
1338 | // Implements public API code:IMetaDataTables::GetNumTables. |
1339 | STDMETHODIMP GetTableIndex( |
1340 | ULONG token, // [IN] Token for which to get table index. |
1341 | __out ULONG *pixTbl); // [OUT] Put table index here. |
1342 | |
1343 | // Implements public API code:IMetaDataTables::GetTableInfo. |
1344 | STDMETHODIMP GetTableInfo( |
1345 | ULONG ixTbl, // [IN] Which table. |
1346 | ULONG *pcbRow, // [OUT] Size of a row, bytes. |
1347 | ULONG *pcRows, // [OUT] Number of rows. |
1348 | ULONG *pcCols, // [OUT] Number of columns in each row. |
1349 | ULONG *piKey, // [OUT] Key column, or -1 if none. |
1350 | const char **ppName); // [OUT] Name of the table. |
1351 | |
1352 | // Implements public API code:IMetaDataTables::GetColumnInfo. |
1353 | STDMETHODIMP GetColumnInfo( |
1354 | ULONG ixTbl, // [IN] Which Table. |
1355 | ULONG ixCol, // [IN] Which Column in the table. |
1356 | ULONG *poCol, // [OUT] Offset of the column in the row. |
1357 | ULONG *pcbCol, // [OUT] Size of a column, bytes. |
1358 | ULONG *pType, // [OUT] Type of the column. |
1359 | const char **ppName); // [OUT] Name of the Column. |
1360 | |
1361 | // Implements public API code:IMetaDataTables::GetCodedTokenInfo. |
1362 | STDMETHODIMP GetCodedTokenInfo( |
1363 | ULONG ixCdTkn, // [IN] Which kind of coded token. |
1364 | ULONG *pcTokens, // [OUT] Count of tokens. |
1365 | ULONG **ppTokens, // [OUT] List of tokens. |
1366 | const char **ppName); // [OUT] Name of the CodedToken. |
1367 | |
1368 | // Implements public API code:IMetaDataTables::GetRow. |
1369 | STDMETHODIMP GetRow( |
1370 | ULONG ixTbl, // [IN] Which table. |
1371 | ULONG rid, // [IN] Which row. |
1372 | void **ppRow); // [OUT] Put pointer to row here. |
1373 | |
1374 | // Implements public API code:IMetaDataTables::GetColumn. |
1375 | STDMETHODIMP GetColumn( |
1376 | ULONG ixTbl, // [IN] Which table. |
1377 | ULONG ixCol, // [IN] Which column. |
1378 | ULONG rid, // [IN] Which row. |
1379 | ULONG *pVal); // [OUT] Put the column contents here. |
1380 | |
1381 | //#GetString_IMetaDataTables |
1382 | // Fills internal null-terminated string (*pszString) at index ixString from string heap (#String). |
1383 | // Returns S_OK (even for index 0) or error code (if index is invalid, fills *pszString with NULL then). |
1384 | // Implements public API code:IMetaDataTables::GetString. |
1385 | STDMETHODIMP GetString( |
1386 | ULONG ixString, // [IN] Value from a string column. |
1387 | const char **pszString); // [OUT] Put a pointer to the string here. |
1388 | |
1389 | //#GetBlob_IMetaDataTables |
1390 | // Fills blob entry (*ppvData of size *pcbDataSize) at index ixBlob from blob heap (#Blob). |
1391 | // Returns S_OK (even for index 0) or error code (if index is invalid, fills NULL and o then). |
1392 | // Implements public API code:IMetaDataTables::GetBlob. |
1393 | STDMETHODIMP GetBlob( |
1394 | ULONG ixBlob, // [IN] Value from a blob column. |
1395 | ULONG *pcbDataSize, // [OUT] Put size of the blob here. |
1396 | const void **ppvData); // [OUT] Put a pointer to the blob here. |
1397 | |
1398 | //#GetGuid_IMetaDataTables |
1399 | // Fills guid (*ppGuid) at index ixGuid from guid heap (#GUID). |
1400 | // Returns S_OK and fills *ppGuid. Returns S_OK even for (invalid) index 0 (fills *ppGuid with pointer |
1401 | // to zeros then). |
1402 | // Retruns error code (if index is invalid except 0, fills NULL and o then). |
1403 | // Implements public API code:IMetaDataTables::GetGuid. |
1404 | // Backward compatibility: returns S_OK even if the index is 0 which is invalid as specified in CLI ECMA |
1405 | // specification. In that case returns pointer to GUID from zeros. |
1406 | STDMETHODIMP GetGuid( |
1407 | ULONG ixGuid, // [IN] Value from a guid column. |
1408 | const GUID **ppGuid); // [OUT] Put a pointer to the GUID here. |
1409 | |
1410 | //#GetUserString_IMetaDataTables |
1411 | // Fills user string (*ppvData of size *pcbDataSize) at index ixUserString. |
1412 | // Returns S_OK (even for index 0) or error code (if index is invalid, fills NULL and o then). |
1413 | // Implements public API code:IMetaDataTables::GetUserString. |
1414 | STDMETHODIMP GetUserString( |
1415 | ULONG ixUserString, // [IN] Value from a UserString column. |
1416 | __out ULONG *pcbData, // [OUT] Put size of the UserString here. |
1417 | __deref_out_opt const void **ppData); // [OUT] Put a pointer to the UserString here. |
1418 | |
1419 | //#GetNextString_IMetaDataTables |
1420 | // Fills index of string (*pixNextString) from the internal strings heap (#String) starting behind |
1421 | // string at index ixString. |
1422 | // Returns S_OK or S_FALSE (if either index is invalid). Fills *pixNextString with 0 on S_FALSE. |
1423 | // Implements public API code:IMetaDataTables::.GetNextString. |
1424 | STDMETHODIMP GetNextString( |
1425 | ULONG ixString, // [IN] Value from a string column. |
1426 | __out ULONG *pixNextString); // [OUT] Put the index of the next string here. |
1427 | |
1428 | //#GetNextBlob_IMetaDataTables |
1429 | // Fills index of blob (*pixNextBlob) from the blobs heap (#Blob) starting behind blob at index ixBlob. |
1430 | // Returns S_OK or S_FALSE (if either index is invalid). Fills *pixNextBlob with 0 on S_FALSE. |
1431 | // Implements public API code:IMetaDataTables::GetNextString. |
1432 | STDMETHODIMP GetNextBlob( |
1433 | ULONG ixBlob, // [IN] Value from a blob column. |
1434 | __out ULONG *pixNextBlob); // [OUT] Put the index of the next blob here. |
1435 | |
1436 | //#GetNextGuid_IMetaDataTables |
1437 | // Fills index of guid (*pixNextGuid) from the guids heap (#GUID) starting behind guid at index ixGuid. |
1438 | // Returns S_OK or S_FALSE (if the new index is invalid). Fills *pixNextGuid with 0 on S_FALSE. |
1439 | // Implements public API code:IMetaDataTables::GetNextGuid. |
1440 | // Backward compatibility: returns S_OK even if the guid index (ixGuid) is 0 which is invalid as |
1441 | // specified in CLI ECMA specification. |
1442 | STDMETHODIMP GetNextGuid( |
1443 | ULONG ixGuid, // [IN] Value from a guid column. |
1444 | __out ULONG *pixNextGuid); // [OUT] Put the index of the next guid here. |
1445 | |
1446 | //#GetNextUserString_IMetaDataTables |
1447 | // Fills index of user string (*pixNextUserString) from the user strings heap (#US) starting behind string |
1448 | // at index ixUserString. |
1449 | // Returns S_OK or S_FALSE (if either index is invalid). Fills *pixNextUserString with 0 on S_FALSE. |
1450 | // Implements public API code:IMetaDataTables::GetNextUserString. |
1451 | // Backward compatibility: returns S_OK even if the string doesn't have odd number of bytes as specified |
1452 | // in CLI ECMA specification. |
1453 | STDMETHODIMP GetNextUserString( |
1454 | ULONG ixUserString, // [IN] Value from a UserString column. |
1455 | __out ULONG *ixpNextUserString); // [OUT] Put the index of the next user string here. |
1456 | |
1457 | // Implements public API code:IMetaDataTables2::GetMetaDataStorage. |
1458 | STDMETHODIMP GetMetaDataStorage( |
1459 | const void **ppvMd, // [OUT] put pointer to MD section here (aka, 'BSJB'). |
1460 | ULONG *pcbMd); // [OUT] put size of the stream here. |
1461 | |
1462 | // Implements public API code:IMetaDataTables2::GetMetaDataStreamInfo. |
1463 | STDMETHODIMP GetMetaDataStreamInfo( // Get info about the MD stream. |
1464 | ULONG ix, // [IN] Stream ordinal desired. |
1465 | const char **ppchName, // [OUT] put pointer to stream name here. |
1466 | const void **ppv, // [OUT] put pointer to MD stream here. |
1467 | ULONG *pcb); // [OUT] put size of the stream here. |
1468 | |
1469 | |
1470 | //***************************************************************************** |
1471 | // IMetaDataInfo |
1472 | //***************************************************************************** |
1473 | |
1474 | // Returns the memory region of the mapped file and type of its mapping. The choice of the file mapping |
1475 | // type for each scope is CLR implementation specific and user cannot explicitly set it. |
1476 | // |
1477 | // The memory is valid only as long as the underlying MetaData scope is opened (there's a reference to |
1478 | // a MetaData interface for this scope). |
1479 | // |
1480 | // Returns S_OK, COR_E_NOTSUPPORTED (.obj files, etc.), or E_INVALIDARG (if NULL is passed). |
1481 | // Implements public API code:IMetaDataInfo::GetFileMapping. |
1482 | STDMETHODIMP GetFileMapping( |
1483 | const void ** ppvData, // [out] Pointer to the start of the mapped file. |
1484 | ULONGLONG * pcbData, // [out] Size of the mapped memory region.. |
1485 | DWORD * pdwMappingType); // [out] Type of file mapping (code:CorFileMapping). |
1486 | |
1487 | |
1488 | #if defined(FEATURE_METADATA_IN_VM) && defined(FEATURE_PREJIT) |
1489 | |
1490 | //***************************************************************************** |
1491 | // IMetaDataCorProfileData |
1492 | //***************************************************************************** |
1493 | |
1494 | STDMETHOD(SetCorProfileData)( |
1495 | CorProfileData *pProfileData); // [IN] Pointer to profile data |
1496 | |
1497 | //***************************************************************************** |
1498 | // IMDInternalMetadataReorderingOptions |
1499 | //***************************************************************************** |
1500 | |
1501 | STDMETHOD(SetMetaDataReorderingOptions)( |
1502 | MetaDataReorderingOptions options); // [IN] metadata reordering options |
1503 | |
1504 | #endif //FEATURE_METADATA_IN_VM && FEATURE_PREJIT |
1505 | |
1506 | //***************************************************************************** |
1507 | // IMDCommon methods |
1508 | //***************************************************************************** |
1509 | STDMETHOD_(IMetaModelCommon*, GetMetaModelCommon)() |
1510 | { |
1511 | return GetMiniMd(); |
1512 | } |
1513 | |
1514 | STDMETHOD_(IMetaModelCommonRO*, GetMetaModelCommonRO)() |
1515 | { |
1516 | if (GetMiniMd()->IsWritable()) |
1517 | { |
1518 | _ASSERTE(!"IMetaModelCommonRO methods cannot be used because this importer is writable." ); |
1519 | return NULL; |
1520 | } |
1521 | return GetMiniMd(); |
1522 | } |
1523 | |
1524 | |
1525 | // returns the "built for" version of a metadata scope. |
1526 | __checkReturn |
1527 | STDMETHOD(GetVersionString)( // S_OK or error. |
1528 | LPCSTR *pVer); // [OUT] Put version string here. |
1529 | |
1530 | //***************************************************************************** |
1531 | // Helpers. |
1532 | //***************************************************************************** |
1533 | |
1534 | HRESULT MarkAll(); // mark everything in a module |
1535 | |
1536 | //***************************************************************************** |
1537 | // Open / Create support. |
1538 | //***************************************************************************** |
1539 | |
1540 | RegMeta(); |
1541 | virtual ~RegMeta(); |
1542 | |
1543 | HRESULT SetOption(OptionValue *pOptionValue); |
1544 | |
1545 | // HRESULT Init(); |
1546 | // void Cleanup(); |
1547 | |
1548 | HRESULT InitWithStgdb( |
1549 | IUnknown *pUnk, // The IUnknown that owns the life time for the existing stgdb |
1550 | CLiteWeightStgdbRW *pStgdb); // existing light weight stgdb |
1551 | |
1552 | ULONG GetRefCount() { return m_cRef; } |
1553 | HRESULT AddToCache(); |
1554 | static HRESULT FindCachedReadOnlyEntry(LPCWSTR szName, DWORD dwOpenFlags, RegMeta **ppMeta); |
1555 | BOOL IsReadOnly() { return IsOfReadOnly(m_OpenFlags); } |
1556 | BOOL IsCopyMemory() { return IsOfCopyMemory(m_OpenFlags); } |
1557 | |
1558 | |
1559 | // helper function to reopen RegMeta with a new chuck of memory |
1560 | HRESULT ReOpenWithMemory( |
1561 | LPCVOID pData, // [in] Location of scope data. |
1562 | ULONG cbData, // [in] ReOpen flags |
1563 | DWORD dwReOpenFlags); // [in] Size of the data pointed to by pData. |
1564 | |
1565 | HRESULT CreateNewMD(); |
1566 | |
1567 | HRESULT OpenExistingMD( |
1568 | LPCWSTR szDatabase, // Name of database. |
1569 | void *pbData, // Data to open on top of, 0 default. |
1570 | ULONG cbData, // How big is the data. |
1571 | ULONG dwFlags); // Flags to control open. |
1572 | |
1573 | #ifdef FEATURE_METADATA_CUSTOM_DATA_SOURCE |
1574 | HRESULT OpenExistingMD( |
1575 | IMDCustomDataSource* pDataSource, // Name of database. |
1576 | ULONG dwFlags); // Flags to control open. |
1577 | #endif |
1578 | |
1579 | FORCEINLINE CLiteWeightStgdbRW* GetMiniStgdb() { return m_pStgdb; } |
1580 | FORCEINLINE CMiniMdRW* GetMiniMd() { return &m_pStgdb->m_MiniMd; } |
1581 | |
1582 | //***************************************************************************** |
1583 | |
1584 | bool IsTypeDefDirty() { return m_fIsTypeDefDirty;} |
1585 | void SetTypeDefDirty(bool fDirty) { m_fIsTypeDefDirty = fDirty;} |
1586 | |
1587 | bool IsMemberDefDirty() { return m_fIsMemberDefDirty;} |
1588 | void SetMemberDefDirty(bool fDirty) { m_fIsMemberDefDirty = fDirty;} |
1589 | |
1590 | FORCEINLINE BOOL IsThreadSafetyOn() |
1591 | { |
1592 | return (m_OptionValue.m_ThreadSafetyOptions & MDThreadSafetyOn) == MDThreadSafetyOn; |
1593 | } |
1594 | |
1595 | LPCWSTR GetNameOfDBFile() { return (m_pStgdb->m_wszFileName == NULL) ? W("" ) : m_pStgdb->m_wszFileName; } |
1596 | DWORD GetLowFileTimeOfDBFile() { return m_pStgdb->m_dwDatabaseLFT; } |
1597 | DWORD GetLowFileSizeOfDBFile() { return m_pStgdb->m_dwDatabaseLFS; } |
1598 | protected: |
1599 | // Helper functions used for implementation of MetaData APIs. |
1600 | HRESULT RefToDefOptimization(); |
1601 | |
1602 | FORCEINLINE BOOL PreserveLocalRefs(CorLocalRefPreservation localRefType) |
1603 | { |
1604 | return (m_OptionValue.m_LocalRefPreservation & localRefType) == localRefType; |
1605 | } |
1606 | |
1607 | HRESULT PreSave(); |
1608 | |
1609 | // Initialize the EE |
1610 | HRESULT StartupEE(); |
1611 | |
1612 | // Define a TypeRef given the name. |
1613 | enum eCheckDups {eCheckDefault=0, eCheckNo=1, eCheckYes=2}; |
1614 | |
1615 | HRESULT _DefinePermissionSet( |
1616 | mdToken tk, // [IN] the object to be decorated. |
1617 | DWORD dwAction, // [IN] CorDeclSecurity. |
1618 | void const *pvPermission, // [IN] permission blob. |
1619 | ULONG cbPermission, // [IN] count of bytes of pvPermission. |
1620 | mdPermission *ppm); // [OUT] returned permission token. |
1621 | |
1622 | HRESULT _DefineTypeRef( |
1623 | mdToken tkResolutionScope, // [IN] ModuleRef or AssemblyRef. |
1624 | const void *szName, // [IN] Name of the TypeRef. |
1625 | BOOL isUnicode, // [IN] Specifies whether the URL is unicode. |
1626 | mdTypeRef *ptk, // [OUT] Put mdTypeRef here. |
1627 | eCheckDups eCheck=eCheckDefault); // [IN] Specifies whether to check for duplicates. |
1628 | |
1629 | // Define MethodSemantics |
1630 | HRESULT _DefineMethodSemantics( // S_OK or error. |
1631 | USHORT usAttr, // [IN] CorMethodSemanticsAttr |
1632 | mdMethodDef md, // [IN] Method |
1633 | mdToken tkAssoc, // [IN] Association |
1634 | BOOL bClear); // [IN] Specifies whether to delete the existing records. |
1635 | |
1636 | HRESULT _SaveToStream( // S_OK or error. |
1637 | IStream *pIStream, // [IN] A writable stream to save to. |
1638 | DWORD dwSaveFlags); // [IN] Flags for the save. |
1639 | |
1640 | HRESULT _SetRVA( // [IN] S_OK or error. |
1641 | mdToken md, // [IN] Member for which to set offset |
1642 | ULONG ulCodeRVA, // [IN] The offset |
1643 | DWORD dwImplFlags); |
1644 | |
1645 | HRESULT _DefineEvent( // Return hresult. |
1646 | mdTypeDef td, // [IN] the class/interface on which the event is being defined |
1647 | LPCWSTR szEvent, // [IN] Name of the event |
1648 | DWORD dwEventFlags, // [IN] CorEventAttr |
1649 | mdToken tkEventType, // [IN] a reference (mdTypeRef or mdTypeRef) to the Event class |
1650 | mdEvent *pmdEvent); // [OUT] output event token |
1651 | |
1652 | // Creates and sets a row in the InterfaceImpl table. Optionally clear |
1653 | // pre-existing records for the owning class. |
1654 | HRESULT _SetImplements( // S_OK or error. |
1655 | mdToken rTk[], // Array of TypeRef or TypeDef tokens for implemented interfaces. |
1656 | mdTypeDef td, // Implementing TypeDef. |
1657 | BOOL bClear); // Specifies whether to clear the existing records. |
1658 | |
1659 | // Sets flags, name and constraints for a single GenericParam record |
1660 | HRESULT _SetGenericParamProps( // S_OK or error. |
1661 | mdGenericParam tkGP, // [IN] Formal parameter token |
1662 | GenericParamRec *pGenericParam, // [IN] GenericParam record ptr |
1663 | DWORD dwParamFlags, // [IN] Flags, for future use (e.g. variance) |
1664 | LPCWSTR szName, // [IN] Optional name |
1665 | DWORD reserved, // [IN] For future use (e.g. non-type parameters) |
1666 | mdToken rtkConstraints[]); // [IN] Array of type constraints (TypeDef,TypeRef,TypeSpec) |
1667 | |
1668 | HRESULT _SetTypeDefProps( // S_OK or error. |
1669 | mdTypeDef td, // [IN] The TypeDef. |
1670 | DWORD dwTypeDefFlags, // [IN] TypeDef flags. |
1671 | mdToken tkExtends, // [IN] Base TypeDef or TypeRef. |
1672 | mdToken rtkImplements[]); // [IN] Implemented interfaces. |
1673 | |
1674 | HRESULT _SetEventProps1( // Return hresult. |
1675 | mdEvent ev, // [IN] Event token. |
1676 | DWORD dwEventFlags, // [IN] Event flags. |
1677 | mdToken tkEventType); // [IN] Event type class. |
1678 | |
1679 | HRESULT _SetEventProps2( // Return hresult. |
1680 | mdEvent ev, // [IN] Event token. |
1681 | mdMethodDef mdAddOn, // [IN] Add method. |
1682 | mdMethodDef mdRemoveOn, // [IN] Remove method. |
1683 | mdMethodDef mdFire, // [IN] Fire method. |
1684 | mdMethodDef rmdOtherMethods[], // [IN] An array of other methods. |
1685 | BOOL bClear); // [IN] Specifies whether to clear the existing MethodSemantics records. |
1686 | |
1687 | HRESULT _SetPermissionSetProps( // Return hresult. |
1688 | mdPermission tkPerm, // [IN] Permission token. |
1689 | DWORD dwAction, // [IN] CorDeclSecurity. |
1690 | void const *pvPermission, // [IN] Permission blob. |
1691 | ULONG cbPermission); // [IN] Count of bytes of pvPermission. |
1692 | |
1693 | HRESULT _DefinePinvokeMap( // Return hresult. |
1694 | mdToken tk, // [IN] FieldDef or MethodDef. |
1695 | DWORD dwMappingFlags, // [IN] Flags used for mapping. |
1696 | LPCWSTR szImportName, // [IN] Import name. |
1697 | mdModuleRef mrImportDLL); // [IN] ModuleRef token for the target DLL. |
1698 | |
1699 | HRESULT _DefineSetConstant( // Return hresult. |
1700 | mdToken tk, // [IN] Parent token. |
1701 | DWORD dwCPlusTypeFlag, // [IN] Flag for the value type, selected ELEMENT_TYPE_* |
1702 | void const *pValue, // [IN] Constant value. |
1703 | ULONG cchString, // [IN] Size of string in wide chars, or -1 for default. |
1704 | BOOL bSearch); // [IN] Specifies whether to search for an existing record. |
1705 | |
1706 | HRESULT _SetMethodProps( // S_OK or error. |
1707 | mdMethodDef md, // [IN] The MethodDef. |
1708 | DWORD dwMethodFlags, // [IN] Method attributes. |
1709 | ULONG ulCodeRVA, // [IN] Code RVA. |
1710 | DWORD dwImplFlags); // [IN] MethodImpl flags. |
1711 | |
1712 | HRESULT _SetFieldProps( // S_OK or error. |
1713 | mdFieldDef fd, // [IN] The FieldDef. |
1714 | DWORD dwFieldFlags, // [IN] Field attributes. |
1715 | DWORD dwCPlusTypeFlag, // [IN] Flag for the value type, selected ELEMENT_TYPE_* |
1716 | void const *pValue, // [IN] Constant value. |
1717 | ULONG cchValue); // [IN] size of constant value (string, in wide chars). |
1718 | |
1719 | HRESULT _SetClassLayout( // S_OK or error. |
1720 | mdTypeDef td, // [IN] The class. |
1721 | ULONG dwPackSize, // [IN] The packing size. |
1722 | ULONG ulClassSize); // [IN, OPTIONAL] The class size. |
1723 | |
1724 | HRESULT _SetFieldOffset( // S_OK or error. |
1725 | mdFieldDef fd, // [IN] The field. |
1726 | ULONG ulOffset); // [IN] The offset of the field. |
1727 | |
1728 | HRESULT _SetPropertyProps( // S_OK or error. |
1729 | mdProperty pr, // [IN] Property token. |
1730 | DWORD dwPropFlags, // [IN] CorPropertyAttr. |
1731 | DWORD dwCPlusTypeFlag, // [IN] Flag for value type, selected ELEMENT_TYPE_* |
1732 | void const *pValue, // [IN] Constant value. |
1733 | ULONG cchValue, // [IN] size of constant value (string, in wide chars). |
1734 | mdMethodDef mdSetter, // [IN] Setter of the property. |
1735 | mdMethodDef mdGetter, // [IN] Getter of the property. |
1736 | mdMethodDef rmdOtherMethods[]); // [IN] Array of other methods. |
1737 | |
1738 | HRESULT _SetParamProps( // Return code. |
1739 | mdParamDef pd, // [IN] Param token. |
1740 | LPCWSTR szName, // [IN] Param name. |
1741 | DWORD dwParamFlags, // [IN] Param flags. |
1742 | DWORD dwCPlusTypeFlag, // [IN] Flag for value type. selected ELEMENT_TYPE_*. |
1743 | void const *pValue, // [OUT] Constant value. |
1744 | ULONG cchValue); // [IN] size of constant value (string, in wide chars). |
1745 | |
1746 | HRESULT _SetAssemblyProps( // S_OK or error. |
1747 | mdAssembly pma, // [IN] Assembly token. |
1748 | const void *pbOriginator, // [IN] Originator of the assembly. |
1749 | ULONG cbOriginator, // [IN] Count of bytes in the Originator blob. |
1750 | ULONG ulHashAlgId, // [IN] Hash Algorithm. |
1751 | LPCWSTR szName, // [IN] Name of the assembly. |
1752 | const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData. |
1753 | DWORD dwAssemblyFlags); // [IN] Flags. |
1754 | |
1755 | HRESULT _SetAssemblyRefProps( // S_OK or error. |
1756 | mdAssemblyRef ar, // [IN] AssemblyRefToken. |
1757 | const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly. |
1758 | ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token. |
1759 | LPCWSTR szName, // [IN] Name of the assembly being referenced. |
1760 | const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData. |
1761 | const void *pbHashValue, // [IN] Hash Blob. |
1762 | ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob. |
1763 | DWORD dwAssemblyRefFlags); // [IN] Token for Execution Location. |
1764 | |
1765 | HRESULT _SetFileProps( // S_OK or error. |
1766 | mdFile file, // [IN] File token. |
1767 | const void *pbHashValue, // [IN] Hash Blob. |
1768 | ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob. |
1769 | DWORD dwFileFlags) ; // [IN] Flags. |
1770 | |
1771 | HRESULT _SetExportedTypeProps( // S_OK or error. |
1772 | mdExportedType ct, // [IN] ExportedType token. |
1773 | mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the ExportedType. |
1774 | mdTypeDef tkTypeDef, // [IN] TypeDef token within the file. |
1775 | DWORD dwExportedTypeFlags); // [IN] Flags. |
1776 | |
1777 | HRESULT _SetManifestResourceProps( // S_OK or error. |
1778 | mdManifestResource mr, // [IN] ManifestResource token. |
1779 | mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource. |
1780 | DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file. |
1781 | DWORD dwResourceFlags); // [IN] Flags. |
1782 | |
1783 | HRESULT _DefineTypeDef( // S_OK or error. |
1784 | LPCWSTR szTypeDef, // [IN] Name of TypeDef |
1785 | DWORD dwTypeDefFlags, // [IN] CustomAttribute flags |
1786 | mdToken tkExtends, // [IN] extends this TypeDef or typeref |
1787 | mdToken rtkImplements[], // [IN] Implements interfaces |
1788 | mdTypeDef tdEncloser, // [IN] TypeDef token of the Enclosing Type. |
1789 | mdTypeDef *ptd); // [OUT] Put TypeDef token here |
1790 | |
1791 | HRESULT _SetFieldMarshal( |
1792 | mdToken tk, // [IN] given a fieldDef or paramDef token |
1793 | PCCOR_SIGNATURE pvNativeType, // [IN] native type specification |
1794 | ULONG cbNativeType); // [IN] count of bytes of pvNativeType |
1795 | |
1796 | HRESULT _IsKnownCustomAttribute( // S_OK, S_FALSE, or error. |
1797 | mdToken tkType, // [IN] Token of custom attribute's type. |
1798 | int *pca); // [OUT] Put value from KnownCustAttr enum here. |
1799 | |
1800 | HRESULT _DefineModuleRef( // S_OK or error. |
1801 | LPCWSTR szName, // [IN] DLL name |
1802 | mdModuleRef *pmur); // [OUT] returned module ref token |
1803 | |
1804 | HRESULT _HandleKnownCustomAttribute( // S_OK or error. |
1805 | mdToken tkObj, // [IN] Object being attributed. |
1806 | const void *pData, // [IN] Custom Attribute data blob. |
1807 | ULONG cbData, // [IN] Count of bytes in the data. |
1808 | int ca, // [IN] Value from KnownCustAttr enum. |
1809 | int *bKeep); // [OUT} Keep the known CA? |
1810 | |
1811 | HRESULT _HandleNativeTypeCustomAttribute(// S_OK or error. |
1812 | mdToken tkObj, // Object being attributed. |
1813 | CaArg *pArgs, // Pointer to args. |
1814 | CaNamedArg *pNamedArgs, // Pointer to named args. |
1815 | CQuickArray<BYTE> &qNativeType); // Native type is built here. |
1816 | |
1817 | // Find a given param of a Method. |
1818 | HRESULT _FindParamOfMethod( // S_OK or error. |
1819 | mdMethodDef md, // [IN] The owning method of the param. |
1820 | ULONG iSeq, // [IN] The sequence # of the param. |
1821 | mdParamDef *pParamDef); // [OUT] Put ParamDef token here. |
1822 | |
1823 | // Given the signature, return the token for signature. |
1824 | HRESULT _GetTokenFromSig( // S_OK or error. |
1825 | PCCOR_SIGNATURE pvSig, // [IN] Signature to define. |
1826 | ULONG cbSig, // [IN] Size of signature data. |
1827 | mdSignature *pmsig); // [OUT] returned signature token. |
1828 | |
1829 | // Turn the specified internal flags on. |
1830 | HRESULT _TurnInternalFlagsOn( // S_OK or error. |
1831 | mdToken tkObj, // [IN] Target object whose internal flags are targeted. |
1832 | DWORD flags); // [IN] Specifies flags to be turned on. |
1833 | |
1834 | // This routine eliminates duplicates from the given list of InterfaceImpl tokens |
1835 | // to be defined. It checks for duplicates against the database only if the |
1836 | // TypeDef for which these tokens are being defined is not a new one. |
1837 | HRESULT _InterfaceImplDupProc( // S_OK or error. |
1838 | mdToken rTk[], // Array of TypeRef or TypeDef tokens for implemented interfaces. |
1839 | mdTypeDef td, // Implementing TypeDef. |
1840 | CQuickBytes *pcqbTk); // Quick Byte object for placing the array of unique tokens. |
1841 | |
1842 | // Helper : convert a text field signature to a com format |
1843 | HRESULT _ConvertTextElementTypeToComSig(// Return hresult. |
1844 | IMetaDataEmit *emit, // [IN] emit interface. |
1845 | BOOL fCreateTrIfNotFound, // [IN] create typeref if not found or fail out? |
1846 | LPCSTR *ppOneArgSig, // [IN|OUT] class file format signature. On exit, it will be next arg starting point |
1847 | CQuickBytes *pqbNewSig, // [OUT] place holder for COM+ signature |
1848 | ULONG cbStart, // [IN] bytes that are already in pqbNewSig |
1849 | ULONG *pcbCount); // [OUT] count of bytes put into the QuickBytes buffer |
1850 | |
1851 | HRESULT _CheckCmodForCallConv( // S_OK, -1 if found, or error. |
1852 | PCCOR_SIGNATURE pbSig, // [IN] Signature to check. |
1853 | ULONG *pcbTotal, // [OUT] Put bytes consumed here. |
1854 | ULONG *pCallConv); // [OUT] If found, put calling convention here. |
1855 | |
1856 | HRESULT _SearchOneArgForCallConv( // S_OK, -1 if found, or error. |
1857 | PCCOR_SIGNATURE pbSig, // [IN] Signature to check. |
1858 | ULONG *pcbTotal, // [OUT] Put bytes consumed here. |
1859 | ULONG *pCallConv); // [OUT] If found, put calling convention here. |
1860 | |
1861 | |
1862 | |
1863 | int inline IsGlobalMethodParent(mdTypeDef *ptd) |
1864 | { |
1865 | if (IsGlobalMethodParentTk(*ptd)) |
1866 | { |
1867 | *ptd = m_tdModule; |
1868 | return (true); |
1869 | } |
1870 | return (false); |
1871 | } |
1872 | |
1873 | int inline IsGlobalMethodParentToken(mdTypeDef td) |
1874 | { |
1875 | return (!IsNilToken(m_tdModule) && td == m_tdModule); |
1876 | } |
1877 | |
1878 | FORCEINLINE BOOL IsENCOn() |
1879 | { |
1880 | _ASSERTE( ((m_OptionValue.m_UpdateMode & MDUpdateMask) == MDUpdateENC) == |
1881 | m_pStgdb->m_MiniMd.IsENCOn() ); |
1882 | return (m_OptionValue.m_UpdateMode & MDUpdateMask) == MDUpdateENC; |
1883 | } |
1884 | |
1885 | FORCEINLINE BOOL IsIncrementalOn() |
1886 | { |
1887 | return (m_OptionValue.m_UpdateMode & MDUpdateMask) == MDUpdateIncremental; |
1888 | } |
1889 | |
1890 | FORCEINLINE BOOL CheckDups(CorCheckDuplicatesFor checkdup) |
1891 | { |
1892 | return ((m_OptionValue.m_DupCheck & checkdup) || |
1893 | (m_OptionValue.m_UpdateMode == MDUpdateIncremental || |
1894 | m_OptionValue.m_UpdateMode == MDUpdateENC) ); |
1895 | } |
1896 | |
1897 | FORCEINLINE HRESULT UpdateENCLog(mdToken tk, CMiniMdRW::eDeltaFuncs funccode = CMiniMdRW::eDeltaFuncDefault) |
1898 | { |
1899 | _ASSERTE( ((m_OptionValue.m_UpdateMode & MDUpdateMask) == MDUpdateENC) == |
1900 | m_pStgdb->m_MiniMd.IsENCOn() ); |
1901 | return m_pStgdb->m_MiniMd.UpdateENCLog(tk, funccode); |
1902 | } |
1903 | |
1904 | FORCEINLINE HRESULT UpdateENCLog2(ULONG ixTbl, ULONG iRid, CMiniMdRW::eDeltaFuncs funccode = CMiniMdRW::eDeltaFuncDefault) |
1905 | { |
1906 | _ASSERTE( ((m_OptionValue.m_UpdateMode & MDUpdateMask) == MDUpdateENC) == |
1907 | m_pStgdb->m_MiniMd.IsENCOn() ); |
1908 | return m_pStgdb->m_MiniMd.UpdateENCLog2(ixTbl, iRid, funccode); |
1909 | } |
1910 | |
1911 | FORCEINLINE bool IsCallerDefine() { return m_SetAPICaller == DEFINE_API; } |
1912 | FORCEINLINE void SetCallerDefine() { m_SetAPICaller = DEFINE_API; } |
1913 | FORCEINLINE bool IsCallerExternal() { return m_SetAPICaller == EXTERNAL_CALLER; } |
1914 | FORCEINLINE void SetCallerExternal() { m_SetAPICaller = EXTERNAL_CALLER; } |
1915 | |
1916 | #ifdef FEATURE_METADATA_RELEASE_MEMORY_ON_REOPEN |
1917 | bool IsSafeToDeleteStgdb() |
1918 | { |
1919 | return m_safeToDeleteStgdb && m_pStgdb->m_MiniMd.IsSafeToDelete(); |
1920 | } |
1921 | |
1922 | FORCEINLINE void MarkUnsafeToDeleteStgdb() { m_safeToDeleteStgdb = false; } |
1923 | FORCEINLINE void MarkSafeToDeleteStgdb() { m_safeToDeleteStgdb = true; } |
1924 | #endif |
1925 | |
1926 | // Define Validate methods for all tables. |
1927 | #undef MiniMdTable |
1928 | #define MiniMdTable(x) HRESULT Validate##x(RID rid); |
1929 | MiniMdTables() |
1930 | |
1931 | // Validate a record in a generic sense using Meta-Meta data. |
1932 | STDMETHODIMP ValidateRecord(ULONG ixTbl, ULONG ulRow); |
1933 | |
1934 | // Validate if the signature is properly formed with regards to the |
1935 | // compression scheme. |
1936 | STDMETHODIMP ValidateSigCompression( |
1937 | mdToken tk, // [IN] Token whose signature needs to be validated. |
1938 | PCCOR_SIGNATURE pbSig, // [IN] Signature. |
1939 | ULONG cbSig); // [IN] Size in bytes of the signature. |
1940 | |
1941 | // Validate one argument given the offset to the beginning of the |
1942 | // argument, size of the full signature and the currentl offset value. |
1943 | STDMETHODIMP ValidateOneArg( |
1944 | mdToken tk, // [IN] Token whose signature is being processed. |
1945 | PCCOR_SIGNATURE &pbSig, // [IN] Pointer to the beginning of argument. |
1946 | ULONG cbSig, // [IN] Size in bytes of the full signature. |
1947 | ULONG *pulCurByte, // [IN/OUT] Current offset into the signature.. |
1948 | ULONG *pulNSentinels, // [IN/OUT] Number of sentinels |
1949 | BOOL bNoVoidAllowed); // [IN] Flag indicating whether "void" is disallowed for this arg |
1950 | |
1951 | // Validate the given Method signature. |
1952 | STDMETHODIMP ValidateMethodSig( |
1953 | mdToken tk, // [IN] Token whose signature needs to be validated. |
1954 | PCCOR_SIGNATURE pbSig, // [IN] Signature. |
1955 | ULONG cbSig, // [IN] Size in bytes of the signature. |
1956 | DWORD dwFlags); // [IN] Method flags. |
1957 | |
1958 | // Validate the given Field signature. |
1959 | STDMETHODIMP ValidateFieldSig( |
1960 | mdToken tk, // [IN] Token whose signature needs to be validated. |
1961 | PCCOR_SIGNATURE pbSig, // [IN] Signature. |
1962 | ULONG cbSig); // [IN] Size in bytes of the signature. |
1963 | |
1964 | // Validate the given MethodSpec signature. |
1965 | STDMETHODIMP ValidateMethodSpecSig( |
1966 | mdMethodSpec tk, // [IN] Token whose signature needs to be validated. |
1967 | PCCOR_SIGNATURE pbSig, // [IN] Signature. |
1968 | ULONG cbSig, // [IN] Size in bytes of the signature. |
1969 | ULONG *ulArity); // [OUT] Arity of the instantiation. |
1970 | |
1971 | |
1972 | protected: |
1973 | |
1974 | // This scope's Stgdb. This stores the actual data which the class then exposes. |
1975 | // This storage may be shared by an internal metadata object too. |
1976 | // This is read-write so that the RegMeta class can implement the emit interfaces. |
1977 | CLiteWeightStgdbRW *m_pStgdb; |
1978 | |
1979 | CLiteWeightStgdbRW *m_pStgdbFreeList; // This scope's Stgdb. |
1980 | mdTypeDef m_tdModule; // The global module. |
1981 | IUnknown *m_pUnk; // The IUnknown that owns the Stgdb. |
1982 | FilterManager *m_pFilterManager; // Contains helper functions for marking |
1983 | |
1984 | #ifdef FEATURE_METADATA_INTERNAL_APIS |
1985 | // Pointer to internal interface. This is a weak reference (it doesn't addref/release). |
1986 | IMDInternalImport *m_pInternalImport; |
1987 | #endif //FEATURE_METADATA_INTERNAL_APIS |
1988 | |
1989 | UTSemReadWrite *m_pSemReadWrite; |
1990 | bool m_fOwnSem; |
1991 | |
1992 | unsigned m_bRemap : 1; // If true, there is a token mapper. |
1993 | unsigned m_bSaveOptimized : 1; // If true, save optimization has been done. |
1994 | unsigned m_hasOptimizedRefToDef : 1; // true if we have performed ref to def optimization |
1995 | IUnknown *m_pHandler; |
1996 | bool m_fIsTypeDefDirty; // This flag is set when the TypeRef to TypeDef map is not valid |
1997 | bool m_fIsMemberDefDirty; // This flag is set when the MemberRef to MemberDef map is not valid |
1998 | bool m_fStartedEE; // Set when EE runtime has been started up. |
1999 | IUnknown *m_pAppDomain; // AppDomain in which managed security code will be run. |
2000 | |
2001 | private: |
2002 | ULONG m_OpenFlags; // Open time flags. |
2003 | |
2004 | LONG m_cRef; // Ref count. |
2005 | IUnknown *m_pFreeThreadedMarshaler; // FreeThreadedMarshaler |
2006 | |
2007 | #ifdef FEATURE_METADATA_PERF_STATS |
2008 | MDCompilerPerf m_MDCompilerPerf; // Compiler perf object to store all stats. |
2009 | #endif |
2010 | |
2011 | // If true, cached in list of global scopes. This is very dangerous because it may allow |
2012 | // unpredictable state sharing between seemingly unrelated dispensers. |
2013 | bool m_bCached; |
2014 | |
2015 | OptionValue m_OptionValue; |
2016 | |
2017 | mdTypeRef m_trLanguageType; |
2018 | |
2019 | // Specifies whether the caller of the Set API is one of the Define functions |
2020 | // or an external API. This allows for performance optimization in the Set APIs |
2021 | // by not checking for Duplicates in certain cases. |
2022 | SetAPICallerType m_SetAPICaller; |
2023 | |
2024 | CorValidatorModuleType m_ModuleType; |
2025 | CCustAttrHash m_caHash; // Hashed list of custom attribute types seen. |
2026 | |
2027 | bool m_bKeepKnownCa; // Should all known CA's be kept? |
2028 | |
2029 | CorProfileData *m_pCorProfileData; |
2030 | |
2031 | MetaDataReorderingOptions m_ReorderingOptions; |
2032 | |
2033 | #ifdef FEATURE_METADATA_RELEASE_MEMORY_ON_REOPEN |
2034 | bool m_safeToDeleteStgdb; // This starts out true, but gets set to FALSE if we detect |
2035 | // a RegMeta API call that might have given out an internal pointer. |
2036 | // There is an equivalent state in MiniMD, and both must be |
2037 | // TRUE in order to delete safely. |
2038 | #endif |
2039 | |
2040 | private: |
2041 | // Returns pointer to zeros of size (cbSize). |
2042 | // Used by public APIs to return compatible values with previous releases. |
2043 | static const BYTE *GetPublicApiCompatibilityZerosOfSize(UINT32 cbSize); |
2044 | // Returns pointer to zeros typed as type T. |
2045 | // Used by public APIs to return compatible values with previous releases. |
2046 | template<class T> |
2047 | T *GetPublicApiCompatibilityZeros() |
2048 | { |
2049 | static_assert_no_msg(sizeof(T) <= sizeof(s_rgMetaDataPublicApiCompatibilityZeros)); |
2050 | return reinterpret_cast<T *>(s_rgMetaDataPublicApiCompatibilityZeros); |
2051 | } |
2052 | // Zeros used by public APIs as return value (or pointer to this memory) for invalid input. |
2053 | // It is used by methods: |
2054 | // * code:RegMeta::GetPublicApiCompatibilityZeros, and |
2055 | // * code:RegMeta::GetPublicApiCompatibilityZerosOfSize. |
2056 | static const BYTE s_rgMetaDataPublicApiCompatibilityZeros[64]; |
2057 | |
2058 | }; // class RegMeta |
2059 | |
2060 | |
2061 | #endif // __RegMeta__h__ |
2062 | |