AdvApi32DuplicateToken Method
Creates a new access token that duplicates one already in existence.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("AdvApi32.dll", SetLastError = true)]
public static bool DuplicateToken(
IntPtr tokenHandle,
SecurityImpersonationLevel impersonationLevel,
ref IntPtr refDuplicateTokenHandle
)
<DllImportAttribute("AdvApi32.dll", SetLastError := true>]
Public Shared Function DuplicateToken (
tokenHandle As IntPtr,
impersonationLevel As SecurityImpersonationLevel,
ByRef refDuplicateTokenHandle As IntPtr
) As Boolean
Dim tokenHandle As IntPtr
Dim impersonationLevel As SecurityImpersonationLevel
Dim refDuplicateTokenHandle As IntPtr
Dim returnValue As Boolean
returnValue = AdvApi32.DuplicateToken(tokenHandle,
impersonationLevel, refDuplicateTokenHandle)
public:
[DllImportAttribute(L"AdvApi32.dll", SetLastError = true)]
static bool DuplicateToken(
IntPtr tokenHandle,
SecurityImpersonationLevel impersonationLevel,
IntPtr% refDuplicateTokenHandle
)
[<DllImportAttribute("AdvApi32.dll", SetLastError = true)>]
static member DuplicateToken :
tokenHandle : IntPtr *
impersonationLevel : SecurityImpersonationLevel *
refDuplicateTokenHandle : IntPtr byref -> bool
No code example is currently available or this language may not be supported.
- tokenHandle IntPtr
-
A handle to an access token opened with Duplicate access.
- impersonationLevel SecurityImpersonationLevel
-
A SecurityImpersonationLevel enumerated type that supplies the impersonation level of the new token.
- refDuplicateTokenHandle IntPtr
-
A pointer to a variable that receives a handle to the duplicate token.
This handle has Impersonate and Query access to the new token.
When you have finished using the new token, call the CloseHandle(IntPtr) function to close the token handle.
Boolean
If the function succeeds, the return value is
.
If the function fails, the return value is
.
To get extended error information, call
GetLastWin32Error.