Files
mirror-processhacker/trunk/ProcessHacker/Win32/Handles/TokenWithLinkedToken.cs
T
wj32 0bc39ec29d more robust symbol loading, done in several stages
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1058 21ef857c-d57f-4fe0-8362-d861dc6d29cd
2009-04-14 05:48:07 +00:00

58 lines
1.7 KiB
C#

/*
* Process Hacker -
* a token with a linked token
*
* Copyright (C) 2008 wj32
*
* This file is part of Process Hacker.
*
* Process Hacker is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Process Hacker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Runtime.InteropServices;
namespace ProcessHacker
{
public partial class Win32
{
public class TokenWithLinkedToken : IWithToken
{
private Win32.TokenHandle _token;
public TokenWithLinkedToken(Win32.TokenHandle token)
{
_token = token;
}
public Win32.TokenHandle GetToken()
{
int linkedToken;
int retLen;
if (!Win32.GetTokenInformation(_token, Win32.TOKEN_INFORMATION_CLASS.TokenLinkedToken,
out linkedToken, 4, out retLen))
Win32.ThrowLastWin32Error();
return new Win32.TokenHandle(linkedToken, true);
}
public Win32.TokenHandle GetToken(Win32.TOKEN_RIGHTS access)
{
return this.GetToken();
}
}
}
}