44 references to SafeCloseHandle
System.ServiceModel (44)
System\ServiceModel\Activation\ListenerUnsafeNativeMethods.cs (7)
55internal static unsafe extern bool AdjustTokenPrivileges(SafeCloseHandle tokenHandle, bool disableAllPrivileges, TOKEN_PRIVILEGES* newState, int bufferLength, IntPtr previousState, IntPtr returnLength); 73internal static extern bool GetKernelObjectSecurity(SafeCloseHandle handle, int securityInformation, [Out] byte[] pSecurityDescriptor, int nLength, out int lpnLengthNeeded); 77internal static extern bool GetTokenInformation(SafeCloseHandle tokenHandle, TOKEN_INFORMATION_CLASS tokenInformationClass, [Out] byte[] pTokenInformation, int tokenInformationLength, out int returnLength); 81internal static extern SafeCloseHandle OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId); 89internal static extern bool OpenProcessToken(SafeCloseHandle processHandle, int desiredAccess, out SafeCloseHandle tokenHandle); 113internal static extern bool SetKernelObjectSecurity(SafeCloseHandle handle, int securityInformation, [In] byte[] pSecurityDescriptor);
System\ServiceModel\Activation\Utility.cs (20)
33static SafeCloseHandle OpenCurrentProcessForWrite() 37SafeCloseHandle process = ListenerUnsafeNativeMethods.OpenProcess(ListenerUnsafeNativeMethods.PROCESS_QUERY_INFORMATION | ListenerUnsafeNativeMethods.WRITE_DAC | ListenerUnsafeNativeMethods.READ_CONTROL, false, processId); 47static SafeCloseHandle OpenProcessForQuery(int pid) 50SafeCloseHandle process = ListenerUnsafeNativeMethods.OpenProcess(ListenerUnsafeNativeMethods.PROCESS_QUERY_INFORMATION, false, pid); 60static SafeCloseHandle GetProcessToken(SafeCloseHandle process, int requiredAccess) 62SafeCloseHandle processToken; 74static int GetTokenInformationLength(SafeCloseHandle token, ListenerUnsafeNativeMethods.TOKEN_INFORMATION_CLASS tic) 90static void GetTokenInformation(SafeCloseHandle token, ListenerUnsafeNativeMethods.TOKEN_INFORMATION_CLASS tic, byte[] tokenInformation) 128SafeCloseHandle process = OpenCurrentProcessForWrite(); 137SafeCloseHandle token = GetProcessToken(process, ListenerUnsafeNativeMethods.TOKEN_QUERY | ListenerUnsafeNativeMethods.WRITE_DAC | ListenerUnsafeNativeMethods.READ_CONTROL); 156SafeCloseHandle process = OpenCurrentProcessForWrite(); 169SafeCloseHandle process = OpenCurrentProcessForWrite(); 183SafeCloseHandle process = OpenCurrentProcessForWrite(); 186SafeCloseHandle token = GetProcessToken(process, ListenerUnsafeNativeMethods.TOKEN_QUERY | ListenerUnsafeNativeMethods.TOKEN_ADJUST_PRIVILEGES | ListenerUnsafeNativeMethods.READ_CONTROL); 238static void EditKernelObjectSecurity(SafeCloseHandle kernelObject, List<SecurityIdentifier> accounts, SecurityIdentifier account, int right, bool add) 336SafeCloseHandle process = OpenProcessForQuery(pid); 339SafeCloseHandle token = GetProcessToken(process, ListenerUnsafeNativeMethods.TOKEN_QUERY); 374SafeCloseHandle process = OpenProcessForQuery(pid); 377SafeCloseHandle token = GetProcessToken(process, ListenerUnsafeNativeMethods.TOKEN_QUERY);
System\ServiceModel\Channels\AppContainerInfo.cs (6)
14using SafeCloseHandle = System.ServiceModel.Activation.SafeCloseHandle; 118SafeCloseHandle tokenHandle = null; 143SafeCloseHandle tokenHandle = null; 226SafeCloseHandle tokenHandle = null; 247static SafeCloseHandle GetCurrentProcessToken() 249SafeCloseHandle tokenHandle = null;
System\ServiceModel\Channels\PipeConnection.cs (2)
30using SafeCloseHandle = System.ServiceModel.Activation.SafeCloseHandle; 640SafeCloseHandle targetProcessHandle = ListenerUnsafeNativeMethods.OpenProcess(ListenerUnsafeNativeMethods.PROCESS_DUP_HANDLE, false, targetProcessId);
System\ServiceModel\Channels\UnsafeNativeMethods.cs (9)
23using SafeCloseHandle = System.ServiceModel.Activation.SafeCloseHandle; 561SafeCloseHandle hTargetProcessHandle, 783out SafeCloseHandle TokenHandle 790SafeCloseHandle tokenHandle, 801SafeCloseHandle tokenHandle, 808internal static unsafe SecurityIdentifier GetAppContainerSid(SafeCloseHandle tokenHandle) 840static uint GetTokenInformationLength(SafeCloseHandle token, TOKEN_INFORMATION_CLASS tokenInformationClass) 863internal static int GetSessionId(SafeCloseHandle tokenHandle) 882internal static bool RunningInAppContainer(SafeCloseHandle tokenHandle)