Serge, thanks for this proposal, I'll try it. ----- Original Message ----- From: "Serge Lidin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, June 22, 2004 8:51 PM Subject: Re: [ADVANCED-DOTNET] Metadata question
Unfortunately, there is no API in IMetaDataImport, returning the type of the metadata stream. Also, there is no API that would retrieve the RIDs of the *Ptr tables. All handling of additional indirection in the unoptimized metadata is done behind the scenes, and there is no distinction between optimized and unoptimized metadata on IMetaDataImport level. However, there is a way around it. Query IMetaDataImport for IMetaDataTables interface (see Cor.h), and you'll be able to read the metadata tables directly, including the *Ptr tables. This interface won't give you the name of the metadata stream (not in v.1.0 or v1.1), but you don't really want to know it -- you want to know if the methods (fields, events, properties) of a TypeDef are referenced directly or through respective *Ptr table. So you only need to check if respective *Ptr table is empty. Thanks, Serge -----Original Message----- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] Behalf Of Dmitry Shaporenkov Sent: Tuesday, June 22, 2004 12:36 AM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Metadata question Serge, thank you for your clarification. It seems that I have to modify my loader and add support for unoptimized metadata representation. I would like, however, to use an efficient mapping where possible, especially since unoptimized assemblies seem to be rare. Hence I have a further question - is there any method exposed in Unmanaged Metadata API that would help me to determine if I'm dealing with optimized or unoptimized metadata stream? Or do I need to look into file headers directly? Thanks for your help again, Dmitry ----- Original Message ----- From: "Serge Lidin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 21, 2004 11:53 PM Subject: Re: [ADVANCED-DOTNET] Metadata question Yes, you can produce the assembly files with unoptimized metadata. Some folks even ship them. It's considered sloppy because of additional overhead (and because it's an indication that the assembly wasn't completely recompiled before shipping), but such assemblies get loaded and run just as well. The CLR loader handles both metadata models. Thanks, Serge -----Original Message----- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] Behalf Of Fabian Schmied Sent: Monday, June 21, 2004 12:44 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Metadata question > In unoptimized model, the intermediate metadata tables such as MethodPtr > are used. In this model, TypeDef's Method entry contains RID not in > Method table, but in MethodPtr table, and the referenced record in > MethodPtr table contains RID in the Method table. The type's records in > MethodPtr table are contiguous, but in Method table they are not. > > The following intermediate tables are used only in unoptimized metadata: > MethodPtr, FieldPtr, ParamPtr, EventPtr, PropertyPtr. There are also a > couple tables specific to edit-and-continue -- ENCLog and ENCMap -- > which are used in unoptimized model only. In optimized model all these > tables are empty. Alright, is it allowed to store these tables in the metadata of an assembly file? Since partition II does not describe these tables, I would've thought they are implementation specific and should not occur in assembly files (only in memory after loading). Fabian =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com