473,383 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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.ValueType".
if i replace bytes 09 01 for 10 01 for specified type's flag i will
have:
"private sealed class <UNMANAGED TYPE NAME> : System.ValueType".

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?
Nov 16 '05 #1
1 1394
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" <dc**@yahoo.com> wrote in message
news:8d**************************@posting.google.c om...
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.ValueType".
if i replace bytes 09 01 for 10 01 for specified type's flag i will
have:
"private sealed class <UNMANAGED TYPE NAME> : System.ValueType".

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?

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tom | last post by:
Given a path to an assembly in unmanaged code does anyone know of a way to load the assembly and enumerate out the types as strings using the mscorlib API? Thanks in advance Tom
2
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking afterwards with ILDASM at what is visible in those assemblies from a...
3
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust...
4
by: William F. Kinsley | last post by:
My understanding is that when I re-compile a existing MFC application with the /clr switch, that the code generated is managed(with some exceptions) but that the data isn't, i.e. not garbage...
5
by: R. MacDonald | last post by:
Hello, all, I am currently working on a .Net (VB) application that invokes routines in unmanaged (Fortran) DLLs. The unmanaged routines then communicate with the .Net application by means of a...
3
by: B. | last post by:
We converted VC++ 6.0 to VS 2005 and tried to compile with /clr, however, we got few linking errors: MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed (8013118D) : Inconsistent...
6
by: bill | last post by:
All, I have an unmanaged data structure that I use to pass to an umanaged DLL written in C. This works great. The structure looks sort of like this: unsafe public struct Inputs { .....
11
by: Alex | last post by:
Hello all, I have a main form(say "form1") .i want to display another form(say "form2") on occuring of an event (say a button click) and want to hide it after some time so that it will again...
3
by: Pixel.to.life | last post by:
Hi, Gurus, I recently attempted to build a .Net forms application, that links with old style unmanaged C++ static libs. Of course I had to recompile the static lib projects to link properly...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.