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