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// callbacks for diasymreader when using SymConverter
7
8
9#ifndef SYMBOLINFO_H
10#define SYMBOLINFO_H
11#include "arraylist.h"
12#include "shash.h"
13#include "corsym.h"
14#include "sstring.h"
15
16class SymbolInfo: IMetaDataEmit, IMetaDataImport
17{
18
19 struct ScopeMap
20 {
21 ULONG32 left;
22 ULONG32 right;
23 ScopeMap(ULONG32 l, ULONG32 r):left(l), right(r){};
24 ULONG32 GetKey() {return left;};
25 static COUNT_T Hash(ULONG32 key) {return key;};
26 };
27
28 struct MethodProps
29 {
30 mdMethodDef method;
31 mdTypeDef cls;
32 SString wszName;
33 MethodProps() : method(mdTokenNil) {};
34 };
35
36 struct ClassProps
37 {
38 mdTypeDef cls;
39 DWORD flags;
40 SString wszName;
41 mdTypeDef tkEnclosing;
42 ClassProps(mdToken c, DWORD f, LPCWSTR name, mdToken tkE):
43 cls(c),flags(f),wszName(name),tkEnclosing(tkE) {wszName.Normalize();};
44
45 mdTypeDef GetKey() {return cls;};
46 static COUNT_T Hash(mdTypeDef key) {return key;};
47 };
48
49 struct SignatureProps
50 {
51 SBuffer sig;
52 DWORD tkSig;
53 SignatureProps(SBuffer& signature, DWORD token):
54 tkSig(token) {sig.Set(signature);};
55 SBuffer& GetKey() {return sig;};
56 static COUNT_T Hash(SBuffer& key) {return HashBytes(key,key.GetSize());};
57 };
58
59 Volatile<LONG> m_cRef;
60 ArrayList m_Documents;
61 PtrSHashWithCleanup<ScopeMap,ULONG32> m_Scopes;
62 PtrSHashWithCleanup<SignatureProps,SBuffer&> m_Signatures;
63 PtrSHashWithCleanup<ClassProps,mdTypeDef> m_Classes;
64
65 MethodProps m_LastMethod; // diasymreader supports only one open method at a time
66
67 ClassProps* FindClass(mdToken cls);
68 SignatureProps* FindSignature(SBuffer& sig);
69
70 virtual ~SymbolInfo(); // protected, b/c the lifetime is controlled by refcount
71
72public:
73 SymbolInfo();
74
75 HRESULT AddDocument(DWORD id, ISymUnmanagedDocumentWriter* Document);
76 HRESULT MapDocument(DWORD id, ISymUnmanagedDocumentWriter** Document);
77 HRESULT AddScope(ULONG32 left, ULONG32 right);
78 HRESULT MapScope(ULONG32 left, ULONG32* pRight);
79 HRESULT SetMethodProps(mdToken method, mdTypeDef cls, LPCWSTR wszName);
80 HRESULT SetClassProps(mdTypeDef cls, DWORD flags, LPCWSTR wszName, mdTypeDef enclosingCls);
81 HRESULT AddSignature(SBuffer& sig, mdSignature token);
82
83 // IUnknown methods
84 STDMETHOD(QueryInterface) (REFIID riid, LPVOID * ppvObj);
85 STDMETHOD_(ULONG,AddRef) ();
86 STDMETHOD_(ULONG,Release) ();
87
88
89 // IMetaDataImport functions
90
91 STDMETHOD_(void, CloseEnum)(HCORENUM hEnum);
92 STDMETHOD(CountEnum)(HCORENUM hEnum, ULONG *pulCount);
93 STDMETHOD(ResetEnum)(HCORENUM hEnum, ULONG ulPos);
94 STDMETHOD(EnumTypeDefs)(HCORENUM *phEnum, mdTypeDef rTypeDefs[],
95 ULONG cMax, ULONG *pcTypeDefs);
96 STDMETHOD(EnumInterfaceImpls)(HCORENUM *phEnum, mdTypeDef td,
97 mdInterfaceImpl rImpls[], ULONG cMax,
98 ULONG* pcImpls);
99 STDMETHOD(EnumTypeRefs)(HCORENUM *phEnum, mdTypeRef rTypeRefs[],
100 ULONG cMax, ULONG* pcTypeRefs);
101
102 STDMETHOD(FindTypeDefByName)( // S_OK or error.
103 LPCWSTR szTypeDef, // [IN] Name of the Type.
104 mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class.
105 mdTypeDef *ptd); // [OUT] Put the TypeDef token here.
106
107 STDMETHOD(GetScopeProps)( // S_OK or error.
108 __out_ecount_part_opt(cchName, *pchName)
109 LPWSTR szName, // [OUT] Put the name here.
110 ULONG cchName, // [IN] Size of name buffer in wide chars.
111 ULONG *pchName, // [OUT] Put size of name (wide chars) here.
112 GUID *pmvid); // [OUT, OPTIONAL] Put MVID here.
113
114 STDMETHOD(GetModuleFromScope)( // S_OK.
115 mdModule *pmd); // [OUT] Put mdModule token here.
116
117 STDMETHOD(GetTypeDefProps)( // S_OK or error.
118 mdTypeDef td, // [IN] TypeDef token for inquiry.
119 __out_ecount_part_opt(cchTypeDef, *pchTypeDef)
120 LPWSTR szTypeDef, // [OUT] Put name here.
121 ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
122 ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
123 DWORD *pdwTypeDefFlags, // [OUT] Put flags here.
124 mdToken *ptkExtends); // [OUT] Put base class TypeDef/TypeRef here.
125
126 STDMETHOD(GetInterfaceImplProps)( // S_OK or error.
127 mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token.
128 mdTypeDef *pClass, // [OUT] Put implementing class token here.
129 mdToken *ptkIface); // [OUT] Put implemented interface token here.
130
131 STDMETHOD(GetTypeRefProps)( // S_OK or error.
132 mdTypeRef tr, // [IN] TypeRef token.
133 mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
134 __out_ecount_part_opt(cchName, *pchName)
135 LPWSTR szName, // [OUT] Name of the TypeRef.
136 ULONG cchName, // [IN] Size of buffer.
137 ULONG *pchName); // [OUT] Size of Name.
138
139 STDMETHOD(ResolveTypeRef)(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd);
140
141 STDMETHOD(EnumMembers)( // S_OK, S_FALSE, or error.
142 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
143 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
144 mdToken rMembers[], // [OUT] Put MemberDefs here.
145 ULONG cMax, // [IN] Max MemberDefs to put.
146 ULONG *pcTokens); // [OUT] Put # put here.
147
148 STDMETHOD(EnumMembersWithName)( // S_OK, S_FALSE, or error.
149 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
150 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
151 LPCWSTR szName, // [IN] Limit results to those with this name.
152 mdToken rMembers[], // [OUT] Put MemberDefs here.
153 ULONG cMax, // [IN] Max MemberDefs to put.
154 ULONG *pcTokens); // [OUT] Put # put here.
155
156 STDMETHOD(EnumMethods)( // S_OK, S_FALSE, or error.
157 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
158 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
159 mdMethodDef rMethods[], // [OUT] Put MethodDefs here.
160 ULONG cMax, // [IN] Max MethodDefs to put.
161 ULONG *pcTokens); // [OUT] Put # put here.
162
163 STDMETHOD(EnumMethodsWithName)( // S_OK, S_FALSE, or error.
164 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
165 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
166 LPCWSTR szName, // [IN] Limit results to those with this name.
167 mdMethodDef rMethods[], // [OU] Put MethodDefs here.
168 ULONG cMax, // [IN] Max MethodDefs to put.
169 ULONG *pcTokens); // [OUT] Put # put here.
170
171 STDMETHOD(EnumFields)( // S_OK, S_FALSE, or error.
172 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
173 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
174 mdFieldDef rFields[], // [OUT] Put FieldDefs here.
175 ULONG cMax, // [IN] Max FieldDefs to put.
176 ULONG *pcTokens); // [OUT] Put # put here.
177
178 STDMETHOD(EnumFieldsWithName)( // S_OK, S_FALSE, or error.
179 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
180 mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
181 LPCWSTR szName, // [IN] Limit results to those with this name.
182 mdFieldDef rFields[], // [OUT] Put MemberDefs here.
183 ULONG cMax, // [IN] Max MemberDefs to put.
184 ULONG *pcTokens); // [OUT] Put # put here.
185
186
187 STDMETHOD(EnumParams)( // S_OK, S_FALSE, or error.
188 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
189 mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
190 mdParamDef rParams[], // [OUT] Put ParamDefs here.
191 ULONG cMax, // [IN] Max ParamDefs to put.
192 ULONG *pcTokens); // [OUT] Put # put here.
193
194 STDMETHOD(EnumMemberRefs)( // S_OK, S_FALSE, or error.
195 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
196 mdToken tkParent, // [IN] Parent token to scope the enumeration.
197 mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here.
198 ULONG cMax, // [IN] Max MemberRefs to put.
199 ULONG *pcTokens); // [OUT] Put # put here.
200
201 STDMETHOD(EnumMethodImpls)( // S_OK, S_FALSE, or error
202 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
203 mdTypeDef td, // [IN] TypeDef to scope the enumeration.
204 mdToken rMethodBody[], // [OUT] Put Method Body tokens here.
205 mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here.
206 ULONG cMax, // [IN] Max tokens to put.
207 ULONG *pcTokens); // [OUT] Put # put here.
208
209 STDMETHOD(EnumPermissionSets)( // S_OK, S_FALSE, or error.
210 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
211 mdToken tk, // [IN] if !NIL, token to scope the enumeration.
212 DWORD dwActions, // [IN] if !0, return only these actions.
213 mdPermission rPermission[], // [OUT] Put Permissions here.
214 ULONG cMax, // [IN] Max Permissions to put.
215 ULONG *pcTokens); // [OUT] Put # put here.
216
217 STDMETHOD(FindMember)(
218 mdTypeDef td, // [IN] given typedef
219 LPCWSTR szName, // [IN] member name
220 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
221 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
222 mdToken *pmb); // [OUT] matching memberdef
223
224 STDMETHOD(FindMethod)(
225 mdTypeDef td, // [IN] given typedef
226 LPCWSTR szName, // [IN] member name
227 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
228 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
229 mdMethodDef *pmb); // [OUT] matching memberdef
230
231 STDMETHOD(FindField)(
232 mdTypeDef td, // [IN] given typedef
233 LPCWSTR szName, // [IN] member name
234 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
235 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
236 mdFieldDef *pmb); // [OUT] matching memberdef
237
238 STDMETHOD(FindMemberRef)(
239 mdTypeRef td, // [IN] given typeRef
240 LPCWSTR szName, // [IN] member name
241 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
242 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
243 mdMemberRef *pmr); // [OUT] matching memberref
244
245 STDMETHOD (GetMethodProps)(
246 mdMethodDef mb, // The method for which to get props.
247 mdTypeDef *pClass, // Put method's class here.
248 __out_ecount_part_opt(cchMethod, *pchMethod)
249 LPWSTR szMethod, // Put method's name here.
250 ULONG cchMethod, // Size of szMethod buffer in wide chars.
251 ULONG *pchMethod, // Put actual size here
252 DWORD *pdwAttr, // Put flags here.
253 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
254 ULONG *pcbSigBlob, // [OUT] actual size of signature blob
255 ULONG *pulCodeRVA, // [OUT] codeRVA
256 DWORD *pdwImplFlags); // [OUT] Impl. Flags
257
258 STDMETHOD(GetMemberRefProps)( // S_OK or error.
259 mdMemberRef mr, // [IN] given memberref
260 mdToken *ptk, // [OUT] Put classref or classdef here.
261 __out_ecount_part_opt(cchMember, *pchMember)
262 LPWSTR szMember, // [OUT] buffer to fill for member's name
263 ULONG cchMember, // [IN] the count of char of szMember
264 ULONG *pchMember, // [OUT] actual count of char in member name
265 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value
266 ULONG *pbSig); // [OUT] actual size of signature blob
267
268 STDMETHOD(EnumProperties)( // S_OK, S_FALSE, or error.
269 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
270 mdTypeDef td, // [IN] TypeDef to scope the enumeration.
271 mdProperty rProperties[], // [OUT] Put Properties here.
272 ULONG cMax, // [IN] Max properties to put.
273 ULONG *pcProperties); // [OUT] Put # put here.
274
275 STDMETHOD(EnumEvents)( // S_OK, S_FALSE, or error.
276 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
277 mdTypeDef td, // [IN] TypeDef to scope the enumeration.
278 mdEvent rEvents[], // [OUT] Put events here.
279 ULONG cMax, // [IN] Max events to put.
280 ULONG *pcEvents); // [OUT] Put # put here.
281
282 STDMETHOD(GetEventProps)( // S_OK, S_FALSE, or error.
283 mdEvent ev, // [IN] event token
284 mdTypeDef *pClass, // [OUT] typedef containing the event declarion.
285 LPCWSTR szEvent, // [OUT] Event name
286 ULONG cchEvent, // [IN] the count of wchar of szEvent
287 ULONG *pchEvent, // [OUT] actual count of wchar for event's name
288 DWORD *pdwEventFlags, // [OUT] Event flags.
289 mdToken *ptkEventType, // [OUT] EventType class
290 mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event
291 mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event
292 mdMethodDef *pmdFire, // [OUT] Fire method of the event
293 mdMethodDef rmdOtherMethod[], // [OUT] other method of the event
294 ULONG cMax, // [IN] size of rmdOtherMethod
295 ULONG *pcOtherMethod); // [OUT] total number of other method of this event
296
297 STDMETHOD(EnumMethodSemantics)( // 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 mdToken rEventProp[], // [OUT] Put Event/Property here.
301 ULONG cMax, // [IN] Max properties to put.
302 ULONG *pcEventProp); // [OUT] Put # put here.
303
304 STDMETHOD(GetMethodSemantics)( // S_OK, S_FALSE, or error.
305 mdMethodDef mb, // [IN] method token
306 mdToken tkEventProp, // [IN] event/property token.
307 DWORD *pdwSemanticsFlags); // [OUT] the role flags for the method/propevent pair
308
309 STDMETHOD(GetClassLayout) (
310 mdTypeDef td, // [IN] give typedef
311 DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16
312 COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array
313 ULONG cMax, // [IN] size of the array
314 ULONG *pcFieldOffset, // [OUT] needed array size
315 ULONG *pulClassSize); // [OUT] the size of the class
316
317 STDMETHOD(GetFieldMarshal) (
318 mdToken tk, // [IN] given a field's memberdef
319 PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field
320 ULONG *pcbNativeType); // [OUT] the count of bytes of *ppvNativeType
321
322 STDMETHOD(GetRVA)( // S_OK or error.
323 mdToken tk, // Member for which to set offset
324 ULONG *pulCodeRVA, // The offset
325 DWORD *pdwImplFlags); // the implementation flags
326
327 STDMETHOD(GetPermissionSetProps) (
328 mdPermission pm, // [IN] the permission token.
329 DWORD *pdwAction, // [OUT] CorDeclSecurity.
330 void const **ppvPermission, // [OUT] permission blob.
331 ULONG *pcbPermission); // [OUT] count of bytes of pvPermission.
332
333 STDMETHOD(GetSigFromToken)( // S_OK or error.
334 mdSignature mdSig, // [IN] Signature token.
335 PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
336 ULONG *pcbSig); // [OUT] return size of signature.
337
338 STDMETHOD(GetModuleRefProps)( // S_OK or error.
339 mdModuleRef mur, // [IN] moduleref token.
340 __out_ecount_part_opt(cchName, *pchName)
341 LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
342 ULONG cchName, // [IN] size of szName in wide characters.
343 ULONG *pchName); // [OUT] actual count of characters in the name.
344
345 STDMETHOD(EnumModuleRefs)( // S_OK or error.
346 HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
347 mdModuleRef rModuleRefs[], // [OUT] put modulerefs here.
348 ULONG cmax, // [IN] max memberrefs to put.
349 ULONG *pcModuleRefs); // [OUT] put # put here.
350
351 STDMETHOD(GetTypeSpecFromToken)( // S_OK or error.
352 mdTypeSpec typespec, // [IN] TypeSpec token.
353 PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature
354 ULONG *pcbSig); // [OUT] return size of signature.
355
356 STDMETHOD(GetNameFromToken)( // Not Recommended! May be removed!
357 mdToken tk, // [IN] Token to get name from. Must have a name.
358 MDUTF8CSTR *pszUtf8NamePtr); // [OUT] Return pointer to UTF8 name in heap.
359
360 STDMETHOD(EnumUnresolvedMethods)( // S_OK, S_FALSE, or error.
361 HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
362 mdToken rMethods[], // [OUT] Put MemberDefs here.
363 ULONG cMax, // [IN] Max MemberDefs to put.
364 ULONG *pcTokens); // [OUT] Put # put here.
365
366 STDMETHOD(GetUserString)( // S_OK or error.
367 mdString stk, // [IN] String token.
368 __out_ecount_part_opt(cchString, *pchString)
369 LPWSTR szString, // [OUT] Copy of string.
370 ULONG cchString, // [IN] Max chars of room in szString.
371 ULONG *pchString); // [OUT] How many chars in actual string.
372
373 STDMETHOD(GetPinvokeMap)( // S_OK or error.
374 mdToken tk, // [IN] FieldDef or MethodDef.
375 DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
376 __out_ecount_part_opt(cchImportName, *pchImportName)
377 LPWSTR szImportName, // [OUT] Import name.
378 ULONG cchImportName, // [IN] Size of the name buffer.
379 ULONG *pchImportName, // [OUT] Actual number of characters stored.
380 mdModuleRef *pmrImportDLL); // [OUT] ModuleRef token for the target DLL.
381
382 STDMETHOD(EnumSignatures)( // S_OK or error.
383 HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
384 mdSignature rSignatures[], // [OUT] put signatures here.
385 ULONG cmax, // [IN] max signatures to put.
386 ULONG *pcSignatures); // [OUT] put # put here.
387
388 STDMETHOD(EnumTypeSpecs)( // S_OK or error.
389 HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
390 mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here.
391 ULONG cmax, // [IN] max TypeSpecs to put.
392 ULONG *pcTypeSpecs); // [OUT] put # put here.
393
394 STDMETHOD(EnumUserStrings)( // S_OK or error.
395 HCORENUM *phEnum, // [IN/OUT] pointer to the enum.
396 mdString rStrings[], // [OUT] put Strings here.
397 ULONG cmax, // [IN] max Strings to put.
398 ULONG *pcStrings); // [OUT] put # put here.
399
400 STDMETHOD(GetParamForMethodIndex)( // S_OK or error.
401 mdMethodDef md, // [IN] Method token.
402 ULONG ulParamSeq, // [IN] Parameter sequence.
403 mdParamDef *ppd); // [IN] Put Param token here.
404
405 STDMETHOD(EnumCustomAttributes)( // S_OK or error.
406 HCORENUM *phEnum, // [IN, OUT] COR enumerator.
407 mdToken tk, // [IN] Token to scope the enumeration, 0 for all.
408 mdToken tkType, // [IN] Type of interest, 0 for all.
409 mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here.
410 ULONG cMax, // [IN] Size of rCustomAttributes.
411 ULONG *pcCustomAttributes); // [OUT, OPTIONAL] Put count of token values here.
412
413 STDMETHOD(GetCustomAttributeProps)( // S_OK or error.
414 mdCustomAttribute cv, // [IN] CustomAttribute token.
415 mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here.
416 mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here.
417 void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here.
418 ULONG *pcbSize); // [OUT, OPTIONAL] Put size of date here.
419
420 STDMETHOD(FindTypeRef)(
421 mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
422 LPCWSTR szName, // [IN] TypeRef Name.
423 mdTypeRef *ptr); // [OUT] matching TypeRef.
424
425 STDMETHOD(GetMemberProps)(
426 mdToken mb, // The member for which to get props.
427 mdTypeDef *pClass, // Put member's class here.
428 __out_ecount_part_opt(cchMember, *pchMember)
429 LPWSTR szMember, // Put member's name here.
430 ULONG cchMember, // Size of szMember buffer in wide chars.
431 ULONG *pchMember, // Put actual size here
432 DWORD *pdwAttr, // Put flags here.
433 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
434 ULONG *pcbSigBlob, // [OUT] actual size of signature blob
435 ULONG *pulCodeRVA, // [OUT] codeRVA
436 DWORD *pdwImplFlags, // [OUT] Impl. Flags
437 DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
438 UVCP_CONSTANT *ppValue, // [OUT] constant value
439 ULONG *pcchValue); // [OUT] size of constant string in chars, 0 for non-strings.
440
441 STDMETHOD(GetFieldProps)(
442 mdFieldDef mb, // The field for which to get props.
443 mdTypeDef *pClass, // Put field's class here.
444 __out_ecount_part_opt(cchField, *pchField)
445 LPWSTR szField, // Put field's name here.
446 ULONG cchField, // Size of szField buffer in wide chars.
447 ULONG *pchField, // Put actual size here
448 DWORD *pdwAttr, // Put flags here.
449 PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
450 ULONG *pcbSigBlob, // [OUT] actual size of signature blob
451 DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
452 UVCP_CONSTANT *ppValue, // [OUT] constant value
453 ULONG *pcchValue); // [OUT] size of constant string in chars, 0 for non-strings.
454
455 STDMETHOD(GetPropertyProps)( // S_OK, S_FALSE, or error.
456 mdProperty prop, // [IN] property token
457 mdTypeDef *pClass, // [OUT] typedef containing the property declarion.
458 LPCWSTR szProperty, // [OUT] Property name
459 ULONG cchProperty, // [IN] the count of wchar of szProperty
460 ULONG *pchProperty, // [OUT] actual count of wchar for property name
461 DWORD *pdwPropFlags, // [OUT] property flags.
462 PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob
463 ULONG *pbSig, // [OUT] count of bytes in *ppvSig
464 DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
465 UVCP_CONSTANT *ppDefaultValue, // [OUT] constant value
466 ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings.
467 mdMethodDef *pmdSetter, // [OUT] setter method of the property
468 mdMethodDef *pmdGetter, // [OUT] getter method of the property
469 mdMethodDef rmdOtherMethod[], // [OUT] other method of the property
470 ULONG cMax, // [IN] size of rmdOtherMethod
471 ULONG *pcOtherMethod); // [OUT] total number of other method of this property
472
473 STDMETHOD(GetParamProps)( // S_OK or error.
474 mdParamDef tk, // [IN]The Parameter.
475 mdMethodDef *pmd, // [OUT] Parent Method token.
476 ULONG *pulSequence, // [OUT] Parameter sequence.
477 __out_ecount_part_opt(cchName, *pchName)
478 LPWSTR szName, // [OUT] Put name here.
479 ULONG cchName, // [OUT] Size of name buffer.
480 ULONG *pchName, // [OUT] Put actual size of name here.
481 DWORD *pdwAttr, // [OUT] Put flags here.
482 DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*.
483 UVCP_CONSTANT *ppValue, // [OUT] Constant value.
484 ULONG *pcchValue); // [OUT] size of constant string in chars, 0 for non-strings.
485
486 STDMETHOD(GetCustomAttributeByName)( // S_OK or error.
487 mdToken tkObj, // [IN] Object with Custom Attribute.
488 LPCWSTR szName, // [IN] Name of desired Custom Attribute.
489 const void **ppData, // [OUT] Put pointer to data here.
490 ULONG *pcbData); // [OUT] Put size of data here.
491
492 STDMETHOD_(BOOL, IsValidToken)( // True or False.
493 mdToken tk); // [IN] Given token.
494
495 STDMETHOD(GetNestedClassProps)( // S_OK or error.
496 mdTypeDef tdNestedClass, // [IN] NestedClass token.
497 mdTypeDef *ptdEnclosingClass); // [OUT] EnclosingClass token.
498
499 STDMETHOD(GetNativeCallConvFromSig)( // S_OK or error.
500 void const *pvSig, // [IN] Pointer to signature.
501 ULONG cbSig, // [IN] Count of signature bytes.
502 ULONG *pCallConv); // [OUT] Put calling conv here (see CorPinvokemap).
503
504 STDMETHOD(IsGlobal)( // S_OK or error.
505 mdToken pd, // [IN] Type, Field, or Method token.
506 int *pbGlobal); // [OUT] Put 1 if global, 0 otherwise.
507
508
509 // IMetaDataEmit functions
510
511 STDMETHOD(SetModuleProps)( // S_OK or error.
512 LPCWSTR szName); // [IN] If not NULL, the name of the module to set.
513
514 STDMETHOD(Save)( // S_OK or error.
515 LPCWSTR szFile, // [IN] The filename to save to.
516 DWORD dwSaveFlags); // [IN] Flags for the save.
517
518 STDMETHOD(SaveToStream)( // S_OK or error.
519 IStream *pIStream, // [IN] A writable stream to save to.
520 DWORD dwSaveFlags); // [IN] Flags for the save.
521
522 STDMETHOD(GetSaveSize)( // S_OK or error.
523 CorSaveSize fSave, // [IN] cssAccurate or cssQuick.
524 DWORD *pdwSaveSize); // [OUT] Put the size here.
525
526 STDMETHOD(DefineTypeDef)( // S_OK or error.
527 LPCWSTR szTypeDef, // [IN] Name of TypeDef
528 DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
529 mdToken tkExtends, // [IN] extends this TypeDef or typeref
530 mdToken rtkImplements[], // [IN] Implements interfaces
531 mdTypeDef *ptd); // [OUT] Put TypeDef token here
532
533 STDMETHOD(DefineNestedType)( // S_OK or error.
534 LPCWSTR szTypeDef, // [IN] Name of TypeDef
535 DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
536 mdToken tkExtends, // [IN] extends this TypeDef or typeref
537 mdToken rtkImplements[], // [IN] Implements interfaces
538 mdTypeDef tdEncloser, // [IN] TypeDef token of the enclosing type.
539 mdTypeDef *ptd); // [OUT] Put TypeDef token here
540
541 STDMETHOD(SetHandler)( // S_OK.
542 IUnknown *pUnk); // [IN] The new error handler.
543
544 STDMETHOD(DefineMethod)( // S_OK or error.
545 mdTypeDef td, // Parent TypeDef
546 LPCWSTR szName, // Name of member
547 DWORD dwMethodFlags, // Member attributes
548 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
549 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
550 ULONG ulCodeRVA,
551 DWORD dwImplFlags,
552 mdMethodDef *pmd); // Put member token here
553
554 STDMETHOD(DefineMethodImpl)( // S_OK or error.
555 mdTypeDef td, // [IN] The class implementing the method
556 mdToken tkBody, // [IN] Method body - MethodDef or MethodRef
557 mdToken tkDecl); // [IN] Method declaration - MethodDef or MethodRef
558
559 STDMETHOD(DefineTypeRefByName)( // S_OK or error.
560 mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
561 LPCWSTR szName, // [IN] Name of the TypeRef.
562 mdTypeRef *ptr); // [OUT] Put TypeRef token here.
563
564 STDMETHOD(DefineImportType)( // S_OK or error.
565 IMetaDataAssemblyImport *pAssemImport, // [IN] Assembly containing the TypeDef.
566 const void *pbHashValue, // [IN] Hash Blob for Assembly.
567 ULONG cbHashValue, // [IN] Count of bytes.
568 IMetaDataImport *pImport, // [IN] Scope containing the TypeDef.
569 mdTypeDef tdImport, // [IN] The imported TypeDef.
570 IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the TypeDef is imported.
571 mdTypeRef *ptr); // [OUT] Put TypeRef token here.
572
573 STDMETHOD(DefineMemberRef)( // S_OK or error
574 mdToken tkImport, // [IN] ClassRef or ClassDef importing a member.
575 LPCWSTR szName, // [IN] member's name
576 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
577 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
578 mdMemberRef *pmr); // [OUT] memberref token
579
580 STDMETHOD(DefineImportMember)( // S_OK or error.
581 IMetaDataAssemblyImport *pAssemImport, // [IN] Assembly containing the Member.
582 const void *pbHashValue, // [IN] Hash Blob for Assembly.
583 ULONG cbHashValue, // [IN] Count of bytes.
584 IMetaDataImport *pImport, // [IN] Import scope, with member.
585 mdToken mbMember, // [IN] Member in import scope.
586 IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the Member is imported.
587 mdToken tkParent, // [IN] Classref or classdef in emit scope.
588 mdMemberRef *pmr); // [OUT] Put member ref here.
589
590 STDMETHOD(DefineEvent) (
591 mdTypeDef td, // [IN] the class/interface on which the event is being defined
592 LPCWSTR szEvent, // [IN] Name of the event
593 DWORD dwEventFlags, // [IN] CorEventAttr
594 mdToken tkEventType, // [IN] a reference (mdTypeRef or mdTypeRef) to the Event class
595 mdMethodDef mdAddOn, // [IN] required add method
596 mdMethodDef mdRemoveOn, // [IN] required remove method
597 mdMethodDef mdFire, // [IN] optional fire method
598 mdMethodDef rmdOtherMethods[], // [IN] optional array of other methods associate with the event
599 mdEvent *pmdEvent); // [OUT] output event token
600
601 STDMETHOD(SetClassLayout) (
602 mdTypeDef td, // [IN] typedef
603 DWORD dwPackSize, // [IN] packing size specified as 1, 2, 4, 8, or 16
604 COR_FIELD_OFFSET rFieldOffsets[], // [IN] array of layout specification
605 ULONG ulClassSize); // [IN] size of the class
606
607 STDMETHOD(DeleteClassLayout) (
608 mdTypeDef td); // [IN] typedef whose layout is to be deleted.
609
610 STDMETHOD(SetFieldMarshal) (
611 mdToken tk, // [IN] given a fieldDef or paramDef token
612 PCCOR_SIGNATURE pvNativeType, // [IN] native type specification
613 ULONG cbNativeType); // [IN] count of bytes of pvNativeType
614
615 STDMETHOD(DeleteFieldMarshal) (
616 mdToken tk); // [IN] given a fieldDef or paramDef token
617
618 STDMETHOD(DefinePermissionSet) (
619 mdToken tk, // [IN] the object to be decorated.
620 DWORD dwAction, // [IN] CorDeclSecurity.
621 void const *pvPermission, // [IN] permission blob.
622 ULONG cbPermission, // [IN] count of bytes of pvPermission.
623 mdPermission *ppm); // [OUT] returned permission token.
624
625 STDMETHOD(SetRVA)( // S_OK or error.
626 mdMethodDef md, // [IN] Method for which to set offset
627 ULONG ulRVA); // [IN] The offset
628
629 STDMETHOD(GetTokenFromSig)( // S_OK or error.
630 PCCOR_SIGNATURE pvSig, // [IN] Signature to define.
631 ULONG cbSig, // [IN] Size of signature data.
632 mdSignature *pmsig); // [OUT] returned signature token.
633
634 STDMETHOD(DefineModuleRef)( // S_OK or error.
635 LPCWSTR szName, // [IN] DLL name
636 mdModuleRef *pmur); // [OUT] returned
637
638 // <TODO>This should go away once everyone starts using SetMemberRefProps.</TODO>
639 STDMETHOD(SetParent)( // S_OK or error.
640 mdMemberRef mr, // [IN] Token for the ref to be fixed up.
641 mdToken tk); // [IN] The ref parent.
642
643 STDMETHOD(GetTokenFromTypeSpec)( // S_OK or error.
644 PCCOR_SIGNATURE pvSig, // [IN] TypeSpec Signature to define.
645 ULONG cbSig, // [IN] Size of signature data.
646 mdTypeSpec *ptypespec); // [OUT] returned TypeSpec token.
647
648 STDMETHOD(SaveToMemory)( // S_OK or error.
649 void *pbData, // [OUT] Location to write data.
650 ULONG cbData); // [IN] Max size of data buffer.
651
652 STDMETHOD(DefineUserString)( // Return code.
653 LPCWSTR szString, // [IN] User literal string.
654 ULONG cchString, // [IN] Length of string.
655 mdString *pstk); // [OUT] String token.
656
657 STDMETHOD(DeleteToken)( // Return code.
658 mdToken tkObj); // [IN] The token to be deleted
659
660 STDMETHOD(SetMethodProps)( // S_OK or error.
661 mdMethodDef md, // [IN] The MethodDef.
662 DWORD dwMethodFlags, // [IN] Method attributes.
663 ULONG ulCodeRVA, // [IN] Code RVA.
664 DWORD dwImplFlags); // [IN] Impl flags.
665
666 STDMETHOD(SetTypeDefProps)( // S_OK or error.
667 mdTypeDef td, // [IN] The TypeDef.
668 DWORD dwTypeDefFlags, // [IN] TypeDef flags.
669 mdToken tkExtends, // [IN] Base TypeDef or TypeRef.
670 mdToken rtkImplements[]); // [IN] Implemented interfaces.
671
672 STDMETHOD(SetEventProps)( // S_OK or error.
673 mdEvent ev, // [IN] The event token.
674 DWORD dwEventFlags, // [IN] CorEventAttr.
675 mdToken tkEventType, // [IN] A reference (mdTypeRef or mdTypeRef) to the Event class.
676 mdMethodDef mdAddOn, // [IN] Add method.
677 mdMethodDef mdRemoveOn, // [IN] Remove method.
678 mdMethodDef mdFire, // [IN] Fire method.
679 mdMethodDef rmdOtherMethods[]);// [IN] Array of other methods associate with the event.
680
681 STDMETHOD(SetPermissionSetProps)( // S_OK or error.
682 mdToken tk, // [IN] The object to be decorated.
683 DWORD dwAction, // [IN] CorDeclSecurity.
684 void const *pvPermission, // [IN] Permission blob.
685 ULONG cbPermission, // [IN] Count of bytes of pvPermission.
686 mdPermission *ppm); // [OUT] Permission token.
687
688 STDMETHOD(DefinePinvokeMap)( // Return code.
689 mdToken tk, // [IN] FieldDef or MethodDef.
690 DWORD dwMappingFlags, // [IN] Flags used for mapping.
691 LPCWSTR szImportName, // [IN] Import name.
692 mdModuleRef mrImportDLL); // [IN] ModuleRef token for the target DLL.
693
694 STDMETHOD(SetPinvokeMap)( // Return code.
695 mdToken tk, // [IN] FieldDef or MethodDef.
696 DWORD dwMappingFlags, // [IN] Flags used for mapping.
697 LPCWSTR szImportName, // [IN] Import name.
698 mdModuleRef mrImportDLL); // [IN] ModuleRef token for the target DLL.
699
700 STDMETHOD(DeletePinvokeMap)( // Return code.
701 mdToken tk); // [IN] FieldDef or MethodDef.
702
703 // New CustomAttribute functions.
704 STDMETHOD(DefineCustomAttribute)( // Return code.
705 mdToken tkObj, // [IN] The object to put the value on.
706 mdToken tkType, // [IN] Type of the CustomAttribute (TypeRef/TypeDef).
707 void const *pCustomAttribute, // [IN] The custom value data.
708 ULONG cbCustomAttribute, // [IN] The custom value data length.
709 mdCustomAttribute *pcv); // [OUT] The custom value token value on return.
710
711 STDMETHOD(SetCustomAttributeValue)( // Return code.
712 mdCustomAttribute pcv, // [IN] The custom value token whose value to replace.
713 void const *pCustomAttribute, // [IN] The custom value data.
714 ULONG cbCustomAttribute);// [IN] The custom value data length.
715
716 STDMETHOD(DefineField)( // S_OK or error.
717 mdTypeDef td, // Parent TypeDef
718 LPCWSTR szName, // Name of member
719 DWORD dwFieldFlags, // Member attributes
720 PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
721 ULONG cbSigBlob, // [IN] count of bytes in the signature blob
722 DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
723 void const *pValue, // [IN] constant value
724 ULONG cchValue, // [IN] size of constant value (string, in wide chars).
725 mdFieldDef *pmd); // [OUT] Put member token here
726
727 STDMETHOD(DefineProperty)(
728 mdTypeDef td, // [IN] the class/interface on which the property is being defined
729 LPCWSTR szProperty, // [IN] Name of the property
730 DWORD dwPropFlags, // [IN] CorPropertyAttr
731 PCCOR_SIGNATURE pvSig, // [IN] the required type signature
732 ULONG cbSig, // [IN] the size of the type signature blob
733 DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
734 void const *pValue, // [IN] constant value
735 ULONG cchValue, // [IN] size of constant value (string, in wide chars).
736 mdMethodDef mdSetter, // [IN] optional setter of the property
737 mdMethodDef mdGetter, // [IN] optional getter of the property
738 mdMethodDef rmdOtherMethods[], // [IN] an optional array of other methods
739 mdProperty *pmdProp); // [OUT] output property token
740
741 STDMETHOD(DefineParam)(
742 mdMethodDef md, // [IN] Owning method
743 ULONG ulParamSeq, // [IN] Which param
744 LPCWSTR szName, // [IN] Optional param name
745 DWORD dwParamFlags, // [IN] Optional param flags
746 DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
747 void const *pValue, // [IN] constant value
748 ULONG cchValue, // [IN] size of constant value (string, in wide chars).
749 mdParamDef *ppd); // [OUT] Put param token here
750
751 STDMETHOD(SetFieldProps)( // S_OK or error.
752 mdFieldDef fd, // [IN] The FieldDef.
753 DWORD dwFieldFlags, // [IN] Field attributes.
754 DWORD dwCPlusTypeFlag, // [IN] Flag for the value type, selected ELEMENT_TYPE_*
755 void const *pValue, // [IN] Constant value.
756 ULONG cchValue); // [IN] size of constant value (string, in wide chars).
757
758 STDMETHOD(SetPropertyProps)( // S_OK or error.
759 mdProperty pr, // [IN] Property token.
760 DWORD dwPropFlags, // [IN] CorPropertyAttr.
761 DWORD dwCPlusTypeFlag, // [IN] Flag for value type, selected ELEMENT_TYPE_*
762 void const *pValue, // [IN] Constant value.
763 ULONG cchValue, // [IN] size of constant value (string, in wide chars).
764 mdMethodDef mdSetter, // [IN] Setter of the property.
765 mdMethodDef mdGetter, // [IN] Getter of the property.
766 mdMethodDef rmdOtherMethods[]);// [IN] Array of other methods.
767
768 STDMETHOD(SetParamProps)( // Return code.
769 mdParamDef pd, // [IN] Param token.
770 LPCWSTR szName, // [IN] Param name.
771 DWORD dwParamFlags, // [IN] Param flags.
772 DWORD dwCPlusTypeFlag, // [IN] Flag for value type. selected ELEMENT_TYPE_*.
773 void const *pValue, // [OUT] Constant value.
774 ULONG cchValue); // [IN] size of constant value (string, in wide chars).
775
776 // Specialized Custom Attributes for security.
777 STDMETHOD(DefineSecurityAttributeSet)( // Return code.
778 mdToken tkObj, // [IN] Class or method requiring security attributes.
779 COR_SECATTR rSecAttrs[], // [IN] Array of security attribute descriptions.
780 ULONG cSecAttrs, // [IN] Count of elements in above array.
781 ULONG *pulErrorAttr); // [OUT] On error, index of attribute causing problem.
782
783 STDMETHOD(ApplyEditAndContinue)( // S_OK or error.
784 IUnknown *pImport); // [IN] Metadata from the delta PE.
785
786 STDMETHOD(TranslateSigWithScope)(
787 IMetaDataAssemblyImport *pAssemImport, // [IN] importing assembly interface
788 const void *pbHashValue, // [IN] Hash Blob for Assembly.
789 ULONG cbHashValue, // [IN] Count of bytes.
790 IMetaDataImport *import, // [IN] importing interface
791 PCCOR_SIGNATURE pbSigBlob, // [IN] signature in the importing scope
792 ULONG cbSigBlob, // [IN] count of bytes of signature
793 IMetaDataAssemblyEmit *pAssemEmit, // [IN] emit assembly interface
794 IMetaDataEmit *emit, // [IN] emit interface
795 PCOR_SIGNATURE pvTranslatedSig, // [OUT] buffer to hold translated signature
796 ULONG cbTranslatedSigMax,
797 ULONG *pcbTranslatedSig);// [OUT] count of bytes in the translated signature
798
799 STDMETHOD(SetMethodImplFlags)( // [IN] S_OK or error.
800 mdMethodDef md, // [IN] Method for which to set ImplFlags
801 DWORD dwImplFlags);
802
803 STDMETHOD(SetFieldRVA)( // [IN] S_OK or error.
804 mdFieldDef fd, // [IN] Field for which to set offset
805 ULONG ulRVA); // [IN] The offset
806
807 STDMETHOD(Merge)( // S_OK or error.
808 IMetaDataImport *pImport, // [IN] The scope to be merged.
809 IMapToken *pHostMapToken, // [IN] Host IMapToken interface to receive token remap notification
810 IUnknown *pHandler); // [IN] An object to receive to receive error notification.
811
812 STDMETHOD(MergeEnd)(); // S_OK or error.
813
814};
815
816#endif // SYMBOLINFO_H
817