Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
cff5854f
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,发现更多精彩内容 >>
未验证
提交
cff5854f
编写于
6月 18, 2021
作者:
E
Elinor Fung
提交者:
GitHub
6月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make some p/invokes blittable (#54370)
上级
cdf65116
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
30 addition
and
24 deletion
+30
-24
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs
...nix/System.Security.Cryptography.Native/Interop.Crypto.cs
+8
-6
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs
.../Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs
+1
-1
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtCreateFile.cs
.../Common/src/Interop/Windows/NtDll/Interop.NtCreateFile.cs
+8
-6
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryDirectoryFile.cs
...src/Interop/Windows/NtDll/Interop.NtQueryDirectoryFile.cs
+1
-1
src/libraries/Common/src/Interop/Windows/User32/Interop.GetWindowThreadProcessId.cs
...nterop/Windows/User32/Interop.GetWindowThreadProcessId.cs
+1
-1
src/libraries/Common/src/Interop/Windows/User32/Interop.IsWindowVisible.cs
...mon/src/Interop/Windows/User32/Interop.IsWindowVisible.cs
+1
-1
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
...cs.Process/src/System/Diagnostics/ProcessManager.Win32.cs
+2
-2
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/Interop.Windows.cs
...dFiles/src/System/IO/MemoryMappedFiles/Interop.Windows.cs
+1
-1
src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Win32.cs
...b/src/System/IO/Enumeration/FileSystemEnumerator.Win32.cs
+2
-1
src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.Windows.cs
...ate.CoreLib/src/System/Runtime/MemoryFailPoint.Windows.cs
+1
-1
src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj
.../System.Runtime.Caching/src/System.Runtime.Caching.csproj
+2
-1
src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryMonitor.Windows.cs
...ching/src/System/Runtime/Caching/MemoryMonitor.Windows.cs
+1
-1
src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/PhysicalMemoryMonitor.Windows.cs
...c/System/Runtime/Caching/PhysicalMemoryMonitor.Windows.cs
+1
-1
未找到文件。
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs
浏览文件 @
cff5854f
...
...
@@ -68,23 +68,25 @@ internal static int BioTell(SafeBioHandle bio)
[
return
:
MarshalAs
(
UnmanagedType
.
Bool
)]
internal
static
extern
bool
PushX509StackField
(
SafeSharedX509StackHandle
stack
,
SafeX509Handle
x509
);
internal
static
string
?
GetX509RootStorePath
(
out
bool
defaultPath
)
internal
static
unsafe
string
?
GetX509RootStorePath
(
out
bool
defaultPath
)
{
IntPtr
ptr
=
GetX509RootStorePath_private
(
out
byte
usedDefault
);
byte
usedDefault
;
IntPtr
ptr
=
GetX509RootStorePath_private
(&
usedDefault
);
defaultPath
=
(
usedDefault
!=
0
);
return
Marshal
.
PtrToStringAnsi
(
ptr
);
}
internal
static
string
?
GetX509RootStoreFile
()
internal
static
unsafe
string
?
GetX509RootStoreFile
()
{
return
Marshal
.
PtrToStringAnsi
(
GetX509RootStoreFile_private
(
out
_
));
byte
unused
;
return
Marshal
.
PtrToStringAnsi
(
GetX509RootStoreFile_private
(&
unused
));
}
[
DllImport
(
Libraries
.
CryptoNative
,
EntryPoint
=
"CryptoNative_GetX509RootStorePath"
)]
private
static
extern
IntPtr
GetX509RootStorePath_private
(
out
byte
defaultPath
);
private
static
unsafe
extern
IntPtr
GetX509RootStorePath_private
(
byte
*
defaultPath
);
[
DllImport
(
Libraries
.
CryptoNative
,
EntryPoint
=
"CryptoNative_GetX509RootStoreFile"
)]
private
static
extern
IntPtr
GetX509RootStoreFile_private
(
out
byte
defaultPath
);
private
static
unsafe
extern
IntPtr
GetX509RootStoreFile_private
(
byte
*
defaultPath
);
[
DllImport
(
Libraries
.
CryptoNative
)]
private
static
extern
int
CryptoNative_X509StoreSetVerifyTime
(
...
...
src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs
浏览文件 @
cff5854f
...
...
@@ -8,6 +8,6 @@ internal static partial class Interop
internal
static
partial
class
Kernel32
{
[
DllImport
(
Libraries
.
Kernel32
)]
internal
static
extern
bool
GlobalMemoryStatusEx
(
ref
MEMORYSTATUSEX
lpBuffer
);
internal
static
unsafe
extern
BOOL
GlobalMemoryStatusEx
(
MEMORYSTATUSEX
*
lpBuffer
);
}
}
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtCreateFile.cs
浏览文件 @
cff5854f
...
...
@@ -14,10 +14,10 @@ internal static partial class NtDll
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff566424.aspx
[
DllImport
(
Libraries
.
NtDll
,
CharSet
=
CharSet
.
Unicode
,
ExactSpelling
=
true
)]
private
static
extern
unsafe
uint
NtCreateFile
(
out
IntPtr
FileHandle
,
IntPtr
*
FileHandle
,
DesiredAccess
DesiredAccess
,
ref
OBJECT_ATTRIBUTES
ObjectAttributes
,
out
IO_STATUS_BLOCK
IoStatusBlock
,
OBJECT_ATTRIBUTES
*
ObjectAttributes
,
IO_STATUS_BLOCK
*
IoStatusBlock
,
long
*
AllocationSize
,
FileAttributes
FileAttributes
,
FileShare
ShareAccess
,
...
...
@@ -55,11 +55,13 @@ internal static partial class NtDll
rootDirectory
,
securityQualityOfService
);
IntPtr
handle
;
IO_STATUS_BLOCK
statusBlock
;
uint
status
=
NtCreateFile
(
out
IntPtr
handle
,
&
handle
,
desiredAccess
,
ref
attributes
,
out
IO_STATUS_BLOCK
statusBlock
,
&
attributes
,
&
statusBlock
,
AllocationSize
:
preallocationSize
,
fileAttributes
,
shareAccess
,
...
...
src/libraries/Common/src/Interop/Windows/NtDll/Interop.NtQueryDirectoryFile.cs
浏览文件 @
cff5854f
...
...
@@ -16,7 +16,7 @@ internal static partial class NtDll
IntPtr
Event
,
IntPtr
ApcRoutine
,
IntPtr
ApcContext
,
out
IO_STATUS_BLOCK
IoStatusBlock
,
IO_STATUS_BLOCK
*
IoStatusBlock
,
IntPtr
FileInformation
,
uint
Length
,
FILE_INFORMATION_CLASS
FileInformationClass
,
...
...
src/libraries/Common/src/Interop/Windows/User32/Interop.GetWindowThreadProcessId.cs
浏览文件 @
cff5854f
...
...
@@ -9,7 +9,7 @@ internal static partial class Interop
internal
static
partial
class
User32
{
[
DllImport
(
Libraries
.
User32
,
ExactSpelling
=
true
)]
public
static
extern
int
GetWindowThreadProcessId
(
IntPtr
handle
,
out
int
processId
);
public
static
unsafe
extern
int
GetWindowThreadProcessId
(
IntPtr
handle
,
int
*
processId
);
[
DllImport
(
Libraries
.
User32
,
ExactSpelling
=
true
)]
public
static
extern
int
GetWindowThreadProcessId
(
HandleRef
handle
,
out
int
processId
);
...
...
src/libraries/Common/src/Interop/Windows/User32/Interop.IsWindowVisible.cs
浏览文件 @
cff5854f
...
...
@@ -9,6 +9,6 @@ internal static partial class Interop
internal
static
partial
class
User32
{
[
DllImport
(
Libraries
.
User32
)]
public
static
extern
bool
IsWindowVisible
(
IntPtr
hWnd
);
public
static
extern
BOOL
IsWindowVisible
(
IntPtr
hWnd
);
}
}
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Win32.cs
浏览文件 @
cff5854f
...
...
@@ -42,7 +42,7 @@ public static unsafe IntPtr FindMainWindow(int processId)
private
static
bool
IsMainWindow
(
IntPtr
handle
)
{
return
(
Interop
.
User32
.
GetWindow
(
handle
,
GW_OWNER
)
==
IntPtr
.
Zero
)
&&
Interop
.
User32
.
IsWindowVisible
(
handle
);
return
(
Interop
.
User32
.
GetWindow
(
handle
,
GW_OWNER
)
==
IntPtr
.
Zero
)
&&
Interop
.
User32
.
IsWindowVisible
(
handle
)
!=
Interop
.
BOOL
.
FALSE
;
}
[
UnmanagedCallersOnly
]
...
...
@@ -51,7 +51,7 @@ private static unsafe Interop.BOOL EnumWindowsCallback(IntPtr handle, IntPtr ext
MainWindowFinder
*
instance
=
(
MainWindowFinder
*)
extraParameter
;
int
processId
=
0
;
// Avoid uninitialized variable if the window got closed in the meantime
Interop
.
User32
.
GetWindowThreadProcessId
(
handle
,
out
processId
);
Interop
.
User32
.
GetWindowThreadProcessId
(
handle
,
&
processId
);
if
((
processId
==
instance
->
_processId
)
&&
IsMainWindow
(
handle
))
{
...
...
src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/Interop.Windows.cs
浏览文件 @
cff5854f
...
...
@@ -13,7 +13,7 @@ public static unsafe void CheckForAvailableVirtualMemory(ulong nativeSize)
{
Interop
.
Kernel32
.
MEMORYSTATUSEX
memoryStatus
=
default
;
memoryStatus
.
dwLength
=
(
uint
)
sizeof
(
Interop
.
Kernel32
.
MEMORYSTATUSEX
);
if
(
Interop
.
Kernel32
.
GlobalMemoryStatusEx
(
ref
memoryStatus
)
)
if
(
Interop
.
Kernel32
.
GlobalMemoryStatusEx
(
&
memoryStatus
)
!=
Interop
.
BOOL
.
FALSE
)
{
ulong
totalVirtual
=
memoryStatus
.
ullTotalVirtual
;
if
(
nativeSize
>=
totalVirtual
)
...
...
src/libraries/System.Private.CoreLib/src/System/IO/Enumeration/FileSystemEnumerator.Win32.cs
浏览文件 @
cff5854f
...
...
@@ -20,12 +20,13 @@ private unsafe bool GetData()
{
Debug
.
Assert
(
_directoryHandle
!=
(
IntPtr
)(-
1
)
&&
_directoryHandle
!=
IntPtr
.
Zero
&&
!
_lastEntryFound
);
Interop
.
NtDll
.
IO_STATUS_BLOCK
statusBlock
;
int
status
=
Interop
.
NtDll
.
NtQueryDirectoryFile
(
FileHandle
:
_directoryHandle
,
Event
:
IntPtr
.
Zero
,
ApcRoutine
:
IntPtr
.
Zero
,
ApcContext
:
IntPtr
.
Zero
,
IoStatusBlock
:
out
Interop
.
NtDll
.
IO_STATUS_BLOCK
statusBlock
,
IoStatusBlock
:
&
statusBlock
,
FileInformation
:
_buffer
,
Length
:
(
uint
)
_bufferLength
,
FileInformationClass
:
Interop
.
NtDll
.
FILE_INFORMATION_CLASS
.
FileFullDirectoryInformation
,
...
...
src/libraries/System.Private.CoreLib/src/System/Runtime/MemoryFailPoint.Windows.cs
浏览文件 @
cff5854f
...
...
@@ -17,7 +17,7 @@ private static unsafe bool CheckForAvailableMemory(out ulong availPageFile, out
{
Interop
.
Kernel32
.
MEMORYSTATUSEX
memoryStatus
=
default
;
memoryStatus
.
dwLength
=
(
uint
)
sizeof
(
Interop
.
Kernel32
.
MEMORYSTATUSEX
);
if
(
!
Interop
.
Kernel32
.
GlobalMemoryStatusEx
(
ref
memoryStatus
)
)
if
(
Interop
.
Kernel32
.
GlobalMemoryStatusEx
(&
memoryStatus
)
==
Interop
.
BOOL
.
FALSE
)
{
availPageFile
=
default
;
totalAddressSpaceFree
=
default
;
...
...
src/libraries/System.Runtime.Caching/src/System.Runtime.Caching.csproj
浏览文件 @
cff5854f
...
...
@@ -51,6 +51,7 @@
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
<Compile Include="System\Runtime\Caching\MemoryMonitor.Windows.cs" />
<Compile Include="System\Runtime\Caching\PhysicalMemoryMonitor.Windows.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Interop.BOOL.cs" Link="Common\Interop\Windows\Interop.BOOL.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GlobalMemoryStatusEx.cs" Link="Common\Interop\Windows\Kernel32\Interop.GlobalMemoryStatusEx.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.MEMORYSTATUSEX.cs" Link="Common\Interop\Windows\Kernel32\Interop.MEMORYSTATUSEX.cs" />
<Compile Include="$(CommonPath)Interop\Windows\Interop.Libraries.cs" Link="Common\Interop\Windows\Interop.Libraries.cs" />
...
...
@@ -85,4 +86,4 @@
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Configuration.ConfigurationManager\src\System.Configuration.ConfigurationManager.csproj" />
</ItemGroup>
</Project>
\ No newline at end of file
</Project>
src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/MemoryMonitor.Windows.cs
浏览文件 @
cff5854f
...
...
@@ -16,7 +16,7 @@ static unsafe MemoryMonitor()
{
Interop
.
Kernel32
.
MEMORYSTATUSEX
memoryStatus
=
default
;
memoryStatus
.
dwLength
=
(
uint
)
sizeof
(
Interop
.
Kernel32
.
MEMORYSTATUSEX
);
if
(
Interop
.
Kernel32
.
GlobalMemoryStatusEx
(
ref
memoryStatus
)
)
if
(
Interop
.
Kernel32
.
GlobalMemoryStatusEx
(
&
memoryStatus
)
!=
Interop
.
BOOL
.
FALSE
)
{
s_totalPhysical
=
(
long
)
memoryStatus
.
ullTotalPhys
;
s_totalVirtual
=
(
long
)
memoryStatus
.
ullTotalVirtual
;
...
...
src/libraries/System.Runtime.Caching/src/System/Runtime/Caching/PhysicalMemoryMonitor.Windows.cs
浏览文件 @
cff5854f
...
...
@@ -14,7 +14,7 @@ protected override unsafe int GetCurrentPressure()
{
Interop
.
Kernel32
.
MEMORYSTATUSEX
memoryStatus
=
default
;
memoryStatus
.
dwLength
=
(
uint
)
sizeof
(
Interop
.
Kernel32
.
MEMORYSTATUSEX
);
if
(
!
Interop
.
Kernel32
.
GlobalMemoryStatusEx
(
ref
memoryStatus
)
)
if
(
Interop
.
Kernel32
.
GlobalMemoryStatusEx
(&
memoryStatus
)
==
Interop
.
BOOL
.
FALSE
)
{
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录