根据这篇文章MSDN,我应该根据我将使用的函数创建一个类,但我的问题是:我该如何知道我应该在哪个类中放置GetSystemPowerStatusEx& GetSystemPowerStatusEx2?
我迷路了…
感谢帮助.
[编辑]我的问题是:这三个类名中哪一个对我来说是好的(NativeMethods / SafeNativeMethods / UnsafeNativeMethods)?
These methods should be in one of the following classes:
NativeMethods – This class does not
suppress stack walks for unmanaged
code permission.
(System.Security.SuppressUnmanagedCodeSecurityAttribute
must not be applied to this class.)
This class is for methods that can be
used anywhere because a stack walk
will be performed.SafeNativeMethods – This class
suppresses stack walks for unmanaged
code permission.
(System.Security.SuppressUnmanagedCodeSecurityAttribute
is applied to this class.) This class
is for methods that are safe for
anyone to call. Callers of these
methods are not required to perform a
full security review to make sure that
the usage is secure because the
methods are harmless for any caller.UnsafeNativeMethods – This class
suppresses stack walks for unmanaged
code permission.
(System.Security.SuppressUnmanagedCodeSecurityAttribute
is applied to this class.) This class
is for methods that are potentially
dangerous. Any caller of these methods
must perform a full security review to
make sure that the usage is secure
because no stack walk will be
performed.