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) 30static extern unsafe int __PInvoke(ushort* __lpSystemName_native, ushort* __lpName_native, global::Interop.Advapi32.LUID* __lpLuid_native); 468internal 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) 504static 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); 513internal 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) 564static 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)
35return Interop.Kernel32.CloseHandle(handle);
System\Security\AccessControl\NativeObjectSecurity.cs (18)
90if (error != Interop.Errors.ERROR_SUCCESS) 101if (error == Interop.Errors.ERROR_ACCESS_DENIED) 105else if (error == Interop.Errors.ERROR_INVALID_OWNER) 109else if (error == Interop.Errors.ERROR_INVALID_PRIMARY_GROUP) 113else if (error == Interop.Errors.ERROR_INVALID_PARAMETER) 117else if (error == Interop.Errors.ERROR_INVALID_NAME) 121else if (error == Interop.Errors.ERROR_FILE_NOT_FOUND) 125else if (error == Interop.Errors.ERROR_PATH_NOT_FOUND) 133else if (error == Interop.Errors.ERROR_NO_SECURITY_ON_OBJECT) 137else if (error == Interop.Errors.ERROR_PIPE_NOT_CONNECTED) 236if (error != Interop.Errors.ERROR_SUCCESS) 247if (error == Interop.Errors.ERROR_ACCESS_DENIED) 251else if (error == Interop.Errors.ERROR_INVALID_OWNER) 255else if (error == Interop.Errors.ERROR_INVALID_PRIMARY_GROUP) 259else if (error == Interop.Errors.ERROR_INVALID_NAME) 263else if (error == Interop.Errors.ERROR_INVALID_HANDLE) 267else if (error == Interop.Errors.ERROR_FILE_NOT_FOUND) 271else if (error == Interop.Errors.ERROR_NO_SECURITY_ON_OBJECT)
System\Security\AccessControl\Privilege.cs (33)
16using Luid = Interop.Advapi32.LUID; 92if (!Interop.Advapi32.LookupPrivilegeValue(null, privilege, out luid)) 96if (error == Interop.Errors.ERROR_NOT_ENOUGH_MEMORY) 100else if (error == Interop.Errors.ERROR_ACCESS_DENIED) 104else if (error == Interop.Errors.ERROR_NO_SUCH_PRIVILEGE) 164if (!Interop.Advapi32.OpenProcessToken( 165Interop.Kernel32.GetCurrentProcess(), 194if (error != Interop.Errors.ERROR_NO_TOKEN) 204if (!Interop.Advapi32.DuplicateTokenEx( 208Interop.Advapi32.SECURITY_IMPERSONATION_LEVEL.SecurityImpersonation, 251if (error == Interop.Errors.ERROR_NOT_ENOUGH_MEMORY) 255else if (error == Interop.Errors.ERROR_ACCESS_DENIED || 256error == Interop.Errors.ERROR_CANT_OPEN_ANONYMOUS) 296Interop.Advapi32.RevertToSelf(); 397Interop.Advapi32.TOKEN_PRIVILEGE newState; 400newState.Privileges.Attributes = enable ? Interop.Advapi32.SEPrivileges.SE_PRIVILEGE_ENABLED : Interop.Advapi32.SEPrivileges.SE_PRIVILEGE_DISABLED; 402Interop.Advapi32.TOKEN_PRIVILEGE previousState = default; 406if (!Interop.Advapi32.AdjustTokenPrivileges( 410(uint)sizeof(Interop.Advapi32.TOKEN_PRIVILEGE), 416else if (Interop.Errors.ERROR_NOT_ALL_ASSIGNED == Marshal.GetLastPInvokeError()) 418error = Interop.Errors.ERROR_NOT_ALL_ASSIGNED; 423_initialState = ((previousState.Privileges.Attributes & Interop.Advapi32.SEPrivileges.SE_PRIVILEGE_ENABLED) != 0); 440if (error == Interop.Errors.ERROR_NOT_ALL_ASSIGNED) 444if (error == Interop.Errors.ERROR_NOT_ENOUGH_MEMORY) 448else if (error == Interop.Errors.ERROR_ACCESS_DENIED || 449error == Interop.Errors.ERROR_CANT_OPEN_ANONYMOUS) 484Interop.Advapi32.TOKEN_PRIVILEGE newState; 487newState.Privileges.Attributes = (_initialState ? Interop.Advapi32.SEPrivileges.SE_PRIVILEGE_ENABLED : Interop.Advapi32.SEPrivileges.SE_PRIVILEGE_DISABLED); 489if (!Interop.Advapi32.AdjustTokenPrivileges( 510if (error == Interop.Errors.ERROR_NOT_ENOUGH_MEMORY) 514else if (error == Interop.Errors.ERROR_ACCESS_DENIED)
System\Security\AccessControl\SecurityDescriptor.cs (11)
180if (error == Interop.Errors.ERROR_INVALID_PARAMETER || 181error == Interop.Errors.ERROR_UNKNOWN_REVISION) 187else if (error != Interop.Errors.ERROR_SUCCESS) 455if (!Interop.Advapi32.ConvertStringSdToSd( 463if (error == Interop.Errors.ERROR_INVALID_PARAMETER || 464error == Interop.Errors.ERROR_INVALID_ACL || 465error == Interop.Errors.ERROR_INVALID_SECURITY_DESCR || 466error == Interop.Errors.ERROR_UNKNOWN_REVISION) 472else if (error == Interop.Errors.ERROR_NOT_ENOUGH_MEMORY) 476else if (error == Interop.Errors.ERROR_INVALID_SID) 482else if (error != Interop.Errors.ERROR_SUCCESS)
System\Security\AccessControl\Win32.cs (21)
30if (!Interop.Advapi32.ConvertSdToStringSd(binaryForm, (uint)requestedRevision, (uint)si, out ByteArray, ref ByteArraySize)) 48if (errorCode == Interop.Errors.ERROR_NOT_ENOUGH_MEMORY) 109errorCode = (int)Interop.Advapi32.GetSecurityInfoByName(name, (uint)resourceType, (uint)SecurityInfos, out SidOwner, out SidGroup, out Dacl, out Sacl, out ByteArray); 121errorCode = (int)Interop.Advapi32.GetSecurityInfoByHandle(handle, (uint)resourceType, (uint)SecurityInfos, &SidOwner, &SidGroup, &Dacl, &Sacl, &ByteArray); 132if (errorCode == Interop.Errors.ERROR_SUCCESS && IntPtr.Zero.Equals(ByteArray)) 138else if (errorCode == Interop.Errors.ERROR_NOT_ALL_ASSIGNED || 139errorCode == Interop.Errors.ERROR_PRIVILEGE_NOT_HELD) 143else if (errorCode == Interop.Errors.ERROR_ACCESS_DENIED || 144errorCode == Interop.Errors.ERROR_CANT_OPEN_ANONYMOUS) 149if (errorCode != Interop.Errors.ERROR_SUCCESS) 166uint Length = Interop.Advapi32.GetSecurityDescriptorLength(ByteArray); 176return Interop.Errors.ERROR_SUCCESS; 180if (errorCode == Interop.Errors.ERROR_NOT_ENOUGH_MEMORY) 255errorCode = (int)Interop.Advapi32.SetSecurityInfoByName(name, (uint)type, unchecked((uint)securityInformation), OwnerBinary, GroupBinary, DaclBinary, SaclBinary); 267errorCode = (int)Interop.Advapi32.SetSecurityInfoByHandle(handle, (uint)type, (uint)securityInformation, OwnerBinary, GroupBinary, DaclBinary, SaclBinary); 277if (errorCode == Interop.Errors.ERROR_NOT_ALL_ASSIGNED || 278errorCode == Interop.Errors.ERROR_PRIVILEGE_NOT_HELD) 282else if (errorCode == Interop.Errors.ERROR_ACCESS_DENIED || 283errorCode == Interop.Errors.ERROR_CANT_OPEN_ANONYMOUS) 287else if (errorCode != Interop.Errors.ERROR_SUCCESS) 307if (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))