AdvApi32ImpersonateSelf Method
Obtains an access token that impersonates the security context of the calling process.
The token is assigned to the calling thread.
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", ExactSpelling = true, SetLastError = true)]
public static bool ImpersonateSelf(
SecurityImpersonationLevel impersonationLevel
)
<DllImportAttribute("AdvApi32.dll", ExactSpelling := true, SetLastError := true>]
Public Shared Function ImpersonateSelf (
impersonationLevel As SecurityImpersonationLevel
) As Boolean
Dim impersonationLevel As SecurityImpersonationLevel
Dim returnValue As Boolean
returnValue = AdvApi32.ImpersonateSelf(impersonationLevel)
public:
[DllImportAttribute(L"AdvApi32.dll", ExactSpelling = true, SetLastError = true)]
static bool ImpersonateSelf(
SecurityImpersonationLevel impersonationLevel
)
[<DllImportAttribute("AdvApi32.dll", ExactSpelling = true, SetLastError = true)>]
static member ImpersonateSelf :
impersonationLevel : SecurityImpersonationLevel -> bool
No code example is currently available or this language may not be supported.
- impersonationLevel SecurityImpersonationLevel
-
The impersonation level of the new token.
Boolean
If the function succeeds, the return value is
.
If the function fails, the return value is
.