473,394 Members | 1,841 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,394 software developers and data experts.

about [SuppressUnmanagedCodeSecurity]

I'm not exactly sur in which context it is valid / usefull.

For example will it suppres the stack in the following sample below when
using the ScreenGraphics class?
(i.e. I wonder if it will work even if it is not applied to the Gdi32 class,
but to the "consumer" class ScreenGraphics instead...)

internal static class Gdi32
{
[DllExport("GDI32")]
public static extern IntPtr GetHdc(IntPtr hWnd);
}
[SuppressUnmanagedCodeSecurity]
public class ScreenGraphics
{
public Graphics Graphics
{
get
{
IntPtr hdc = Gdi32.GetHdc(IntPtr.Zero);
return Graphics.FromHdc(hdc);
}
}
}
Jun 10 '06 #1
2 3230
Hi Lloyd,

"Lloyd Dupont" <net.galador@ld> wrote in message
news:eu**************@TK2MSFTNGP02.phx.gbl...
I'm not exactly sur in which context it is valid / usefull.

For example will it suppres the stack in the following sample below when
using the ScreenGraphics class?
(i.e. I wonder if it will work even if it is not applied to the Gdi32
class, but to the "consumer" class ScreenGraphics instead...)

internal static class Gdi32
{
[DllExport("GDI32")]
public static extern IntPtr GetHdc(IntPtr hWnd);
}
[SuppressUnmanagedCodeSecurity]
public class ScreenGraphics
{
public Graphics Graphics
{
get
{
IntPtr hdc = Gdi32.GetHdc(IntPtr.Zero);
return Graphics.FromHdc(hdc);
}
}
}


You should apply [SuppressUnmanagedCodeSecurity] to P/Invoke functions or to
types implementing P/Invoke functions - not to types using them.
Jun 10 '06 #2
Hi Marcus,
Thanks for the information!
Too bad for the info itself :-(

"Marcus Heege" <NO****@heege.net> wrote in message
news:ev**************@TK2MSFTNGP03.phx.gbl...
Hi Lloyd,

"Lloyd Dupont" <net.galador@ld> wrote in message
news:eu**************@TK2MSFTNGP02.phx.gbl...
I'm not exactly sur in which context it is valid / usefull.

For example will it suppres the stack in the following sample below when
using the ScreenGraphics class?
(i.e. I wonder if it will work even if it is not applied to the Gdi32
class, but to the "consumer" class ScreenGraphics instead...)

internal static class Gdi32
{
[DllExport("GDI32")]
public static extern IntPtr GetHdc(IntPtr hWnd);
}
[SuppressUnmanagedCodeSecurity]
public class ScreenGraphics
{
public Graphics Graphics
{
get
{
IntPtr hdc = Gdi32.GetHdc(IntPtr.Zero);
return Graphics.FromHdc(hdc);
}
}
}


You should apply [SuppressUnmanagedCodeSecurity] to P/Invoke functions or
to types implementing P/Invoke functions - not to types using them.

Jun 10 '06 #3

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

Similar topics

1
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
8
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
5
by: eScrewDotCom | last post by:
www.eScrew.com eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is...
0
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew...
7
by: Edward Yang | last post by:
A few days ago I started a thread "I think C# is forcing us to write more (redundant) code" and got many replies (more than what I had expected). But after reading all the replies I think my...
2
by: Michael Tissington | last post by:
I'm having trouble using the SuppressUnmanagedCodeSecurity attribute. When I try to compile, I get an error saying that the namespace is not known. Any ideas please ? -- Michael Tissington...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.