本文整理汇总了C#中TOKEN_INFORMATION_CLASS类的典型用法代码示例。如果您正苦于以下问题:C# TOKEN_INFORMATION_CLASS类的具体用法?C# TOKEN_INFORMATION_CLASS怎么用?C# TOKEN_INFORMATION_CLASS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TOKEN_INFORMATION_CLASS类属于命名空间,在下文中一共展示了TOKEN_INFORMATION_CLASS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTokenInformation
public static SafeHandle GetTokenInformation(SafeCloseHandle token, TOKEN_INFORMATION_CLASS infoClass)
{
uint length;
if (!SafeNativeMethods.GetTokenInformation(token, infoClass, SafeHGlobalHandle.InvalidHandle, 0, out length))
{
int error = Marshal.GetLastWin32Error();
if (error != (int)Win32Error.ERROR_INSUFFICIENT_BUFFER)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(error, SR.GetString(SR.GetTokenInfoFailed, error)));
}
}
SafeHandle buffer = SafeHGlobalHandle.AllocHGlobal(length);
try
{
if (!SafeNativeMethods.GetTokenInformation(token, infoClass, buffer, length, out length))
{
int error = Marshal.GetLastWin32Error();
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(error, SR.GetString(SR.GetTokenInfoFailed, error)));
}
}
catch
{
buffer.Dispose();
throw;
}
return buffer;
}
示例2: GetTokenInformation
static extern bool GetTokenInformation(
IntPtr TokenHandle,
TOKEN_INFORMATION_CLASS TokenInformationClass,
IntPtr TokenInformation,
uint TokenInformationLength,
out uint ReturnLength
);
示例3: GetTokenInformation
static extern bool GetTokenInformation(
HANDLE hToken,
TOKEN_INFORMATION_CLASS tokenInfoClass,
IntPtr TokenInformation,
int tokeInfoLength,
ref int reqLength
);
示例4: GetTokenInformation
public static extern bool GetTokenInformation(
IntPtr TokenHandle,
TOKEN_INFORMATION_CLASS TokenInformationClass,
IntPtr TokenInformation,
UInt32 TokenInformationLength,
out UInt32 ReturnLength
);
示例5: GetTokenInformation
internal static extern bool GetTokenInformation(SafeCloseHandle tokenHandle, TOKEN_INFORMATION_CLASS tokenInformationClass, [Out] byte[] pTokenInformation, int tokenInformationLength, out int returnLength);
示例6: GetTokenInformation
public static extern bool GetTokenInformation(int TokenHandle,
TOKEN_INFORMATION_CLASS TokenInformationClass, ref TOKEN_SOURCE TokenInformation,
int TokenInformationLength, out int ReturnLength);
示例7: GetTokenInformation
public static bool GetTokenInformation([NotNull] SafeTokenHandle hToken, TOKEN_INFORMATION_CLASS tokenInfoClass, [NotNull] SafeNativeMemory pTokenInfo)
{
Contract.Requires(hToken != null);
Contract.Requires(pTokenInfo != null);
int cbReturned;
return GetTokenInformation(hToken, tokenInfoClass, pTokenInfo.DangerousGetHandle(), pTokenInfo.Size, out cbReturned);
}
示例8: SetTokenInformation
public static extern bool SetTokenInformation(IntPtr TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass,
ref int TokenInformation, int TokenInformationLength);
示例9: GetTokenInformation
public unsafe static extern bool GetTokenInformation(
SafeTokenHandle TokenHandle,
TOKEN_INFORMATION_CLASS TokenInfoClass,
[Out] void* TokenInformation,
int TokenInfoLength,
[Out] out int ccbReturn);
示例10: GetTokenInformation
private static extern int GetTokenInformation(
IntPtr TokenHandle,
TOKEN_INFORMATION_CLASS TokenInformationClass,
out int TokenInformation,
int TokenInformationLength,
out int ReturnLength);
示例11: GetTokenInformation
public static SafeHandle GetTokenInformation(SafeCloseHandle token, TOKEN_INFORMATION_CLASS infoClass)
{
uint num;
if (!SafeNativeMethods.GetTokenInformation(token, infoClass, SafeHGlobalHandle.InvalidHandle, 0, out num))
{
int error = Marshal.GetLastWin32Error();
if (error != 0x7a)
{
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(error, System.ServiceModel.SR.GetString("GetTokenInfoFailed", new object[] { error })));
}
}
SafeHandle tokenInformation = SafeHGlobalHandle.AllocHGlobal(num);
try
{
if (!SafeNativeMethods.GetTokenInformation(token, infoClass, tokenInformation, num, out num))
{
int num3 = Marshal.GetLastWin32Error();
throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Win32Exception(num3, System.ServiceModel.SR.GetString("GetTokenInfoFailed", new object[] { num3 })));
}
}
catch
{
tokenInformation.Dispose();
throw;
}
return tokenInformation;
}
示例12: SetTokenInformation
static extern Boolean SetTokenInformation(IntPtr TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, ref UInt32 TokenInformation, UInt32 TokenInformationLength);
示例13: SetTokenInformation
public static extern bool SetTokenInformation(
SafeTokenHandle hToken,
TOKEN_INFORMATION_CLASS tokenInfoClass,
IntPtr pTokenInfo,
Int32 tokenInfoLength);
示例14: GetTokenInformation
public static extern bool GetTokenInformation(SafeTokenHandle TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, ref TOKEN_ELEVATION_TYPE TokenInformation, int TokenInformationLength, out uint ReturnLength);
示例15: SetTokenInformation
internal static extern bool SetTokenInformation(SafeTokenHandle hToken, TOKEN_INFORMATION_CLASS informationClass,
TOKEN_MANDATORY_LABEL tokenInformation,
int tokenInformationLength);