ManagedC++ security: How to avoid the stack walk?

L

Lloyd Dupont

In C# I could remove security check on an C DLL call by tagging my function
as follow:
[System::Security::SuppressUnmanagedCodeSecurityAttribute]
[DllImport("SomeDll.dll")]
static extern void SomeMethod();

In Managed C++ I don't declare the function I just #include the headers.

How could I avoid security stack walk?
 
C

Carl Daniel [VC++ MVP]

Lloyd Dupont said:
In C# I could remove security check on an C DLL call by tagging my
function as follow:
[System::Security::SuppressUnmanagedCodeSecurityAttribute]
[DllImport("SomeDll.dll")]
static extern void SomeMethod();

In Managed C++ I don't declare the function I just #include the headers.

How could I avoid security stack walk?

I would assume that you would apply it to the managed function that's
calling the native function. Attributes can't really be attached to native
functions - the C# declaration really attaches the attribute to the P/Invoke
thunk that's automatically generated and not to the native function itself.

-cd
 
L

Lloyd Dupont

Thanks Daniel!

Mmh.. it looks like I'm stuck in a wall...
Anyway.....

--
Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
Carl Daniel said:
Lloyd Dupont said:
In C# I could remove security check on an C DLL call by tagging my
function as follow:
[System::Security::SuppressUnmanagedCodeSecurityAttribute]
[DllImport("SomeDll.dll")]
static extern void SomeMethod();

In Managed C++ I don't declare the function I just #include the headers.

How could I avoid security stack walk?

I would assume that you would apply it to the managed function that's
calling the native function. Attributes can't really be attached to
native functions - the C# declaration really attaches the attribute to the
P/Invoke thunk that's automatically generated and not to the native
function itself.

-cd
 

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