@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: TODO - a short description !!!!C# Signature: [DllImport("advapi32.dll", SetLastError = true)] static extern Boolean SetTokenInformation(IntPtr TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, ref UInt32 TokenInformation, UInt32 TokenInformationLength); !!!!VB Signature: Declare Function SetTokenInformation Lib "advapi32.dll" (TODO) As TODO !!!!User-Defined Types: [TOKEN_INFORMATION_CLASS] !!!!Alternative Managed API: Do you know one? Please contribute it! !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!Sample Code: [DllImport("advapi32.dll", SetLastError = true)] static extern Boolean SetTokenInformation(IntPtr TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, IntPtr TokenInformation, int TokenInformationLength); // api signature: // WINADVAPI // BOOL // WINAPI // SetTokenInformation( // _In_ HANDLE TokenHandle, // _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, // _In_reads_bytes_(TokenInformationLength) LPVOID TokenInformation, // _In_ DWORD TokenInformationLength // ); // // Note: Parameter TokenInformation gets various data, use IntPtr to your data // Example: pass int-value to SetTokenInformation // Alloc 4 bytes for the value var sessionIDPtr = Marshal.AllocHGlobal(4); // Convert value to byte[] and copy to sessionIDPtr Marshal.Copy(BitConverter.GetBytes(sessionID), 0, sessionIDPtr, 4); if (!api.advapi32.SetTokenInformation(hProcTokenDub, api.TOKEN_INFORMATION_CLASS.TokenSessionId, sessionIDPtr, 4)) { Trace.TraceError("SetTokenInformation"); } // clean allocated data Marshal.FreeHGlobal(sessionIDPtr); Documentation: SetTokenInformation@msdn on MSDN
Edit advapi32.settoken...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.