Home All Groups Group Topic Archive Search About

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

Author
26 Jul 2006 1:53 AM
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?

Author
26 Jul 2006 1:59 AM
Carl Daniel [VC++ MVP]
"Lloyd Dupont" <net.galador@ld> wrote in message
news:uWl0EYFsGHA.1424@TK2MSFTNGP05.phx.gbl...
> 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
Author
26 Jul 2006 2:47 AM
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>
Show quote
"Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@mvps.org.nospam>
wrote in message news:OS3DYcFsGHA.4740@TK2MSFTNGP03.phx.gbl...
> "Lloyd Dupont" <net.galador@ld> wrote in message
> news:uWl0EYFsGHA.1424@TK2MSFTNGP05.phx.gbl...
>> 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
>
>

AddThis Social Bookmark Button