Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
3cbbadee
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,发现更多精彩内容 >>
未验证
提交
3cbbadee
编写于
4月 11, 2021
作者:
J
John Tur
提交者:
GitHub
4月 11, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move some Marshal functions to shared partition (#51045)
上级
c5872ac0
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
28 addition
and
77 deletion
+28
-77
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
...Lib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
+0
-31
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs
...reLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs
+0
-18
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs
...ate.CoreLib/src/System/Runtime/InteropServices/Marshal.cs
+28
-0
src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs
...ime.InteropServices/ref/System.Runtime.InteropServices.cs
+0
-3
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/AddRefTests.cs
...sts/System/Runtime/InteropServices/Marshal/AddRefTests.cs
+0
-8
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs
...em/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs
+0
-9
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReleaseTests.cs
...ts/System/Runtime/InteropServices/Marshal/ReleaseTests.cs
+0
-8
未找到文件。
src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
浏览文件 @
3cbbadee
...
...
@@ -600,37 +600,6 @@ public static bool SetComObjectData(object obj, object key, object? data)
[
MethodImpl
(
MethodImplOptions
.
InternalCall
)]
public
static
extern
bool
IsTypeVisibleFromCom
(
Type
t
);
[
SupportedOSPlatform
(
"windows"
)]
public
static
unsafe
int
QueryInterface
(
IntPtr
pUnk
,
ref
Guid
iid
,
out
IntPtr
ppv
)
{
if
(
pUnk
==
IntPtr
.
Zero
)
throw
new
ArgumentNullException
(
nameof
(
pUnk
));
fixed
(
Guid
*
pIID
=
&
iid
)
fixed
(
IntPtr
*
p
=
&
ppv
)
{
return
((
delegate
*
unmanaged
<
IntPtr
,
Guid
*,
IntPtr
*,
int
>)(*(*(
void
***)
pUnk
+
0
/* IUnknown.QueryInterface slot */
)))(
pUnk
,
pIID
,
p
);
}
}
[
SupportedOSPlatform
(
"windows"
)]
public
static
unsafe
int
AddRef
(
IntPtr
pUnk
)
{
if
(
pUnk
==
IntPtr
.
Zero
)
throw
new
ArgumentNullException
(
nameof
(
pUnk
));
return
((
delegate
*
unmanaged
<
IntPtr
,
int
>)(*(*(
void
***)
pUnk
+
1
/* IUnknown.AddRef slot */
)))(
pUnk
);
}
[
SupportedOSPlatform
(
"windows"
)]
public
static
unsafe
int
Release
(
IntPtr
pUnk
)
{
if
(
pUnk
==
IntPtr
.
Zero
)
throw
new
ArgumentNullException
(
nameof
(
pUnk
));
return
((
delegate
*
unmanaged
<
IntPtr
,
int
>)(*(*(
void
***)
pUnk
+
2
/* IUnknown.Release slot */
)))(
pUnk
);
}
[
SupportedOSPlatform
(
"windows"
)]
[
MethodImpl
(
MethodImplOptions
.
InternalCall
)]
public
static
extern
void
GetNativeVariantForObject
(
object
?
obj
,
/* VARIANT * */
IntPtr
pDstNativeVariant
);
...
...
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.NoCom.cs
浏览文件 @
3cbbadee
...
...
@@ -15,12 +15,6 @@ public static int GetHRForException(Exception? e)
return
e
?.
HResult
??
0
;
}
[
SupportedOSPlatform
(
"windows"
)]
public
static
int
AddRef
(
IntPtr
pUnk
)
{
throw
new
PlatformNotSupportedException
(
SR
.
PlatformNotSupported_ComInterop
);
}
public
static
bool
AreComObjectsAvailableForCleanup
()
=>
false
;
[
SupportedOSPlatform
(
"windows"
)]
...
...
@@ -214,18 +208,6 @@ public static bool IsTypeVisibleFromCom(Type t)
return
false
;
}
[
SupportedOSPlatform
(
"windows"
)]
public
static
int
QueryInterface
(
IntPtr
pUnk
,
ref
Guid
iid
,
out
IntPtr
ppv
)
{
throw
new
PlatformNotSupportedException
(
SR
.
PlatformNotSupported_ComInterop
);
}
[
SupportedOSPlatform
(
"windows"
)]
public
static
int
Release
(
IntPtr
pUnk
)
{
throw
new
PlatformNotSupportedException
(
SR
.
PlatformNotSupported_ComInterop
);
}
[
SupportedOSPlatform
(
"windows"
)]
public
static
int
ReleaseComObject
(
object
o
)
{
...
...
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs
浏览文件 @
3cbbadee
...
...
@@ -144,6 +144,34 @@ public static int SizeOf(Type t)
public
static
int
SizeOf
<
T
>()
=>
SizeOf
(
typeof
(
T
));
public
static
unsafe
int
QueryInterface
(
IntPtr
pUnk
,
ref
Guid
iid
,
out
IntPtr
ppv
)
{
if
(
pUnk
==
IntPtr
.
Zero
)
throw
new
ArgumentNullException
(
nameof
(
pUnk
));
fixed
(
Guid
*
pIID
=
&
iid
)
fixed
(
IntPtr
*
p
=
&
ppv
)
{
return
((
delegate
*
unmanaged
<
IntPtr
,
Guid
*,
IntPtr
*,
int
>)(*(*(
void
***)
pUnk
+
0
/* IUnknown.QueryInterface slot */
)))(
pUnk
,
pIID
,
p
);
}
}
public
static
unsafe
int
AddRef
(
IntPtr
pUnk
)
{
if
(
pUnk
==
IntPtr
.
Zero
)
throw
new
ArgumentNullException
(
nameof
(
pUnk
));
return
((
delegate
*
unmanaged
<
IntPtr
,
int
>)(*(*(
void
***)
pUnk
+
1
/* IUnknown.AddRef slot */
)))(
pUnk
);
}
public
static
unsafe
int
Release
(
IntPtr
pUnk
)
{
if
(
pUnk
==
IntPtr
.
Zero
)
throw
new
ArgumentNullException
(
nameof
(
pUnk
));
return
((
delegate
*
unmanaged
<
IntPtr
,
int
>)(*(*(
void
***)
pUnk
+
2
/* IUnknown.Release slot */
)))(
pUnk
);
}
/// <summary>
/// IMPORTANT NOTICE: This method does not do any verification on the array.
/// It must be used with EXTREME CAUTION since passing in invalid index or
...
...
src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs
浏览文件 @
3cbbadee
...
...
@@ -492,7 +492,6 @@ public static partial class Marshal
{
public
static
readonly
int
SystemDefaultCharSize
;
public
static
readonly
int
SystemMaxDBCSCharSize
;
[
System
.
Runtime
.
Versioning
.
SupportedOSPlatformAttribute
(
"windows"
)]
public
static
int
AddRef
(
System
.
IntPtr
pUnk
)
{
throw
null
;
}
public
static
System
.
IntPtr
AllocCoTaskMem
(
int
cb
)
{
throw
null
;
}
public
static
System
.
IntPtr
AllocHGlobal
(
int
cb
)
{
throw
null
;
}
...
...
@@ -625,7 +624,6 @@ public static partial class Marshal
public
static
object
?
PtrToStructure
(
System
.
IntPtr
ptr
,
[
System
.
Diagnostics
.
CodeAnalysis
.
DynamicallyAccessedMembersAttribute
(
System
.
Diagnostics
.
CodeAnalysis
.
DynamicallyAccessedMemberTypes
.
PublicParameterlessConstructor
)]
System
.
Type
structureType
)
{
throw
null
;
}
public
static
T
?
PtrToStructure
<[
System
.
Diagnostics
.
CodeAnalysis
.
DynamicallyAccessedMembersAttribute
(
System
.
Diagnostics
.
CodeAnalysis
.
DynamicallyAccessedMemberTypes
.
PublicParameterlessConstructor
)]
T
>(
System
.
IntPtr
ptr
)
{
throw
null
;
}
public
static
void
PtrToStructure
<
T
>(
System
.
IntPtr
ptr
,
[
System
.
Diagnostics
.
CodeAnalysis
.
DisallowNullAttribute
]
T
structure
)
{
}
[
System
.
Runtime
.
Versioning
.
SupportedOSPlatformAttribute
(
"windows"
)]
public
static
int
QueryInterface
(
System
.
IntPtr
pUnk
,
ref
System
.
Guid
iid
,
out
System
.
IntPtr
ppv
)
{
throw
null
;
}
public
static
byte
ReadByte
(
System
.
IntPtr
ptr
)
{
throw
null
;
}
public
static
byte
ReadByte
(
System
.
IntPtr
ptr
,
int
ofs
)
{
throw
null
;
}
...
...
@@ -654,7 +652,6 @@ public static partial class Marshal
public
static
System
.
IntPtr
ReadIntPtr
(
object
ptr
,
int
ofs
)
{
throw
null
;
}
public
static
System
.
IntPtr
ReAllocCoTaskMem
(
System
.
IntPtr
pv
,
int
cb
)
{
throw
null
;
}
public
static
System
.
IntPtr
ReAllocHGlobal
(
System
.
IntPtr
pv
,
System
.
IntPtr
cb
)
{
throw
null
;
}
[
System
.
Runtime
.
Versioning
.
SupportedOSPlatformAttribute
(
"windows"
)]
public
static
int
Release
(
System
.
IntPtr
pUnk
)
{
throw
null
;
}
[
System
.
Runtime
.
Versioning
.
SupportedOSPlatformAttribute
(
"windows"
)]
public
static
int
ReleaseComObject
(
object
o
)
{
throw
null
;
}
...
...
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/AddRefTests.cs
浏览文件 @
3cbbadee
...
...
@@ -29,14 +29,6 @@ public void AddRef_ValidPointer_Success()
}
[
Fact
]
[
PlatformSpecific
(
TestPlatforms
.
AnyUnix
)]
public
void
AddRef_Unix_ThrowsPlatformNotSupportedException
()
{
Assert
.
Throws
<
PlatformNotSupportedException
>(()
=>
Marshal
.
AddRef
(
IntPtr
.
Zero
));
}
[
Fact
]
[
PlatformSpecific
(
TestPlatforms
.
Windows
)]
public
void
AddRef_ZeroPointer_ThrowsArgumentNullException
()
{
AssertExtensions
.
Throws
<
ArgumentNullException
>(
"pUnk"
,
()
=>
Marshal
.
AddRef
(
IntPtr
.
Zero
));
...
...
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/QueryInterfaceTests.cs
浏览文件 @
3cbbadee
...
...
@@ -124,15 +124,6 @@ public void QueryInterface_NoSuchInterface_Success(object o, string iidString)
}
[
Fact
]
[
PlatformSpecific
(
TestPlatforms
.
AnyUnix
)]
public
void
QueryInterface_Unix_ThrowsPlatformNotSupportedException
()
{
Guid
iid
=
Guid
.
Empty
;
Assert
.
Throws
<
PlatformNotSupportedException
>(()
=>
Marshal
.
QueryInterface
(
IntPtr
.
Zero
,
ref
iid
,
out
IntPtr
ppv
));
}
[
Fact
]
[
PlatformSpecific
(
TestPlatforms
.
Windows
)]
public
void
QueryInterface_ZeroPointer_ThrowsArgumentNullException
()
{
Guid
iid
=
Guid
.
Empty
;
...
...
src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/ReleaseTests.cs
浏览文件 @
3cbbadee
...
...
@@ -30,14 +30,6 @@ public void Release_ValidPointer_Success()
}
[
Fact
]
[
PlatformSpecific
(
TestPlatforms
.
AnyUnix
)]
public
void
Release_Unix_ThrowsPlatformNotSupportedException
()
{
Assert
.
Throws
<
PlatformNotSupportedException
>(()
=>
Marshal
.
Release
(
IntPtr
.
Zero
));
}
[
Fact
]
[
PlatformSpecific
(
TestPlatforms
.
Windows
)]
public
void
Release_ZeroPointer_ThrowsArgumentNullException
()
{
AssertExtensions
.
Throws
<
ArgumentNullException
>(
"pUnk"
,
()
=>
Marshal
.
Release
(
IntPtr
.
Zero
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录