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