c# Programming Glossary: gettokeninformation
Detect if running as Administrator with or without elevated privileges? http://stackoverflow.com/questions/1220213/detect-if-running-as-administrator-with-or-without-elevated-privileges advapi32.dll SetLastError true public static extern bool GetTokenInformation IntPtr TokenHandle TOKEN_INFORMATION_CLASS TokenInformationClass.. Marshal.AllocHGlobal elevationResultSize bool success GetTokenInformation tokenHandle TOKEN_INFORMATION_CLASS.TokenElevationType elevationTypePtr..
How to get the logon SID in c# http://stackoverflow.com/questions/2146153/how-to-get-the-logon-sid-in-c-sharp it at pinvoke.net please see the bottom of the page Result GetTokenInformation WindowsIdentity.GetCurrent .Token TOKEN_INFORMATION_CLASS.TokenSessionId.. advapi32.dll SetLastError true static extern bool GetTokenInformation IntPtr TokenHandle TOKEN_INFORMATION_CLASS TokenInformationClass.. 0 first call gets lenght of TokenInformation bool Result GetTokenInformation WindowsIdentity.GetCurrent .Token TOKEN_INFORMATION_CLASS.TokenGroups..
Possible to launch a process in a user's session from a service? http://stackoverflow.com/questions/3128017/possible-to-launch-a-process-in-a-users-session-from-a-service en us library aa382990.aspx . You can use GetTokenInformation function with the parameter TokenSessionId see http msdn.microsoft.com.. NULL DWORD dwSessionId cbReturnLength bSuccess GetTokenInformation hClient TokenSessionId dwSessionId sizeof DWORD cbReturnLength..
Using Process.Start() to start a process as a different user from within a Windows Service http://stackoverflow.com/questions/362419/using-process-start-to-start-a-process-as-a-different-user-from-within-a-windo int dwLogonProvider out IntPtr phToken #region GetTokenInformation BOOL WINAPI GetTokenInformation __in HANDLE TokenHandle __in.. IntPtr phToken #region GetTokenInformation BOOL WINAPI GetTokenInformation __in HANDLE TokenHandle __in TOKEN_INFORMATION_CLASS TokenInformationClass.. advapi32.dll SetLastError true static extern bool GetTokenInformation IntPtr TokenHandle TOKEN_INFORMATION_CLASS TokenInformationClass..
How to get a Unique ID for the current user's logon session in windows - c# http://stackoverflow.com/questions/6061143/how-to-get-a-unique-id-for-the-current-users-logon-session-in-windows-c-sharp .SessionId The value is the same as returned by GetTokenInformation ... TokenSessionId ... . Note One thing you should keep in mind.. OriginatingLogonSession DllImport advapi32.dll EntryPoint GetTokenInformation SetLastError true static extern bool GetTokenInformation IntPtr.. GetTokenInformation SetLastError true static extern bool GetTokenInformation IntPtr tokenHandle TokenInformationClass tokenInformationClass..
|