未验证 提交 9f109990 编写于 作者: M Matt Thalman 提交者: GitHub

Refactor interop usage in DirectoryServices (#51325)

上级 5524f37b
......@@ -5,16 +5,24 @@ internal static partial class Interop
{
internal static partial class Libraries
{
internal const string Activeds = "activeds.dll";
internal const string Advapi32 = "advapi32.dll";
internal const string Authz = "authz.dll";
internal const string BCrypt = "BCrypt.dll";
internal const string Credui = "credui.dll";
internal const string Crypt32 = "crypt32.dll";
internal const string CryptUI = "cryptui.dll";
internal const string Dnsapi = "dnsapi.dll";
internal const string Dsrole = "dsrole.dll";
internal const string Gdi32 = "gdi32.dll";
internal const string HttpApi = "httpapi.dll";
internal const string IpHlpApi = "iphlpapi.dll";
internal const string Kernel32 = "kernel32.dll";
internal const string Logoncli = "logoncli.dll";
internal const string Mswsock = "mswsock.dll";
internal const string NCrypt = "ncrypt.dll";
internal const string Netapi32 = "netapi32.dll";
internal const string Netutils = "netutils.dll";
internal const string NtDll = "ntdll.dll";
internal const string Odbc32 = "odbc32.dll";
internal const string Ole32 = "ole32.dll";
......@@ -28,6 +36,7 @@ internal static partial class Libraries
internal const string WebSocket = "websocket.dll";
internal const string WinHttp = "winhttp.dll";
internal const string WinMM = "winmm.dll";
internal const string Wkscli = "wkscli.dll";
internal const string Wldap32 = "wldap32.dll";
internal const string Ws2_32 = "ws2_32.dll";
internal const string Wtsapi32 = "wtsapi32.dll";
......
......@@ -12,7 +12,6 @@
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetFramework)' == 'netstandard2.0'">SR.DirectoryServicesAccountManagement_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
<Compile Include="System\DirectoryServices\AccountManagement\ExternDll.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\interopt.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\PrincipalSearcher.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\Utils.cs" />
......
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System
{
internal static class ExternDll
{
public const string Activeds = "activeds.dll";
public const string Advapi32 = "advapi32.dll";
public const string Comctl32 = "comctl32.dll";
public const string Comdlg32 = "comdlg32.dll";
public const string Gdi32 = "gdi32.dll";
public const string Gdiplus = "gdiplus.dll";
public const string Hhctrl = "hhctrl.ocx";
public const string Imm32 = "imm32.dll";
public const string Kernel32 = "kernel32.dll";
public const string Loadperf = "Loadperf.dll";
public const string Mscoree = "mscoree.dll";
public const string Clr = "clr.dll";
public const string Msi = "msi.dll";
public const string Mqrt = "mqrt.dll";
public const string Ntdll = "ntdll.dll";
public const string Ole32 = "ole32.dll";
public const string Oleacc = "oleacc.dll";
public const string Oleaut32 = "oleaut32.dll";
public const string Olepro32 = "olepro32.dll";
public const string PerfCounter = "perfcounter.dll";
public const string Powrprof = "Powrprof.dll";
public const string Psapi = "psapi.dll";
public const string Shell32 = "shell32.dll";
public const string User32 = "user32.dll";
public const string Uxtheme = "uxtheme.dll";
public const string WinMM = "winmm.dll";
public const string Winspool = "winspool.drv";
public const string Wtsapi32 = "wtsapi32.dll";
public const string Version = "version.dll";
public const string Vsassert = "vsassert.dll";
public const string Fxassert = "Fxassert.dll";
public const string Shlwapi = "shlwapi.dll";
public const string Crypt32 = "crypt32.dll";
// system.data specific
internal const string Odbc32 = "odbc32.dll";
internal const string SNI = "System.Data.dll";
// system.data.oracleclient specific
internal const string OciDll = "oci.dll";
internal const string OraMtsDll = "oramts.dll";
}
}
......@@ -23,16 +23,16 @@ internal static class Constants
internal static class SafeNativeMethods
{
[DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentThreadId", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Kernel32, CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentThreadId", CharSet = CharSet.Unicode)]
public static extern int GetCurrentThreadId();
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaNtStatusToWinError", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaNtStatusToWinError", CharSet = CharSet.Unicode)]
public static extern int LsaNtStatusToWinError(int ntStatus);
}
internal static class UnsafeNativeMethods
{
[DllImport(ExternDll.Activeds, ExactSpelling = true, EntryPoint = "ADsOpenObject", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
[DllImport(Interop.Libraries.Activeds, ExactSpelling = true, EntryPoint = "ADsOpenObject", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
private static extern int IntADsOpenObject(string path, string userName, string password, int flags, [In, Out] ref Guid iid, [Out, MarshalAs(UnmanagedType.Interface)] out object ppObject);
public static int ADsOpenObject(string path, string userName, string password, int flags, [In, Out] ref Guid iid, [Out, MarshalAs(UnmanagedType.Interface)] out object ppObject)
{
......@@ -431,7 +431,7 @@ public sealed class DSROLE_PRIMARY_DOMAIN_INFO_BASIC
PBYTE* Buffer
); */
[DllImport("dsrole.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsRoleGetPrimaryDomainInformation", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Dsrole, CallingConvention = CallingConvention.StdCall, EntryPoint = "DsRoleGetPrimaryDomainInformation", CharSet = CharSet.Unicode)]
public static extern int DsRoleGetPrimaryDomainInformation(
[MarshalAs(UnmanagedType.LPTStr)] string lpServer,
[In] DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel,
......@@ -467,7 +467,7 @@ public sealed class DomainControllerInfo
PVOID Buffer
);
*/
[DllImport("dsrole.dll")]
[DllImport(Interop.Libraries.Dsrole)]
public static extern int DsRoleFreeMemory(
[In] IntPtr buffer);
......@@ -479,7 +479,7 @@ PVOID Buffer
ULONG Flags,
PDOMAIN_CONTROLLER_INFO* DomainControllerInfo
);*/
[DllImport("logoncli.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcNameW", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Logoncli, CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcNameW", CharSet = CharSet.Unicode)]
public static extern int DsGetDcName(
[In] string computerName,
[In] string domainName,
......@@ -505,10 +505,10 @@ public sealed class WKSTA_INFO_100
public int wki100_ver_minor;
};
[DllImport("wkscli.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "NetWkstaGetInfo", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Wkscli, CallingConvention = CallingConvention.StdCall, EntryPoint = "NetWkstaGetInfo", CharSet = CharSet.Unicode)]
public static extern int NetWkstaGetInfo(string server, int level, ref IntPtr buffer);
[DllImport("netutils.dll")]
[DllImport(Interop.Libraries.Netutils)]
public static extern int NetApiBufferFree(
[In] IntPtr buffer);
......@@ -516,37 +516,37 @@ public sealed class WKSTA_INFO_100
// SID
//
[DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "ConvertSidToStringSidW", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "ConvertSidToStringSidW", CharSet = CharSet.Unicode)]
public static extern bool ConvertSidToStringSid(IntPtr sid, ref string stringSid);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "ConvertStringSidToSidW", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "ConvertStringSidToSidW", CharSet = CharSet.Unicode)]
public static extern bool ConvertStringSidToSid(string stringSid, ref IntPtr sid);
[DllImport("advapi32.dll")]
[DllImport(Interop.Libraries.Advapi32)]
public static extern int GetLengthSid(IntPtr sid);
[DllImport("advapi32.dll", SetLastError = true)]
[DllImport(Interop.Libraries.Advapi32, SetLastError = true)]
public static extern bool IsValidSid(IntPtr sid);
[DllImport("advapi32.dll")]
[DllImport(Interop.Libraries.Advapi32)]
public static extern IntPtr GetSidIdentifierAuthority(IntPtr sid);
[DllImport("advapi32.dll")]
[DllImport(Interop.Libraries.Advapi32)]
public static extern IntPtr GetSidSubAuthority(IntPtr sid, int index);
[DllImport("advapi32.dll")]
[DllImport(Interop.Libraries.Advapi32)]
public static extern IntPtr GetSidSubAuthorityCount(IntPtr sid);
[DllImport("advapi32.dll")]
[DllImport(Interop.Libraries.Advapi32)]
public static extern bool EqualDomainSid(IntPtr pSid1, IntPtr pSid2, ref bool equal);
[DllImport("advapi32.dll", SetLastError = true)]
[DllImport(Interop.Libraries.Advapi32, SetLastError = true)]
public static extern bool CopySid(int destinationLength, IntPtr pSidDestination, IntPtr pSidSource);
[DllImport("kernel32.dll")]
[DllImport(Interop.Libraries.Kernel32)]
public static extern IntPtr LocalFree(IntPtr ptr);
[DllImport("Credui.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "CredUIParseUserNameW", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Credui, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "CredUIParseUserNameW", CharSet = CharSet.Unicode)]
public static extern unsafe int CredUIParseUserName(
string pszUserName,
char* pszUser,
......@@ -570,7 +570,7 @@ internal sealed class AUTHZ_RM_FLAG
public static int AUTHZ_VALID_RM_INIT_FLAGS = (AUTHZ_RM_FLAG_NO_AUDIT | AUTHZ_RM_FLAG_INITIALIZE_UNDER_IMPERSONATION);
}
[DllImport("authz.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzInitializeResourceManager", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Authz, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzInitializeResourceManager", CharSet = CharSet.Unicode)]
public static extern bool AuthzInitializeResourceManager(
int flags,
IntPtr pfnAccessCheck,
......@@ -591,7 +591,7 @@ internal sealed class AUTHZ_RM_FLAG
PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
);
*/
[DllImport("authz.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzInitializeContextFromSid", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Authz, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzInitializeContextFromSid", CharSet = CharSet.Unicode)]
public static extern bool AuthzInitializeContextFromSid(
int Flags,
IntPtr UserSid,
......@@ -603,7 +603,7 @@ PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
);
/*
[DllImport("authz.dll", SetLastError=true, CallingConvention=CallingConvention.StdCall, EntryPoint="AuthzInitializeContextFromToken", CharSet=CharSet.Unicode)]
[DllImport(Interop.Libraries.Authz, SetLastError=true, CallingConvention=CallingConvention.StdCall, EntryPoint="AuthzInitializeContextFromToken", CharSet=CharSet.Unicode)]
static extern public bool AuthzInitializeContextFromToken(
int Flags,
IntPtr TokenHandle,
......@@ -614,7 +614,7 @@ PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
out IntPtr pAuthzClientContext
);
*/
[DllImport("authz.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzGetInformationFromContext", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Authz, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzGetInformationFromContext", CharSet = CharSet.Unicode)]
public static extern bool AuthzGetInformationFromContext(
IntPtr hAuthzClientContext,
int InfoClass,
......@@ -623,12 +623,12 @@ PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
IntPtr Buffer
);
[DllImport("authz.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzFreeContext", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Authz, CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzFreeContext", CharSet = CharSet.Unicode)]
public static extern bool AuthzFreeContext(
IntPtr AuthzClientContext
);
[DllImport("authz.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzFreeResourceManager", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Authz, CallingConvention = CallingConvention.StdCall, EntryPoint = "AuthzFreeResourceManager", CharSet = CharSet.Unicode)]
public static extern bool AuthzFreeResourceManager(
IntPtr rm
);
......@@ -734,7 +734,7 @@ public sealed class LSA_TRUST_INFORMATION
private readonly IntPtr _pSid = IntPtr.Zero;
}
[DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "OpenThreadToken", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "OpenThreadToken", CharSet = CharSet.Unicode)]
public static extern bool OpenThreadToken(
IntPtr threadHandle,
int desiredAccess,
......@@ -742,23 +742,23 @@ public sealed class LSA_TRUST_INFORMATION
ref IntPtr tokenHandle
);
[DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "OpenProcessToken", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "OpenProcessToken", CharSet = CharSet.Unicode)]
public static extern bool OpenProcessToken(
IntPtr processHandle,
int desiredAccess,
ref IntPtr tokenHandle
);
[DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "CloseHandle", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Kernel32, CallingConvention = CallingConvention.StdCall, EntryPoint = "CloseHandle", CharSet = CharSet.Unicode)]
public static extern bool CloseHandle(IntPtr handle);
[DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentThread", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Kernel32, CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentThread", CharSet = CharSet.Unicode)]
public static extern IntPtr GetCurrentThread();
[DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentProcess", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Kernel32, CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentProcess", CharSet = CharSet.Unicode)]
public static extern IntPtr GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "GetTokenInformation", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "GetTokenInformation", CharSet = CharSet.Unicode)]
public static extern bool GetTokenInformation(
IntPtr tokenHandle,
int tokenInformationClass,
......@@ -767,21 +767,21 @@ public sealed class LSA_TRUST_INFORMATION
ref int returnLength
);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaOpenPolicy", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaOpenPolicy", CharSet = CharSet.Unicode)]
public static extern int LsaOpenPolicy(
IntPtr lsaUnicodeString,
IntPtr lsaObjectAttributes,
int desiredAccess,
ref IntPtr policyHandle);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaQueryInformationPolicy", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaQueryInformationPolicy", CharSet = CharSet.Unicode)]
public static extern int LsaQueryInformationPolicy(
IntPtr policyHandle,
int policyInformationClass,
ref IntPtr buffer
);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaLookupSids", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaLookupSids", CharSet = CharSet.Unicode)]
public static extern int LsaLookupSids(
IntPtr policyHandle,
int count,
......@@ -790,17 +790,17 @@ public sealed class LSA_TRUST_INFORMATION
out IntPtr names
);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaFreeMemory", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaFreeMemory", CharSet = CharSet.Unicode)]
public static extern int LsaFreeMemory(IntPtr buffer);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaClose", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaClose", CharSet = CharSet.Unicode)]
public static extern int LsaClose(IntPtr policyHandle);
//
// Impersonation
//
[DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "LogonUserW", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "LogonUserW", CharSet = CharSet.Unicode)]
public static extern int LogonUser(
string lpszUsername,
string lpszDomain,
......@@ -809,10 +809,10 @@ public sealed class LSA_TRUST_INFORMATION
int dwLogonProvider,
ref IntPtr phToken);
[DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "ImpersonateLoggedOnUser", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "ImpersonateLoggedOnUser", CharSet = CharSet.Unicode)]
public static extern int ImpersonateLoggedOnUser(IntPtr hToken);
[DllImport("Advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "RevertToSelf", CharSet = CharSet.Unicode)]
[DllImport(Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "RevertToSelf", CharSet = CharSet.Unicode)]
public static extern int RevertToSelf();
}
}
......@@ -9,13 +9,13 @@ namespace System.DirectoryServices.Interop
{
internal static class SafeNativeMethods
{
[DllImport(ExternDll.Oleaut32, PreserveSig = false)]
[DllImport(global::Interop.Libraries.OleAut32, PreserveSig = false)]
public static extern void VariantClear(IntPtr pObject);
[DllImport(ExternDll.Oleaut32)]
[DllImport(global::Interop.Libraries.OleAut32)]
public static extern void VariantInit(IntPtr pObject);
[DllImport(ExternDll.Activeds)]
[DllImport(global::Interop.Libraries.Activeds)]
public static extern bool FreeADsMem(IntPtr pVoid);
public const int
......@@ -25,10 +25,10 @@ public const int
ERROR_MORE_DATA = 234,
ERROR_SUCCESS = 0;
[DllImport(ExternDll.Activeds, CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Activeds, CharSet = CharSet.Unicode)]
public static extern unsafe int ADsGetLastError(out int error, char* errorBuffer, int errorBufferLength, char* nameBuffer, int nameBufferLength);
[DllImport(ExternDll.Activeds, CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Activeds, CharSet = CharSet.Unicode)]
public static extern int ADsSetLastError(int error, string? errorString, string? provider);
public class EnumVariant
......
......@@ -28,7 +28,7 @@ internal struct Variant
internal static class UnsafeNativeMethods
{
[DllImport(ExternDll.Activeds, ExactSpelling = true, EntryPoint = "ADsOpenObject", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Activeds, ExactSpelling = true, EntryPoint = "ADsOpenObject", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
private static extern int IntADsOpenObject(string path, string? userName, string? password, int flags, [In, Out] ref Guid iid, [Out, MarshalAs(UnmanagedType.Interface)] out object ppObject);
public static int ADsOpenObject(string path, string? userName, string? password, int flags, [In, Out] ref Guid iid, [Out, MarshalAs(UnmanagedType.Interface)] out object ppObject)
......
......@@ -11,7 +11,6 @@
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetFramework)' == 'netstandard2.0'">SR.DirectoryServices_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
<Compile Include="System\DirectoryServices\ExternDll.cs" />
<Compile Include="System\DirectoryServices\ActiveDirectorySecurity.cs" />
<Compile Include="System\DirectoryServices\AdsVLV.cs" />
<Compile Include="System\DirectoryServices\AuthenticationTypes.cs" />
......@@ -137,6 +136,8 @@
<Compile Include="Interop\NativeMethods.cs" />
<Compile Include="Interop\SafeNativeMethods.cs" />
<Compile Include="Interop\UnsafeNativeMethods.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Interop.Libraries.cs"
Link="Common\Interop\Windows\Interop.Libraries.cs" />
<Compile Include="$(CommonPath)System\Obsoletions.cs" Link="System\Obsoletions.cs" />
</ItemGroup>
<ItemGroup>
......
......@@ -320,7 +320,7 @@ internal sealed class NativeMethods
ULONG Flags,
PDOMAIN_CONTROLLER_INFO* DomainControllerInfo
);*/
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcNameW", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Netapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcNameW", CharSet = CharSet.Unicode)]
internal static extern int DsGetDcName(
[In] string? computerName,
[In] string? domainName,
......@@ -338,7 +338,7 @@ internal sealed class NativeMethods
ULONG DcFlags,
PHANDLE RetGetDcContext
);*/
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcOpenW", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Netapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcOpenW", CharSet = CharSet.Unicode)]
internal static extern int DsGetDcOpen(
[In] string? dnsName,
[In] int optionFlags,
......@@ -354,7 +354,7 @@ PHANDLE RetGetDcContext
LPSOCKET_ADDRESS* SockAddresses,
LPTSTR* DnsHostName
);*/
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcNextW", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Netapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcNextW", CharSet = CharSet.Unicode)]
internal static extern int DsGetDcNext(
[In] IntPtr getDcContextHandle,
[In, Out] ref IntPtr sockAddressCount,
......@@ -364,14 +364,14 @@ PHANDLE RetGetDcContext
/*void WINAPI DsGetDcClose(
HANDLE GetDcContextHandle
);*/
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcCloseW", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Netapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "DsGetDcCloseW", CharSet = CharSet.Unicode)]
internal static extern void DsGetDcClose(
[In] IntPtr getDcContextHandle);
/*NET_API_STATUS NetApiBufferFree(
LPVOID Buffer
);*/
[DllImport("Netapi32.dll")]
[DllImport(global::Interop.Libraries.Netapi32)]
internal static extern int NetApiBufferFree(
[In] IntPtr buffer);
......@@ -458,7 +458,7 @@ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
[Out] out IntPtr roles);
/*DWORD GetLastError(VOID)*/
[DllImport("Kernel32.dll")]
[DllImport(global::Interop.Libraries.Kernel32)]
internal static extern int GetLastError();
internal const int DnsSrvData = 33;
......@@ -472,7 +472,7 @@ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
PDNS_RECORD *ppQueryResultsSet,
PVOID *pReserved
);*/
[DllImport("Dnsapi.dll", EntryPoint = "DnsQuery_W", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Dnsapi, EntryPoint = "DnsQuery_W", CharSet = CharSet.Unicode)]
internal static extern int DnsQuery(
[In] string recordName,
[In] short recordType,
......@@ -485,7 +485,7 @@ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
PDNS_RECORD pRecordList,
DNS_FREE_TYPE FreeType
);*/
[DllImport("Dnsapi.dll", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Dnsapi, CharSet = CharSet.Unicode)]
internal static extern void DnsRecordListFree(
[In] IntPtr dnsResultList,
[In] bool dnsFreeType);
......@@ -493,7 +493,7 @@ DNS_FREE_TYPE FreeType
/*BOOL GetVersionEx(
LPOSVERSIONINFO lpVersionInfo
);*/
[DllImport("Kernel32.dll", EntryPoint = "GetVersionExW", CharSet = CharSet.Unicode, SetLastError = true)]
[DllImport(global::Interop.Libraries.Kernel32, EntryPoint = "GetVersionExW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern bool GetVersionEx(
[In, Out] OSVersionInfoEx ver);
......@@ -518,7 +518,7 @@ LPOSVERSIONINFO lpVersionInfo
/*NTSTATUS LsaConnectUntrusted(
PHANDLE LsaHandle
);*/
[DllImport("Secur32.dll")]
[DllImport(global::Interop.Libraries.Secur32)]
internal static extern int LsaConnectUntrusted(
[Out] out LsaLogonProcessSafeHandle lsaHandle);
......@@ -533,7 +533,7 @@ PHANDLE LsaHandle
PULONG ReturnBufferLength,
PNTSTATUS ProtocolStatus
);*/
[DllImport("Secur32.dll")]
[DllImport(global::Interop.Libraries.Secur32)]
internal static extern int LsaCallAuthenticationPackage(
[In] LsaLogonProcessSafeHandle lsaHandle,
[In] int authenticationPackage,
......@@ -546,14 +546,14 @@ PNTSTATUS ProtocolStatus
/*NTSTATUS LsaFreeReturnBuffer(
PVOID Buffer
);*/
[DllImport("Secur32.dll")]
[DllImport(global::Interop.Libraries.Secur32)]
internal static extern uint LsaFreeReturnBuffer(
[In] IntPtr buffer);
/*NTSTATUS LsaDeregisterLogonProcess(
HANDLE LsaHandle
);*/
[DllImport("Secur32.dll")]
[DllImport(global::Interop.Libraries.Secur32)]
internal static extern int LsaDeregisterLogonProcess(
[In] IntPtr lsaHandle);
......@@ -564,7 +564,7 @@ HANDLE LsaHandle
DWORD lpString2,
DWORD cchCount2
);*/
[DllImport("Kernel32.dll", EntryPoint = "CompareStringW", CharSet = CharSet.Unicode, SetLastError = true)]
[DllImport(global::Interop.Libraries.Kernel32, EntryPoint = "CompareStringW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int CompareString(
[In] uint locale,
[In] uint dwCmpFlags,
......@@ -573,7 +573,7 @@ DWORD cchCount2
[In] IntPtr lpString2,
[In] int cchCount2);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaNtStatusToWinError", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaNtStatusToWinError", CharSet = CharSet.Unicode)]
internal static extern int LsaNtStatusToWinError(int ntStatus);
}
......
......@@ -639,107 +639,107 @@ internal static class UnsafeNativeMethods
public delegate int DsReplicaSyncAllW(IntPtr handle, [MarshalAs(UnmanagedType.LPWStr)] string partition, int flags, SyncReplicaFromAllServersCallback callback, IntPtr data, ref IntPtr error);
[DllImport("kernel32.dll", EntryPoint = "LocalFree")]
[DllImport(global::Interop.Libraries.Kernel32, EntryPoint = "LocalFree")]
public static extern int LocalFree(IntPtr mem);
[DllImport("activeds.dll", EntryPoint = "ADsEncodeBinaryData", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Activeds, EntryPoint = "ADsEncodeBinaryData", CharSet = CharSet.Unicode)]
public static extern int ADsEncodeBinaryData(byte[] data, int length, ref IntPtr result);
[DllImport("activeds.dll", EntryPoint = "FreeADsMem")]
[DllImport(global::Interop.Libraries.Activeds, EntryPoint = "FreeADsMem")]
public static extern bool FreeADsMem(IntPtr pVoid);
[DllImport("netapi32.dll", EntryPoint = "DsGetSiteNameW", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Netapi32, EntryPoint = "DsGetSiteNameW", CharSet = CharSet.Unicode)]
public static extern int DsGetSiteName(string? dcName, ref IntPtr ptr);
public delegate int DsListDomainsInSiteW(IntPtr handle, [MarshalAs(UnmanagedType.LPWStr)] string site, ref IntPtr info);
public delegate void DsFreeNameResultW(IntPtr result);
[DllImport("Netapi32.dll", EntryPoint = "DsEnumerateDomainTrustsW", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Netapi32, EntryPoint = "DsEnumerateDomainTrustsW", CharSet = CharSet.Unicode)]
public static extern int DsEnumerateDomainTrustsW(string serverName, int flags, out IntPtr domains, out int count);
[DllImport("Netapi32.dll", EntryPoint = "NetApiBufferFree")]
[DllImport(global::Interop.Libraries.Netapi32, EntryPoint = "NetApiBufferFree")]
public static extern int NetApiBufferFree(IntPtr buffer);
[DllImport("Advapi32.dll", EntryPoint = "LogonUserW", CharSet = CharSet.Unicode, SetLastError = true)]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LogonUserW", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern int LogonUserW(string? lpszUsername, string? lpszDomain, string? lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);
[DllImport("Advapi32.dll", EntryPoint = "ImpersonateLoggedOnUser", SetLastError = true)]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "ImpersonateLoggedOnUser", SetLastError = true)]
public static extern int ImpersonateLoggedOnUser(IntPtr hToken);
[DllImport("Advapi32.dll", EntryPoint = "RevertToSelf", SetLastError = true)]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "RevertToSelf", SetLastError = true)]
public static extern int RevertToSelf();
[DllImport("Advapi32.dll", EntryPoint = "ConvertSidToStringSidW", CharSet = CharSet.Unicode, SetLastError = true)]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "ConvertSidToStringSidW", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern int ConvertSidToStringSidW(IntPtr pSid, ref IntPtr stringSid);
[DllImport("Advapi32.dll", EntryPoint = "ConvertStringSidToSidW", CharSet = CharSet.Unicode, SetLastError = true)]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSidToSidW", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern int ConvertStringSidToSidW(IntPtr stringSid, ref IntPtr pSid);
[DllImport("Advapi32.dll", EntryPoint = "LsaSetForestTrustInformation")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaSetForestTrustInformation")]
public static extern int LsaSetForestTrustInformation(PolicySafeHandle handle, LSA_UNICODE_STRING target, IntPtr forestTrustInfo, int checkOnly, out IntPtr collisionInfo);
[DllImport("Advapi32.dll", EntryPoint = "LsaOpenPolicy")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaOpenPolicy")]
public static extern int LsaOpenPolicy(LSA_UNICODE_STRING target, LSA_OBJECT_ATTRIBUTES objectAttributes, int access, out IntPtr handle);
[DllImport("Advapi32.dll", EntryPoint = "LsaClose")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaClose")]
public static extern int LsaClose(IntPtr handle);
[DllImport("Advapi32.dll", EntryPoint = "LsaQueryForestTrustInformation")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaQueryForestTrustInformation")]
public static extern int LsaQueryForestTrustInformation(PolicySafeHandle handle, LSA_UNICODE_STRING target, ref IntPtr ForestTrustInfo);
[DllImport("Advapi32.dll", EntryPoint = "LsaQueryTrustedDomainInfoByName")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaQueryTrustedDomainInfoByName")]
public static extern int LsaQueryTrustedDomainInfoByName(PolicySafeHandle handle, LSA_UNICODE_STRING trustedDomain, TRUSTED_INFORMATION_CLASS infoClass, ref IntPtr buffer);
[DllImport("Advapi32.dll", EntryPoint = "LsaNtStatusToWinError")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaNtStatusToWinError")]
public static extern int LsaNtStatusToWinError(int status);
[DllImport("Advapi32.dll", EntryPoint = "LsaFreeMemory")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaFreeMemory")]
public static extern int LsaFreeMemory(IntPtr ptr);
[DllImport("Advapi32.dll", EntryPoint = "LsaSetTrustedDomainInfoByName")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaSetTrustedDomainInfoByName")]
public static extern int LsaSetTrustedDomainInfoByName(PolicySafeHandle handle, LSA_UNICODE_STRING trustedDomain, TRUSTED_INFORMATION_CLASS infoClass, IntPtr buffer);
[DllImport("Advapi32.dll", EntryPoint = "LsaOpenTrustedDomainByName")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaOpenTrustedDomainByName")]
public static extern int LsaOpenTrustedDomainByName(PolicySafeHandle policyHandle, LSA_UNICODE_STRING trustedDomain, int access, ref IntPtr trustedDomainHandle);
[DllImport("Advapi32.dll", EntryPoint = "LsaDeleteTrustedDomain")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaDeleteTrustedDomain")]
public static extern int LsaDeleteTrustedDomain(PolicySafeHandle handle, IntPtr pSid);
[DllImport("netapi32.dll", EntryPoint = "I_NetLogonControl2", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Netapi32, EntryPoint = "I_NetLogonControl2", CharSet = CharSet.Unicode)]
public static extern int I_NetLogonControl2(string serverName, int FunctionCode, int QueryLevel, IntPtr data, out IntPtr buffer);
[DllImport("Kernel32.dll", EntryPoint = "GetSystemTimeAsFileTime")]
[DllImport(global::Interop.Libraries.Kernel32, EntryPoint = "GetSystemTimeAsFileTime")]
public static extern void GetSystemTimeAsFileTime(IntPtr fileTime);
[DllImport("Advapi32.dll", EntryPoint = "LsaQueryInformationPolicy")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaQueryInformationPolicy")]
public static extern int LsaQueryInformationPolicy(PolicySafeHandle handle, int infoClass, out IntPtr buffer);
[DllImport("Advapi32.dll", EntryPoint = "LsaCreateTrustedDomainEx")]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "LsaCreateTrustedDomainEx")]
public static extern int LsaCreateTrustedDomainEx(PolicySafeHandle handle, TRUSTED_DOMAIN_INFORMATION_EX domainEx, TRUSTED_DOMAIN_AUTH_INFORMATION authInfo, int classInfo, out IntPtr domainHandle);
[DllImport("Kernel32.dll", EntryPoint = "OpenThread", SetLastError = true)]
[DllImport(global::Interop.Libraries.Kernel32, EntryPoint = "OpenThread", SetLastError = true)]
public static extern IntPtr OpenThread(uint desiredAccess, bool inheirted, int threadID);
[DllImport("Kernel32.dll", EntryPoint = "GetCurrentThreadId")]
[DllImport(global::Interop.Libraries.Kernel32, EntryPoint = "GetCurrentThreadId")]
public static extern int GetCurrentThreadId();
[DllImport("Advapi32.dll", EntryPoint = "ImpersonateAnonymousToken", SetLastError = true)]
[DllImport(global::Interop.Libraries.Advapi32, EntryPoint = "ImpersonateAnonymousToken", SetLastError = true)]
public static extern int ImpersonateAnonymousToken(IntPtr token);
[DllImport("Kernel32.dll", EntryPoint = "CloseHandle")]
[DllImport(global::Interop.Libraries.Kernel32, EntryPoint = "CloseHandle")]
public static extern int CloseHandle(IntPtr handle);
[DllImport("ntdll.dll", EntryPoint = "RtlInitUnicodeString")]
[DllImport(global::Interop.Libraries.NtDll, EntryPoint = "RtlInitUnicodeString")]
public static extern int RtlInitUnicodeString(LSA_UNICODE_STRING result, IntPtr s);
[DllImport("Kernel32.dll", EntryPoint = "LoadLibraryW", CharSet = CharSet.Unicode, SetLastError = true)]
[DllImport(global::Interop.Libraries.Kernel32, EntryPoint = "LoadLibraryW", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern IntPtr LoadLibrary(string name);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Kernel32, CharSet = CharSet.Unicode)]
public static extern uint FreeLibrary(IntPtr libName);
[DllImport("kernel32.dll", EntryPoint = "GetProcAddress", SetLastError = true, BestFitMapping = false)]
[DllImport(global::Interop.Libraries.Kernel32, EntryPoint = "GetProcAddress", SetLastError = true, BestFitMapping = false)]
public static extern IntPtr GetProcAddress(LoadLibrarySafeHandle hModule, string entryPoint);
/*
......@@ -749,40 +749,40 @@ internal static class UnsafeNativeMethods
PBYTE* Buffer
); */
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsRoleGetPrimaryDomainInformation", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Netapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "DsRoleGetPrimaryDomainInformation", CharSet = CharSet.Unicode)]
public static extern int DsRoleGetPrimaryDomainInformation(
[MarshalAs(UnmanagedType.LPTStr)] string lpServer,
[In] DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel,
out IntPtr Buffer);
[DllImport("Netapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "DsRoleGetPrimaryDomainInformation", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Netapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "DsRoleGetPrimaryDomainInformation", CharSet = CharSet.Unicode)]
public static extern int DsRoleGetPrimaryDomainInformation(
[In] IntPtr lpServer,
[In] DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel,
out IntPtr Buffer);
[DllImport("advapi32.dll")]
[DllImport(global::Interop.Libraries.Advapi32)]
public static extern int GetLengthSid(IntPtr sid);
[DllImport("advapi32.dll", SetLastError = true)]
[DllImport(global::Interop.Libraries.Advapi32, SetLastError = true)]
public static extern bool IsValidSid(IntPtr sid);
[DllImport("advapi32.dll")]
[DllImport(global::Interop.Libraries.Advapi32)]
public static extern IntPtr GetSidIdentifierAuthority(IntPtr sid);
[DllImport("advapi32.dll")]
[DllImport(global::Interop.Libraries.Advapi32)]
public static extern IntPtr GetSidSubAuthority(IntPtr sid, int index);
[DllImport("advapi32.dll")]
[DllImport(global::Interop.Libraries.Advapi32)]
public static extern IntPtr GetSidSubAuthorityCount(IntPtr sid);
[DllImport("advapi32.dll")]
[DllImport(global::Interop.Libraries.Advapi32)]
public static extern bool EqualDomainSid(IntPtr pSid1, IntPtr pSid2, ref bool equal);
[DllImport("advapi32.dll", SetLastError = true)]
[DllImport(global::Interop.Libraries.Advapi32, SetLastError = true)]
public static extern bool CopySid(int destinationLength, IntPtr pSidDestination, IntPtr pSidSource);
[DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "OpenThreadToken", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Advapi32, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "OpenThreadToken", CharSet = CharSet.Unicode)]
public static extern bool OpenThreadToken(
IntPtr threadHandle,
int desiredAccess,
......@@ -790,20 +790,20 @@ internal static class UnsafeNativeMethods
ref IntPtr tokenHandle
);
[DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "OpenProcessToken", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Advapi32, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "OpenProcessToken", CharSet = CharSet.Unicode)]
public static extern bool OpenProcessToken(
IntPtr processHandle,
int desiredAccess,
ref IntPtr tokenHandle
);
[DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentThread", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Kernel32, CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentThread", CharSet = CharSet.Unicode)]
public static extern IntPtr GetCurrentThread();
[DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentProcess", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Kernel32, CallingConvention = CallingConvention.StdCall, EntryPoint = "GetCurrentProcess", CharSet = CharSet.Unicode)]
public static extern IntPtr GetCurrentProcess();
[DllImport("advapi32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "GetTokenInformation", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Advapi32, SetLastError = true, CallingConvention = CallingConvention.StdCall, EntryPoint = "GetTokenInformation", CharSet = CharSet.Unicode)]
public static extern bool GetTokenInformation(
IntPtr tokenHandle,
int tokenInformationClass,
......@@ -812,21 +812,21 @@ internal static class UnsafeNativeMethods
ref int returnLength
);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaOpenPolicy", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaOpenPolicy", CharSet = CharSet.Unicode)]
public static extern int LsaOpenPolicy(
IntPtr lsaUnicodeString,
IntPtr lsaObjectAttributes,
int desiredAccess,
ref IntPtr policyHandle);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaQueryInformationPolicy", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaQueryInformationPolicy", CharSet = CharSet.Unicode)]
public static extern int LsaQueryInformationPolicy(
IntPtr policyHandle,
int policyInformationClass,
ref IntPtr buffer
);
[DllImport("advapi32.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaLookupSids", CharSet = CharSet.Unicode)]
[DllImport(global::Interop.Libraries.Advapi32, CallingConvention = CallingConvention.StdCall, EntryPoint = "LsaLookupSids", CharSet = CharSet.Unicode)]
public static extern int LsaLookupSids(
IntPtr policyHandle,
int count,
......@@ -840,7 +840,7 @@ internal static class UnsafeNativeMethods
PVOID Buffer
);
*/
[DllImport("Netapi32.dll")]
[DllImport(global::Interop.Libraries.Netapi32)]
public static extern int DsRoleFreeMemory(
[In] IntPtr buffer);
}
......
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System
{
internal static class ExternDll
{
public const string Activeds = "activeds.dll";
public const string Advapi32 = "advapi32.dll";
public const string Comctl32 = "comctl32.dll";
public const string Comdlg32 = "comdlg32.dll";
public const string Gdi32 = "gdi32.dll";
public const string Gdiplus = "gdiplus.dll";
public const string Hhctrl = "hhctrl.ocx";
public const string Imm32 = "imm32.dll";
public const string Kernel32 = "kernel32.dll";
public const string Loadperf = "Loadperf.dll";
public const string Mscoree = "mscoree.dll";
public const string Clr = "clr.dll";
public const string Msi = "msi.dll";
public const string Mqrt = "mqrt.dll";
public const string Ntdll = "ntdll.dll";
public const string Ole32 = "ole32.dll";
public const string Oleacc = "oleacc.dll";
public const string Oleaut32 = "oleaut32.dll";
public const string Olepro32 = "olepro32.dll";
public const string PerfCounter = "perfcounter.dll";
public const string Powrprof = "Powrprof.dll";
public const string Psapi = "psapi.dll";
public const string Shell32 = "shell32.dll";
public const string User32 = "user32.dll";
public const string Uxtheme = "uxtheme.dll";
public const string WinMM = "winmm.dll";
public const string Winspool = "winspool.drv";
public const string Wtsapi32 = "wtsapi32.dll";
public const string Version = "version.dll";
public const string Vsassert = "vsassert.dll";
public const string Fxassert = "Fxassert.dll";
public const string Shlwapi = "shlwapi.dll";
public const string Crypt32 = "crypt32.dll";
// system.data specific
internal const string Odbc32 = "odbc32.dll";
internal const string SNI = "System.Data.dll";
// system.data.oracleclient specific
internal const string OciDll = "oci.dll";
internal const string OraMtsDll = "oramts.dll";
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册