Debian Codegraph @

symbols/pdb/Mono.Cecil.Pdb/ModuleMetadata.cs

raw
1 using System;
2 using System.Collections.Generic;
3 using System.Runtime.InteropServices;
4 using System.Text;
5
6 #if !READ_ONLY
7
8 namespace Mono.Cecil.Pdb {
9
10 [ComImport, InterfaceType (ComInterfaceType.InterfaceIsIUnknown), Guid ("BA3FEE4C-ECB9-4e41-83B7-183FA41CD859")]
11 interface IMetaDataEmit {
12 void SetModuleProps (string szName);
13 void Save (string szFile, uint dwSaveFlags);
14 void SaveToStream (IntPtr pIStream, uint dwSaveFlags);
15 uint GetSaveSize (uint fSave);
16 uint DefineTypeDef (IntPtr szTypeDef, uint dwTypeDefFlags, uint tkExtends, IntPtr rtkImplements);
17 uint DefineNestedType (IntPtr szTypeDef, uint dwTypeDefFlags, uint tkExtends, IntPtr rtkImplements, uint tdEncloser);
18 void SetHandler ([MarshalAs (UnmanagedType.IUnknown), In]object pUnk);
19 uint DefineMethod (uint td, IntPtr zName, uint dwMethodFlags, IntPtr pvSigBlob, uint cbSigBlob, uint ulCodeRVA, uint dwImplFlags);
20 void DefineMethodImpl (uint td, uint tkBody, uint tkDecl);
21 uint DefineTypeRefByName (uint tkResolutionScope, IntPtr szName);
22 uint DefineImportType (IntPtr pAssemImport, IntPtr pbHashValue, uint cbHashValue, IMetaDataImport pImport,
23 uint tdImport, IntPtr pAssemEmit);
24 uint DefineMemberRef (uint tkImport, string szName, IntPtr pvSigBlob, uint cbSigBlob);
25 uint DefineImportMember (IntPtr pAssemImport, IntPtr /* void* */ pbHashValue, uint cbHashValue,
26 IMetaDataImport pImport, uint mbMember, IntPtr pAssemEmit, uint tkParent);
27 uint DefineEvent (uint td, string szEvent, uint dwEventFlags, uint tkEventType, uint mdAddOn, uint mdRemoveOn, uint mdFire, IntPtr /* uint* */ rmdOtherMethods);
28 void SetClassLayout (uint td, uint dwPackSize, IntPtr /*COR_FIELD_OFFSET**/ rFieldOffsets, uint ulClassSize);
29 void DeleteClassLayout (uint td);
30 void SetFieldMarshal (uint tk, IntPtr /* byte* */ pvNativeType, uint cbNativeType);
31 void DeleteFieldMarshal (uint tk);
32 uint DefinePermissionSet (uint tk, uint dwAction, IntPtr /* void* */ pvPermission, uint cbPermission);
33 void SetRVA (uint md, uint ulRVA);
34 uint GetTokenFromSig (IntPtr /* byte* */ pvSig, uint cbSig);
35 uint DefineModuleRef (string szName);
36 void SetParent (uint mr, uint tk);
37 uint GetTokenFromTypeSpec (IntPtr /* byte* */ pvSig, uint cbSig);
38 void SaveToMemory (IntPtr /* void* */ pbData, uint cbData);
39 uint DefineUserString (string szString, uint cchString);
40 void DeleteToken (uint tkObj);
41 void SetMethodProps (uint md, uint dwMethodFlags, uint ulCodeRVA, uint dwImplFlags);
42 void SetTypeDefProps (uint td, uint dwTypeDefFlags, uint tkExtends, IntPtr /* uint* */ rtkImplements);
43 void SetEventProps (uint ev, uint dwEventFlags, uint tkEventType, uint mdAddOn, uint mdRemoveOn, uint mdFire, IntPtr /* uint* */ rmdOtherMethods);
44 uint SetPermissionSetProps (uint tk, uint dwAction, IntPtr /* void* */ pvPermission, uint cbPermission);
45 void DefinePinvokeMap (uint tk, uint dwMappingFlags, string szImportName, uint mrImportDLL);
46 void SetPinvokeMap (uint tk, uint dwMappingFlags, string szImportName, uint mrImportDLL);
47 void DeletePinvokeMap (uint tk);
48 uint DefineCustomAttribute (uint tkObj, uint tkType, IntPtr /* void* */ pCustomAttribute, uint cbCustomAttribute);
49 void SetCustomAttributeValue (uint pcv, IntPtr /* void* */ pCustomAttribute, uint cbCustomAttribute);
50 uint DefineField (uint td, string szName, uint dwFieldFlags, IntPtr /* byte* */ pvSigBlob, uint cbSigBlob, uint dwCPlusTypeFlag, IntPtr /* void* */ pValue, uint cchValue);
51 uint DefineProperty (uint td, string szProperty, uint dwPropFlags, IntPtr /* byte* */ pvSig, uint cbSig, uint dwCPlusTypeFlag,
52 IntPtr /* void* */ pValue, uint cchValue, uint mdSetter, uint mdGetter, IntPtr /* uint* */ rmdOtherMethods);
53 uint DefineParam (uint md, uint ulParamSeq, string szName, uint dwParamFlags, uint dwCPlusTypeFlag, IntPtr /* void* */ pValue, uint cchValue);
54 void SetFieldProps (uint fd, uint dwFieldFlags, uint dwCPlusTypeFlag, IntPtr /* void* */ pValue, uint cchValue);
55 void SetPropertyProps (uint pr, uint dwPropFlags, uint dwCPlusTypeFlag, IntPtr /* void* */ pValue, uint cchValue, uint mdSetter, uint mdGetter, IntPtr /* uint* */ rmdOtherMethods);
56 void SetParamProps (uint pd, string szName, uint dwParamFlags, uint dwCPlusTypeFlag, IntPtr /* void* */ pValue, uint cchValue);
57 uint DefineSecurityAttributeSet (uint tkObj, IntPtr rSecAttrs, uint cSecAttrs);
58 void ApplyEditAndContinue ([MarshalAs (UnmanagedType.IUnknown)]object pImport);
59 uint TranslateSigWithScope (IntPtr pAssemImport, IntPtr /* void* */ pbHashValue, uint cbHashValue,
60 IMetaDataImport import, IntPtr /* byte* */ pbSigBlob, uint cbSigBlob, IntPtr pAssemEmit, IMetaDataEmit emit, IntPtr /* byte* */ pvTranslatedSig, uint cbTranslatedSigMax);
61 void SetMethodImplFlags (uint md, uint dwImplFlags);
62 void SetFieldRVA (uint fd, uint ulRVA);
63 void Merge (IMetaDataImport pImport, IntPtr pHostMapToken, [MarshalAs (UnmanagedType.IUnknown)]object pHandler);
64 void MergeEnd ();
65 }
66
67 [ComImport, InterfaceType (ComInterfaceType.InterfaceIsIUnknown), Guid ("7DAC8207-D3AE-4c75-9B67-92801A497D44")]
68 interface IMetaDataImport {
69 [PreserveSig]
70 void CloseEnum (uint hEnum);
71 uint CountEnum (uint hEnum);
72 void ResetEnum (uint hEnum, uint ulPos);
73 uint EnumTypeDefs (ref uint phEnum, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 2)] uint [] rTypeDefs, uint cMax);
74 uint EnumInterfaceImpls (ref uint phEnum, uint td, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] uint [] rImpls, uint cMax);
75 uint EnumTypeRefs (ref uint phEnum, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 2)] uint [] rTypeRefs, uint cMax);
76 uint FindTypeDefByName (string szTypeDef, uint tkEnclosingClass);
77 Guid GetScopeProps (StringBuilder szName, uint cchName, out uint pchName);
78 uint GetModuleFromScope ();
79 uint GetTypeDefProps (uint td, IntPtr szTypeDef, uint cchTypeDef, out uint pchTypeDef, IntPtr pdwTypeDefFlags);
80 uint GetInterfaceImplProps (uint iiImpl, out uint pClass);
81 uint GetTypeRefProps (uint tr, out uint ptkResolutionScope, StringBuilder szName, uint cchName);
82 uint ResolveTypeRef (uint tr, [In] ref Guid riid, [MarshalAs (UnmanagedType.Interface)] out object ppIScope);
83 uint EnumMembers (ref uint phEnum, uint cl, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] uint [] rMembers, uint cMax);
84 uint EnumMembersWithName (ref uint phEnum, uint cl, string szName, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 4)] uint [] rMembers, uint cMax);
85 uint EnumMethods (ref uint phEnum, uint cl, IntPtr /* uint* */ rMethods, uint cMax);
86 uint EnumMethodsWithName (ref uint phEnum, uint cl, string szName, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 4)] uint [] rMethods, uint cMax);
87 uint EnumFields (ref uint phEnum, uint cl, IntPtr /* uint* */ rFields, uint cMax);
88 uint EnumFieldsWithName (ref uint phEnum, uint cl, string szName, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 4)] uint [] rFields, uint cMax);
89 uint EnumParams (ref uint phEnum, uint mb, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] uint [] rParams, uint cMax);
90 uint EnumMemberRefs (ref uint phEnum, uint tkParent, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] uint [] rMemberRefs, uint cMax);
91 uint EnumMethodImpls (ref uint phEnum, uint td, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 4)] uint [] rMethodBody,
92 [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 4)] uint [] rMethodDecl, uint cMax);
93 uint EnumPermissionSets (ref uint phEnum, uint tk, uint dwActions, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 4)] uint [] rPermission,
94 uint cMax);
95 uint FindMember (uint td, string szName, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] byte [] pvSigBlob, uint cbSigBlob);
96 uint FindMethod (uint td, string szName, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] byte [] pvSigBlob, uint cbSigBlob);
97 uint FindField (uint td, string szName, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] byte [] pvSigBlob, uint cbSigBlob);
98 uint FindMemberRef (uint td, string szName, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] byte [] pvSigBlob, uint cbSigBlob);
99 uint GetMethodProps (uint mb, out uint pClass, IntPtr szMethod, uint cchMethod, out uint pchMethod, IntPtr pdwAttr, IntPtr ppvSigBlob, IntPtr pcbSigBlob, IntPtr pulCodeRVA);
100 uint GetMemberRefProps (uint mr, ref uint ptk, StringBuilder szMember, uint cchMember, out uint pchMember, out IntPtr /* byte* */ ppvSigBlob);
101 uint EnumProperties (ref uint phEnum, uint td, IntPtr /* uint* */ rProperties, uint cMax);
102 uint EnumEvents (ref uint phEnum, uint td, IntPtr /* uint* */ rEvents, uint cMax);
103 uint GetEventProps (uint ev, out uint pClass, StringBuilder szEvent, uint cchEvent, out uint pchEvent, out uint pdwEventFlags,
104 out uint ptkEventType, out uint pmdAddOn, out uint pmdRemoveOn, out uint pmdFire,
105 [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 11)] uint [] rmdOtherMethod, uint cMax);
106 uint EnumMethodSemantics (ref uint phEnum, uint mb, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] uint [] rEventProp, uint cMax);
107 uint GetMethodSemantics (uint mb, uint tkEventProp);
108 uint GetClassLayout (uint td, out uint pdwPackSize, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 3)] IntPtr /*COR_FIELD_OFFSET **/ rFieldOffset, uint cMax, out uint pcFieldOffset);
109 uint GetFieldMarshal (uint tk, out IntPtr /* byte* */ ppvNativeType);
110 uint GetRVA (uint tk, out uint pulCodeRVA);
111 uint GetPermissionSetProps (uint pm, out uint pdwAction, out IntPtr /* void* */ ppvPermission);
112 uint GetSigFromToken (uint mdSig, out IntPtr /* byte* */ ppvSig);
113 uint GetModuleRefProps (uint mur, StringBuilder szName, uint cchName);
114 uint EnumModuleRefs (ref uint phEnum, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 2)] uint [] rModuleRefs, uint cmax);
115 uint GetTypeSpecFromToken (uint typespec, out IntPtr /* byte* */ ppvSig);
116 uint GetNameFromToken (uint tk);
117 uint EnumUnresolvedMethods (ref uint phEnum, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 2)] uint [] rMethods, uint cMax);
118 uint GetUserString (uint stk, StringBuilder szString, uint cchString);
119 uint GetPinvokeMap (uint tk, out uint pdwMappingFlags, StringBuilder szImportName, uint cchImportName, out uint pchImportName);
120 uint EnumSignatures (ref uint phEnum, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 2)] uint [] rSignatures, uint cmax);
121 uint EnumTypeSpecs (ref uint phEnum, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 2)] uint [] rTypeSpecs, uint cmax);
122 uint EnumUserStrings (ref uint phEnum, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 2)] uint [] rStrings, uint cmax);
123 [PreserveSig]
124 int GetParamForMethodIndex (uint md, uint ulParamSeq, out uint pParam);
125 uint EnumCustomAttributes (ref uint phEnum, uint tk, uint tkType, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 4)] uint [] rCustomAttributes, uint cMax);
126 uint GetCustomAttributeProps (uint cv, out uint ptkObj, out uint ptkType, out IntPtr /* void* */ ppBlob);
127 uint FindTypeRef (uint tkResolutionScope, string szName);
128 uint GetMemberProps (uint mb, out uint pClass, StringBuilder szMember, uint cchMember, out uint pchMember, out uint pdwAttr,
129 out IntPtr /* byte* */ ppvSigBlob, out uint pcbSigBlob, out uint pulCodeRVA, out uint pdwImplFlags, out uint pdwCPlusTypeFlag, out IntPtr /* void* */ ppValue);
130 uint GetFieldProps (uint mb, out uint pClass, StringBuilder szField, uint cchField, out uint pchField, out uint pdwAttr,
131 out IntPtr /* byte* */ ppvSigBlob, out uint pcbSigBlob, out uint pdwCPlusTypeFlag, out IntPtr /* void* */ ppValue);
132 uint GetPropertyProps (uint prop, out uint pClass, StringBuilder szProperty, uint cchProperty, out uint pchProperty, out uint pdwPropFlags,
133 out IntPtr /* byte* */ ppvSig, out uint pbSig, out uint pdwCPlusTypeFlag, out IntPtr /* void* */ ppDefaultValue, out uint pcchDefaultValue, out uint pmdSetter,
134 out uint pmdGetter, [MarshalAs (UnmanagedType.LPArray, SizeParamIndex = 14)] uint [] rmdOtherMethod, uint cMax);
135 uint GetParamProps (uint tk, out uint pmd, out uint pulSequence, StringBuilder szName, uint cchName, out uint pchName,
136 out uint pdwAttr, out uint pdwCPlusTypeFlag, out IntPtr /* void* */ ppValue);
137 uint GetCustomAttributeByName (uint tkObj, string szName, out IntPtr /* void* */ ppData);
138 [PreserveSig]
139 [return: MarshalAs (UnmanagedType.Bool)]
140 bool IsValidToken (uint tk);
141 uint GetNestedClassProps (uint tdNestedClass);
142 uint GetNativeCallConvFromSig (IntPtr /* void* */ pvSig, uint cbSig);
143 int IsGlobal (uint pd);
144 }
145
146 class ModuleMetadata : IMetaDataEmit, IMetaDataImport {
147
148 readonly ModuleDefinition module;
149
150 Dictionary<uint, TypeDefinition> types;
151 Dictionary<uint, MethodDefinition> methods;
152
153 public ModuleMetadata (ModuleDefinition module)
154 {
155 this.module = module;
156 }
157
158 bool TryGetType (uint token, out TypeDefinition type)
159 {
160 if (types == null)
161 InitializeMetadata (module);
162
163 return types.TryGetValue (token, out type);
164 }
165
166 bool TryGetMethod (uint token, out MethodDefinition method)
167 {
168 if (methods == null)
169 InitializeMetadata (module);
170
171 return methods.TryGetValue (token, out method);
172 }
173
174 void InitializeMetadata (ModuleDefinition module)
175 {
176 types = new Dictionary<uint, TypeDefinition> ();
177 methods = new Dictionary<uint, MethodDefinition> ();
178
179 foreach (var type in module.GetTypes ()) {
180 types.Add (type.MetadataToken.ToUInt32 (), type);
181 InitializeMethods (type);
182 }
183 }
184
185 void InitializeMethods (TypeDefinition type)
186 {
187 foreach (var method in type.Methods)
188 methods.Add (method.MetadataToken.ToUInt32 (), method);
189 }
190
191 public void SetModuleProps (string szName)
192 {
193 throw new NotImplementedException ();
194 }
195
196 public void Save (string szFile, uint dwSaveFlags)
197 {
198 throw new NotImplementedException ();
199 }
200
201 public void SaveToStream (IntPtr pIStream, uint dwSaveFlags)
202 {
203 throw new NotImplementedException ();
204 }
205
206 public uint GetSaveSize (uint fSave)
207 {
208 throw new NotImplementedException ();
209 }
210
211 public uint DefineTypeDef (IntPtr szTypeDef, uint dwTypeDefFlags, uint tkExtends, IntPtr rtkImplements)
212 {
213 throw new NotImplementedException ();
214 }
215
216 public uint DefineNestedType (IntPtr szTypeDef, uint dwTypeDefFlags, uint tkExtends, IntPtr rtkImplements, uint tdEncloser)
217 {
218 throw new NotImplementedException ();
219 }
220
221 public void SetHandler (object pUnk)
222 {
223 throw new NotImplementedException ();
224 }
225
226 public uint DefineMethod (uint td, IntPtr zName, uint dwMethodFlags, IntPtr pvSigBlob, uint cbSigBlob, uint ulCodeRVA, uint dwImplFlags)
227 {
228 throw new NotImplementedException ();
229 }
230
231 public void DefineMethodImpl (uint td, uint tkBody, uint tkDecl)
232 {
233 throw new NotImplementedException ();
234 }
235
236 public uint DefineTypeRefByName (uint tkResolutionScope, IntPtr szName)
237 {
238 throw new NotImplementedException ();
239 }
240
241 public uint DefineImportType (IntPtr pAssemImport, IntPtr pbHashValue, uint cbHashValue, IMetaDataImport pImport, uint tdImport, IntPtr pAssemEmit)
242 {
243 throw new NotImplementedException ();
244 }
245
246 public uint DefineMemberRef (uint tkImport, string szName, IntPtr pvSigBlob, uint cbSigBlob)
247 {
248 throw new NotImplementedException ();
249 }
250
251 public uint DefineImportMember (IntPtr pAssemImport, IntPtr pbHashValue, uint cbHashValue, IMetaDataImport pImport, uint mbMember, IntPtr pAssemEmit, uint tkParent)
252 {
253 throw new NotImplementedException ();
254 }
255
256 public uint DefineEvent (uint td, string szEvent, uint dwEventFlags, uint tkEventType, uint mdAddOn, uint mdRemoveOn, uint mdFire, IntPtr rmdOtherMethods)
257 {
258 throw new NotImplementedException ();
259 }
260
261 public void SetClassLayout (uint td, uint dwPackSize, IntPtr rFieldOffsets, uint ulClassSize)
262 {
263 throw new NotImplementedException ();
264 }
265
266 public void DeleteClassLayout (uint td)
267 {
268 throw new NotImplementedException ();
269 }
270
271 public void SetFieldMarshal (uint tk, IntPtr pvNativeType, uint cbNativeType)
272 {
273 throw new NotImplementedException ();
274 }
275
276 public void DeleteFieldMarshal (uint tk)
277 {
278 throw new NotImplementedException ();
279 }
280
281 public uint DefinePermissionSet (uint tk, uint dwAction, IntPtr pvPermission, uint cbPermission)
282 {
283 throw new NotImplementedException ();
284 }
285
286 public void SetRVA (uint md, uint ulRVA)
287 {
288 throw new NotImplementedException ();
289 }
290
291 public uint GetTokenFromSig (IntPtr pvSig, uint cbSig)
292 {
293 throw new NotImplementedException ();
294 }
295
296 public uint DefineModuleRef (string szName)
297 {
298 throw new NotImplementedException ();
299 }
300
301 public void SetParent (uint mr, uint tk)
302 {
303 throw new NotImplementedException ();
304 }
305
306 public uint GetTokenFromTypeSpec (IntPtr pvSig, uint cbSig)
307 {
308 throw new NotImplementedException ();
309 }
310
311 public void SaveToMemory (IntPtr pbData, uint cbData)
312 {
313 throw new NotImplementedException ();
314 }
315
316 public uint DefineUserString (string szString, uint cchString)
317 {
318 throw new NotImplementedException ();
319 }
320
321 public void DeleteToken (uint tkObj)
322 {
323 throw new NotImplementedException ();
324 }
325
326 public void SetMethodProps (uint md, uint dwMethodFlags, uint ulCodeRVA, uint dwImplFlags)
327 {
328 throw new NotImplementedException ();
329 }
330
331 public void SetTypeDefProps (uint td, uint dwTypeDefFlags, uint tkExtends, IntPtr rtkImplements)
332 {
333 throw new NotImplementedException ();
334 }
335
336 public void SetEventProps (uint ev, uint dwEventFlags, uint tkEventType, uint mdAddOn, uint mdRemoveOn, uint mdFire, IntPtr rmdOtherMethods)
337 {
338 throw new NotImplementedException ();
339 }
340
341 public uint SetPermissionSetProps (uint tk, uint dwAction, IntPtr pvPermission, uint cbPermission)
342 {
343 throw new NotImplementedException ();
344 }
345
346 public void DefinePinvokeMap (uint tk, uint dwMappingFlags, string szImportName, uint mrImportDLL)
347 {
348 throw new NotImplementedException ();
349 }
350
351 public void SetPinvokeMap (uint tk, uint dwMappingFlags, string szImportName, uint mrImportDLL)
352 {
353 throw new NotImplementedException ();
354 }
355
356 public void DeletePinvokeMap (uint tk)
357 {
358 throw new NotImplementedException ();
359 }
360
361 public uint DefineCustomAttribute (uint tkObj, uint tkType, IntPtr pCustomAttribute, uint cbCustomAttribute)
362 {
363 throw new NotImplementedException ();
364 }
365
366 public void SetCustomAttributeValue (uint pcv, IntPtr pCustomAttribute, uint cbCustomAttribute)
367 {
368 throw new NotImplementedException ();
369 }
370
371 public uint DefineField (uint td, string szName, uint dwFieldFlags, IntPtr pvSigBlob, uint cbSigBlob, uint dwCPlusTypeFlag, IntPtr pValue, uint cchValue)
372 {
373 throw new NotImplementedException ();
374 }
375
376 public uint DefineProperty (uint td, string szProperty, uint dwPropFlags, IntPtr pvSig, uint cbSig, uint dwCPlusTypeFlag, IntPtr pValue, uint cchValue, uint mdSetter, uint mdGetter, IntPtr rmdOtherMethods)
377 {
378 throw new NotImplementedException ();
379 }
380
381 public uint DefineParam (uint md, uint ulParamSeq, string szName, uint dwParamFlags, uint dwCPlusTypeFlag, IntPtr pValue, uint cchValue)
382 {
383 throw new NotImplementedException ();
384 }
385
386 public void SetFieldProps (uint fd, uint dwFieldFlags, uint dwCPlusTypeFlag, IntPtr pValue, uint cchValue)
387 {
388 throw new NotImplementedException ();
389 }
390
391 public void SetPropertyProps (uint pr, uint dwPropFlags, uint dwCPlusTypeFlag, IntPtr pValue, uint cchValue, uint mdSetter, uint mdGetter, IntPtr rmdOtherMethods)
392 {
393 throw new NotImplementedException ();
394 }
395
396 public void SetParamProps (uint pd, string szName, uint dwParamFlags, uint dwCPlusTypeFlag, IntPtr pValue, uint cchValue)
397 {
398 throw new NotImplementedException ();
399 }
400
401 public uint DefineSecurityAttributeSet (uint tkObj, IntPtr rSecAttrs, uint cSecAttrs)
402 {
403 throw new NotImplementedException ();
404 }
405
406 public void ApplyEditAndContinue (object pImport)
407 {
408 throw new NotImplementedException ();
409 }
410
411 public uint TranslateSigWithScope (IntPtr pAssemImport, IntPtr pbHashValue, uint cbHashValue, IMetaDataImport import, IntPtr pbSigBlob, uint cbSigBlob, IntPtr pAssemEmit, IMetaDataEmit emit, IntPtr pvTranslatedSig, uint cbTranslatedSigMax)
412 {
413 throw new NotImplementedException ();
414 }
415
416 public void SetMethodImplFlags (uint md, uint dwImplFlags)
417 {
418 throw new NotImplementedException ();
419 }
420
421 public void SetFieldRVA (uint fd, uint ulRVA)
422 {
423 throw new NotImplementedException ();
424 }
425
426 public void Merge (IMetaDataImport pImport, IntPtr pHostMapToken, object pHandler)
427 {
428 throw new NotImplementedException ();
429 }
430
431 public void MergeEnd ()
432 {
433 throw new NotImplementedException ();
434 }
435
436 public void CloseEnum (uint hEnum)
437 {
438 throw new NotImplementedException ();
439 }
440
441 public uint CountEnum (uint hEnum)
442 {
443 throw new NotImplementedException ();
444 }
445
446 public void ResetEnum (uint hEnum, uint ulPos)
447 {
448 throw new NotImplementedException ();
449 }
450
451 public uint EnumTypeDefs (ref uint phEnum, uint[] rTypeDefs, uint cMax)
452 {
453 throw new NotImplementedException ();
454 }
455
456 public uint EnumInterfaceImpls (ref uint phEnum, uint td, uint[] rImpls, uint cMax)
457 {
458 throw new NotImplementedException ();
459 }
460
461 public uint EnumTypeRefs (ref uint phEnum, uint[] rTypeRefs, uint cMax)
462 {
463 throw new NotImplementedException ();
464 }
465
466 public uint FindTypeDefByName (string szTypeDef, uint tkEnclosingClass)
467 {
468 throw new NotImplementedException ();
469 }
470
471 public Guid GetScopeProps (StringBuilder szName, uint cchName, out uint pchName)
472 {
473 throw new NotImplementedException ();
474 }
475
476 public uint GetModuleFromScope ()
477 {
478 throw new NotImplementedException ();
479 }
480
481 public uint GetTypeDefProps (uint td, IntPtr szTypeDef, uint cchTypeDef, out uint pchTypeDef, IntPtr pdwTypeDefFlags)
482 {
483 TypeDefinition type;
484 if (!TryGetType (td, out type)) {
485 Marshal.WriteInt16 (szTypeDef, 0);
486 pchTypeDef = 1;
487 return 0;
488 }
489
490 WriteString (type.IsNested ? type.Name : type.FullName, szTypeDef, cchTypeDef, out pchTypeDef);
491 WriteIntPtr (pdwTypeDefFlags, (uint) type.Attributes);
492 return type.BaseType != null ? type.BaseType.MetadataToken.ToUInt32 () : 0;
493 }
494
495 static void WriteIntPtr (IntPtr ptr, uint value)
496 {
497 if (ptr == IntPtr.Zero)
498 return;
499
500 Marshal.WriteInt32 (ptr, (int) value);
501 }
502
503 static void WriteString (string str, IntPtr buffer, uint bufferSize, out uint chars)
504 {
505 var length = str.Length + 1 >= bufferSize ? bufferSize - 1 : (uint) str.Length;
506 chars = length + 1;
507 var offset = 0;
508
509 for (int i = 0; i < length; i++) {
510 Marshal.WriteInt16 (buffer, offset, str [i]);
511 offset += 2;
512 }
513
514 Marshal.WriteInt16 (buffer, offset, 0);
515 }
516
517 public uint GetInterfaceImplProps (uint iiImpl, out uint pClass)
518 {
519 throw new NotImplementedException ();
520 }
521
522 public uint GetTypeRefProps (uint tr, out uint ptkResolutionScope, StringBuilder szName, uint cchName)
523 {
524 throw new NotImplementedException ();
525 }
526
527 public uint ResolveTypeRef (uint tr, ref Guid riid, out object ppIScope)
528 {
529 throw new NotImplementedException ();
530 }
531
532 public uint EnumMembers (ref uint phEnum, uint cl, uint[] rMembers, uint cMax)
533 {
534 throw new NotImplementedException ();
535 }
536
537 public uint EnumMembersWithName (ref uint phEnum, uint cl, string szName, uint[] rMembers, uint cMax)
538 {
539 throw new NotImplementedException ();
540 }
541
542 public uint EnumMethods (ref uint phEnum, uint cl, IntPtr rMethods, uint cMax)
543 {
544 throw new NotImplementedException ();
545 }
546
547 public uint EnumMethodsWithName (ref uint phEnum, uint cl, string szName, uint[] rMethods, uint cMax)
548 {
549 throw new NotImplementedException ();
550 }
551
552 public uint EnumFields (ref uint phEnum, uint cl, IntPtr rFields, uint cMax)
553 {
554 throw new NotImplementedException ();
555 }
556
557 public uint EnumFieldsWithName (ref uint phEnum, uint cl, string szName, uint[] rFields, uint cMax)
558 {
559 throw new NotImplementedException ();
560 }
561
562 public uint EnumParams (ref uint phEnum, uint mb, uint[] rParams, uint cMax)
563 {
564 throw new NotImplementedException ();
565 }
566
567 public uint EnumMemberRefs (ref uint phEnum, uint tkParent, uint[] rMemberRefs, uint cMax)
568 {
569 throw new NotImplementedException ();
570 }
571
572 public uint EnumMethodImpls (ref uint phEnum, uint td, uint[] rMethodBody, uint[] rMethodDecl, uint cMax)
573 {
574 throw new NotImplementedException ();
575 }
576
577 public uint EnumPermissionSets (ref uint phEnum, uint tk, uint dwActions, uint[] rPermission, uint cMax)
578 {
579 throw new NotImplementedException ();
580 }
581
582 public uint FindMember (uint td, string szName, byte[] pvSigBlob, uint cbSigBlob)
583 {
584 throw new NotImplementedException ();
585 }
586
587 public uint FindMethod (uint td, string szName, byte[] pvSigBlob, uint cbSigBlob)
588 {
589 throw new NotImplementedException ();
590 }
591
592 public uint FindField (uint td, string szName, byte[] pvSigBlob, uint cbSigBlob)
593 {
594 throw new NotImplementedException ();
595 }
596
597 public uint FindMemberRef (uint td, string szName, byte[] pvSigBlob, uint cbSigBlob)
598 {
599 throw new NotImplementedException ();
600 }
601
602 public uint GetMethodProps (uint mb, out uint pClass, IntPtr szMethod, uint cchMethod, out uint pchMethod, IntPtr pdwAttr, IntPtr ppvSigBlob, IntPtr pcbSigBlob, IntPtr pulCodeRVA)
603 {
604 MethodDefinition method;
605 if (!TryGetMethod (mb, out method)) {
606 Marshal.WriteInt16 (szMethod, 0);
607 pchMethod = 1;
608 pClass = 0;
609 return 0;
610 }
611
612 pClass = method.DeclaringType.MetadataToken.ToUInt32 ();
613 WriteString (method.Name, szMethod, cchMethod, out pchMethod);
614 WriteIntPtr (pdwAttr, (uint) method.Attributes);
615 WriteIntPtr (pulCodeRVA, (uint) method.RVA);
616
617 return (uint) method.ImplAttributes;
618 }
619
620 public uint GetMemberRefProps (uint mr, ref uint ptk, StringBuilder szMember, uint cchMember, out uint pchMember, out IntPtr ppvSigBlob)
621 {
622 throw new NotImplementedException ();
623 }
624
625 public uint EnumProperties (ref uint phEnum, uint td, IntPtr rProperties, uint cMax)
626 {
627 throw new NotImplementedException ();
628 }
629
630 public uint EnumEvents (ref uint phEnum, uint td, IntPtr rEvents, uint cMax)
631 {
632 throw new NotImplementedException ();
633 }
634
635 public uint GetEventProps (uint ev, out uint pClass, StringBuilder szEvent, uint cchEvent, out uint pchEvent, out uint pdwEventFlags, out uint ptkEventType, out uint pmdAddOn, out uint pmdRemoveOn, out uint pmdFire, uint[] rmdOtherMethod, uint cMax)
636 {
637 throw new NotImplementedException ();
638 }
639
640 public uint EnumMethodSemantics (ref uint phEnum, uint mb, uint[] rEventProp, uint cMax)
641 {
642 throw new NotImplementedException ();
643 }
644
645 public uint GetMethodSemantics (uint mb, uint tkEventProp)
646 {
647 throw new NotImplementedException ();
648 }
649
650 public uint GetClassLayout (uint td, out uint pdwPackSize, IntPtr rFieldOffset, uint cMax, out uint pcFieldOffset)
651 {
652 throw new NotImplementedException ();
653 }
654
655 public uint GetFieldMarshal (uint tk, out IntPtr ppvNativeType)
656 {
657 throw new NotImplementedException ();
658 }
659
660 public uint GetRVA (uint tk, out uint pulCodeRVA)
661 {
662 throw new NotImplementedException ();
663 }
664
665 public uint GetPermissionSetProps (uint pm, out uint pdwAction, out IntPtr ppvPermission)
666 {
667 throw new NotImplementedException ();
668 }
669
670 public uint GetSigFromToken (uint mdSig, out IntPtr ppvSig)
671 {
672 throw new NotImplementedException ();
673 }
674
675 public uint GetModuleRefProps (uint mur, StringBuilder szName, uint cchName)
676 {
677 throw new NotImplementedException ();
678 }
679
680 public uint EnumModuleRefs (ref uint phEnum, uint[] rModuleRefs, uint cmax)
681 {
682 throw new NotImplementedException ();
683 }
684
685 public uint GetTypeSpecFromToken (uint typespec, out IntPtr ppvSig)
686 {
687 throw new NotImplementedException ();
688 }
689
690 public uint GetNameFromToken (uint tk)
691 {
692 throw new NotImplementedException ();
693 }
694
695 public uint EnumUnresolvedMethods (ref uint phEnum, uint[] rMethods, uint cMax)
696 {
697 throw new NotImplementedException ();
698 }
699
700 public uint GetUserString (uint stk, StringBuilder szString, uint cchString)
701 {
702 throw new NotImplementedException ();
703 }
704
705 public uint GetPinvokeMap (uint tk, out uint pdwMappingFlags, StringBuilder szImportName, uint cchImportName, out uint pchImportName)
706 {
707 throw new NotImplementedException ();
708 }
709
710 public uint EnumSignatures (ref uint phEnum, uint[] rSignatures, uint cmax)
711 {
712 throw new NotImplementedException ();
713 }
714
715 public uint EnumTypeSpecs (ref uint phEnum, uint[] rTypeSpecs, uint cmax)
716 {
717 throw new NotImplementedException ();
718 }
719
720 public uint EnumUserStrings (ref uint phEnum, uint[] rStrings, uint cmax)
721 {
722 throw new NotImplementedException ();
723 }
724
725 public int GetParamForMethodIndex (uint md, uint ulParamSeq, out uint pParam)
726 {
727 throw new NotImplementedException ();
728 }
729
730 public uint EnumCustomAttributes (ref uint phEnum, uint tk, uint tkType, uint[] rCustomAttributes, uint cMax)
731 {
732 throw new NotImplementedException ();
733 }
734
735 public uint GetCustomAttributeProps (uint cv, out uint ptkObj, out uint ptkType, out IntPtr ppBlob)
736 {
737 throw new NotImplementedException ();
738 }
739
740 public uint FindTypeRef (uint tkResolutionScope, string szName)
741 {
742 throw new NotImplementedException ();
743 }
744
745 public uint GetMemberProps (uint mb, out uint pClass, StringBuilder szMember, uint cchMember, out uint pchMember, out uint pdwAttr, out IntPtr ppvSigBlob, out uint pcbSigBlob, out uint pulCodeRVA, out uint pdwImplFlags, out uint pdwCPlusTypeFlag, out IntPtr ppValue)
746 {
747 throw new NotImplementedException ();
748 }
749
750 public uint GetFieldProps (uint mb, out uint pClass, StringBuilder szField, uint cchField, out uint pchField, out uint pdwAttr, out IntPtr ppvSigBlob, out uint pcbSigBlob, out uint pdwCPlusTypeFlag, out IntPtr ppValue)
751 {
752 throw new NotImplementedException ();
753 }
754
755 public uint GetPropertyProps (uint prop, out uint pClass, StringBuilder szProperty, uint cchProperty, out uint pchProperty, out uint pdwPropFlags, out IntPtr ppvSig, out uint pbSig, out uint pdwCPlusTypeFlag, out IntPtr ppDefaultValue, out uint pcchDefaultValue, out uint pmdSetter, out uint pmdGetter, uint[] rmdOtherMethod, uint cMax)
756 {
757 throw new NotImplementedException ();
758 }
759
760 public uint GetParamProps (uint tk, out uint pmd, out uint pulSequence, StringBuilder szName, uint cchName, out uint pchName, out uint pdwAttr, out uint pdwCPlusTypeFlag, out IntPtr ppValue)
761 {
762 throw new NotImplementedException ();
763 }
764
765 public uint GetCustomAttributeByName (uint tkObj, string szName, out IntPtr ppData)
766 {
767 throw new NotImplementedException ();
768 }
769
770 public bool IsValidToken (uint tk)
771 {
772 throw new NotImplementedException ();
773 }
774
775 public uint GetNestedClassProps (uint tdNestedClass)
776 {
777 TypeDefinition type;
778 if (!TryGetType (tdNestedClass, out type))
779 return 0;
780
781 return type.IsNested ? type.DeclaringType.MetadataToken.ToUInt32 () : 0;
782 }
783
784 public uint GetNativeCallConvFromSig (IntPtr pvSig, uint cbSig)
785 {
786 throw new NotImplementedException ();
787 }
788
789 public int IsGlobal (uint pd)
790 {
791 throw new NotImplementedException ();
792 }
793 }
794 }
795
796 #endif