
Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
I tried these steps and was successful, but with concern. I read the link
you mentioned, but for modifying an assembly step 1 is not successful for me
at all. TlbImp fails to create a PIA for my assembly because I can't make or
get my hands on a PIA for MSXML. MS told us not to sign it. I can't change
my TLibs, so we were directed to modify the non signed interop to remove teh
MSXML dependency and then regen the type lib. The problem is that I am not
starting from managed code, and the PIA attribute is not there.
I added the PIA attr. to the IL, but I was guessing at some of the fields
based on other PIAs. The IL looks like this that I added:
.custom instance void
[mscorlib]System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute::.ctor(int32,
int32) = ( 01 00 03 00 00 00 09 00 00 00 00 00 )
I was a little nervous to fill in the binary data for this Attribute. The
Constructor shows Int32, Int32, but there are 12 bytes of data, not 8. I can
tell which are the major and minor version (3.9 in this tlib's case), but I
don't know why the first value is 01 00 and the last it 00 00. Not sure
what these values are setting, but they are in other PIAs and appear to work.
What do the first short and the last short of data refer to? Is it OK to
hand enter this data in IL? It worked now, but will it always?
> Hi
>
[quoted text clipped - 13 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 22 Dec 2004 04:43 GMT
Hi
So I did not find any document about the usage of 01 00 and 00 00.
I think the leading 01 00 and the 00 00 is used for enbracing and
identifying the paramters attribute.
Based on my research, all the attribute's ctor. will have the 0100 and 0000
even if it is the defaul the ctor.
So far I think your solution is OK, also IL is kind of programming language
which is the base of all kind of other language(C#,VB.NET), so to change it
is OK. We can consider it as the "advanced" assembly language.
If you still have any concern, please feel free to post here.
Best regards,
Perter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Mattias Sj?gren - 28 Dec 2004 00:01 GMT
>What do the first short and the last short of data refer to? Is it OK to
>hand enter this data in IL? It worked now, but will it always?
00 01 can be seens as a tag or version number identifying the
attribute blob format, and the only value defined (so far) is 1.
00 00 indicates the number of named fields or properties that are set
by the attribute, in thiz case none.
So yes, that should always work.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.