diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-03-20 14:03:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-20 14:03:14 -0700 |
commit | 750085eaa497dbcd15c8888f66cd7a3920d7a949 (patch) | |
tree | 268dc56496cf413c6a45387759364091e4b0f394 /src | |
parent | 0097b99d215927ee9be083f7acdc4129679624d2 (diff) | |
parent | 40fee095de80676ffb6e60bd2e9d38d85bfa40b3 (diff) | |
download | coreclr-750085eaa497dbcd15c8888f66cd7a3920d7a949.tar.gz coreclr-750085eaa497dbcd15c8888f66cd7a3920d7a949.tar.bz2 coreclr-750085eaa497dbcd15c8888f66cd7a3920d7a949.zip |
Merge pull request #10317 from dotnet/mirror-merge-9055826
Mirror changes from dotnet/corert
Diffstat (limited to 'src')
-rw-r--r-- | src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs | 8 | ||||
-rw-r--r-- | src/mscorlib/shared/System/IO/FileStream.WinRT.cs | 15 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs index d8cfabddac..0909d3a6c8 100644 --- a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs +++ b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs @@ -11,20 +11,20 @@ internal partial class Interop internal partial class Kernel32 { [DllImport(Libraries.Kernel32, EntryPoint = "CreateFile2", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] - internal static extern SafeFileHandle CreateFile2( + internal static extern unsafe SafeFileHandle CreateFile2( string lpFileName, int dwDesiredAccess, System.IO.FileShare dwShareMode, System.IO.FileMode dwCreationDisposition, - ref CREATEFILE2_EXTENDED_PARAMETERS parameters); + CREATEFILE2_EXTENDED_PARAMETERS* pCreateExParams); - internal struct CREATEFILE2_EXTENDED_PARAMETERS + internal unsafe struct CREATEFILE2_EXTENDED_PARAMETERS { internal uint dwSize; internal uint dwFileAttributes; internal uint dwFileFlags; internal uint dwSecurityQosFlags; - internal IntPtr lpSecurityAttributes; + internal SECURITY_ATTRIBUTES* lpSecurityAttributes; internal IntPtr hTemplateFile; } } diff --git a/src/mscorlib/shared/System/IO/FileStream.WinRT.cs b/src/mscorlib/shared/System/IO/FileStream.WinRT.cs index df5e9966b3..062b160b57 100644 --- a/src/mscorlib/shared/System/IO/FileStream.WinRT.cs +++ b/src/mscorlib/shared/System/IO/FileStream.WinRT.cs @@ -9,7 +9,7 @@ namespace System.IO { public partial class FileStream : Stream { - private SafeFileHandle OpenHandle(FileMode mode, FileShare share, FileOptions options) + private unsafe SafeFileHandle OpenHandle(FileMode mode, FileShare share, FileOptions options) { Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = GetSecAttrs(share); @@ -26,14 +26,16 @@ namespace System.IO mode = FileMode.OpenOrCreate; Interop.Kernel32.CREATEFILE2_EXTENDED_PARAMETERS parameters = new Interop.Kernel32.CREATEFILE2_EXTENDED_PARAMETERS(); + parameters.dwSize = (uint)sizeof(Interop.Kernel32.CREATEFILE2_EXTENDED_PARAMETERS); parameters.dwFileFlags = (uint)options; + parameters.lpSecurityAttributes = &secAttrs; SafeFileHandle fileHandle = Interop.Kernel32.CreateFile2( lpFileName: _path, dwDesiredAccess: fAccess, dwShareMode: share, dwCreationDisposition: mode, - parameters: ref parameters); + pCreateExParams: ¶meters); fileHandle.IsAsync = _useAsyncIO; @@ -55,21 +57,22 @@ namespace System.IO return fileHandle; } +#if PROJECTN // TODO: These internal methods should be removed once we start consuming updated CoreFX builds - internal static FileStream InternalOpen(string path, int bufferSize = 4096, bool useAsync = true) + public static FileStream InternalOpen(string path, int bufferSize = 4096, bool useAsync = true) { return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, useAsync); } - internal static FileStream InternalCreate(string path, int bufferSize = 4096, bool useAsync = true) + public static FileStream InternalCreate(string path, int bufferSize = 4096, bool useAsync = true) { return new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, bufferSize, useAsync); } - internal static FileStream InternalAppend(string path, int bufferSize = 4096, bool useAsync = true) + public static FileStream InternalAppend(string path, int bufferSize = 4096, bool useAsync = true) { return new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.Read, bufferSize, useAsync); } - +#endif } } |