mixed managed/unmanaged in same exe... how-to hide unmanaged?

M

mike

I have a windows service that I've written in managed code. However,
I want to use unmanaged code in it that contains some of our core IP
and prevent it from be viewed in ILDASM. I've found the documentation
on /d1PrivateNativeTypes flag but not sure if this will do what I
want. Can someone please point me in direction of how to best design/
build such a scenario?

Thanks,
Mike
 
W

William DePalo [MVP VC++]

mike said:
I have a windows service that I've written in managed code. However,
I want to use unmanaged code in it that contains some of our core IP
and prevent it from be viewed in ILDASM. I've found the documentation
on /d1PrivateNativeTypes flag but not sure if this will do what I
want. Can someone please point me in direction of how to best design/
build such a scenario?

In the IDE you open up the C++ properties, drill down to "Command Line" and
in the "Additional Options" edit box type

/d1PrivateNativeTypes

IIRC, the names of the types will be visible to ILDASM but none of their
members.

Regards,
Will
 
M

mike

In the IDE you open up the C++ properties, drill down to "Command Line" and
in the "Additional Options" edit box type

/d1PrivateNativeTypes

IIRC, the names of the types will be visible to ILDASM but none of their
members.

Regards,
Will

Will,

Thanks. Does this mean that if I have .c files in my project that has
functions I call and use this compiler switch that someone will be
able to see the function in ILDASM but they will not be able to
decompile of view the contents?

Mike
 
B

Ben Voigt [C++ MVP]

mike said:
Will,

Thanks. Does this mean that if I have .c files in my project that has
functions I call and use this compiler switch that someone will be
able to see the function in ILDASM but they will not be able to
decompile of view the contents?

Compile those files without /clr, or put #pragma managed(push, off) #pragma
managed(pop) around the code you want compiled to native code (which is more
difficult to reverse engineer).
 
M

Mark Salsbery [MVP]

I also add

#if (_MANAGED == 1)
#pragma unmanaged
#endif

around all my native code that doesn't need to be compiled to CLR.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top