¡@

Home 

c# Programming Glossary: duplicatetoken

Run Powershell-Script from C# Application

http://stackoverflow.com/questions/11120452/run-powershell-script-from-c-sharp-application

CharSet.Auto SetLastError true private static extern int DuplicateToken IntPtr hToken int impersonationLevel ref IntPtr hNewToken DllImport.. LOGON32_PROVIDER_DEFAULT ref token 0 if DuplicateToken token 2 ref tokenDuplicate 0 tempWindowsIdentity new WindowsIdentity..

How do you impersonate an Active Directory user in Powershell?

http://stackoverflow.com/questions/11806/how-do-you-impersonate-an-active-directory-user-in-powershell

CharSet.Auto SetLastError true private static extern int DuplicateToken IntPtr hToken int impersonationLevel ref IntPtr hNewToken DllImport.. LOGON32_PROVIDER_DEFAULT ref token 0 if DuplicateToken token 2 ref tokenDuplicate 0 tempWindowsIdentity new WindowsIdentity..

C#: How to logon to a share when using DirectoryInfo

http://stackoverflow.com/questions/1232120/c-how-to-logon-to-a-share-when-using-directoryinfo

true ExactSpelling true public static extern int DuplicateToken IntPtr ExistingTokenHandle int ImpersonationLevel ref IntPtr.. ExistingTokenHandle int ImpersonationLevel ref IntPtr DuplicateTokenHandle DllImport advapi32.dll CharSet CharSet.Auto SetLastError.. LOGON32_PROVIDER_WINNT50 ref token 0 if DuplicateToken token 2 ref tokenDuplicate 0 tempWindowsIdentity new WindowsIdentity..

How to change folders permission to the current user by using admin credentials?

http://stackoverflow.com/questions/18580419/how-to-change-folders-permission-to-the-current-user-by-using-admin-credentials

false ThrowOnUnmappableChar true private static extern int DuplicateToken IntPtr hToken int impersonationLevel ref IntPtr hNewToken.. INTERACTIVE_NUMBER DEFAULT_NUMBER ref token 0 if DuplicateToken token 2 ref tokenDuplicate 0 tempWindowsIdentity new WindowsIdentity..

How do I pass credentials to a machine so I can use Microsoft.Win32.RegistryKey.OpenRemoteBaseKey() on it?

http://stackoverflow.com/questions/2541504/how-do-i-pass-credentials-to-a-machine-so-i-can-use-microsoft-win32-registrykey

CharSet.Auto SetLastError true public extern static bool DuplicateToken IntPtr existingTokenHandle int SECURITY_IMPERSONATION_LEVEL..

Accessing Password Protected Network Drives in Windows in C#?

http://stackoverflow.com/questions/2563724/accessing-password-protected-network-drives-in-windows-in-c

MarshalAs UnmanagedType.Bool internal static extern bool DuplicateToken IntPtr existingTokenHandle SecurityImpersonationLevel securityImpersonationLevel.. Win32Exception try IntPtr tokenDuplicate if NativeMethods.DuplicateToken token NativeMethods.SecurityImpersonationLevel.Impersonation..

How to Process Start with Impersonated Domain User

http://stackoverflow.com/questions/4624113/how-to-process-start-with-impersonated-domain-user

CharSet.Auto SetLastError true public extern static bool DuplicateToken IntPtr ExistingTokenHandle int SECURITY_IMPERSONATION_LEVEL.. int SECURITY_IMPERSONATION_LEVEL ref IntPtr DuplicateTokenHandle #endregion summary Constructor. Impersonates the requested..

LogonUser and delegation

http://stackoverflow.com/questions/996429/logonuser-and-delegation

need to define the API's for AdvApi32.LogonUser AdvApi32.DuplicateToken and Kernel32.CloseHandle and make sure to Close the WindowsImpersonationContext.. lastWin32Error lastError copy the token isOkay AdvApi32.DuplicateToken existingTokenHandle int AdvApi32.SecurityImpersonationLevel.SecurityImpersonation.. existingTokenHandle throw new Exception DuplicateToken Failed lastWin32Error lastError create an identity from the..