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
6
7#ifndef _PROFILER_METADATA_EMIT_VALIDATOR_H_
8#define _PROFILER_METADATA_EMIT_VALIDATOR_H_
9
10// This is a wrapper over IMetaDataEmit interfaces to prevent profilers from making changes the runtime can't support
11// Annoyingly, it is legal to QI IMetaDataImport from the emitter and vice-versa, so the wrapper also proxies those interfaces
12
13class ProfilerMetadataEmitValidator : public IMetaDataEmit2, public IMetaDataAssemblyEmit, public IMetaDataImport2, public IMetaDataAssemblyImport
14{
15public:
16 ProfilerMetadataEmitValidator(IMetaDataEmit* pInnerEmit);
17 virtual ~ProfilerMetadataEmitValidator();
18
19 //IUnknown
20 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppInterface);
21 virtual ULONG STDMETHODCALLTYPE AddRef();
22 virtual ULONG STDMETHODCALLTYPE Release();
23
24 //IMetaDataEmit
25 virtual HRESULT STDMETHODCALLTYPE SetModuleProps(
26 LPCWSTR szName);
27
28 virtual HRESULT STDMETHODCALLTYPE Save(
29 LPCWSTR szFile,
30 DWORD dwSaveFlags);
31
32 virtual HRESULT STDMETHODCALLTYPE SaveToStream(
33 IStream *pIStream,
34 DWORD dwSaveFlags);
35
36 virtual HRESULT STDMETHODCALLTYPE GetSaveSize(
37 CorSaveSize fSave,
38 DWORD *pdwSaveSize);
39
40 virtual HRESULT STDMETHODCALLTYPE DefineTypeDef(
41 LPCWSTR szTypeDef,
42 DWORD dwTypeDefFlags,
43 mdToken tkExtends,
44 mdToken rtkImplements[],
45 mdTypeDef *ptd);
46
47 virtual HRESULT STDMETHODCALLTYPE DefineNestedType(
48 LPCWSTR szTypeDef,
49 DWORD dwTypeDefFlags,
50 mdToken tkExtends,
51 mdToken rtkImplements[],
52 mdTypeDef tdEncloser,
53 mdTypeDef *ptd);
54
55 virtual HRESULT STDMETHODCALLTYPE SetHandler(
56 IUnknown *pUnk);
57
58 virtual HRESULT STDMETHODCALLTYPE DefineMethod(
59 mdTypeDef td,
60 LPCWSTR szName,
61 DWORD dwMethodFlags,
62 PCCOR_SIGNATURE pvSigBlob,
63 ULONG cbSigBlob,
64 ULONG ulCodeRVA,
65 DWORD dwImplFlags,
66 mdMethodDef *pmd);
67
68 virtual HRESULT STDMETHODCALLTYPE DefineMethodImpl(
69 mdTypeDef td,
70 mdToken tkBody,
71 mdToken tkDecl);
72
73 virtual HRESULT STDMETHODCALLTYPE DefineTypeRefByName(
74 mdToken tkResolutionScope,
75 LPCWSTR szName,
76 mdTypeRef *ptr);
77
78 virtual HRESULT STDMETHODCALLTYPE DefineImportType(
79 IMetaDataAssemblyImport *pAssemImport,
80 const void *pbHashValue,
81 ULONG cbHashValue,
82 IMetaDataImport *pImport,
83 mdTypeDef tdImport,
84 IMetaDataAssemblyEmit *pAssemEmit,
85 mdTypeRef *ptr);
86
87 virtual HRESULT STDMETHODCALLTYPE DefineMemberRef(
88 mdToken tkImport,
89 LPCWSTR szName,
90 PCCOR_SIGNATURE pvSigBlob,
91 ULONG cbSigBlob,
92 mdMemberRef *pmr);
93
94 virtual HRESULT STDMETHODCALLTYPE DefineImportMember(
95 IMetaDataAssemblyImport *pAssemImport,
96 const void *pbHashValue,
97 ULONG cbHashValue,
98 IMetaDataImport *pImport,
99 mdToken mbMember,
100 IMetaDataAssemblyEmit *pAssemEmit,
101 mdToken tkParent,
102 mdMemberRef *pmr);
103
104 virtual HRESULT STDMETHODCALLTYPE DefineEvent(
105 mdTypeDef td,
106 LPCWSTR szEvent,
107 DWORD dwEventFlags,
108 mdToken tkEventType,
109 mdMethodDef mdAddOn,
110 mdMethodDef mdRemoveOn,
111 mdMethodDef mdFire,
112 mdMethodDef rmdOtherMethods[],
113 mdEvent *pmdEvent);
114
115 virtual HRESULT STDMETHODCALLTYPE SetClassLayout(
116 mdTypeDef td,
117 DWORD dwPackSize,
118 COR_FIELD_OFFSET rFieldOffsets[],
119 ULONG ulClassSize);
120
121 virtual HRESULT STDMETHODCALLTYPE DeleteClassLayout(
122 mdTypeDef td);
123
124 virtual HRESULT STDMETHODCALLTYPE SetFieldMarshal(
125 mdToken tk,
126 PCCOR_SIGNATURE pvNativeType,
127 ULONG cbNativeType);
128
129 virtual HRESULT STDMETHODCALLTYPE DeleteFieldMarshal(
130 mdToken tk);
131
132 virtual HRESULT STDMETHODCALLTYPE DefinePermissionSet(
133 mdToken tk,
134 DWORD dwAction,
135 void const *pvPermission,
136 ULONG cbPermission,
137 mdPermission *ppm);
138
139 virtual HRESULT STDMETHODCALLTYPE SetRVA(
140 mdMethodDef md,
141 ULONG ulRVA);
142
143 virtual HRESULT STDMETHODCALLTYPE GetTokenFromSig(
144 PCCOR_SIGNATURE pvSig,
145 ULONG cbSig,
146 mdSignature *pmsig);
147
148 virtual HRESULT STDMETHODCALLTYPE DefineModuleRef(
149 LPCWSTR szName,
150 mdModuleRef *pmur);
151
152 virtual HRESULT STDMETHODCALLTYPE SetParent(
153 mdMemberRef mr,
154 mdToken tk);
155
156 virtual HRESULT STDMETHODCALLTYPE GetTokenFromTypeSpec(
157 PCCOR_SIGNATURE pvSig,
158 ULONG cbSig,
159 mdTypeSpec *ptypespec);
160
161 virtual HRESULT STDMETHODCALLTYPE SaveToMemory(
162 void *pbData,
163 ULONG cbData);
164
165 virtual HRESULT STDMETHODCALLTYPE DefineUserString(
166 LPCWSTR szString,
167 ULONG cchString,
168 mdString *pstk);
169
170 virtual HRESULT STDMETHODCALLTYPE DeleteToken(
171 mdToken tkObj);
172
173 virtual HRESULT STDMETHODCALLTYPE SetMethodProps(
174 mdMethodDef md,
175 DWORD dwMethodFlags,
176 ULONG ulCodeRVA,
177 DWORD dwImplFlags);
178
179 virtual HRESULT STDMETHODCALLTYPE SetTypeDefProps(
180 mdTypeDef td,
181 DWORD dwTypeDefFlags,
182 mdToken tkExtends,
183 mdToken rtkImplements[]);
184
185 virtual HRESULT STDMETHODCALLTYPE SetEventProps(
186 mdEvent ev,
187 DWORD dwEventFlags,
188 mdToken tkEventType,
189 mdMethodDef mdAddOn,
190 mdMethodDef mdRemoveOn,
191 mdMethodDef mdFire,
192 mdMethodDef rmdOtherMethods[]);
193
194 virtual HRESULT STDMETHODCALLTYPE SetPermissionSetProps(
195 mdToken tk,
196 DWORD dwAction,
197 void const *pvPermission,
198 ULONG cbPermission,
199 mdPermission *ppm);
200
201 virtual HRESULT STDMETHODCALLTYPE DefinePinvokeMap(
202 mdToken tk,
203 DWORD dwMappingFlags,
204 LPCWSTR szImportName,
205 mdModuleRef mrImportDLL);
206
207 virtual HRESULT STDMETHODCALLTYPE SetPinvokeMap(
208 mdToken tk,
209 DWORD dwMappingFlags,
210 LPCWSTR szImportName,
211 mdModuleRef mrImportDLL);
212
213 virtual HRESULT STDMETHODCALLTYPE DeletePinvokeMap(
214 mdToken tk);
215
216 // New CustomAttribute functions.
217 virtual HRESULT STDMETHODCALLTYPE DefineCustomAttribute(
218 mdToken tkOwner,
219 mdToken tkCtor,
220 void const *pCustomAttribute,
221 ULONG cbCustomAttribute,
222 mdCustomAttribute *pcv);
223
224 virtual HRESULT STDMETHODCALLTYPE SetCustomAttributeValue(
225 mdCustomAttribute pcv,
226 void const *pCustomAttribute,
227 ULONG cbCustomAttribute);
228
229 virtual HRESULT STDMETHODCALLTYPE DefineField(
230 mdTypeDef td,
231 LPCWSTR szName,
232 DWORD dwFieldFlags,
233 PCCOR_SIGNATURE pvSigBlob,
234 ULONG cbSigBlob,
235 DWORD dwCPlusTypeFlag,
236 void const *pValue,
237 ULONG cchValue,
238 mdFieldDef *pmd);
239
240 virtual HRESULT STDMETHODCALLTYPE DefineProperty(
241 mdTypeDef td,
242 LPCWSTR szProperty,
243 DWORD dwPropFlags,
244 PCCOR_SIGNATURE pvSig,
245 ULONG cbSig,
246 DWORD dwCPlusTypeFlag,
247 void const *pValue,
248 ULONG cchValue,
249 mdMethodDef mdSetter,
250 mdMethodDef mdGetter,
251 mdMethodDef rmdOtherMethods[],
252 mdProperty *pmdProp);
253
254 virtual HRESULT STDMETHODCALLTYPE DefineParam(
255 mdMethodDef md,
256 ULONG ulParamSeq,
257 LPCWSTR szName,
258 DWORD dwParamFlags,
259 DWORD dwCPlusTypeFlag,
260 void const *pValue,
261 ULONG cchValue,
262 mdParamDef *ppd);
263
264 virtual HRESULT STDMETHODCALLTYPE SetFieldProps(
265 mdFieldDef fd,
266 DWORD dwFieldFlags,
267 DWORD dwCPlusTypeFlag,
268 void const *pValue,
269 ULONG cchValue);
270
271 virtual HRESULT STDMETHODCALLTYPE SetPropertyProps(
272 mdProperty pr,
273 DWORD dwPropFlags,
274 DWORD dwCPlusTypeFlag,
275 void const *pValue,
276 ULONG cchValue,
277 mdMethodDef mdSetter,
278 mdMethodDef mdGetter,
279 mdMethodDef rmdOtherMethods[]);
280
281 virtual HRESULT STDMETHODCALLTYPE SetParamProps(
282 mdParamDef pd,
283 LPCWSTR szName,
284 DWORD dwParamFlags,
285 DWORD dwCPlusTypeFlag,
286 void const *pValue,
287 ULONG cchValue);
288
289 virtual HRESULT STDMETHODCALLTYPE DefineSecurityAttributeSet(
290 mdToken tkObj,
291 COR_SECATTR rSecAttrs[],
292 ULONG cSecAttrs,
293 ULONG *pulErrorAttr);
294
295 virtual HRESULT STDMETHODCALLTYPE ApplyEditAndContinue(
296 IUnknown *pImport);
297
298 virtual HRESULT STDMETHODCALLTYPE TranslateSigWithScope(
299 IMetaDataAssemblyImport *pAssemImport,
300 const void *pbHashValue,
301 ULONG cbHashValue,
302 IMetaDataImport *import,
303 PCCOR_SIGNATURE pbSigBlob,
304 ULONG cbSigBlob,
305 IMetaDataAssemblyEmit *pAssemEmit,
306 IMetaDataEmit *emit,
307 PCOR_SIGNATURE pvTranslatedSig,
308 ULONG cbTranslatedSigMax,
309 ULONG *pcbTranslatedSig);
310
311 virtual HRESULT STDMETHODCALLTYPE SetMethodImplFlags(
312 mdMethodDef md,
313 DWORD dwImplFlags);
314
315 virtual HRESULT STDMETHODCALLTYPE SetFieldRVA(
316 mdFieldDef fd,
317 ULONG ulRVA);
318
319 virtual HRESULT STDMETHODCALLTYPE Merge(
320 IMetaDataImport *pImport,
321 IMapToken *pHostMapToken,
322 IUnknown *pHandler);
323
324 virtual HRESULT STDMETHODCALLTYPE MergeEnd();
325
326 // IMetaDataEmit2
327 virtual HRESULT STDMETHODCALLTYPE DefineMethodSpec(
328 mdToken tkParent,
329 PCCOR_SIGNATURE pvSigBlob,
330 ULONG cbSigBlob,
331 mdMethodSpec *pmi);
332
333 virtual HRESULT STDMETHODCALLTYPE GetDeltaSaveSize(
334 CorSaveSize fSave,
335 DWORD *pdwSaveSize);
336
337 virtual HRESULT STDMETHODCALLTYPE SaveDelta(
338 LPCWSTR szFile,
339 DWORD dwSaveFlags);
340
341 virtual HRESULT STDMETHODCALLTYPE SaveDeltaToStream(
342 IStream *pIStream,
343 DWORD dwSaveFlags);
344
345 virtual HRESULT STDMETHODCALLTYPE SaveDeltaToMemory(
346 void *pbData,
347 ULONG cbData);
348
349 virtual HRESULT STDMETHODCALLTYPE DefineGenericParam(
350 mdToken tk,
351 ULONG ulParamSeq,
352 DWORD dwParamFlags,
353 LPCWSTR szname,
354 DWORD reserved,
355 mdToken rtkConstraints[],
356 mdGenericParam *pgp);
357
358 virtual HRESULT STDMETHODCALLTYPE SetGenericParamProps(
359 mdGenericParam gp,
360 DWORD dwParamFlags,
361 LPCWSTR szName,
362 DWORD reserved,
363 mdToken rtkConstraints[]);
364
365 virtual HRESULT STDMETHODCALLTYPE ResetENCLog();
366
367 //IMetaDataAssemblyEmit
368 virtual HRESULT STDMETHODCALLTYPE DefineAssembly(
369 const void *pbPublicKey,
370 ULONG cbPublicKey,
371 ULONG ulHashAlgId,
372 LPCWSTR szName,
373 const ASSEMBLYMETADATA *pMetaData,
374 DWORD dwAssemblyFlags,
375 mdAssembly *pma);
376
377 virtual HRESULT STDMETHODCALLTYPE DefineAssemblyRef(
378 const void *pbPublicKeyOrToken,
379 ULONG cbPublicKeyOrToken,
380 LPCWSTR szName,
381 const ASSEMBLYMETADATA *pMetaData,
382 const void *pbHashValue,
383 ULONG cbHashValue,
384 DWORD dwAssemblyRefFlags,
385 mdAssemblyRef *pmdar);
386
387 virtual HRESULT STDMETHODCALLTYPE DefineFile(
388 LPCWSTR szName,
389 const void *pbHashValue,
390 ULONG cbHashValue,
391 DWORD dwFileFlags,
392 mdFile *pmdf);
393
394 virtual HRESULT STDMETHODCALLTYPE DefineExportedType(
395 LPCWSTR szName,
396 mdToken tkImplementation,
397 mdTypeDef tkTypeDef,
398 DWORD dwExportedTypeFlags,
399 mdExportedType *pmdct);
400
401 virtual HRESULT STDMETHODCALLTYPE DefineManifestResource(
402 LPCWSTR szName,
403 mdToken tkImplementation,
404 DWORD dwOffset,
405 DWORD dwResourceFlags,
406 mdManifestResource *pmdmr);
407
408 virtual HRESULT STDMETHODCALLTYPE SetAssemblyProps(
409 mdAssembly pma,
410 const void *pbPublicKey,
411 ULONG cbPublicKey,
412 ULONG ulHashAlgId,
413 LPCWSTR szName,
414 const ASSEMBLYMETADATA *pMetaData,
415 DWORD dwAssemblyFlags);
416
417 virtual HRESULT STDMETHODCALLTYPE SetAssemblyRefProps(
418 mdAssemblyRef ar,
419 const void *pbPublicKeyOrToken,
420 ULONG cbPublicKeyOrToken,
421 LPCWSTR szName,
422 const ASSEMBLYMETADATA *pMetaData,
423 const void *pbHashValue,
424 ULONG cbHashValue,
425 DWORD dwAssemblyRefFlags);
426
427 virtual HRESULT STDMETHODCALLTYPE SetFileProps(
428 mdFile file,
429 const void *pbHashValue,
430 ULONG cbHashValue,
431 DWORD dwFileFlags);
432
433 virtual HRESULT STDMETHODCALLTYPE SetExportedTypeProps(
434 mdExportedType ct,
435 mdToken tkImplementation,
436 mdTypeDef tkTypeDef,
437 DWORD dwExportedTypeFlags);
438
439 virtual HRESULT STDMETHODCALLTYPE SetManifestResourceProps(
440 mdManifestResource mr,
441 mdToken tkImplementation,
442 DWORD dwOffset,
443 DWORD dwResourceFlags);
444
445 //IMetaDataImport
446 virtual void STDMETHODCALLTYPE CloseEnum(HCORENUM hEnum);
447 virtual HRESULT STDMETHODCALLTYPE CountEnum(HCORENUM hEnum, ULONG *pulCount);
448 virtual HRESULT STDMETHODCALLTYPE ResetEnum(HCORENUM hEnum, ULONG ulPos);
449 virtual HRESULT STDMETHODCALLTYPE EnumTypeDefs(HCORENUM *phEnum, mdTypeDef rTypeDefs[],
450 ULONG cMax, ULONG *pcTypeDefs);
451 virtual HRESULT STDMETHODCALLTYPE EnumInterfaceImpls(HCORENUM *phEnum, mdTypeDef td,
452 mdInterfaceImpl rImpls[], ULONG cMax,
453 ULONG* pcImpls);
454 virtual HRESULT STDMETHODCALLTYPE EnumTypeRefs(HCORENUM *phEnum, mdTypeRef rTypeRefs[],
455 ULONG cMax, ULONG* pcTypeRefs);
456
457 virtual HRESULT STDMETHODCALLTYPE FindTypeDefByName( // S_OK or error.
458 LPCWSTR szTypeDef, // [IN] Name of the Type.
459 mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class.
460 mdTypeDef *ptd); // [OUT] Put the TypeDef token here.
461
462 virtual HRESULT STDMETHODCALLTYPE GetScopeProps( // S_OK or error.
463 __out_ecount(cchName)
464 LPWSTR szName, // [OUT] Put the name here.
465 ULONG cchName, // [IN] Size of name buffer in wide chars.
466 ULONG *pchName, // [OUT] Put size of name (wide chars) here.
467 GUID *pmvid); // [OUT, OPTIONAL] Put MVID here.
468
469 virtual HRESULT STDMETHODCALLTYPE GetModuleFromScope( // S_OK.
470 mdModule *pmd); // [OUT] Put mdModule token here.
471
472 virtual HRESULT STDMETHODCALLTYPE GetTypeDefProps( // S_OK or error.
473 mdTypeDef td, // [IN] TypeDef token for inquiry.
474 __out_ecount(cchTypeDef)
475 LPWSTR szTypeDef, // [OUT] Put name here.
476 ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
477 ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
478 DWORD *pdwTypeDefFlags, // [OUT] Put flags here.
479 mdToken *ptkExtends); // [OUT] Put base class TypeDef/TypeRef here.
480
481 virtual HRESULT STDMETHODCALLTYPE GetInterfaceImplProps( // S_OK or error.
482 mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token.
483 mdTypeDef *pClass, // [OUT] Put implementing class token here.
484 mdToken *ptkIface); // [OUT] Put implemented interface token here.
485
486 virtual HRESULT STDMETHODCALLTYPE GetTypeRefProps( // S_OK or error.
487 mdTypeRef tr, // [IN] TypeRef token.
488 mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
489 __out_ecount(cchName)
490 LPWSTR szName, // [OUT] Name of the TypeRef.
491 ULONG cchName, // [IN] Size of buffer.
492 ULONG *pchName); // [OUT] Size of Name.
493
494 virtual HRESULT STDMETHODCALLTYPE ResolveTypeRef(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd);
495
496 virtual HRESULT STDMETHODCALLTYPE EnumMembers( // S_OK, S_FALSE, or error.
497 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
498 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
499 mdToken rMembers[], // [OUT] Put MemberDefs here.
500 ULONG cMax, // [IN] Max MemberDefs to put.
501 ULONG *pcTokens); // [OUT] Put # put here.
502
503 virtual HRESULT STDMETHODCALLTYPE EnumMembersWithName( // S_OK, S_FALSE, or error.
504 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
505 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
506 LPCWSTR szName, // [IN] Limit results to those with this name.
507 mdToken rMembers[], // [OUT] Put MemberDefs here.
508 ULONG cMax, // [IN] Max MemberDefs to put.
509 ULONG *pcTokens); // [OUT] Put # put here.
510
511 virtual HRESULT STDMETHODCALLTYPE EnumMethods( // S_OK, S_FALSE, or error.
512 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
513 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
514 mdMethodDef rMethods[], // [OUT] Put MethodDefs here.
515 ULONG cMax, // [IN] Max MethodDefs to put.
516 ULONG *pcTokens); // [OUT] Put # put here.
517
518 virtual HRESULT STDMETHODCALLTYPE EnumMethodsWithName( // S_OK, S_FALSE, or error.
519 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
520 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
521 LPCWSTR szName, // [IN] Limit results to those with this name.
522 mdMethodDef rMethods[], // [OU] Put MethodDefs here.
523 ULONG cMax, // [IN] Max MethodDefs to put.
524 ULONG *pcTokens); // [OUT] Put # put here.
525
526 virtual HRESULT STDMETHODCALLTYPE EnumFields( // S_OK, S_FALSE, or error.
527 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
528 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
529 mdFieldDef rFields[], // [OUT] Put FieldDefs here.
530 ULONG cMax, // [IN] Max FieldDefs to put.
531 ULONG *pcTokens); // [OUT] Put # put here.
532
533 virtual HRESULT STDMETHODCALLTYPE EnumFieldsWithName( // S_OK, S_FALSE, or error.
534 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
535 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
536 LPCWSTR szName, // [IN] Limit results to those with this name.
537 mdFieldDef rFields[], // [OUT] Put MemberDefs here.
538 ULONG cMax, // [IN] Max MemberDefs to put.
539 ULONG *pcTokens); // [OUT] Put # put here.
540
541
542 virtual HRESULT STDMETHODCALLTYPE EnumParams( // S_OK, S_FALSE, or error.
543 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
544 mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
545 mdParamDef rParams[], // [OUT] Put ParamDefs here.
546 ULONG cMax, // [IN] Max ParamDefs to put.
547 ULONG *pcTokens); // [OUT] Put # put here.
548
549 virtual HRESULT STDMETHODCALLTYPE EnumMemberRefs( // S_OK, S_FALSE, or error.
550 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
551 mdToken tkParent, // [IN] Parent token to scope the enumeration.
552 mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here.
553 ULONG cMax, // [IN] Max MemberRefs to put.
554 ULONG *pcTokens); // [OUT] Put # put here.
555
556 virtual HRESULT STDMETHODCALLTYPE EnumMethodImpls( // S_OK, S_FALSE, or error
557 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
558 mdTypeDef td, // [IN] TypeDef to scope the enumeration.
559 mdToken rMethodBody[], // [OUT] Put Method Body tokens here.
560 mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here.
561 ULONG cMax, // [IN] Max tokens to put.
562 ULONG *pcTokens); // [OUT] Put # put here.
563
564 virtual HRESULT STDMETHODCALLTYPE EnumPermissionSets( // S_OK, S_FALSE, or error.
565 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
566 mdToken tk, // [IN] if !NIL, token to scope the enumeration.
567 DWORD dwActions, // [IN] if !0, return only these actions.
568 mdPermission rPermission[], // [OUT] Put Permissions here.
569 ULONG cMax, // [IN] Max Permissions to put.
570 ULONG *pcTokens); // [OUT] Put # put here.
571
572 virtual HRESULT STDMETHODCALLTYPE FindMember(
573 mdTypeDef td, // [IN] given typedef
574 LPCWSTR szName, // [IN] member name
575 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
576 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
577 mdToken *pmb); // [OUT] matching memberdef
578
579 virtual HRESULT STDMETHODCALLTYPE FindMethod(
580 mdTypeDef td, // [IN] given typedef
581 LPCWSTR szName, // [IN] member name
582 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
583 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
584 mdMethodDef *pmb); // [OUT] matching memberdef
585
586 virtual HRESULT STDMETHODCALLTYPE FindField(
587 mdTypeDef td, // [IN] given typedef
588 LPCWSTR szName, // [IN] member name
589 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
590 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
591 mdFieldDef *pmb); // [OUT] matching memberdef
592
593 virtual HRESULT STDMETHODCALLTYPE FindMemberRef(
594 mdTypeRef td, // [IN] given typeRef
595 LPCWSTR szName, // [IN] member name
596 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
597 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
598 mdMemberRef *pmr); // [OUT] matching memberref
599
600 virtual HRESULT STDMETHODCALLTYPE GetMethodProps(
601 mdMethodDef mb, // The method for which to get props.
602 mdTypeDef *pClass, // Put method's class here.
603 __out_ecount(cchMethod)
604 LPWSTR szMethod, // Put method's name here.
605 ULONG cchMethod, // Size of szMethod buffer in wide chars.
606 ULONG *pchMethod, // Put actual size here
607 DWORD *pdwAttr, // Put flags here.
608 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
609 ULONG *pcbSigBlob, // [OUT] actual size of signature blob
610 ULONG *pulCodeRVA, // [OUT] codeRVA
611 DWORD *pdwImplFlags); // [OUT] Impl. Flags
612
613 virtual HRESULT STDMETHODCALLTYPE GetMemberRefProps( // S_OK or error.
614 mdMemberRef mr, // [IN] given memberref
615 mdToken *ptk, // [OUT] Put classref or classdef here.
616 __out_ecount(cchMember)
617 LPWSTR szMember, // [OUT] buffer to fill for member's name
618 ULONG cchMember, // [IN] the count of char of szMember
619 ULONG *pchMember, // [OUT] actual count of char in member name
620 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value
621 ULONG *pbSig); // [OUT] actual size of signature blob
622
623 virtual HRESULT STDMETHODCALLTYPE EnumProperties( // S_OK, S_FALSE, or error.
624 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
625 mdTypeDef td, // [IN] TypeDef to scope the enumeration.
626 mdProperty rProperties[], // [OUT] Put Properties here.
627 ULONG cMax, // [IN] Max properties to put.
628 ULONG *pcProperties); // [OUT] Put # put here.
629
630 virtual HRESULT STDMETHODCALLTYPE EnumEvents( // S_OK, S_FALSE, or error.
631 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
632 mdTypeDef td, // [IN] TypeDef to scope the enumeration.
633 mdEvent rEvents[], // [OUT] Put events here.
634 ULONG cMax, // [IN] Max events to put.
635 ULONG *pcEvents); // [OUT] Put # put here.
636
637 virtual HRESULT STDMETHODCALLTYPE GetEventProps( // S_OK, S_FALSE, or error.
638 mdEvent ev, // [IN] event token
639 mdTypeDef *pClass, // [OUT] typedef containing the event declarion.
640 LPCWSTR szEvent, // [OUT] Event name
641 ULONG cchEvent, // [IN] the count of wchar of szEvent
642 ULONG *pchEvent, // [OUT] actual count of wchar for event's name
643 DWORD *pdwEventFlags, // [OUT] Event flags.
644 mdToken *ptkEventType, // [OUT] EventType class
645 mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event
646 mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event
647 mdMethodDef *pmdFire, // [OUT] Fire method of the event
648 mdMethodDef rmdOtherMethod[], // [OUT] other method of the event
649 ULONG cMax, // [IN] size of rmdOtherMethod
650 ULONG *pcOtherMethod); // [OUT] total number of other method of this event
651
652 virtual HRESULT STDMETHODCALLTYPE EnumMethodSemantics( // S_OK, S_FALSE, or error.
653 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
654 mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
655 mdToken rEventProp[], // [OUT] Put Event/Property here.
656 ULONG cMax, // [IN] Max properties to put.
657 ULONG *pcEventProp); // [OUT] Put # put here.
658
659 virtual HRESULT STDMETHODCALLTYPE GetMethodSemantics( // S_OK, S_FALSE, or error.
660 mdMethodDef mb, // [IN] method token
661 mdToken tkEventProp, // [IN] event/property token.
662 DWORD *pdwSemanticsFlags); // [OUT] the role flags for the method/propevent pair
663
664 virtual HRESULT STDMETHODCALLTYPE GetClassLayout(
665 mdTypeDef td, // [IN] give typedef
666 DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16
667 COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array
668 ULONG cMax, // [IN] size of the array
669 ULONG *pcFieldOffset, // [OUT] needed array size
670 ULONG *pulClassSize); // [OUT] the size of the class
671
672 virtual HRESULT STDMETHODCALLTYPE GetFieldMarshal(
673 mdToken tk, // [IN] given a field's memberdef
674 PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field
675 ULONG *pcbNativeType); // [OUT] the count of bytes of *ppvNativeType
676
677 virtual HRESULT STDMETHODCALLTYPE GetRVA( // S_OK or error.
678 mdToken tk, // Member for which to set offset
679 ULONG *pulCodeRVA, // The offset
680 DWORD *pdwImplFlags); // the implementation flags
681
682 virtual HRESULT STDMETHODCALLTYPE GetPermissionSetProps(
683 mdPermission pm, // [IN] the permission token.
684 DWORD *pdwAction, // [OUT] CorDeclSecurity.
685 void const **ppvPermission, // [OUT] permission blob.
686 ULONG *pcbPermission); // [OUT] count of bytes of pvPermission.
687
688 virtual HRESULT STDMETHODCALLTYPE GetSigFromToken( // S_OK or error.
689 mdSignature mdSig, // [IN] Signature token.
690 PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
691 ULONG *pcbSig); // [OUT] return size of signature.
692
693 virtual HRESULT STDMETHODCALLTYPE GetModuleRefProps( // S_OK or error.
694 mdModuleRef mur, // [IN] moduleref token.
695 __out_ecount_part_opt(cchName, *pchName)
696 LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
697 ULONG cchName, // [IN] size of szName in wide characters.
698 ULONG *pchName); // [OUT] actual count of characters in the name.
699
700 virtual HRESULT STDMETHODCALLTYPE EnumModuleRefs( // S_OK or error.
701 HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
702 mdModuleRef rModuleRefs[], // [OUT] put modulerefs here.
703 ULONG cmax, // [IN] max memberrefs to put.
704 ULONG *pcModuleRefs); // [OUT] put # put here.
705
706 virtual HRESULT STDMETHODCALLTYPE GetTypeSpecFromToken( // S_OK or error.
707 mdTypeSpec typespec, // [IN] TypeSpec token.
708 PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature
709 ULONG *pcbSig); // [OUT] return size of signature.
710
711 virtual HRESULT STDMETHODCALLTYPE GetNameFromToken( // Not Recommended! May be removed!
712 mdToken tk, // [IN] Token to get name from. Must have a name.
713 MDUTF8CSTR *pszUtf8NamePtr); // [OUT] Return pointer to UTF8 name in heap.
714
715 virtual HRESULT STDMETHODCALLTYPE EnumUnresolvedMethods( // S_OK, S_FALSE, or error.
716 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
717 mdToken rMethods[], // [OUT] Put MemberDefs here.
718 ULONG cMax, // [IN] Max MemberDefs to put.
719 ULONG *pcTokens); // [OUT] Put # put here.
720
721 virtual HRESULT STDMETHODCALLTYPE GetUserString( // S_OK or error.
722 mdString stk, // [IN] String token.
723 __out_ecount(cchString)
724 LPWSTR szString, // [OUT] Copy of string.
725 ULONG cchString, // [IN] Max chars of room in szString.
726 ULONG *pchString); // [OUT] How many chars in actual string.
727
728 virtual HRESULT STDMETHODCALLTYPE GetPinvokeMap( // S_OK or error.
729 mdToken tk, // [IN] FieldDef or MethodDef.
730 DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
731 __out_ecount(cchImportName)
732 LPWSTR szImportName, // [OUT] Import name.
733 ULONG cchImportName, // [IN] Size of the name buffer.
734 ULONG *pchImportName, // [OUT] Actual number of characters stored.
735 mdModuleRef *pmrImportDLL); // [OUT] ModuleRef token for the target DLL.
736
737 virtual HRESULT STDMETHODCALLTYPE EnumSignatures( // S_OK or error.
738 HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
739 mdSignature rSignatures[], // [OUT] put signatures here.
740 ULONG cmax, // [IN] max signatures to put.
741 ULONG *pcSignatures); // [OUT] put # put here.
742
743 virtual HRESULT STDMETHODCALLTYPE EnumTypeSpecs( // S_OK or error.
744 HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
745 mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here.
746 ULONG cmax, // [IN] max TypeSpecs to put.
747 ULONG *pcTypeSpecs); // [OUT] put # put here.
748
749 virtual HRESULT STDMETHODCALLTYPE EnumUserStrings( // S_OK or error.
750 HCORENUM *phEnum, // [IN/OUT] pointer to the enum.
751 mdString rStrings[], // [OUT] put Strings here.
752 ULONG cmax, // [IN] max Strings to put.
753 ULONG *pcStrings); // [OUT] put # put here.
754
755 virtual HRESULT STDMETHODCALLTYPE GetParamForMethodIndex( // S_OK or error.
756 mdMethodDef md, // [IN] Method token.
757 ULONG ulParamSeq, // [IN] Parameter sequence.
758 mdParamDef *ppd); // [IN] Put Param token here.
759
760 virtual HRESULT STDMETHODCALLTYPE EnumCustomAttributes( // S_OK or error.
761 HCORENUM *phEnum, // [IN, OUT] COR enumerator.
762 mdToken tk, // [IN] Token to scope the enumeration, 0 for all.
763 mdToken tkType, // [IN] Type of interest, 0 for all.
764 mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here.
765 ULONG cMax, // [IN] Size of rCustomAttributes.
766 ULONG *pcCustomAttributes); // [OUT, OPTIONAL] Put count of token values here.
767
768 virtual HRESULT STDMETHODCALLTYPE GetCustomAttributeProps( // S_OK or error.
769 mdCustomAttribute cv, // [IN] CustomAttribute token.
770 mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here.
771 mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here.
772 void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here.
773 ULONG *pcbSize); // [OUT, OPTIONAL] Put size of date here.
774
775 virtual HRESULT STDMETHODCALLTYPE FindTypeRef(
776 mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
777 LPCWSTR szName, // [IN] TypeRef Name.
778 mdTypeRef *ptr); // [OUT] matching TypeRef.
779
780 virtual HRESULT STDMETHODCALLTYPE GetMemberProps(
781 mdToken mb, // The member for which to get props.
782 mdTypeDef *pClass, // Put member's class here.
783 __out_ecount(cchMember)
784 LPWSTR szMember, // Put member's name here.
785 ULONG cchMember, // Size of szMember buffer in wide chars.
786 ULONG *pchMember, // Put actual size here
787 DWORD *pdwAttr, // Put flags here.
788 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
789 ULONG *pcbSigBlob, // [OUT] actual size of signature blob
790 ULONG *pulCodeRVA, // [OUT] codeRVA
791 DWORD *pdwImplFlags, // [OUT] Impl. Flags
792 DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
793 UVCP_CONSTANT *ppValue, // [OUT] constant value
794 ULONG *pcchValue); // [OUT] size of constant string in chars, 0 for non-strings.
795
796 virtual HRESULT STDMETHODCALLTYPE GetFieldProps(
797 mdFieldDef mb, // The field for which to get props.
798 mdTypeDef *pClass, // Put field's class here.
799 __out_ecount(cchField)
800 LPWSTR szField, // Put field's name here.
801 ULONG cchField, // Size of szField buffer in wide chars.
802 ULONG *pchField, // Put actual size here
803 DWORD *pdwAttr, // Put flags here.
804 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
805 ULONG *pcbSigBlob, // [OUT] actual size of signature blob
806 DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
807 UVCP_CONSTANT *ppValue, // [OUT] constant value
808 ULONG *pcchValue); // [OUT] size of constant string in chars, 0 for non-strings.
809
810 virtual HRESULT STDMETHODCALLTYPE GetPropertyProps( // S_OK, S_FALSE, or error.
811 mdProperty prop, // [IN] property token
812 mdTypeDef *pClass, // [OUT] typedef containing the property declarion.
813 LPCWSTR szProperty, // [OUT] Property name
814 ULONG cchProperty, // [IN] the count of wchar of szProperty
815 ULONG *pchProperty, // [OUT] actual count of wchar for property name
816 DWORD *pdwPropFlags, // [OUT] property flags.
817 PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob
818 ULONG *pbSig, // [OUT] count of bytes in *ppvSig
819 DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
820 UVCP_CONSTANT *ppDefaultValue, // [OUT] constant value
821 ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings.
822 mdMethodDef *pmdSetter, // [OUT] setter method of the property
823 mdMethodDef *pmdGetter, // [OUT] getter method of the property
824 mdMethodDef rmdOtherMethod[], // [OUT] other method of the property
825 ULONG cMax, // [IN] size of rmdOtherMethod
826 ULONG *pcOtherMethod); // [OUT] total number of other method of this property
827
828 virtual HRESULT STDMETHODCALLTYPE GetParamProps( // S_OK or error.
829 mdParamDef tk, // [IN]The Parameter.
830 mdMethodDef *pmd, // [OUT] Parent Method token.
831 ULONG *pulSequence, // [OUT] Parameter sequence.
832 __out_ecount(cchName)
833 LPWSTR szName, // [OUT] Put name here.
834 ULONG cchName, // [OUT] Size of name buffer.
835 ULONG *pchName, // [OUT] Put actual size of name here.
836 DWORD *pdwAttr, // [OUT] Put flags here.
837 DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*.
838 UVCP_CONSTANT *ppValue, // [OUT] Constant value.
839 ULONG *pcchValue); // [OUT] size of constant string in chars, 0 for non-strings.
840
841 virtual HRESULT STDMETHODCALLTYPE GetCustomAttributeByName( // S_OK or error.
842 mdToken tkObj, // [IN] Object with Custom Attribute.
843 LPCWSTR szName, // [IN] Name of desired Custom Attribute.
844 const void **ppData, // [OUT] Put pointer to data here.
845 ULONG *pcbData); // [OUT] Put size of data here.
846
847 virtual BOOL STDMETHODCALLTYPE IsValidToken( // True or False.
848 mdToken tk); // [IN] Given token.
849
850 virtual HRESULT STDMETHODCALLTYPE GetNestedClassProps( // S_OK or error.
851 mdTypeDef tdNestedClass, // [IN] NestedClass token.
852 mdTypeDef *ptdEnclosingClass); // [OUT] EnclosingClass token.
853
854 virtual HRESULT STDMETHODCALLTYPE GetNativeCallConvFromSig( // S_OK or error.
855 void const *pvSig, // [IN] Pointer to signature.
856 ULONG cbSig, // [IN] Count of signature bytes.
857 ULONG *pCallConv); // [OUT] Put calling conv here (see CorPinvokemap).
858
859 virtual HRESULT STDMETHODCALLTYPE IsGlobal( // S_OK or error.
860 mdToken pd, // [IN] Type, Field, or Method token.
861 int *pbGlobal); // [OUT] Put 1 if global, 0 otherwise.
862
863 //IMetaDataImport2
864 virtual HRESULT STDMETHODCALLTYPE EnumGenericParams(
865 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
866 mdToken tk, // [IN] TypeDef or MethodDef whose generic parameters are requested
867 mdGenericParam rGenericParams[], // [OUT] Put GenericParams here.
868 ULONG cMax, // [IN] Max GenericParams to put.
869 ULONG *pcGenericParams); // [OUT] Put # put here.
870
871 virtual HRESULT STDMETHODCALLTYPE GetGenericParamProps( // S_OK or error.
872 mdGenericParam gp, // [IN] GenericParam
873 ULONG *pulParamSeq, // [OUT] Index of the type parameter
874 DWORD *pdwParamFlags, // [OUT] Flags, for future use (e.g. variance)
875 mdToken *ptOwner, // [OUT] Owner (TypeDef or MethodDef)
876 DWORD *reserved, // [OUT] For future use (e.g. non-type parameters)
877 __out_ecount(cchName)
878 LPWSTR wzname, // [OUT] Put name here
879 ULONG cchName, // [IN] Size of buffer
880 ULONG *pchName); // [OUT] Put size of name (wide chars) here.
881
882 virtual HRESULT STDMETHODCALLTYPE GetMethodSpecProps(
883 mdMethodSpec mi, // [IN] The method instantiation
884 mdToken *tkParent, // [OUT] MethodDef or MemberRef
885 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
886 ULONG *pcbSigBlob); // [OUT] actual size of signature blob
887
888 virtual HRESULT STDMETHODCALLTYPE EnumGenericParamConstraints(
889 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
890 mdGenericParam tk, // [IN] GenericParam whose constraints are requested
891 mdGenericParamConstraint rGenericParamConstraints[], // [OUT] Put GenericParamConstraints here.
892 ULONG cMax, // [IN] Max GenericParamConstraints to put.
893 ULONG *pcGenericParamConstraints); // [OUT] Put # put here.
894
895 virtual HRESULT STDMETHODCALLTYPE GetGenericParamConstraintProps( // S_OK or error.
896 mdGenericParamConstraint gpc, // [IN] GenericParamConstraint
897 mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained
898 mdToken *ptkConstraintType); // [OUT] TypeDef/Ref/Spec constraint
899
900 virtual HRESULT STDMETHODCALLTYPE GetPEKind( // S_OK or error.
901 DWORD* pdwPEKind, // [OUT] The kind of PE (0 - not a PE)
902 DWORD* pdwMAchine); // [OUT] Machine as defined in NT header
903
904 virtual HRESULT STDMETHODCALLTYPE GetVersionString( // S_OK or error.
905 __out_ecount(ccBufSize)
906 LPWSTR pwzBuf, // [OUT] Put version string here.
907 DWORD ccBufSize, // [IN] size of the buffer, in wide chars
908 DWORD *pccBufSize); // [OUT] Size of the version string, wide chars, including terminating nul.
909
910 virtual HRESULT STDMETHODCALLTYPE EnumMethodSpecs(
911 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
912 mdToken tk, // [IN] MethodDef or MemberRef whose MethodSpecs are requested
913 mdMethodSpec rMethodSpecs[], // [OUT] Put MethodSpecs here.
914 ULONG cMax, // [IN] Max tokens to put.
915 ULONG *pcMethodSpecs); // [OUT] Put actual count here.
916
917
918 // IMetaDataAssemblyImport
919 virtual HRESULT STDMETHODCALLTYPE GetAssemblyProps( // S_OK or error.
920 mdAssembly mda, // [IN] The Assembly for which to get the properties.
921 const void **ppbPublicKey, // [OUT] Pointer to the public key.
922 ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key.
923 ULONG *pulHashAlgId, // [OUT] Hash Algorithm.
924 __out_ecount(cchName)
925 LPWSTR szName, // [OUT] Buffer to fill with assembly's simply name.
926 ULONG cchName, // [IN] Size of buffer in wide chars.
927 ULONG *pchName, // [OUT] Actual # of wide chars in name.
928 ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
929 DWORD *pdwAssemblyFlags); // [OUT] Flags.
930
931 virtual HRESULT STDMETHODCALLTYPE GetAssemblyRefProps( // S_OK or error.
932 mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties.
933 const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token.
934 ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token.
935 __out_ecount(cchName)
936 LPWSTR szName, // [OUT] Buffer to fill with name.
937 ULONG cchName, // [IN] Size of buffer in wide chars.
938 ULONG *pchName, // [OUT] Actual # of wide chars in name.
939 ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
940 const void **ppbHashValue, // [OUT] Hash blob.
941 ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob.
942 DWORD *pdwAssemblyRefFlags); // [OUT] Flags.
943
944 virtual HRESULT STDMETHODCALLTYPE GetFileProps( // S_OK or error.
945 mdFile mdf, // [IN] The File for which to get the properties.
946 __out_ecount(cchName)
947 LPWSTR szName, // [OUT] Buffer to fill with name.
948 ULONG cchName, // [IN] Size of buffer in wide chars.
949 ULONG *pchName, // [OUT] Actual # of wide chars in name.
950 const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob.
951 ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob.
952 DWORD *pdwFileFlags); // [OUT] Flags.
953
954 virtual HRESULT STDMETHODCALLTYPE GetExportedTypeProps( // S_OK or error.
955 mdExportedType mdct, // [IN] The ExportedType for which to get the properties.
956 __out_ecount(cchName)
957 LPWSTR szName, // [OUT] Buffer to fill with name.
958 ULONG cchName, // [IN] Size of buffer in wide chars.
959 ULONG *pchName, // [OUT] Actual # of wide chars in name.
960 mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef or mdExportedType.
961 mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file.
962 DWORD *pdwExportedTypeFlags); // [OUT] Flags.
963
964 virtual HRESULT STDMETHODCALLTYPE GetManifestResourceProps( // S_OK or error.
965 mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties.
966 __out_ecount(cchName)
967 LPWSTR szName, // [OUT] Buffer to fill with name.
968 ULONG cchName, // [IN] Size of buffer in wide chars.
969 ULONG *pchName, // [OUT] Actual # of wide chars in name.
970 mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ManifestResource.
971 DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file.
972 DWORD *pdwResourceFlags);// [OUT] Flags.
973
974 virtual HRESULT STDMETHODCALLTYPE EnumAssemblyRefs( // S_OK or error
975 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
976 mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here.
977 ULONG cMax, // [IN] Max AssemblyRefs to put.
978 ULONG *pcTokens); // [OUT] Put # put here.
979
980 virtual HRESULT STDMETHODCALLTYPE EnumFiles( // S_OK or error
981 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
982 mdFile rFiles[], // [OUT] Put Files here.
983 ULONG cMax, // [IN] Max Files to put.
984 ULONG *pcTokens); // [OUT] Put # put here.
985
986 virtual HRESULT STDMETHODCALLTYPE EnumExportedTypes( // S_OK or error
987 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
988 mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here.
989 ULONG cMax, // [IN] Max ExportedTypes to put.
990 ULONG *pcTokens); // [OUT] Put # put here.
991
992 virtual HRESULT STDMETHODCALLTYPE EnumManifestResources( // S_OK or error
993 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
994 mdManifestResource rManifestResources[], // [OUT] Put ManifestResources here.
995 ULONG cMax, // [IN] Max Resources to put.
996 ULONG *pcTokens); // [OUT] Put # put here.
997
998 virtual HRESULT STDMETHODCALLTYPE GetAssemblyFromScope( // S_OK or error
999 mdAssembly *ptkAssembly); // [OUT] Put token here.
1000
1001 virtual HRESULT STDMETHODCALLTYPE FindExportedTypeByName( // S_OK or error
1002 LPCWSTR szName, // [IN] Name of the ExportedType.
1003 mdToken mdtExportedType, // [IN] ExportedType for the enclosing class.
1004 mdExportedType *ptkExportedType); // [OUT] Put the ExportedType token here.
1005
1006 virtual HRESULT STDMETHODCALLTYPE FindManifestResourceByName( // S_OK or error
1007 LPCWSTR szName, // [IN] Name of the ManifestResource.
1008 mdManifestResource *ptkManifestResource); // [OUT] Put the ManifestResource token here.
1009
1010 //STDMETHOD_(void, CloseEnum(
1011 // HCORENUM hEnum); // Enum to be closed.
1012
1013 virtual HRESULT STDMETHODCALLTYPE FindAssembliesByName( // S_OK or error
1014 LPCWSTR szAppBase, // [IN] optional - can be NULL
1015 LPCWSTR szPrivateBin, // [IN] optional - can be NULL
1016 LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
1017 IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here
1018 ULONG cMax, // [IN] The max number to put
1019 ULONG *pcAssemblies); // [OUT] The number of assemblies returned.
1020
1021private:
1022 Volatile<LONG> m_cRefCount;
1023 ReleaseHolder<IMetaDataImport2> m_pInnerImport;
1024 ReleaseHolder<IMDInternalImport> m_pInnerInternalImport;
1025 ReleaseHolder<IMetaDataAssemblyImport> m_pInnerAssemblyImport;
1026 ReleaseHolder<IMetaDataEmit2> m_pInner;
1027 ReleaseHolder<IMetaDataAssemblyEmit> m_pInnerAssembly;
1028
1029 // all tokens with values <= these maximums are considered pre-existing content
1030 // and can not be altered using this emitter
1031 mdTypeDef maxInitialTypeDef;
1032 mdMethodDef maxInitialMethodDef;
1033 mdFieldDef maxInitialFieldDef;
1034 mdMemberRef maxInitialMemberRef;
1035 mdParamDef maxInitialParamDef;
1036 mdCustomAttribute maxInitialCustomAttribute;
1037 mdEvent maxInitialEvent;
1038 mdProperty maxInitialProperty;
1039 mdGenericParam maxInitialGenericParam;
1040};
1041
1042
1043
1044#endif
1045