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)
29
static extern unsafe int __PInvoke(ushort* __lpSystemName_native, ushort* __lpName_native, global::
Interop
.Advapi32.LUID* __lpLuid_native);
456
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)
491
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);
500
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)
550
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)
11
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "ConvertSecurityDescriptorToStringSecurityDescriptorW",
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ConvertStringSdToSd.cs (1)
11
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "ConvertStringSecurityDescriptorToSecurityDescriptorW",
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.DuplicateTokenEx_SafeTokenHandle.cs (1)
13
[LibraryImport(
Interop
.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetSecurityInfoByHandle.cs (1)
11
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "GetSecurityInfo")]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetSecurityInfoByName.cs (1)
11
[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)
13
[LibraryImport(
Interop
.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.RevertToSelf.cs (1)
11
[LibraryImport(
Interop
.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.SetSecurityInfoByHandle.cs (1)
11
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "SetSecurityInfo", SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.SetSecurityInfoByName.cs (1)
11
[LibraryImport(
Interop
.Libraries.Advapi32, EntryPoint = "SetNamedSecurityInfoW",
src\runtime\src\libraries\Common\src\Interop\Windows\Kernel32\Interop.GetCurrentThread.cs (1)
11
[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)
113
if (error !=
Interop
.Errors.ERROR_SUCCESS)
124
if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED)
128
else if (error ==
Interop
.Errors.ERROR_INVALID_OWNER)
132
else if (error ==
Interop
.Errors.ERROR_INVALID_PRIMARY_GROUP)
136
else if (error ==
Interop
.Errors.ERROR_INVALID_PARAMETER)
140
else if (error ==
Interop
.Errors.ERROR_INVALID_NAME)
144
else if (error ==
Interop
.Errors.ERROR_FILE_NOT_FOUND)
148
else if (error ==
Interop
.Errors.ERROR_PATH_NOT_FOUND)
156
else if (error ==
Interop
.Errors.ERROR_NO_SECURITY_ON_OBJECT)
160
else if (error ==
Interop
.Errors.ERROR_PIPE_NOT_CONNECTED)
265
if (error !=
Interop
.Errors.ERROR_SUCCESS)
276
if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED)
280
else if (error ==
Interop
.Errors.ERROR_INVALID_OWNER)
284
else if (error ==
Interop
.Errors.ERROR_INVALID_PRIMARY_GROUP)
288
else if (error ==
Interop
.Errors.ERROR_INVALID_NAME)
292
else if (error ==
Interop
.Errors.ERROR_INVALID_HANDLE)
296
else if (error ==
Interop
.Errors.ERROR_FILE_NOT_FOUND)
300
else if (error ==
Interop
.Errors.ERROR_NO_SECURITY_ON_OBJECT)
System\Security\AccessControl\Privilege.cs (33)
16
using Luid =
Interop
.Advapi32.LUID;
98
if (!
Interop
.Advapi32.LookupPrivilegeValue(null, privilege, out luid))
102
if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
106
else if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED)
110
else if (error ==
Interop
.Errors.ERROR_NO_SUCH_PRIVILEGE)
172
if (!
Interop
.Advapi32.OpenProcessToken(
173
Interop
.Kernel32.GetCurrentProcess(),
205
if (error !=
Interop
.Errors.ERROR_NO_TOKEN)
215
if (!
Interop
.Advapi32.DuplicateTokenEx(
219
Interop
.Advapi32.SECURITY_IMPERSONATION_LEVEL.SecurityImpersonation,
262
if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
266
else if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED ||
267
error ==
Interop
.Errors.ERROR_CANT_OPEN_ANONYMOUS)
310
Interop
.Advapi32.RevertToSelf();
436
Interop
.Advapi32.TOKEN_PRIVILEGE newState;
439
newState.Privileges.Attributes = enable ?
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_ENABLED :
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_DISABLED;
441
Interop
.Advapi32.TOKEN_PRIVILEGE previousState = default;
448
if (!
Interop
.Advapi32.AdjustTokenPrivileges(
452
(uint)sizeof(
Interop
.Advapi32.TOKEN_PRIVILEGE),
458
else if (
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED == Marshal.GetLastPInvokeError())
460
error =
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED;
468
this.initialState = ((previousState.Privileges.Attributes &
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_ENABLED) != 0);
491
if (error ==
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED)
495
if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
499
else if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED ||
500
error ==
Interop
.Errors.ERROR_CANT_OPEN_ANONYMOUS)
538
Interop
.Advapi32.TOKEN_PRIVILEGE newState;
541
newState.Privileges.Attributes = (this.initialState ?
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_ENABLED :
Interop
.Advapi32.SEPrivileges.SE_PRIVILEGE_DISABLED);
543
if (!
Interop
.Advapi32.AdjustTokenPrivileges(
564
if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
568
else if (error ==
Interop
.Errors.ERROR_ACCESS_DENIED)
System\Security\AccessControl\SecurityDescriptor.cs (11)
237
if (error ==
Interop
.Errors.ERROR_INVALID_PARAMETER ||
238
error ==
Interop
.Errors.ERROR_UNKNOWN_REVISION)
247
else if (error !=
Interop
.Errors.ERROR_SUCCESS)
617
if (!
Interop
.Advapi32.ConvertStringSdToSd(
625
if (error ==
Interop
.Errors.ERROR_INVALID_PARAMETER ||
626
error ==
Interop
.Errors.ERROR_INVALID_ACL ||
627
error ==
Interop
.Errors.ERROR_INVALID_SECURITY_DESCR ||
628
error ==
Interop
.Errors.ERROR_UNKNOWN_REVISION)
634
else if (error ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
638
else if (error ==
Interop
.Errors.ERROR_INVALID_SID)
644
else if (error !=
Interop
.Errors.ERROR_SUCCESS)
System\Security\AccessControl\Win32.cs (21)
33
if (!
Interop
.Advapi32.ConvertSdToStringSd(binaryForm, (uint)requestedRevision, (uint)si, out ByteArray, ref ByteArraySize))
57
if (errorCode ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
121
errorCode = (int)
Interop
.Advapi32.GetSecurityInfoByName(name, (uint)resourceType, (uint)SecurityInfos, out SidOwner, out SidGroup, out Dacl, out Sacl, out ByteArray);
133
errorCode = (int)
Interop
.Advapi32.GetSecurityInfoByHandle(handle, (uint)resourceType, (uint)SecurityInfos, &SidOwner, &SidGroup, &Dacl, &Sacl, &ByteArray);
144
if (errorCode ==
Interop
.Errors.ERROR_SUCCESS && IntPtr.Zero.Equals(ByteArray))
152
else if (errorCode ==
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED ||
153
errorCode ==
Interop
.Errors.ERROR_PRIVILEGE_NOT_HELD)
157
else if (errorCode ==
Interop
.Errors.ERROR_ACCESS_DENIED ||
158
errorCode ==
Interop
.Errors.ERROR_CANT_OPEN_ANONYMOUS)
163
if (errorCode !=
Interop
.Errors.ERROR_SUCCESS)
183
uint Length =
Interop
.Advapi32.GetSecurityDescriptorLength(ByteArray);
193
return
Interop
.Errors.ERROR_SUCCESS;
197
if (errorCode ==
Interop
.Errors.ERROR_NOT_ENOUGH_MEMORY)
278
errorCode = (int)
Interop
.Advapi32.SetSecurityInfoByName(name, (uint)type, unchecked((uint)securityInformation), OwnerBinary, GroupBinary, DaclBinary, SaclBinary);
290
errorCode = (int)
Interop
.Advapi32.SetSecurityInfoByHandle(handle, (uint)type, (uint)securityInformation, OwnerBinary, GroupBinary, DaclBinary, SaclBinary);
300
if (errorCode ==
Interop
.Errors.ERROR_NOT_ALL_ASSIGNED ||
301
errorCode ==
Interop
.Errors.ERROR_PRIVILEGE_NOT_HELD)
305
else if (errorCode ==
Interop
.Errors.ERROR_ACCESS_DENIED ||
306
errorCode ==
Interop
.Errors.ERROR_CANT_OPEN_ANONYMOUS)
310
else if (errorCode !=
Interop
.Errors.ERROR_SUCCESS)
330
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))