Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
9f109990
R
runtime
项目概览
dotNET Platform
/
runtime
11 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9f109990
编写于
4月 19, 2021
作者:
M
Matt Thalman
提交者:
GitHub
4月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor interop usage in DirectoryServices (#51325)
上级
5524f37b
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
122 addition
and
213 deletion
+122
-213
src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs
...libraries/Common/src/Interop/Windows/Interop.Libraries.cs
+9
-0
src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
...ent/src/System.DirectoryServices.AccountManagement.csproj
+0
-1
src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/ExternDll.cs
...c/System/DirectoryServices/AccountManagement/ExternDll.cs
+0
-50
src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/interopt.cs
...rc/System/DirectoryServices/AccountManagement/interopt.cs
+39
-39
src/libraries/System.DirectoryServices/src/Interop/SafeNativeMethods.cs
...System.DirectoryServices/src/Interop/SafeNativeMethods.cs
+5
-5
src/libraries/System.DirectoryServices/src/Interop/UnsafeNativeMethods.cs
...stem.DirectoryServices/src/Interop/UnsafeNativeMethods.cs
+1
-1
src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
...tem.DirectoryServices/src/System.DirectoryServices.csproj
+2
-1
src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/NativeMethods.cs
...System/DirectoryServices/ActiveDirectory/NativeMethods.cs
+15
-15
src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/UnsafeNativeMethods.cs
.../DirectoryServices/ActiveDirectory/UnsafeNativeMethods.cs
+51
-51
src/libraries/System.DirectoryServices/src/System/DirectoryServices/ExternDll.cs
...rectoryServices/src/System/DirectoryServices/ExternDll.cs
+0
-50
未找到文件。
src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs
浏览文件 @
9f109990
...
@@ -5,16 +5,24 @@ internal static partial class Interop
...
@@ -5,16 +5,24 @@ internal static partial class Interop
{
{
internal
static
partial
class
Libraries
internal
static
partial
class
Libraries
{
{
internal
const
string
Activeds
=
"activeds.dll"
;
internal
const
string
Advapi32
=
"advapi32.dll"
;
internal
const
string
Advapi32
=
"advapi32.dll"
;
internal
const
string
Authz
=
"authz.dll"
;
internal
const
string
BCrypt
=
"BCrypt.dll"
;
internal
const
string
BCrypt
=
"BCrypt.dll"
;
internal
const
string
Credui
=
"credui.dll"
;
internal
const
string
Crypt32
=
"crypt32.dll"
;
internal
const
string
Crypt32
=
"crypt32.dll"
;
internal
const
string
CryptUI
=
"cryptui.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
Gdi32
=
"gdi32.dll"
;
internal
const
string
HttpApi
=
"httpapi.dll"
;
internal
const
string
HttpApi
=
"httpapi.dll"
;
internal
const
string
IpHlpApi
=
"iphlpapi.dll"
;
internal
const
string
IpHlpApi
=
"iphlpapi.dll"
;
internal
const
string
Kernel32
=
"kernel32.dll"
;
internal
const
string
Kernel32
=
"kernel32.dll"
;
internal
const
string
Logoncli
=
"logoncli.dll"
;
internal
const
string
Mswsock
=
"mswsock.dll"
;
internal
const
string
Mswsock
=
"mswsock.dll"
;
internal
const
string
NCrypt
=
"ncrypt.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
NtDll
=
"ntdll.dll"
;
internal
const
string
Odbc32
=
"odbc32.dll"
;
internal
const
string
Odbc32
=
"odbc32.dll"
;
internal
const
string
Ole32
=
"ole32.dll"
;
internal
const
string
Ole32
=
"ole32.dll"
;
...
@@ -28,6 +36,7 @@ internal static partial class Libraries
...
@@ -28,6 +36,7 @@ internal static partial class Libraries
internal
const
string
WebSocket
=
"websocket.dll"
;
internal
const
string
WebSocket
=
"websocket.dll"
;
internal
const
string
WinHttp
=
"winhttp.dll"
;
internal
const
string
WinHttp
=
"winhttp.dll"
;
internal
const
string
WinMM
=
"winmm.dll"
;
internal
const
string
WinMM
=
"winmm.dll"
;
internal
const
string
Wkscli
=
"wkscli.dll"
;
internal
const
string
Wldap32
=
"wldap32.dll"
;
internal
const
string
Wldap32
=
"wldap32.dll"
;
internal
const
string
Ws2_32
=
"ws2_32.dll"
;
internal
const
string
Ws2_32
=
"ws2_32.dll"
;
internal
const
string
Wtsapi32
=
"wtsapi32.dll"
;
internal
const
string
Wtsapi32
=
"wtsapi32.dll"
;
...
...
src/libraries/System.DirectoryServices.AccountManagement/src/System.DirectoryServices.AccountManagement.csproj
浏览文件 @
9f109990
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetFramework)' == 'netstandard2.0'">SR.DirectoryServicesAccountManagement_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetFramework)' == 'netstandard2.0'">SR.DirectoryServicesAccountManagement_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
</PropertyGroup>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
<Compile Include="System\DirectoryServices\AccountManagement\ExternDll.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\interopt.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\interopt.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\PrincipalSearcher.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\PrincipalSearcher.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\Utils.cs" />
<Compile Include="System\DirectoryServices\AccountManagement\Utils.cs" />
...
...
src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/ExternDll.cs
已删除
100644 → 0
浏览文件 @
5524f37b
// 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"
;
}
}
src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/interopt.cs
浏览文件 @
9f109990
...
@@ -23,16 +23,16 @@ internal static class Constants
...
@@ -23,16 +23,16 @@ internal static class Constants
internal
static
class
SafeNativeMethods
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
();
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
);
public
static
extern
int
LsaNtStatusToWinError
(
int
ntStatus
);
}
}
internal
static
class
UnsafeNativeMethods
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
);
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
)
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
...
@@ -431,7 +431,7 @@ public sealed class DSROLE_PRIMARY_DOMAIN_INFO_BASIC
PBYTE* Buffer
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
(
public
static
extern
int
DsRoleGetPrimaryDomainInformation
(
[
MarshalAs
(
UnmanagedType
.
LPTStr
)]
string
lpServer
,
[
MarshalAs
(
UnmanagedType
.
LPTStr
)]
string
lpServer
,
[
In
]
DSROLE_PRIMARY_DOMAIN_INFO_LEVEL
InfoLevel
,
[
In
]
DSROLE_PRIMARY_DOMAIN_INFO_LEVEL
InfoLevel
,
...
@@ -467,7 +467,7 @@ public sealed class DomainControllerInfo
...
@@ -467,7 +467,7 @@ public sealed class DomainControllerInfo
PVOID Buffer
PVOID Buffer
);
);
*/
*/
[
DllImport
(
"dsrole.dll"
)]
[
DllImport
(
Interop
.
Libraries
.
Dsrole
)]
public
static
extern
int
DsRoleFreeMemory
(
public
static
extern
int
DsRoleFreeMemory
(
[
In
]
IntPtr
buffer
);
[
In
]
IntPtr
buffer
);
...
@@ -479,7 +479,7 @@ PVOID Buffer
...
@@ -479,7 +479,7 @@ PVOID Buffer
ULONG Flags,
ULONG Flags,
PDOMAIN_CONTROLLER_INFO* DomainControllerInfo
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
(
public
static
extern
int
DsGetDcName
(
[
In
]
string
computerName
,
[
In
]
string
computerName
,
[
In
]
string
domainName
,
[
In
]
string
domainName
,
...
@@ -505,10 +505,10 @@ public sealed class WKSTA_INFO_100
...
@@ -505,10 +505,10 @@ public sealed class WKSTA_INFO_100
public
int
wki100_ver_minor
;
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
);
public
static
extern
int
NetWkstaGetInfo
(
string
server
,
int
level
,
ref
IntPtr
buffer
);
[
DllImport
(
"netutils.dll"
)]
[
DllImport
(
Interop
.
Libraries
.
Netutils
)]
public
static
extern
int
NetApiBufferFree
(
public
static
extern
int
NetApiBufferFree
(
[
In
]
IntPtr
buffer
);
[
In
]
IntPtr
buffer
);
...
@@ -516,37 +516,37 @@ public sealed class WKSTA_INFO_100
...
@@ -516,37 +516,37 @@ public sealed class WKSTA_INFO_100
// SID
// 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
);
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
);
public
static
extern
bool
ConvertStringSidToSid
(
string
stringSid
,
ref
IntPtr
sid
);
[
DllImport
(
"advapi32.dll"
)]
[
DllImport
(
Interop
.
Libraries
.
Advapi32
)]
public
static
extern
int
GetLengthSid
(
IntPtr
sid
);
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
);
public
static
extern
bool
IsValidSid
(
IntPtr
sid
);
[
DllImport
(
"advapi32.dll"
)]
[
DllImport
(
Interop
.
Libraries
.
Advapi32
)]
public
static
extern
IntPtr
GetSidIdentifierAuthority
(
IntPtr
sid
);
public
static
extern
IntPtr
GetSidIdentifierAuthority
(
IntPtr
sid
);
[
DllImport
(
"advapi32.dll"
)]
[
DllImport
(
Interop
.
Libraries
.
Advapi32
)]
public
static
extern
IntPtr
GetSidSubAuthority
(
IntPtr
sid
,
int
index
);
public
static
extern
IntPtr
GetSidSubAuthority
(
IntPtr
sid
,
int
index
);
[
DllImport
(
"advapi32.dll"
)]
[
DllImport
(
Interop
.
Libraries
.
Advapi32
)]
public
static
extern
IntPtr
GetSidSubAuthorityCount
(
IntPtr
sid
);
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
);
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
);
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
);
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
(
public
static
extern
unsafe
int
CredUIParseUserName
(
string
pszUserName
,
string
pszUserName
,
char
*
pszUser
,
char
*
pszUser
,
...
@@ -570,7 +570,7 @@ internal sealed class AUTHZ_RM_FLAG
...
@@ -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
);
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
(
public
static
extern
bool
AuthzInitializeResourceManager
(
int
flags
,
int
flags
,
IntPtr
pfnAccessCheck
,
IntPtr
pfnAccessCheck
,
...
@@ -591,7 +591,7 @@ internal sealed class AUTHZ_RM_FLAG
...
@@ -591,7 +591,7 @@ internal sealed class AUTHZ_RM_FLAG
PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
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
(
public
static
extern
bool
AuthzInitializeContextFromSid
(
int
Flags
,
int
Flags
,
IntPtr
UserSid
,
IntPtr
UserSid
,
...
@@ -603,7 +603,7 @@ PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
...
@@ -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(
static extern public bool AuthzInitializeContextFromToken(
int Flags,
int Flags,
IntPtr TokenHandle,
IntPtr TokenHandle,
...
@@ -614,7 +614,7 @@ PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
...
@@ -614,7 +614,7 @@ PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
out IntPtr 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
(
public
static
extern
bool
AuthzGetInformationFromContext
(
IntPtr
hAuthzClientContext
,
IntPtr
hAuthzClientContext
,
int
InfoClass
,
int
InfoClass
,
...
@@ -623,12 +623,12 @@ PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
...
@@ -623,12 +623,12 @@ PAUTHZ_CLIENT_CONTEXT_HANDLE pAuthzClientContext
IntPtr
Buffer
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
(
public
static
extern
bool
AuthzFreeContext
(
IntPtr
AuthzClientContext
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
(
public
static
extern
bool
AuthzFreeResourceManager
(
IntPtr
rm
IntPtr
rm
);
);
...
@@ -734,7 +734,7 @@ public sealed class LSA_TRUST_INFORMATION
...
@@ -734,7 +734,7 @@ public sealed class LSA_TRUST_INFORMATION
private
readonly
IntPtr
_pSid
=
IntPtr
.
Zero
;
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
(
public
static
extern
bool
OpenThreadToken
(
IntPtr
threadHandle
,
IntPtr
threadHandle
,
int
desiredAccess
,
int
desiredAccess
,
...
@@ -742,23 +742,23 @@ public sealed class LSA_TRUST_INFORMATION
...
@@ -742,23 +742,23 @@ public sealed class LSA_TRUST_INFORMATION
ref
IntPtr
tokenHandle
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
(
public
static
extern
bool
OpenProcessToken
(
IntPtr
processHandle
,
IntPtr
processHandle
,
int
desiredAccess
,
int
desiredAccess
,
ref
IntPtr
tokenHandle
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
);
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
();
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
();
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
(
public
static
extern
bool
GetTokenInformation
(
IntPtr
tokenHandle
,
IntPtr
tokenHandle
,
int
tokenInformationClass
,
int
tokenInformationClass
,
...
@@ -767,21 +767,21 @@ public sealed class LSA_TRUST_INFORMATION
...
@@ -767,21 +767,21 @@ public sealed class LSA_TRUST_INFORMATION
ref
int
returnLength
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
(
public
static
extern
int
LsaOpenPolicy
(
IntPtr
lsaUnicodeString
,
IntPtr
lsaUnicodeString
,
IntPtr
lsaObjectAttributes
,
IntPtr
lsaObjectAttributes
,
int
desiredAccess
,
int
desiredAccess
,
ref
IntPtr
policyHandle
);
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
(
public
static
extern
int
LsaQueryInformationPolicy
(
IntPtr
policyHandle
,
IntPtr
policyHandle
,
int
policyInformationClass
,
int
policyInformationClass
,
ref
IntPtr
buffer
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
(
public
static
extern
int
LsaLookupSids
(
IntPtr
policyHandle
,
IntPtr
policyHandle
,
int
count
,
int
count
,
...
@@ -790,17 +790,17 @@ public sealed class LSA_TRUST_INFORMATION
...
@@ -790,17 +790,17 @@ public sealed class LSA_TRUST_INFORMATION
out
IntPtr
names
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
);
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
);
public
static
extern
int
LsaClose
(
IntPtr
policyHandle
);
//
//
// Impersonation
// 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
(
public
static
extern
int
LogonUser
(
string
lpszUsername
,
string
lpszUsername
,
string
lpszDomain
,
string
lpszDomain
,
...
@@ -809,10 +809,10 @@ public sealed class LSA_TRUST_INFORMATION
...
@@ -809,10 +809,10 @@ public sealed class LSA_TRUST_INFORMATION
int
dwLogonProvider
,
int
dwLogonProvider
,
ref
IntPtr
phToken
);
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
);
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
();
public
static
extern
int
RevertToSelf
();
}
}
}
}
src/libraries/System.DirectoryServices/src/Interop/SafeNativeMethods.cs
浏览文件 @
9f109990
...
@@ -9,13 +9,13 @@ namespace System.DirectoryServices.Interop
...
@@ -9,13 +9,13 @@ namespace System.DirectoryServices.Interop
{
{
internal
static
class
SafeNativeMethods
internal
static
class
SafeNativeMethods
{
{
[
DllImport
(
ExternDll
.
Olea
ut32
,
PreserveSig
=
false
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
OleA
ut32
,
PreserveSig
=
false
)]
public
static
extern
void
VariantClear
(
IntPtr
pObject
);
public
static
extern
void
VariantClear
(
IntPtr
pObject
);
[
DllImport
(
ExternDll
.
Olea
ut32
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
OleA
ut32
)]
public
static
extern
void
VariantInit
(
IntPtr
pObject
);
public
static
extern
void
VariantInit
(
IntPtr
pObject
);
[
DllImport
(
ExternDll
.
Activeds
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Activeds
)]
public
static
extern
bool
FreeADsMem
(
IntPtr
pVoid
);
public
static
extern
bool
FreeADsMem
(
IntPtr
pVoid
);
public
const
int
public
const
int
...
@@ -25,10 +25,10 @@ public const int
...
@@ -25,10 +25,10 @@ public const int
ERROR_MORE_DATA
=
234
,
ERROR_MORE_DATA
=
234
,
ERROR_SUCCESS
=
0
;
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
);
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
static
extern
int
ADsSetLastError
(
int
error
,
string
?
errorString
,
string
?
provider
);
public
class
EnumVariant
public
class
EnumVariant
...
...
src/libraries/System.DirectoryServices/src/Interop/UnsafeNativeMethods.cs
浏览文件 @
9f109990
...
@@ -28,7 +28,7 @@ internal struct Variant
...
@@ -28,7 +28,7 @@ internal struct Variant
internal
static
class
UnsafeNativeMethods
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
);
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
)
public
static
int
ADsOpenObject
(
string
path
,
string
?
userName
,
string
?
password
,
int
flags
,
[
In
,
Out
]
ref
Guid
iid
,
[
Out
,
MarshalAs
(
UnmanagedType
.
Interface
)]
out
object
ppObject
)
...
...
src/libraries/System.DirectoryServices/src/System.DirectoryServices.csproj
浏览文件 @
9f109990
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetFramework)' == 'netstandard2.0'">SR.DirectoryServices_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetFramework)' == 'netstandard2.0'">SR.DirectoryServices_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
</PropertyGroup>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.0'">
<Compile Include="System\DirectoryServices\ExternDll.cs" />
<Compile Include="System\DirectoryServices\ActiveDirectorySecurity.cs" />
<Compile Include="System\DirectoryServices\ActiveDirectorySecurity.cs" />
<Compile Include="System\DirectoryServices\AdsVLV.cs" />
<Compile Include="System\DirectoryServices\AdsVLV.cs" />
<Compile Include="System\DirectoryServices\AuthenticationTypes.cs" />
<Compile Include="System\DirectoryServices\AuthenticationTypes.cs" />
...
@@ -137,6 +136,8 @@
...
@@ -137,6 +136,8 @@
<Compile Include="Interop\NativeMethods.cs" />
<Compile Include="Interop\NativeMethods.cs" />
<Compile Include="Interop\SafeNativeMethods.cs" />
<Compile Include="Interop\SafeNativeMethods.cs" />
<Compile Include="Interop\UnsafeNativeMethods.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" />
<Compile Include="$(CommonPath)System\Obsoletions.cs" Link="System\Obsoletions.cs" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
...
...
src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/NativeMethods.cs
浏览文件 @
9f109990
...
@@ -320,7 +320,7 @@ internal sealed class NativeMethods
...
@@ -320,7 +320,7 @@ internal sealed class NativeMethods
ULONG Flags,
ULONG Flags,
PDOMAIN_CONTROLLER_INFO* DomainControllerInfo
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
(
internal
static
extern
int
DsGetDcName
(
[
In
]
string
?
computerName
,
[
In
]
string
?
computerName
,
[
In
]
string
?
domainName
,
[
In
]
string
?
domainName
,
...
@@ -338,7 +338,7 @@ internal sealed class NativeMethods
...
@@ -338,7 +338,7 @@ internal sealed class NativeMethods
ULONG DcFlags,
ULONG DcFlags,
PHANDLE RetGetDcContext
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
(
internal
static
extern
int
DsGetDcOpen
(
[
In
]
string
?
dnsName
,
[
In
]
string
?
dnsName
,
[
In
]
int
optionFlags
,
[
In
]
int
optionFlags
,
...
@@ -354,7 +354,7 @@ PHANDLE RetGetDcContext
...
@@ -354,7 +354,7 @@ PHANDLE RetGetDcContext
LPSOCKET_ADDRESS* SockAddresses,
LPSOCKET_ADDRESS* SockAddresses,
LPTSTR* DnsHostName
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
(
internal
static
extern
int
DsGetDcNext
(
[
In
]
IntPtr
getDcContextHandle
,
[
In
]
IntPtr
getDcContextHandle
,
[
In
,
Out
]
ref
IntPtr
sockAddressCount
,
[
In
,
Out
]
ref
IntPtr
sockAddressCount
,
...
@@ -364,14 +364,14 @@ PHANDLE RetGetDcContext
...
@@ -364,14 +364,14 @@ PHANDLE RetGetDcContext
/*void WINAPI DsGetDcClose(
/*void WINAPI DsGetDcClose(
HANDLE GetDcContextHandle
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
(
internal
static
extern
void
DsGetDcClose
(
[
In
]
IntPtr
getDcContextHandle
);
[
In
]
IntPtr
getDcContextHandle
);
/*NET_API_STATUS NetApiBufferFree(
/*NET_API_STATUS NetApiBufferFree(
LPVOID Buffer
LPVOID Buffer
);*/
);*/
[
DllImport
(
"Netapi32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Netapi32
)]
internal
static
extern
int
NetApiBufferFree
(
internal
static
extern
int
NetApiBufferFree
(
[
In
]
IntPtr
buffer
);
[
In
]
IntPtr
buffer
);
...
@@ -458,7 +458,7 @@ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
...
@@ -458,7 +458,7 @@ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
[
Out
]
out
IntPtr
roles
);
[
Out
]
out
IntPtr
roles
);
/*DWORD GetLastError(VOID)*/
/*DWORD GetLastError(VOID)*/
[
DllImport
(
"Kernel32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Kernel32
)]
internal
static
extern
int
GetLastError
();
internal
static
extern
int
GetLastError
();
internal
const
int
DnsSrvData
=
33
;
internal
const
int
DnsSrvData
=
33
;
...
@@ -472,7 +472,7 @@ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
...
@@ -472,7 +472,7 @@ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
PDNS_RECORD *ppQueryResultsSet,
PDNS_RECORD *ppQueryResultsSet,
PVOID *pReserved
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
(
internal
static
extern
int
DnsQuery
(
[
In
]
string
recordName
,
[
In
]
string
recordName
,
[
In
]
short
recordType
,
[
In
]
short
recordType
,
...
@@ -485,7 +485,7 @@ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
...
@@ -485,7 +485,7 @@ RPC_AUTH_IDENTITY_HANDLE AuthIdentity
PDNS_RECORD pRecordList,
PDNS_RECORD pRecordList,
DNS_FREE_TYPE FreeType
DNS_FREE_TYPE FreeType
);*/
);*/
[
DllImport
(
"Dnsapi.dll"
,
CharSet
=
CharSet
.
Unicode
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Dnsapi
,
CharSet
=
CharSet
.
Unicode
)]
internal
static
extern
void
DnsRecordListFree
(
internal
static
extern
void
DnsRecordListFree
(
[
In
]
IntPtr
dnsResultList
,
[
In
]
IntPtr
dnsResultList
,
[
In
]
bool
dnsFreeType
);
[
In
]
bool
dnsFreeType
);
...
@@ -493,7 +493,7 @@ DNS_FREE_TYPE FreeType
...
@@ -493,7 +493,7 @@ DNS_FREE_TYPE FreeType
/*BOOL GetVersionEx(
/*BOOL GetVersionEx(
LPOSVERSIONINFO lpVersionInfo
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
(
internal
static
extern
bool
GetVersionEx
(
[
In
,
Out
]
OSVersionInfoEx
ver
);
[
In
,
Out
]
OSVersionInfoEx
ver
);
...
@@ -518,7 +518,7 @@ LPOSVERSIONINFO lpVersionInfo
...
@@ -518,7 +518,7 @@ LPOSVERSIONINFO lpVersionInfo
/*NTSTATUS LsaConnectUntrusted(
/*NTSTATUS LsaConnectUntrusted(
PHANDLE LsaHandle
PHANDLE LsaHandle
);*/
);*/
[
DllImport
(
"Secur32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Secur32
)]
internal
static
extern
int
LsaConnectUntrusted
(
internal
static
extern
int
LsaConnectUntrusted
(
[
Out
]
out
LsaLogonProcessSafeHandle
lsaHandle
);
[
Out
]
out
LsaLogonProcessSafeHandle
lsaHandle
);
...
@@ -533,7 +533,7 @@ PHANDLE LsaHandle
...
@@ -533,7 +533,7 @@ PHANDLE LsaHandle
PULONG ReturnBufferLength,
PULONG ReturnBufferLength,
PNTSTATUS ProtocolStatus
PNTSTATUS ProtocolStatus
);*/
);*/
[
DllImport
(
"Secur32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Secur32
)]
internal
static
extern
int
LsaCallAuthenticationPackage
(
internal
static
extern
int
LsaCallAuthenticationPackage
(
[
In
]
LsaLogonProcessSafeHandle
lsaHandle
,
[
In
]
LsaLogonProcessSafeHandle
lsaHandle
,
[
In
]
int
authenticationPackage
,
[
In
]
int
authenticationPackage
,
...
@@ -546,14 +546,14 @@ PNTSTATUS ProtocolStatus
...
@@ -546,14 +546,14 @@ PNTSTATUS ProtocolStatus
/*NTSTATUS LsaFreeReturnBuffer(
/*NTSTATUS LsaFreeReturnBuffer(
PVOID Buffer
PVOID Buffer
);*/
);*/
[
DllImport
(
"Secur32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Secur32
)]
internal
static
extern
uint
LsaFreeReturnBuffer
(
internal
static
extern
uint
LsaFreeReturnBuffer
(
[
In
]
IntPtr
buffer
);
[
In
]
IntPtr
buffer
);
/*NTSTATUS LsaDeregisterLogonProcess(
/*NTSTATUS LsaDeregisterLogonProcess(
HANDLE LsaHandle
HANDLE LsaHandle
);*/
);*/
[
DllImport
(
"Secur32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Secur32
)]
internal
static
extern
int
LsaDeregisterLogonProcess
(
internal
static
extern
int
LsaDeregisterLogonProcess
(
[
In
]
IntPtr
lsaHandle
);
[
In
]
IntPtr
lsaHandle
);
...
@@ -564,7 +564,7 @@ HANDLE LsaHandle
...
@@ -564,7 +564,7 @@ HANDLE LsaHandle
DWORD lpString2,
DWORD lpString2,
DWORD cchCount2
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
(
internal
static
extern
int
CompareString
(
[
In
]
uint
locale
,
[
In
]
uint
locale
,
[
In
]
uint
dwCmpFlags
,
[
In
]
uint
dwCmpFlags
,
...
@@ -573,7 +573,7 @@ DWORD cchCount2
...
@@ -573,7 +573,7 @@ DWORD cchCount2
[
In
]
IntPtr
lpString2
,
[
In
]
IntPtr
lpString2
,
[
In
]
int
cchCount2
);
[
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
);
internal
static
extern
int
LsaNtStatusToWinError
(
int
ntStatus
);
}
}
...
...
src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/UnsafeNativeMethods.cs
浏览文件 @
9f109990
...
@@ -639,107 +639,107 @@ internal static class UnsafeNativeMethods
...
@@ -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
);
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
);
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
);
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
);
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
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
int
DsListDomainsInSiteW
(
IntPtr
handle
,
[
MarshalAs
(
UnmanagedType
.
LPWStr
)]
string
site
,
ref
IntPtr
info
);
public
delegate
void
DsFreeNameResultW
(
IntPtr
result
);
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
);
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
);
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
);
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
);
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
();
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
();
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
);
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
);
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
);
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
);
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
);
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
);
public
static
extern
IntPtr
GetProcAddress
(
LoadLibrarySafeHandle
hModule
,
string
entryPoint
);
/*
/*
...
@@ -749,40 +749,40 @@ internal static class UnsafeNativeMethods
...
@@ -749,40 +749,40 @@ internal static class UnsafeNativeMethods
PBYTE* Buffer
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
(
public
static
extern
int
DsRoleGetPrimaryDomainInformation
(
[
MarshalAs
(
UnmanagedType
.
LPTStr
)]
string
lpServer
,
[
MarshalAs
(
UnmanagedType
.
LPTStr
)]
string
lpServer
,
[
In
]
DSROLE_PRIMARY_DOMAIN_INFO_LEVEL
InfoLevel
,
[
In
]
DSROLE_PRIMARY_DOMAIN_INFO_LEVEL
InfoLevel
,
out
IntPtr
Buffer
);
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
(
public
static
extern
int
DsRoleGetPrimaryDomainInformation
(
[
In
]
IntPtr
lpServer
,
[
In
]
IntPtr
lpServer
,
[
In
]
DSROLE_PRIMARY_DOMAIN_INFO_LEVEL
InfoLevel
,
[
In
]
DSROLE_PRIMARY_DOMAIN_INFO_LEVEL
InfoLevel
,
out
IntPtr
Buffer
);
out
IntPtr
Buffer
);
[
DllImport
(
"advapi32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Advapi32
)]
public
static
extern
int
GetLengthSid
(
IntPtr
sid
);
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
);
public
static
extern
bool
IsValidSid
(
IntPtr
sid
);
[
DllImport
(
"advapi32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Advapi32
)]
public
static
extern
IntPtr
GetSidIdentifierAuthority
(
IntPtr
sid
);
public
static
extern
IntPtr
GetSidIdentifierAuthority
(
IntPtr
sid
);
[
DllImport
(
"advapi32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Advapi32
)]
public
static
extern
IntPtr
GetSidSubAuthority
(
IntPtr
sid
,
int
index
);
public
static
extern
IntPtr
GetSidSubAuthority
(
IntPtr
sid
,
int
index
);
[
DllImport
(
"advapi32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Advapi32
)]
public
static
extern
IntPtr
GetSidSubAuthorityCount
(
IntPtr
sid
);
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
);
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
);
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
(
public
static
extern
bool
OpenThreadToken
(
IntPtr
threadHandle
,
IntPtr
threadHandle
,
int
desiredAccess
,
int
desiredAccess
,
...
@@ -790,20 +790,20 @@ internal static class UnsafeNativeMethods
...
@@ -790,20 +790,20 @@ internal static class UnsafeNativeMethods
ref
IntPtr
tokenHandle
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
(
public
static
extern
bool
OpenProcessToken
(
IntPtr
processHandle
,
IntPtr
processHandle
,
int
desiredAccess
,
int
desiredAccess
,
ref
IntPtr
tokenHandle
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
();
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
();
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
(
public
static
extern
bool
GetTokenInformation
(
IntPtr
tokenHandle
,
IntPtr
tokenHandle
,
int
tokenInformationClass
,
int
tokenInformationClass
,
...
@@ -812,21 +812,21 @@ internal static class UnsafeNativeMethods
...
@@ -812,21 +812,21 @@ internal static class UnsafeNativeMethods
ref
int
returnLength
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
(
public
static
extern
int
LsaOpenPolicy
(
IntPtr
lsaUnicodeString
,
IntPtr
lsaUnicodeString
,
IntPtr
lsaObjectAttributes
,
IntPtr
lsaObjectAttributes
,
int
desiredAccess
,
int
desiredAccess
,
ref
IntPtr
policyHandle
);
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
(
public
static
extern
int
LsaQueryInformationPolicy
(
IntPtr
policyHandle
,
IntPtr
policyHandle
,
int
policyInformationClass
,
int
policyInformationClass
,
ref
IntPtr
buffer
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
(
public
static
extern
int
LsaLookupSids
(
IntPtr
policyHandle
,
IntPtr
policyHandle
,
int
count
,
int
count
,
...
@@ -840,7 +840,7 @@ internal static class UnsafeNativeMethods
...
@@ -840,7 +840,7 @@ internal static class UnsafeNativeMethods
PVOID Buffer
PVOID Buffer
);
);
*/
*/
[
DllImport
(
"Netapi32.dll"
)]
[
DllImport
(
global
::
Interop
.
Libraries
.
Netapi32
)]
public
static
extern
int
DsRoleFreeMemory
(
public
static
extern
int
DsRoleFreeMemory
(
[
In
]
IntPtr
buffer
);
[
In
]
IntPtr
buffer
);
}
}
...
...
src/libraries/System.DirectoryServices/src/System/DirectoryServices/ExternDll.cs
已删除
100644 → 0
浏览文件 @
5524f37b
// 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录