Use CreateFile2FromApp if available (#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)
commit41a2b788cb77668d397e372df40c5215bf61bfa7
treefeaf3b12cac4c47f045a26f0fefd54963957fd04
parent151002c8814c2f9fdbc0979c6737f6a3e1878fba
Use CreateFile2FromApp if available (#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
16 files changed:
src/mscorlib/System.Private.CoreLib.csproj
src/mscorlib/shared/Interop/Windows/FileApiInterop/Interop.CreateFile2FromApp.cs [new file with mode: 0644]
src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CREATEFILE2_EXTENDED_PARAMETERS.cs [new file with mode: 0644]
src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs [deleted file]
src/mscorlib/shared/Interop/Windows/Kernel32/Interop.FreeLibrary.cs [new file with mode: 0644]
src/mscorlib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryExW.cs [new file with mode: 0644]
src/mscorlib/shared/Interop/Windows/User32/Interop.LoadStringW.cs [new file with mode: 0644]
src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs [moved from src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs with 77% similarity]
src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
src/mscorlib/shared/System/IO/DisableMediaInsertionPrompt.cs [new file with mode: 0644]
src/mscorlib/shared/System/IO/FileStream.Win32.cs
src/mscorlib/shared/System/IO/FileStream.WinRT.cs
src/mscorlib/shared/System/IO/FileStream.Windows.cs
src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs
src/mscorlib/src/Microsoft/Win32/Win32Native.cs
src/mscorlib/src/System/TimeZoneInfo.Win32.cs