106 references to Interop
System.Security.AccessControl (106)
_generated\0\LibraryImports.g.cs (9)
7
internal static partial bool LookupPrivilegeValue(string lpSystemName, string lpName, out global::
Interop
.Advapi32.LUID lpLuid)
14
fixed (global::
Interop
.Advapi32.LUID* __lpLuid_native = &lpLuid)
30
static extern unsafe int __PInvoke(ushort* __lpSystemName_native, ushort* __lpName_native, global::
Interop
.Advapi32.LUID* __lpLuid_native);
468
internal static unsafe partial bool AdjustTokenPrivileges(global::Microsoft.Win32.SafeHandles.SafeTokenHandle TokenHandle, bool DisableAllPrivileges, global::
Interop
.Advapi32.TOKEN_PRIVILEGE* NewState, uint BufferLength, global::
Interop
.Advapi32.TOKEN_PRIVILEGE* PreviousState, uint* ReturnLength)
504
static extern unsafe int __PInvoke(nint __TokenHandle_native, int __DisableAllPrivileges_native, global::
Interop
.Advapi32.TOKEN_PRIVILEGE* __NewState_native, uint __BufferLength_native, global::
Interop
.Advapi32.TOKEN_PRIVILEGE* __PreviousState_native, uint* __ReturnLength_native);
513
internal static partial bool DuplicateTokenEx(global::Microsoft.Win32.SafeHandles.SafeTokenHandle ExistingTokenHandle, global::System.Security.Principal.TokenAccessLevels DesiredAccess, nint TokenAttributes, global::
Interop
.Advapi32.SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, global::System.Security.Principal.TokenType TokenType, ref global::Microsoft.Win32.SafeHandles.SafeTokenHandle DuplicateTokenHandle)
564
static extern unsafe int __PInvoke(nint __ExistingTokenHandle_native, global::System.Security.Principal.TokenAccessLevels __DesiredAccess_native, nint __TokenAttributes_native, global::
Interop
.Advapi32.SECURITY_IMPERSONATION_LEVEL __ImpersonationLevel_native, global::System.Security.Principal.TokenType __TokenType_native, nint* __DuplicateTokenHandle_native);
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ConvertSdToStringSd.cs (1)
12
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "ConvertSecurityDescriptorToStringSecurityDescriptorW",
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ConvertStringSdToSd.cs (1)
12
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "ConvertStringSecurityDescriptorToSecurityDescriptorW",
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.DuplicateTokenEx_SafeTokenHandle.cs (1)
14
[LibraryImport(
Interop
.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetSecurityInfoByHandle.cs (1)
12
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "GetSecurityInfo")]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetSecurityInfoByName.cs (1)
12
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "GetNamedSecurityInfoW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.OpenThreadToken_SafeTokenHandle.cs (1)
14
[LibraryImport(
Interop
.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.RevertToSelf.cs (1)
12
[LibraryImport(
Interop
.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.SetSecurityInfoByHandle.cs (1)
12
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "SetSecurityInfo", SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.SetSecurityInfoByName.cs (1)
12
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "SetNamedSecurityInfoW",
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.GetCurrentThread.cs (1)
12
[LibraryImport(
Interop
.Libraries.Kernel32)]
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeTokenHandle.cs (1)
35
return
Interop
.Kernel32.CloseHandle(handle);
System\Security\AccessControl\NativeObjectSecurity.cs (18)
90
if (error !=
Interop
.Errors.ERROR_SUCCESS)
101
if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED)
105
else if (error ==
Interop
.Errors.ERROR_INVALID_OWNER)
109
else if (error ==
Interop
.Errors.ERROR_INVALID_PRIMARY_GROUP)
113
else if (error ==
Interop
.Errors.ERROR_INVALID_PARAMETER)
117
else if (error ==
Interop
.Errors.ERROR_INVALID_NAME)
121
else if (error ==
Interop
.Errors.ERROR_FILE_NOT_FOUND)
125
else if (error ==
Interop
.Errors.ERROR_PATH_NOT_FOUND)
133
else if (error ==
Interop
.Errors.ERROR_NO_SECURITY_ON_OBJECT)
137
else if (error ==
Interop
.Errors.ERROR_PIPE_NOT_CONNECTED)
236
if (error !=
Interop
.Errors.ERROR_SUCCESS)
247
if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED)
251
else if (error ==
Interop
.Errors.ERROR_INVALID_OWNER)
255
else if (error ==
Interop
.Errors.ERROR_INVALID_PRIMARY_GROUP)
259
else if (error ==
Interop
.Errors.ERROR_INVALID_NAME)
263
else if (error ==
Interop
.Errors.ERROR_INVALID_HANDLE)
267
else if (error ==
Interop
.Errors.ERROR_FILE_NOT_FOUND)
271
else if (error ==
Interop
.Errors.ERROR_NO_SECURITY_ON_OBJECT)
System\Security\AccessControl\Privilege.cs (33)
16
using Luid =
Interop
.Advapi32.LUID;
92
if (!
Interop
.Advapi32.LookupPrivilegeValue(null, privilege, out luid))
96
if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
100
else if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED)
104
else if (error ==
Interop
.Errors.ERROR_NO_SUCH_PRIVILEGE)
164
if (!
Interop
.Advapi32.OpenProcessToken(
165
Interop
.Kernel32.GetCurrentProcess(),
194
if (error !=
Interop
.Errors.ERROR_NO_TOKEN)
204
if (!
Interop
.Advapi32.DuplicateTokenEx(
208
Interop
.Advapi32.SECURITY_IMPERSONATION_LEVEL.SecurityImpersonation,
251
if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
255
else if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED ||
256
error ==
Interop
.Errors.ERROR_CANT_OPEN_ANONYMOUS)
296
Interop
.Advapi32.RevertToSelf();
397
Interop
.Advapi32.TOKEN_PRIVILEGE newState;
400
newState.Privileges.Attributes = enable ?
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_ENABLED :
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_DISABLED;
402
Interop
.Advapi32.TOKEN_PRIVILEGE previousState = default;
406
if (!
Interop
.Advapi32.AdjustTokenPrivileges(
410
(uint)sizeof(
Interop
.Advapi32.TOKEN_PRIVILEGE),
416
else if (
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED == Marshal.GetLastPInvokeError())
418
error =
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED;
423
_initialState = ((previousState.Privileges.Attributes &
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_ENABLED) != 0);
440
if (error ==
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED)
444
if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
448
else if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED ||
449
error ==
Interop
.Errors.ERROR_CANT_OPEN_ANONYMOUS)
484
Interop
.Advapi32.TOKEN_PRIVILEGE newState;
487
newState.Privileges.Attributes = (_initialState ?
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_ENABLED :
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_DISABLED);
489
if (!
Interop
.Advapi32.AdjustTokenPrivileges(
510
if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
514
else if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED)
System\Security\AccessControl\SecurityDescriptor.cs (11)
180
if (error ==
Interop
.Errors.ERROR_INVALID_PARAMETER ||
181
error ==
Interop
.Errors.ERROR_UNKNOWN_REVISION)
187
else if (error !=
Interop
.Errors.ERROR_SUCCESS)
455
if (!
Interop
.Advapi32.ConvertStringSdToSd(
463
if (error ==
Interop
.Errors.ERROR_INVALID_PARAMETER ||
464
error ==
Interop
.Errors.ERROR_INVALID_ACL ||
465
error ==
Interop
.Errors.ERROR_INVALID_SECURITY_DESCR ||
466
error ==
Interop
.Errors.ERROR_UNKNOWN_REVISION)
472
else if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
476
else if (error ==
Interop
.Errors.ERROR_INVALID_SID)
482
else if (error !=
Interop
.Errors.ERROR_SUCCESS)
System\Security\AccessControl\Win32.cs (21)
30
if (!
Interop
.Advapi32.ConvertSdToStringSd(binaryForm, (uint)requestedRevision, (uint)si, out ByteArray, ref ByteArraySize))
48
if (errorCode ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
109
errorCode = (int)
Interop
.Advapi32.GetSecurityInfoByName(name, (uint)resourceType, (uint)SecurityInfos, out SidOwner, out SidGroup, out Dacl, out Sacl, out ByteArray);
121
errorCode = (int)
Interop
.Advapi32.GetSecurityInfoByHandle(handle, (uint)resourceType, (uint)SecurityInfos, &SidOwner, &SidGroup, &Dacl, &Sacl, &ByteArray);
132
if (errorCode ==
Interop
.Errors.ERROR_SUCCESS && IntPtr.Zero.Equals(ByteArray))
138
else if (errorCode ==
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED ||
139
errorCode ==
Interop
.Errors.ERROR_PRIVILEGE_NOT_HELD)
143
else if (errorCode ==
Interop
.Errors.ERROR_ACCESS_DENIED ||
144
errorCode ==
Interop
.Errors.ERROR_CANT_OPEN_ANONYMOUS)
149
if (errorCode !=
Interop
.Errors.ERROR_SUCCESS)
166
uint Length =
Interop
.Advapi32.GetSecurityDescriptorLength(ByteArray);
176
return
Interop
.Errors.ERROR_SUCCESS;
180
if (errorCode ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
255
errorCode = (int)
Interop
.Advapi32.SetSecurityInfoByName(name, (uint)type, unchecked((uint)securityInformation), OwnerBinary, GroupBinary, DaclBinary, SaclBinary);
267
errorCode = (int)
Interop
.Advapi32.SetSecurityInfoByHandle(handle, (uint)type, (uint)securityInformation, OwnerBinary, GroupBinary, DaclBinary, SaclBinary);
277
if (errorCode ==
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED ||
278
errorCode ==
Interop
.Errors.ERROR_PRIVILEGE_NOT_HELD)
282
else if (errorCode ==
Interop
.Errors.ERROR_ACCESS_DENIED ||
283
errorCode ==
Interop
.Errors.ERROR_CANT_OPEN_ANONYMOUS)
287
else if (errorCode !=
Interop
.Errors.ERROR_SUCCESS)
307
if (errorCode ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
System\Security\Principal\Win32.cs (3)
25
if (!
Interop
.Advapi32.OpenThreadToken((IntPtr)(-2), dwDesiredAccess, openAsSelf, out phThreadToken))
32
if (!
Interop
.Advapi32.OpenThreadToken((IntPtr)(-2), dwDesiredAccess, openAsSelf, out phThreadToken))
52
if (!
Interop
.Advapi32.SetThreadToken(IntPtr.Zero, hToken))