Use CreateFile2FromApp if available (dotnet/coreclr#13410)
authorJeremy Kuhne <jeremy.kuhne@microsoft.com>
Mon, 21 Aug 2017 22:45:57 +0000 (15:45 -0700)
committerGitHub <noreply@github.com>
Mon, 21 Aug 2017 22:45:57 +0000 (15:45 -0700)
commit885aa67ef538bc733a8525065e6d822779be216c
tree2bee6eabdfb7aac7b3b328ca49e7c79f176ffa46
parent89bdca84994a81cca920f445cbbf0da891992dd7
Use CreateFile2FromApp if available (dotnet/coreclr#13410)

* Use CreateFile2FromApp if available

This is needed for F5 UAP brokering scenarios.

Remove check for handle type. Overzealous, doesn't apply to UAP scenarios.

* Address feedback

- Use CreateFile2 if Win8 or higher
- Always use CreateFile2FromApp if Appx
- Make DisableMediaInsertionPrompt a struct
- Push CreateFile2FromApp down to avoid JIT

* More feedback

Always use FromApp for WinRT.

* Conditionalize IsWindows8OrAbove check

* Always use FromApp if in AppX

* Address more feedback

- Fix Unix build by moving LoadString to shared
- Break out CREATEFILE2 struct
- Condition CreateFile2FromApp usage

* Move include

Commit migrated from https://github.com/dotnet/coreclr/commit/41a2b788cb77668d397e372df40c5215bf61bfa7
16 files changed:
src/coreclr/src/mscorlib/System.Private.CoreLib.csproj
src/coreclr/src/mscorlib/shared/Interop/Windows/FileApiInterop/Interop.CreateFile2FromApp.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs [deleted file]
src/coreclr/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.FreeLibrary.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryExW.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/Interop/Windows/User32/Interop.LoadStringW.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs [moved from src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs with 77% similarity]
src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
src/coreclr/src/mscorlib/shared/System/IO/DisableMediaInsertionPrompt.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/System/IO/FileStream.Win32.cs
src/coreclr/src/mscorlib/shared/System/IO/FileStream.WinRT.cs
src/coreclr/src/mscorlib/shared/System/IO/FileStream.Windows.cs
src/coreclr/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs
src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
src/coreclr/src/mscorlib/src/System/TimeZoneInfo.Win32.cs