408 references to Interop
System.DirectoryServices (408)
_generated\0\LibraryImports.g.cs (48)
129internal static partial global::Interop.BOOL ConvertSidToStringSid(nint sid, out string stringSid) 135global::Interop.BOOL __retVal = default; 161static extern unsafe global::Interop.BOOL __PInvoke(nint __sid_native, ushort** __stringSid_native); 171internal static unsafe partial global::Interop.BOOL ConvertStringSidToSid(string StringSid, out void* Sid) 175global::Interop.BOOL __retVal; 189static extern unsafe global::Interop.BOOL __PInvoke(ushort* __StringSid_native, void** __Sid_native); 446internal static partial uint LsaCreateTrustedDomainEx(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX domainEx, in global::Interop.Advapi32.TRUSTED_DOMAIN_AUTH_INFORMATION authInfo, int desiredAccess, out nint domainHandle) 459fixed (global::Interop.Advapi32.TRUSTED_DOMAIN_AUTH_INFORMATION* __authInfo_native = &authInfo) 460fixed (global::Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX* __domainEx_native = &domainEx) 476static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX* __domainEx_native, global::Interop.Advapi32.TRUSTED_DOMAIN_AUTH_INFORMATION* __authInfo_native, int __desiredAccess_native, nint* __domainHandle_native); 553private static partial uint LsaOpenPolicy(ref global::Interop.UNICODE_STRING SystemName, ref global::Interop.OBJECT_ATTRIBUTES ObjectAttributes, int AccessMask, out global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle PolicyHandle) 565fixed (global::Interop.OBJECT_ATTRIBUTES* __ObjectAttributes_native = &ObjectAttributes) 566fixed (global::Interop.UNICODE_STRING* __SystemName_native = &SystemName) 592static extern unsafe uint __PInvoke(global::Interop.UNICODE_STRING* __SystemName_native, global::Interop.OBJECT_ATTRIBUTES* __ObjectAttributes_native, int __AccessMask_native, nint* __PolicyHandle_native); 624internal static partial uint LsaQueryForestTrustInformation(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.UNICODE_STRING target, ref nint ForestTrustInfo) 636fixed (global::Interop.UNICODE_STRING* __target_native = &target) 652static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.UNICODE_STRING* __target_native, nint* __ForestTrustInfo_native); 662internal static partial uint LsaQueryTrustedDomainInfoByName(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.UNICODE_STRING trustedDomain, global::Interop.Advapi32.TRUSTED_INFORMATION_CLASS infoClass, ref nint buffer) 674fixed (global::Interop.UNICODE_STRING* __trustedDomain_native = &trustedDomain) 690static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.UNICODE_STRING* __trustedDomain_native, global::Interop.Advapi32.TRUSTED_INFORMATION_CLASS __infoClass_native, nint* __buffer_native); 700internal static partial uint LsaSetForestTrustInformation(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.UNICODE_STRING target, nint forestTrustInfo, bool checkOnly, out nint collisionInfo) 715fixed (global::Interop.UNICODE_STRING* __target_native = &target) 731static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.UNICODE_STRING* __target_native, nint __forestTrustInfo_native, byte __checkOnly_native, nint* __collisionInfo_native); 741internal static partial uint LsaSetTrustedDomainInfoByName(global::Microsoft.Win32.SafeHandles.SafeLsaPolicyHandle handle, in global::Interop.UNICODE_STRING trustedDomain, global::Interop.Advapi32.TRUSTED_INFORMATION_CLASS infoClass, nint buffer) 752fixed (global::Interop.UNICODE_STRING* __trustedDomain_native = &trustedDomain) 768static extern unsafe uint __PInvoke(nint __handle_native, global::Interop.UNICODE_STRING* __trustedDomain_native, global::Interop.Advapi32.TRUSTED_INFORMATION_CLASS __infoClass_native, nint __buffer_native); 1153internal static partial int DsEnumerateDomainTrustsW(string serverName, global::Interop.Netapi32.DS_DOMAINTRUST_FLAG flags, out nint domains, out int count) 1169static extern unsafe int __PInvoke(ushort* __serverName_native, global::Interop.Netapi32.DS_DOMAINTRUST_FLAG __flags_native, nint* __domains_native, int* __count_native); 1321internal static partial int DsRoleGetPrimaryDomainInformation(string lpServer, global::Interop.Netapi32.DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel, out nint Buffer) 1335static extern unsafe int __PInvoke(ushort* __lpServer_native, global::Interop.Netapi32.DSROLE_PRIMARY_DOMAIN_INFO_LEVEL __InfoLevel_native, nint* __Buffer_native); 1353internal static partial void RtlInitUnicodeString(out global::Interop.UNICODE_STRING result, nint s) 1357fixed (global::Interop.UNICODE_STRING* __result_native = &result) 1364static extern unsafe void __PInvoke(global::Interop.UNICODE_STRING* __result_native, nint __s_native); 1374internal static partial uint LsaCallAuthenticationPackage(global::Interop.Secur32.LsaLogonProcessSafeHandle lsaHandle, int authenticationPackage, in global::Interop.Secur32.NegotiateCallerNameRequest protocolSubmitBuffer, int submitBufferLength, out nint protocolReturnBuffer, out int returnBufferLength, out uint protocolStatus) 1382global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.Secur32.LsaLogonProcessSafeHandle>.ManagedToUnmanagedIn __lsaHandle_native__marshaller = new(); 1391fixed (global::Interop.Secur32.NegotiateCallerNameRequest* __protocolSubmitBuffer_native = &protocolSubmitBuffer) 1407static extern unsafe uint __PInvoke(nint __lsaHandle_native, int __authenticationPackage_native, global::Interop.Secur32.NegotiateCallerNameRequest* __protocolSubmitBuffer_native, int __submitBufferLength_native, nint* __protocolReturnBuffer_native, int* __returnBufferLength_native, uint* __protocolStatus_native); 1417internal static partial uint LsaConnectUntrusted(out global::Interop.Secur32.LsaLogonProcessSafeHandle lsaHandle) 1424global::System.Runtime.InteropServices.Marshalling.SafeHandleMarshaller<global::Interop.Secur32.LsaLogonProcessSafeHandle>.ManagedToUnmanagedOut __lsaHandle_native__marshaller = new();
Interop\UnsafeNativeMethods.cs (1)
19int hr = global::Interop.Activeds.ADsOpenObject(path, userName, password, flags, ref iid, out ppObjectNative);
src\runtime\src\libraries\Common\src\Interop\Windows\Activeds\Interop.ADsOpenObject.cs (1)
11[LibraryImport(Interop.Libraries.Activeds, StringMarshalling = StringMarshalling.Utf16)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.ConvertStringSidToSid.cs (1)
12[LibraryImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSidToSidW", SetLastError = true, StringMarshalling = StringMarshalling.Utf16)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.CopySid.cs (1)
11[LibraryImport(Interop.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.EqualDomainSid.cs (1)
11[LibraryImport(Interop.Libraries.Advapi32)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetLengthSid.cs (1)
11[LibraryImport(Interop.Libraries.Advapi32)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetSidIdentifierAuthority.cs (2)
25[LibraryImport(Interop.Libraries.Advapi32)] 28[LibraryImport(Interop.Libraries.Advapi32)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.GetTokenInformation.cs (1)
12[LibraryImport(Interop.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaClose.cs (1)
11[LibraryImport(Interop.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaFreeMemory.cs (1)
11[LibraryImport(Interop.Libraries.Advapi32, SetLastError = true)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaNtStatusToWinError.cs (1)
11[LibraryImport(Interop.Libraries.Advapi32, SetLastError = false)]
src\runtime\src\libraries\Common\src\Interop\Windows\Advapi32\Interop.LsaOpenPolicy.cs (1)
30[LibraryImport(Interop.Libraries.Advapi32, EntryPoint = "LsaOpenPolicy", SetLastError = true)]
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\Kernel32\Interop.GetCurrentThread.cs (1)
11[LibraryImport(Interop.Libraries.Kernel32)]
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeLibraryHandle.cs (1)
19return Interop.Kernel32.FreeLibrary(handle);
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeLsaPolicyHandle.cs (1)
20return Interop.Advapi32.LsaClose(handle) == 0;
src\runtime\src\libraries\Common\src\Microsoft\Win32\SafeHandles\SafeTokenHandle.cs (1)
35return Interop.Kernel32.CloseHandle(handle);
System\DirectoryServices\ActiveDirectory\ActiveDirectorySite.cs (4)
197int result = Interop.Netapi32.DsGetSiteName(null, ref ptr); 201if (result == Interop.Errors.ERROR_NO_SITENAME) 1309var dsListDomainsInSiteW = (delegate* unmanaged<IntPtr, char*, void**, int>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsListDomainsInSiteW"); 1353var dsFreeNameResultW = (delegate* unmanaged<void*, void>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsFreeNameResultW");
System\DirectoryServices\ActiveDirectory\ApplicationPartition.cs (2)
322if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 1167if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN)
System\DirectoryServices\ActiveDirectory\DirectoryContext.cs (26)
206if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 212if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 228else if (errorCode == Interop.Errors.ERROR_INVALID_DOMAINNAME) 255if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 261if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 277else if (errorCode == Interop.Errors.ERROR_INVALID_DOMAINNAME) 303if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 309if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 322else if (errorCode == Interop.Errors.ERROR_INVALID_DOMAINNAME) 471else if (errorCode != Interop.Errors.ERROR_NO_SUCH_DOMAIN) 551Interop.Secur32.NegotiateCallerNameRequest requestBuffer = default; 552int requestBufferLength = sizeof(Interop.Secur32.NegotiateCallerNameRequest); 560Interop.Secur32.LsaLogonProcessSafeHandle lsaHandle; 565result = Interop.Secur32.LsaConnectUntrusted(out lsaHandle); 574result = Interop.Secur32.LsaCallAuthenticationPackage(lsaHandle, 0, requestBuffer, requestBufferLength, out pResponseBuffer, out responseBufferLength, out protocolStatus); 592if (result == global::Interop.StatusOptions.STATUS_QUOTA_EXCEEDED) 596else if ((result == 0) && (global::Interop.Advapi32.LsaNtStatusToWinError(protocolStatus) == Interop.Errors.ERROR_NO_SUCH_LOGON_SESSION)) 610throw ExceptionHelper.GetExceptionFromErrorCode((int)global::Interop.Advapi32.LsaNtStatusToWinError((result != 0) ? result : protocolStatus)); 618Interop.Secur32.LsaFreeReturnBuffer(pResponseBuffer); 622else if (result == global::Interop.StatusOptions.STATUS_QUOTA_EXCEEDED) 628throw ExceptionHelper.GetExceptionFromErrorCode((int)global::Interop.Advapi32.LsaNtStatusToWinError(result)); 656if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 660if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 686IntPtr tempHandle = global::Interop.Kernel32.LoadLibrary(systemPath + "\\ntdsapi.dll"); 699tempHandle = global::Interop.Kernel32.LoadLibrary(windowsDirectory.FullName + "\\ADAM\\ntdsapi.dll");
System\DirectoryServices\ActiveDirectory\DirectoryServer.cs (12)
285var replicaConsistencyCheck = (delegate* unmanaged<IntPtr, int, int, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsReplicaConsistencyCheck"); 305var dsReplicaGetInfo2W = (delegate* unmanaged<IntPtr, int, char*, IntPtr, char*, char*, int, int, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsReplicaGetInfo2W"); 309var dsReplicaGetInfoW = (delegate* unmanaged<IntPtr, int, char*, IntPtr, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsReplicaGetInfoW"); 333var dsReplicaGetInfoW = (delegate* unmanaged<IntPtr, int, char*, IntPtr, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsReplicaGetInfoW"); 353if (result == Interop.Errors.ERROR_DS_DRA_BAD_DN || result == Interop.Errors.ERROR_DS_NAME_UNPARSEABLE) 636var dsReplicaSyncAllW = (delegate* unmanaged<IntPtr, char*, int, IntPtr, IntPtr, void**, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsReplicaSyncAllW"); 672global::Interop.Kernel32.LocalFree(pErrors); 681var dsReplicaFreeInfo = (delegate* unmanaged<int, IntPtr, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsReplicaFreeInfo"); 719var dsReplicaSyncW = (delegate* unmanaged<IntPtr, char*, IntPtr, int, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsReplicaSyncW"); 737if (result == Interop.Errors.RPC_S_SERVER_UNAVAILABLE) 740else if (result == Interop.Errors.RPC_S_CALL_FAILED)
System\DirectoryServices\ActiveDirectory\Domain.cs (26)
531return TrustHelper.GetTrustedDomainInfoStatus(context, Name, targetDomainName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION, false); 544TrustHelper.SetTrustedDomainInfoStatus(context, Name, targetDomainName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION, enable, false); 557return TrustHelper.GetTrustedDomainInfoStatus(context, Name, targetDomainName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN, false); 570TrustHelper.SetTrustedDomainInfoStatus(context, Name, targetDomainName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN, enable, false); 1256error = Interop.Netapi32.DsEnumerateDomainTrustsW(serverName, Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_IN_FOREST | Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_OUTBOUND | Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_INBOUND, out domains, out count); 1280addr = IntPtr.Add(domains, +i * sizeof(Interop.Netapi32.DS_DOMAIN_TRUSTS)); 1281Interop.Netapi32.DS_DOMAIN_TRUSTS unmanagedTrust = *(Interop.Netapi32.DS_DOMAIN_TRUSTS*)addr; 1288Interop.Netapi32.DS_DOMAIN_TRUSTS unmanagedTrust = (Interop.Netapi32.DS_DOMAIN_TRUSTS)unmanagedTrustList[i]!; 1291if ((unmanagedTrust.Flags & (Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_PRIMARY | Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_OUTBOUND | Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_INBOUND)) == 0) 1324if (!sameTarget && (obj.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_PRIMARY) == 0) 1329if ((obj.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_PRIMARY) != 0) 1334if ((obj.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_TREE_ROOT) == 0) 1337Interop.Netapi32.DS_DOMAIN_TRUSTS parentTrust = (Interop.Netapi32.DS_DOMAIN_TRUSTS)unmanagedTrustList[obj.ParentIndex]!; 1373if ((tmpObject.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_IN_FOREST) != 0) 1381else if ((tmpObject.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_TREE_ROOT) != 0 && 1382(((TrustObject)tmpTrustList[localDomainIndex]!).Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_TREE_ROOT) != 0) 1408if ((tmpObject.TrustAttributes & (int)Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_FOREST_TRANSITIVE) != 0) 1425Interop.Netapi32.NetApiBufferFree(domains);
System\DirectoryServices\ActiveDirectory\DomainController.cs (7)
979if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 984if (errorCode == Interop.Errors.ERROR_INVALID_FLAGS) 1018if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 1060var dsGetDomainControllerInfo = (delegate* unmanaged<IntPtr, char*, int, int*, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsGetDomainControllerInfoW"); 1144var dsFreeDomainControllerInfo = (delegate* unmanaged<int, int, IntPtr, void>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsFreeDomainControllerInfoW"); 1232var dsListRoles = (delegate* unmanaged<IntPtr, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsListRolesW"); 1271var dsFreeNameResult = (delegate* unmanaged<IntPtr, void>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsFreeNameResultW");
System\DirectoryServices\ActiveDirectory\Exception.cs (12)
386if ((errorCode == Interop.Errors.ERROR_ACCESS_DENIED) || (errorCode == Interop.Errors.ERROR_DS_DRA_ACCESS_DENIED)) 390else if ((errorCode == Interop.Errors.ERROR_NOT_ENOUGH_MEMORY) || (errorCode == Interop.Errors.ERROR_OUTOFMEMORY) || (errorCode == Interop.Errors.ERROR_DS_DRA_OUT_OF_MEM) || (errorCode == Interop.Errors.RPC_S_OUT_OF_RESOURCES)) 394else if ((errorCode == Interop.Errors.ERROR_NO_LOGON_SERVERS) || (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) || (errorCode == Interop.Errors.RPC_S_SERVER_UNAVAILABLE) || (errorCode == Interop.Errors.RPC_S_CALL_FAILED)) 428if (error.dwWin32Err == Interop.Errors.ERROR_CANCELLED) 450if (error.dwWin32Err != Interop.Errors.ERROR_CANCELLED)
System\DirectoryServices\ActiveDirectory\Forest.cs (16)
343return TrustHelper.GetTrustedDomainInfoStatus(_context, Name, targetForestName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION, true); 356TrustHelper.SetTrustedDomainInfoStatus(_context, Name, targetForestName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION, enable, true); 369return TrustHelper.GetTrustedDomainInfoStatus(_context, Name, targetForestName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL, true); 382TrustHelper.SetTrustedDomainInfoStatus(_context, Name, targetForestName, Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL, enable, true); 852var dsListSites = (delegate* unmanaged<IntPtr, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsListSitesW"); 888var dsFreeNameResultW = (delegate* unmanaged<IntPtr, void>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsFreeNameResultW"); 1085error = Interop.Netapi32.DsEnumerateDomainTrustsW(serverName, Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_PRIMARY | Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_OUTBOUND | Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_INBOUND, out domains, out count); 1107addr = IntPtr.Add(domains, i * sizeof(Interop.Netapi32.DS_DOMAIN_TRUSTS)); 1108Interop.Netapi32.DS_DOMAIN_TRUSTS unmanagedTrust = *(Interop.Netapi32.DS_DOMAIN_TRUSTS*)addr; 1133if (unmanagedTrust.TrustType == TrustHelper.TRUST_TYPE_UPLEVEL && ((unmanagedTrust.TrustAttributes & (int)Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_FOREST_TRANSITIVE) != 0)) 1136if ((unmanagedTrust.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_PRIMARY) != 0) 1149Interop.Netapi32.NetApiBufferFree(domains);
System\DirectoryServices\ActiveDirectory\ForestTrustDomainInformation.cs (3)
30global::Interop.BOOL result = global::Interop.Advapi32.ConvertSidToStringSid(domainInfo.sid, out sidLocal); 31if (result == global::Interop.BOOL.FALSE)
System\DirectoryServices\ActiveDirectory\ForestTrustRelationshipInformation.cs (25)
22internal ForestTrustRelationshipInformation(DirectoryContext context, string source, Interop.Netapi32.DS_DOMAIN_TRUSTS unmanagedTrust, TrustType type) 39if ((unmanagedTrust.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_OUTBOUND) != 0 && 40(unmanagedTrust.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_INBOUND) != 0) 42else if ((unmanagedTrust.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_OUTBOUND) != 0) 44else if ((unmanagedTrust.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_INBOUND) != 0) 119Interop.Kernel32.GetSystemTimeAsFileTime(fileTime); 135Interop.NtDll.RtlInitUnicodeString(out record.TopLevelName, ptr); 165Interop.NtDll.RtlInitUnicodeString(out record.TopLevelName, ptr); 184global::Interop.BOOL result = global::Interop.Advapi32.ConvertStringSidToSid(tmp.DomainSid, out pSid); 185if (result == global::Interop.BOOL.FALSE) 251global::Interop.UNICODE_STRING trustedDomainName; 253Interop.NtDll.RtlInitUnicodeString(out trustedDomainName, target); 256uint error = Interop.Advapi32.LsaSetForestTrustInformation(handle, trustedDomainName, forestInfo, true, out collisionInfo); 259throw ExceptionHelper.GetExceptionFromErrorCode((int)global::Interop.Advapi32.LsaNtStatusToWinError(error), serverName); 269error = Interop.Advapi32.LsaSetForestTrustInformation(handle, trustedDomainName, forestInfo, false, out collisionInfo); 291global::Interop.Kernel32.LocalFree((void*)(nint)sidList[i]!); 305global::Interop.Advapi32.LsaFreeMemory(collisionInfo); 340global::Interop.UNICODE_STRING tmpName; 342Interop.NtDll.RtlInitUnicodeString(out tmpName, targetPtr); 352uint result = Interop.Advapi32.LsaQueryForestTrustInformation(handle, tmpName, ref forestTrustInfo); 356uint win32Error = global::Interop.Advapi32.LsaNtStatusToWinError(result); 381record.TopLevelName = *(global::Interop.UNICODE_STRING*)myPtr; 389record.TopLevelName = *(global::Interop.UNICODE_STRING*)myPtr; 420global::Interop.Advapi32.LsaFreeMemory(forestTrustInfo);
System\DirectoryServices\ActiveDirectory\GlobalCatalog.cs (3)
364if (error == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 381if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 386if (errorCode == Interop.Errors.ERROR_INVALID_FLAGS)
System\DirectoryServices\ActiveDirectory\Locator.cs (17)
45result = Interop.Netapi32.DsGetDcName(computerName, domainName, IntPtr.Zero, siteName, (int)(flags | (long)PrivateLocatorFlags.ReturnDNSName), out pDomainControllerInfo); 60result = Interop.Netapi32.NetApiBufferFree(pDomainControllerInfo); 96else if (errorCode == Interop.Errors.ERROR_NO_SUCH_DOMAIN) 141result = Interop.Netapi32.DsGetDcOpen(domainName, (int)optionFlags, siteName, IntPtr.Zero, null, (int)dcFlags, out retGetDcContext); 146result = Interop.Netapi32.DsGetDcNext(retGetDcContext, out sockAddressCountPtr, out sockAddressList, out dcDnsHostNamePtr); 148if (result != 0 && result != Interop.Errors.ERROR_FILEMARK_DETECTED && result != Interop.Errors.DNS_ERROR_RCODE_NAME_ERROR && result != Interop.Errors.ERROR_NO_MORE_ITEMS) 153while (result != Interop.Errors.ERROR_NO_MORE_ITEMS) 155if (result != Interop.Errors.ERROR_FILEMARK_DETECTED && result != Interop.Errors.DNS_ERROR_RCODE_NAME_ERROR) 177result = Interop.Netapi32.NetApiBufferFree(dcDnsHostNamePtr); 182result = Interop.Netapi32.DsGetDcNext(retGetDcContext, out sockAddressCountPtr, out sockAddressList, out dcDnsHostNamePtr); 183if (result != 0 && result != Interop.Errors.ERROR_FILEMARK_DETECTED && result != Interop.Errors.DNS_ERROR_RCODE_NAME_ERROR && result != Interop.Errors.ERROR_NO_MORE_ITEMS) 191Interop.Netapi32.DsGetDcClose(retGetDcContext);
System\DirectoryServices\ActiveDirectory\ReplicationFailureCollection.cs (1)
63managedFailure.lastResult = Interop.Errors.ERROR_DS_UNKNOWN_ERROR;
System\DirectoryServices\ActiveDirectory\TopLevelName.cs (1)
22internal TopLevelName(int flag, global::Interop.UNICODE_STRING val, LARGE_INTEGER time)
System\DirectoryServices\ActiveDirectory\TrustHelper.cs (105)
29internal static unsafe bool GetTrustedDomainInfoStatus(DirectoryContext context, string? sourceName, string targetName, Interop.Advapi32.TRUST_ATTRIBUTE attribute, bool isForest) 49global::Interop.UNICODE_STRING trustedDomainName; 51Interop.NtDll.RtlInitUnicodeString(out trustedDomainName, target); 53uint result = Interop.Advapi32.LsaQueryTrustedDomainInfoByName(handle, trustedDomainName, Interop.Advapi32.TRUSTED_INFORMATION_CLASS.TrustedDomainInformationEx, ref buffer); 56uint win32Error = global::Interop.Advapi32.LsaNtStatusToWinError(result); 71Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX domainInfo = *(Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX*)buffer; 79if (attribute == Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION) 81if ((domainInfo.TrustAttributes & Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION) == 0) 87else if (attribute == Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL) 89if ((domainInfo.TrustAttributes & Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL) == 0) 95else if (attribute == Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN) 97if ((domainInfo.TrustAttributes & Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN) == 0) 117global::Interop.Advapi32.LsaFreeMemory(buffer); 123internal static unsafe void SetTrustedDomainInfoStatus(DirectoryContext context, string? sourceName, string targetName, Interop.Advapi32.TRUST_ATTRIBUTE attribute, bool status, bool isForest) 143global::Interop.UNICODE_STRING trustedDomainName; 145Interop.NtDll.RtlInitUnicodeString(out trustedDomainName, target); 148uint result = Interop.Advapi32.LsaQueryTrustedDomainInfoByName(handle, trustedDomainName, Interop.Advapi32.TRUSTED_INFORMATION_CLASS.TrustedDomainInformationEx, ref buffer); 151uint win32Error = global::Interop.Advapi32.LsaNtStatusToWinError(result); 166Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX domainInfo = *(Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX*)buffer; 174if (attribute == Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION) 179domainInfo.TrustAttributes |= Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION; 184domainInfo.TrustAttributes &= ~(Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_CROSS_ORGANIZATION); 188else if (attribute == Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL) 193domainInfo.TrustAttributes &= ~(Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL); 198domainInfo.TrustAttributes |= Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL; 202else if (attribute == Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN) 207domainInfo.TrustAttributes |= Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN; 212domainInfo.TrustAttributes &= ~(Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN); 221newInfo = Marshal.AllocHGlobal(sizeof(Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX)); 224result = Interop.Advapi32.LsaSetTrustedDomainInfoByName(handle, trustedDomainName, Interop.Advapi32.TRUSTED_INFORMATION_CLASS.TrustedDomainInformationEx, newInfo); 227throw ExceptionHelper.GetExceptionFromErrorCode((int)global::Interop.Advapi32.LsaNtStatusToWinError(result), serverName); 241global::Interop.Advapi32.LsaFreeMemory(buffer); 269global::Interop.UNICODE_STRING trustedDomainName; 271Interop.NtDll.RtlInitUnicodeString(out trustedDomainName, target); 274uint result = Interop.Advapi32.LsaQueryTrustedDomainInfoByName(policyHandle, trustedDomainName, Interop.Advapi32.TRUSTED_INFORMATION_CLASS.TrustedDomainInformationEx, ref buffer); 277uint win32Error = global::Interop.Advapi32.LsaNtStatusToWinError(result); 294Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX domainInfo = *(Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX*)buffer; 300result = Interop.Advapi32.LsaDeleteTrustedDomain(policyHandle, domainInfo.Sid); 303uint win32Error = global::Interop.Advapi32.LsaNtStatusToWinError(result); 310global::Interop.Advapi32.LsaFreeMemory(buffer); 348global::Interop.UNICODE_STRING trustedDomainName; 350Interop.NtDll.RtlInitUnicodeString(out trustedDomainName, target); 365win32Error = Interop.Netapi32.I_NetLogonControl2(policyServerName, NETLOGON_CONTROL_TC_VERIFY, NETLOGON_QUERY_LEVEL, ptr, out buffer1); 394if (win32Error == Interop.Errors.ERROR_INVALID_LEVEL) 408win32Error = Interop.Netapi32.I_NetLogonControl2(policyServerName, NETLOGON_CONTROL_REDISCOVER, NETLOGON_QUERY_LEVEL, ptr, out buffer2); 429Interop.Netapi32.NetApiBufferFree(buffer1); 432Interop.Netapi32.NetApiBufferFree(buffer2); 461Interop.Kernel32.GetSystemTimeAsFileTime(fileTime); 478Interop.Advapi32.TRUSTED_DOMAIN_AUTH_INFORMATION AuthInfoEx = default; 493Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX tdi = new Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX() 503tdi.TrustAttributes = Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_FOREST_TRANSITIVE; 507tdi.TrustAttributes = Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_QUARANTINED_DOMAIN; 517uint result = Interop.Advapi32.LsaCreateTrustedDomainEx(policyHandle, tdi, AuthInfoEx, TRUSTED_SET_POSIX | TRUSTED_SET_AUTH, out domainHandle); 520result = global::Interop.Advapi32.LsaNtStatusToWinError(result); 521if (result == Interop.Errors.ERROR_ALREADY_EXISTS) 541global::Interop.Advapi32.LsaClose(domainHandle); 544global::Interop.Advapi32.LsaFreeMemory(info); 581global::Interop.UNICODE_STRING trustedDomainName; 583Interop.NtDll.RtlInitUnicodeString(out trustedDomainName, target); 586uint result = Interop.Advapi32.LsaQueryTrustedDomainInfoByName(handle, trustedDomainName, Interop.Advapi32.TRUSTED_INFORMATION_CLASS.TrustedDomainFullInformation, ref buffer); 589uint win32Error = global::Interop.Advapi32.LsaNtStatusToWinError(result); 603Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION domainInfo = *(Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION*)buffer; 614Interop.Kernel32.GetSystemTimeAsFileTime(fileTime); 631Interop.Advapi32.TRUSTED_DOMAIN_AUTH_INFORMATION AuthInfoEx = default; 648newBuffer = Marshal.AllocHGlobal(sizeof(Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION)); 651result = Interop.Advapi32.LsaSetTrustedDomainInfoByName(handle, trustedDomainName, Interop.Advapi32.TRUSTED_INFORMATION_CLASS.TrustedDomainFullInformation, newBuffer); 654throw ExceptionHelper.GetExceptionFromErrorCode((int)global::Interop.Advapi32.LsaNtStatusToWinError(result), serverName); 668global::Interop.Advapi32.LsaFreeMemory(buffer); 710global::Interop.UNICODE_STRING trustedDomainName; 712Interop.NtDll.RtlInitUnicodeString(out trustedDomainName, target); 715uint result = Interop.Advapi32.LsaQueryTrustedDomainInfoByName(handle, trustedDomainName, Interop.Advapi32.TRUSTED_INFORMATION_CLASS.TrustedDomainFullInformation, ref buffer); 718uint win32Error = global::Interop.Advapi32.LsaNtStatusToWinError(result); 732Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION domainInfo = *(Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION*)buffer; 740Interop.Kernel32.GetSystemTimeAsFileTime(fileTime); 757Interop.Advapi32.TRUSTED_DOMAIN_AUTH_INFORMATION AuthInfoEx; 789newBuffer = Marshal.AllocHGlobal(sizeof(Interop.Advapi32.TRUSTED_DOMAIN_FULL_INFORMATION)); 792result = Interop.Advapi32.LsaSetTrustedDomainInfoByName(handle, trustedDomainName, Interop.Advapi32.TRUSTED_INFORMATION_CLASS.TrustedDomainFullInformation, newBuffer); 795throw ExceptionHelper.GetExceptionFromErrorCode((int)global::Interop.Advapi32.LsaNtStatusToWinError(result), serverName); 809global::Interop.Advapi32.LsaFreeMemory(buffer); 827private static unsafe void ValidateTrust(SafeLsaPolicyHandle handle, global::Interop.UNICODE_STRING trustedDomainName, string? sourceName, string? targetName, bool isForest, int direction, string serverName) 832uint result = Interop.Advapi32.LsaQueryTrustedDomainInfoByName(handle, trustedDomainName, Interop.Advapi32.TRUSTED_INFORMATION_CLASS.TrustedDomainInformationEx, ref buffer); 835uint win32Error = global::Interop.Advapi32.LsaNtStatusToWinError(result); 852Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX domainInfo = *(Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX*)buffer; 872global::Interop.Advapi32.LsaFreeMemory(buffer); 876private static void ValidateTrustAttribute(Interop.Advapi32.TRUSTED_DOMAIN_INFORMATION_EX domainInfo, bool isForest, string? sourceName, string? targetName) 881if ((domainInfo.TrustAttributes & Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_FOREST_TRANSITIVE) == 0) 889if ((domainInfo.TrustAttributes & Interop.Advapi32.TRUST_ATTRIBUTE.TRUST_ATTRIBUTE_FOREST_TRANSITIVE) != 0) 1002uint result = global::Interop.Advapi32.LsaQueryInformationPolicy(policyHandle.DangerousGetHandle(), policyDnsDomainInformation, ref buffer); 1005throw ExceptionHelper.GetExceptionFromErrorCode((int)global::Interop.Advapi32.LsaNtStatusToWinError(result), serverName);
System\DirectoryServices\ActiveDirectory\TrustRelationshipInformation.cs (4)
43if ((obj.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_OUTBOUND) != 0 && 44(obj.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_INBOUND) != 0) 46else if ((obj.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_OUTBOUND) != 0) 48else if ((obj.Flags & Interop.Netapi32.DS_DOMAINTRUST_FLAG.DS_DOMAIN_DIRECT_INBOUND) != 0)
System\DirectoryServices\ActiveDirectory\UnsafeNativeMethods.cs (7)
349public Interop.Netapi32.DS_DOMAINTRUST_FLAG Flags; 373public global::Interop.UNICODE_STRING TopLevelName; 424public global::Interop.UNICODE_STRING Name; 457public global::Interop.UNICODE_STRING Name; 458public global::Interop.UNICODE_STRING DnsDomainName; 459public global::Interop.UNICODE_STRING DnsForestName; 492public global::Interop.UNICODE_STRING DomainName;
System\DirectoryServices\ActiveDirectory\Utils.cs (63)
116var dsCrackNames = (delegate* unmanaged<IntPtr, int, int, int, int, IntPtr, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsCrackNamesW"); 171var dsFreeNameResultW = (delegate* unmanaged<IntPtr, void>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsFreeNameResultW"); 211var dsCrackNames = (delegate* unmanaged<IntPtr, int, int, int, int, IntPtr, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsCrackNamesW"); 246var dsFreeNameResultW = (delegate* unmanaged<IntPtr, void>)global::Interop.Kernel32.GetProcAddress(DirectoryContext.ADHandle, "DsFreeNameResultW"); 640var dsMakePasswordCredentials = (delegate* unmanaged<char*, char*, char*, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsMakePasswordCredentialsW"); 669var dsFreePasswordCredentials = (delegate* unmanaged<IntPtr, void>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsFreePasswordCredentials"); 691var bindWithCred = (delegate* unmanaged<char*, char*, IntPtr, IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsBindWithCredW"); 718var dsUnBind = (delegate* unmanaged<IntPtr*, int>)global::Interop.Kernel32.GetProcAddress(libHandle, "DsUnBindW"); 873int hr = Interop.Activeds.ADsEncodeBinaryData(byteGuid, byteGuid.Length, ref ptr); 884Interop.Activeds.FreeADsMem(ptr); 963int result = global::Interop.Advapi32.LogonUser(userName!, domainName, context.Password, LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_WINNT50, ref hToken); 970result = global::Interop.Advapi32.ImpersonateLoggedOnUser(hToken); 980global::Interop.Kernel32.CloseHandle(hToken); 988IntPtr hThread = Interop.Kernel32.OpenThread(Interop.Kernel32.THREAD_ALL_ACCESS, false, global::Interop.Kernel32.GetCurrentThreadId()); 994bool success = Interop.Advapi32.ImpersonateAnonymousToken(hThread); 1001global::Interop.Kernel32.CloseHandle(hThread); 1007if (!global::Interop.Advapi32.RevertToSelf()) 1073global::Interop.OBJECT_ATTRIBUTES objectAttribute = default; 1075uint result = global::Interop.Advapi32.LsaOpenPolicy(serverName, ref objectAttribute, (int)global::Interop.Advapi32.PolicyRights.POLICY_VIEW_LOCAL_INFORMATION, out handle); 1078throw ExceptionHelper.GetExceptionFromErrorCode((int)global::Interop.Advapi32.LsaNtStatusToWinError(result), serverName); 1862result = Interop.Kernel32.CompareString(LCID, compareFlags, s1, cchCount1, s2, cchCount2); 2004bool success = global::Interop.Advapi32.EqualDomainSid(pCopyOfUserSid, pMachineDomainSid, ref sameDomain); 2042if (!global::Interop.Advapi32.OpenThreadToken( 2043global::Interop.Kernel32.GetCurrentThread(), 2055if (!global::Interop.Advapi32.OpenProcessToken( 2056global::Interop.Kernel32.GetCurrentProcess(), 2077bool success = global::Interop.Advapi32.GetTokenInformation( 2079(uint)global::Interop.Advapi32.TOKEN_INFORMATION_CLASS.TokenUser, 2096success = global::Interop.Advapi32.GetTokenInformation( 2098(uint)global::Interop.Advapi32.TOKEN_INFORMATION_CLASS.TokenUser, 2111Interop.TOKEN_USER tokenUser = *(Interop.TOKEN_USER*)pBuffer; 2114Debug.Assert(global::Interop.Advapi32.IsValidSid(pUserSid)); 2117int userSidLength = global::Interop.Advapi32.GetLengthSid(pUserSid); 2119success = global::Interop.Advapi32.CopySid(userSidLength, pCopyOfUserSid, pUserSid); 2145global::Interop.OBJECT_ATTRIBUTES oa = default; 2146uint err = global::Interop.Advapi32.LsaOpenPolicy( 2149(int)global::Interop.Advapi32.PolicyRights.POLICY_VIEW_LOCAL_INFORMATION, 2154throw new InvalidOperationException(SR.Format(SR.UnableToRetrievePolicy, global::Interop.Advapi32.LsaNtStatusToWinError(err))); 2158err = global::Interop.Advapi32.LsaQueryInformationPolicy( 2165throw new InvalidOperationException(SR.Format(SR.UnableToRetrievePolicy, global::Interop.Advapi32.LsaNtStatusToWinError(err))); 2171Debug.Assert(global::Interop.Advapi32.IsValidSid(info.DomainSid)); 2174int sidLength = global::Interop.Advapi32.GetLengthSid(info.DomainSid); 2176bool success = global::Interop.Advapi32.CopySid(sidLength, pCopyOfSid, info.DomainSid); 2191global::Interop.Advapi32.LsaFreeMemory(pBuffer); 2203err = Interop.Netapi32.DsRoleGetPrimaryDomainInformation(null, Interop.Netapi32.DSROLE_PRIMARY_DOMAIN_INFO_LEVEL.DsRolePrimaryDomainInfoBasic, out dsRoleInfoPtr); 2205err = Interop.Netapi32.DsRoleGetPrimaryDomainInformation(computerName, Interop.Netapi32.DSROLE_PRIMARY_DOMAIN_INFO_LEVEL.DsRolePrimaryDomainInfoBasic, out dsRoleInfoPtr); 2224Interop.Netapi32.DsRoleFreeMemory(dsRoleInfoPtr); 2230Debug.Assert(global::Interop.Advapi32.IsValidSid(pSid)); 2233IntPtr pIdentAuth = global::Interop.Advapi32.GetSidIdentifierAuthority(pSid); 2235Interop.Advapi32.SID_IDENTIFIER_AUTHORITY identAuth = *(Interop.Advapi32.SID_IDENTIFIER_AUTHORITY*)pIdentAuth; 2237IntPtr pRid = global::Interop.Advapi32.GetSidSubAuthority(pSid, 0); 2274IntPtr pRidCount = global::Interop.Advapi32.GetSidSubAuthorityCount(pSid); 2276IntPtr pLastRid = global::Interop.Advapi32.GetSidSubAuthority(pSid, ridCount - 1); 2330Debug.Assert(global::Interop.Advapi32.IsValidSid(pSid)); 2332IntPtr psubAuthorityCount = global::Interop.Advapi32.GetSidSubAuthorityCount(pSid); 2357IntPtr pcurrentSubauthority = global::Interop.Advapi32.GetSidSubAuthority(pSid, i);
System\DirectoryServices\DirectoryServicesCOMException.cs (1)
63Interop.Activeds.ADsGetLastError(out error, errorBuffer, errorBuffer.Length, nameBuffer, nameBuffer.Length);
System\DirectoryServices\SearchResultCollection.cs (6)
336Interop.Activeds.FreeADsMem(pszColumnName); 399if (errorCode != Interop.Errors.ERROR_MORE_DATA) 446Interop.Activeds.ADsSetLastError(Interop.Errors.ERROR_SUCCESS, null, null); 453errorCode = Interop.Errors.ERROR_SUCCESS; 454return Interop.Activeds.ADsGetLastError(out errorCode, errorBuffer, errorBuffer.Length, nameBuffer, nameBuffer.Length);