71 references to ListenerUnsafeNativeMethods
System.ServiceModel (71)
System\ServiceModel\Activation\ListenerUnsafeNativeMethods.cs (1)
283
return
ListenerUnsafeNativeMethods
.CloseServiceHandle(handle);
System\ServiceModel\Activation\Utility.cs (62)
37
SafeCloseHandle process =
ListenerUnsafeNativeMethods
.OpenProcess(
ListenerUnsafeNativeMethods
.PROCESS_QUERY_INFORMATION |
ListenerUnsafeNativeMethods
.WRITE_DAC |
ListenerUnsafeNativeMethods
.READ_CONTROL, false, processId);
50
SafeCloseHandle process =
ListenerUnsafeNativeMethods
.OpenProcess(
ListenerUnsafeNativeMethods
.PROCESS_QUERY_INFORMATION, false, pid);
63
bool success =
ListenerUnsafeNativeMethods
.OpenProcessToken(process, requiredAccess, out processToken);
74
static int GetTokenInformationLength(SafeCloseHandle token,
ListenerUnsafeNativeMethods
.TOKEN_INFORMATION_CLASS tic)
77
bool success =
ListenerUnsafeNativeMethods
.GetTokenInformation(token, tic, null, 0, out lengthNeeded);
81
if (error !=
ListenerUnsafeNativeMethods
.ERROR_INSUFFICIENT_BUFFER)
90
static void GetTokenInformation(SafeCloseHandle token,
ListenerUnsafeNativeMethods
.TOKEN_INFORMATION_CLASS tic, byte[] tokenInformation)
93
if (!
ListenerUnsafeNativeMethods
.GetTokenInformation(token, tic, tokenInformation, tokenInformation.Length, out lengthNeeded))
103
SafeServiceHandle scManager =
ListenerUnsafeNativeMethods
.OpenSCManager(null, null,
ListenerUnsafeNativeMethods
.SC_MANAGER_CONNECT);
116
SafeServiceHandle service =
ListenerUnsafeNativeMethods
.OpenService(scManager, serviceName, purpose);
137
SafeCloseHandle token = GetProcessToken(process,
ListenerUnsafeNativeMethods
.TOKEN_QUERY |
ListenerUnsafeNativeMethods
.WRITE_DAC |
ListenerUnsafeNativeMethods
.READ_CONTROL);
186
SafeCloseHandle token = GetProcessToken(process,
ListenerUnsafeNativeMethods
.TOKEN_QUERY |
ListenerUnsafeNativeMethods
.TOKEN_ADJUST_PRIVILEGES |
ListenerUnsafeNativeMethods
.READ_CONTROL);
190
bool success =
ListenerUnsafeNativeMethods
.LookupPrivilegeValue(IntPtr.Zero, privilege, &luid);
197
int length = GetTokenInformationLength(token,
ListenerUnsafeNativeMethods
.TOKEN_INFORMATION_CLASS.TokenPrivileges);
201
GetTokenInformation(token,
ListenerUnsafeNativeMethods
.TOKEN_INFORMATION_CLASS.TokenPrivileges,
204
ListenerUnsafeNativeMethods
.TOKEN_PRIVILEGES* pTP = (
ListenerUnsafeNativeMethods
.TOKEN_PRIVILEGES*)pTokenPrivileges;
218
success =
ListenerUnsafeNativeMethods
.AdjustTokenPrivileges(token, false, pTP, tokenInformation.Length, IntPtr.Zero, IntPtr.Zero);
242
bool success =
ListenerUnsafeNativeMethods
.GetKernelObjectSecurity(kernelObject,
ListenerUnsafeNativeMethods
.DACL_SECURITY_INFORMATION, null, 0, out lpnLengthNeeded);
246
if (errorCode !=
ListenerUnsafeNativeMethods
.ERROR_INSUFFICIENT_BUFFER)
253
success =
ListenerUnsafeNativeMethods
.GetKernelObjectSecurity(kernelObject,
ListenerUnsafeNativeMethods
.DACL_SECURITY_INFORMATION, pSecurityDescriptor, pSecurityDescriptor.Length, out lpnLengthNeeded);
277
success =
ListenerUnsafeNativeMethods
.SetKernelObjectSecurity(kernelObject,
ListenerUnsafeNativeMethods
.DACL_SECURITY_INFORMATION, pSecurityDescriptor);
306
if (!
ListenerUnsafeNativeMethods
.LookupAccountName(null, accountName, sid, ref cbSid,
310
if (error !=
ListenerUnsafeNativeMethods
.ERROR_INSUFFICIENT_BUFFER)
318
if (!
ListenerUnsafeNativeMethods
.LookupAccountName(null, accountName, sid, ref cbSid,
339
SafeCloseHandle token = GetProcessToken(process,
ListenerUnsafeNativeMethods
.TOKEN_QUERY);
342
int length = GetTokenInformationLength(token,
ListenerUnsafeNativeMethods
.TOKEN_INFORMATION_CLASS.TokenGroups);
346
GetTokenInformation(token,
ListenerUnsafeNativeMethods
.TOKEN_INFORMATION_CLASS.TokenGroups, tokenInformation);
348
ListenerUnsafeNativeMethods
.TOKEN_GROUPS* ptg = (
ListenerUnsafeNativeMethods
.TOKEN_GROUPS*)pTokenInformation;
349
ListenerUnsafeNativeMethods
.SID_AND_ATTRIBUTES* sids = (
ListenerUnsafeNativeMethods
.SID_AND_ATTRIBUTES*)(&(ptg->Groups));
352
if ((sids[i].Attributes &
ListenerUnsafeNativeMethods
.SidAttribute.SE_GROUP_LOGON_ID) ==
ListenerUnsafeNativeMethods
.SidAttribute.SE_GROUP_LOGON_ID)
377
SafeCloseHandle token = GetProcessToken(process,
ListenerUnsafeNativeMethods
.TOKEN_QUERY);
380
int length = GetTokenInformationLength(token,
ListenerUnsafeNativeMethods
.TOKEN_INFORMATION_CLASS.TokenUser);
384
GetTokenInformation(token,
ListenerUnsafeNativeMethods
.TOKEN_INFORMATION_CLASS.TokenUser, tokenInformation);
386
ListenerUnsafeNativeMethods
.TOKEN_USER* ptg = (
ListenerUnsafeNativeMethods
.TOKEN_USER*)pTokenInformation;
387
ListenerUnsafeNativeMethods
.SID_AND_ATTRIBUTES* sids = (
ListenerUnsafeNativeMethods
.SID_AND_ATTRIBUTES*)(&(ptg->User));
403
static
ListenerUnsafeNativeMethods
.SERVICE_STATUS_PROCESS GetStatusForService(string serviceName)
408
SafeServiceHandle service = OpenService(scManager, serviceName,
ListenerUnsafeNativeMethods
.SERVICE_QUERY_STATUS);
412
bool success =
ListenerUnsafeNativeMethods
.QueryServiceStatusEx(service,
ListenerUnsafeNativeMethods
.SC_STATUS_PROCESS_INFO, null, 0, out lpnLengthNeeded);
416
if (errorCode !=
ListenerUnsafeNativeMethods
.ERROR_INSUFFICIENT_BUFFER)
423
success =
ListenerUnsafeNativeMethods
.QueryServiceStatusEx(service,
ListenerUnsafeNativeMethods
.SC_STATUS_PROCESS_INFO, serviceStatusProcess, serviceStatusProcess.Length, out lpnLengthNeeded);
430
return (
ListenerUnsafeNativeMethods
.SERVICE_STATUS_PROCESS)Marshal.PtrToStructure((IntPtr)pServiceStatusProcess, typeof(
ListenerUnsafeNativeMethods
.SERVICE_STATUS_PROCESS));
System\ServiceModel\Channels\PipeConnection.cs (3)
640
SafeCloseHandle targetProcessHandle =
ListenerUnsafeNativeMethods
.OpenProcess(
ListenerUnsafeNativeMethods
.PROCESS_DUP_HANDLE, false, targetProcessId);
650
IntPtr sourceProcessHandle =
ListenerUnsafeNativeMethods
.GetCurrentProcess();
System\ServiceModel\Channels\SharedConnectionListener.cs (4)
1528
ListenerUnsafeNativeMethods
.ICorRuntimeHost corRuntimeHost;
1530
corRuntimeHost = (
ListenerUnsafeNativeMethods
.ICorRuntimeHost)System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeInterfaceAsObject(rclsid, riid);
1592
Utility.AddRightGrantedToAccount(new SecurityIdentifier(grantedSid),
ListenerUnsafeNativeMethods
.PROCESS_DUP_HANDLE);
1604
Utility.RemoveRightGrantedToAccount(new SecurityIdentifier(grantedSid),
ListenerUnsafeNativeMethods
.PROCESS_DUP_HANDLE);
System\ServiceModel\Channels\UnsafeNativeMethods.cs (1)
24
using TOKEN_INFORMATION_CLASS = System.ServiceModel.Activation.
ListenerUnsafeNativeMethods
.TOKEN_INFORMATION_CLASS;