Debian Codegraph @

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