PC Review


Reply
Thread Tools Rate Thread

cli specification vs. VS Implementation

 
 
Ben Schwehn
Guest
Posts: n/a
 
      11th Jul 2004
Hello all

Sorry for X-posting, If there's a more appropiate group, please f'up to it.

I've looked a the binary source of several .net modules both with a hex
editor and with a parser I've written.

There are several things I've noticed and/or don't quite understand with
how the metadata is layed out in the Portable Executable File:

1. is there an updated specifaction (or draft), newer than
http://msdn.microsoft.com/netframewo...gramming/clr/?
I'll refer to the documents on this webpage in the following

2. in "CLI Partition II - Metadata Definition and Semantics" part 23

a) I've found dlls in which the the "#~" stream was named "#-" (0x23
0x2d instead of 0x23 0x7e). This seem to be in violation of the spec.
The dlls were produced by VS.Net 2002.

b) within the #~ stream (23.2.6), the spec says that "MinorVersion"
should always be 0 and the second "reserved" be 1.
I've found that "MinorVersion" seems to be always 1 when using the
framework 2/VS 2005 beta version, is this correct?.
Is there a specifaction on how VS 2005 generates these values?

Also, the second reserved is not always 1. What's the relevance of this
value?

3. In section 23.2.3 the spec says that indeces to the "#strings" heap
should point to an valid null terminated string. Does that mean that if
i have a string "testtest", which is indexed at offset 1, i can index a
second string "test" just by pointing at offset 5? (of course you'd have
to take unicode in account, but in principle, can you index substrings?)

Thanks
Ben

 
Reply With Quote
 
 
 
 
Michael Giagnocavo [MVP]
Guest
Posts: n/a
 
      11th Jul 2004
> a) I've found dlls in which the the "#~" stream was named "#-" (0x23 0x2d
> instead of 0x23 0x7e). This seem to be in violation of the spec. The dlls
> were produced by VS.Net 2002.


The #~ stream is a optimized stream. #- is unoptimized and contains extra
lookup tables. Page 181 of partition II says:

Implementation Specific (Microsoft Only)
Some compilers store metadata in a #- stream, which holds an uncompressed,
or non-optimized, representation of metadata tables; this includes extra
metadata "pointer" tables. Such PE files do not form part of this ECMA
standard

> b) within the #~ stream (23.2.6), the spec says that "MinorVersion"
> should always be 0 and the second "reserved" be 1.
> I've found that "MinorVersion" seems to be always 1 when using the
> framework 2/VS 2005 beta version, is this correct?.
> Is there a specifaction on how VS 2005 generates these values?


The new ECMA specs are not available AFAIK.

> 3. In section 23.2.3 the spec says that indeces to the "#strings" heap
> should point to an valid null terminated string. Does that mean that if i
> have a string "testtest", which is indexed at offset 1, i can index a
> second string "test" just by pointing at offset 5? (of course you'd have
> to take unicode in account, but in principle, can you index substrings?)


I've done so, and don't see how this would be a problem...

-mike
MVP


 
Reply With Quote
 
Ben Schwehn
Guest
Posts: n/a
 
      11th Jul 2004
Michael Giagnocavo [MVP] wrote:
>>a) I've found dlls in which the the "#~" stream was named "#-" (0x23 0x2d
>>instead of 0x23 0x7e). This seem to be in violation of the spec. The dlls
>>were produced by VS.Net 2002.

>
>
> The #~ stream is a optimized stream. #- is unoptimized and contains extra
> lookup tables. Page 181 of partition II says:


which doc are you refering to?
the documents I've got from
http://msdn.microsoft.com/netframework/programming/clr/ which are "Final
Draft October 2003" do not mention this. (No page no. 181, search for
"#-" doesn't find a match)
You can't even google for "#-"...

>
>>3. In section 23.2.3 the spec says that indeces to the "#strings" heap
>>should point to an valid null terminated string. Does that mean that if i
>>have a string "testtest", which is indexed at offset 1, i can index a
>>second string "test" just by pointing at offset 5? (of course you'd have
>>to take unicode in account, but in principle, can you index substrings?)

>
>
> I've done so, and don't see how this would be a problem...


Thanks
Ben

 
Reply With Quote
 
Mike
Guest
Posts: n/a
 
      11th Jul 2004

>>
>> The #~ stream is a optimized stream. #- is unoptimized and contains
>> extra lookup tables. Page 181 of partition II says:

>
>
> which doc are you refering to?
> the documents I've got from
> http://msdn.microsoft.com/netframework/programming/clr/ which are "Final
> Draft October 2003" do not mention this. (No page no. 181, search for
> "#-" doesn't find a match)
> You can't even google for "#-"...
>


Hi,

the .NET SDK from Microsoft provides anotated versions of these specs.
For me (and my v1.1 SDK) they live at:

\Program Files\Microsoft.NET\SDK\v1.1\Tool Developers Guide\docs\*.doc

They contain inline notes about Microsoft's implementation of the ECMA
standard (like the p181 comment mentioned above).

Mike
 
Reply With Quote
 
Ben Schwehn
Guest
Posts: n/a
 
      13th Jul 2004
> the .NET SDK from Microsoft provides anotated versions of these specs.
> For me (and my v1.1 SDK) they live at:
>
> \Program Files\Microsoft.NET\SDK\v1.1\Tool Developers Guide\docs\*.doc
>
> They contain inline notes about Microsoft's implementation of the ECMA
> standard (like the p181 comment mentioned above).



thanks mike,

there's also an updated version coming with the framework 2.0 beta sdk

Ben
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Specification ascagnel Microsoft Access Forms 1 27th Jun 2008 07:32 PM
RDP specification =?Utf-8?B?V2F5bmUgU28=?= Windows XP General 3 19th Nov 2005 04:59 AM
Specification David Kennedy Microsoft Access Getting Started 2 12th May 2005 03:17 AM
ole db specification Microsoft ADO .NET 7 17th Nov 2003 02:17 PM
Where is Specification go? NewBie Microsoft Access External Data 0 6th Aug 2003 08:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:12 PM.