hiding unmanaged types in metadata

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fedor Buyakov

    #1

    hiding unmanaged types in metadata

    hello all

    i have a specific question according hiding unmanaged (native) types
    in metadata for assemblies generated by c++ with managed extensions. i
    understand what these types are nedeed in metadata for runtime but why
    to do it public?

    is code will run correctly if i make these types private for assembly?

    there is no way to do so from IDE or by some compiler option but i can
    edit assembly file directly in hex editor and change flag according
    specified type.

    all unmanaged types in metadata have flags 0x109, ie:
    "public sealed class <UNMANAGED TYPE NAME> : System.ValueTyp e".
    if i replace bytes 09 01 for 10 01 for specified type's flag i will
    have:
    "private sealed class <UNMANAGED TYPE NAME> : System.ValueTyp e".

    hurrah! we have a hidden type but it's still present in the manifest
    and i think this will no break runtime (my first experience shows what
    all is ok).

    this workaround will especially useful for component developers who
    need to wrap some native (eg. win32api) code to .Net interface.

    any comments?
  • Lee Alexander

    #2
    Re: hiding unmanaged types in metadata

    Unmanaged types in the manifest appeared in version 7.1 of Dev Studio. I'm
    guessing that MS did it as some kind of workaround for problems they were
    having with the debugger. I had lots of instances where I couldn't see the
    contents of unmanaged classes in 7.0 whilst debugging. There is no reason
    why we should see private types exposed in the manifest so hopefully MS will
    fix it at some point.

    Personally I would like to see another point release / service pack as 7.1
    is still a bit flaky especially the Windows forms designer.

    Regards
    Lee

    "Fedor Buyakov" <dcby@yahoo.com > wrote in message
    news:8d936c29.0 307111128.1cf28 ee1@posting.goo gle.com...[color=blue]
    > hello all
    >
    > i have a specific question according hiding unmanaged (native) types
    > in metadata for assemblies generated by c++ with managed extensions. i
    > understand what these types are nedeed in metadata for runtime but why
    > to do it public?
    >
    > is code will run correctly if i make these types private for assembly?
    >
    > there is no way to do so from IDE or by some compiler option but i can
    > edit assembly file directly in hex editor and change flag according
    > specified type.
    >
    > all unmanaged types in metadata have flags 0x109, ie:
    > "public sealed class <UNMANAGED TYPE NAME> : System.ValueTyp e".
    > if i replace bytes 09 01 for 10 01 for specified type's flag i will
    > have:
    > "private sealed class <UNMANAGED TYPE NAME> : System.ValueTyp e".
    >
    > hurrah! we have a hidden type but it's still present in the manifest
    > and i think this will no break runtime (my first experience shows what
    > all is ok).
    >
    > this workaround will especially useful for component developers who
    > need to wrap some native (eg. win32api) code to .Net interface.
    >
    > any comments?[/color]


    Comment

    Working...