Use Kernel32 instead of api-ms-win-core-* in DllImports in SafeFileHandle.cs
authorEgor Chesakov <Egor.Chesakov@microsoft.com>
Thu, 3 Jan 2019 20:13:13 +0000 (12:13 -0800)
committerEgor Chesakov <Egor.Chesakov@microsoft.com>
Fri, 4 Jan 2019 01:44:44 +0000 (17:44 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/90a295c24f7f8764ea56670955340e2ddc764b00

src/coreclr/tests/src/Interop/PInvoke/SafeHandles/SafeFileHandle.cs

index b88696f..efbba7d 100644 (file)
@@ -21,7 +21,7 @@ namespace SafeHandlesTests{
         }
 
         //each SafeHandle subclass will expose a static method for instance creation
-        [DllImport("api-ms-win-core-file-l1-2-1", EntryPoint = "CreateFileW", SetLastError = true)]
+        [DllImport("Kernel32", EntryPoint = "CreateFileW", SetLastError = true)]
         public static extern ChildSFH_NoCloseHandle CreateChildSafeFileHandle(String lpFileName,
             DesiredAccess dwDesiredAccess, ShareMode dwShareMode,
             IntPtr lpSecurityAttributes, CreationDisposition dwCreationDisposition,
@@ -49,7 +49,7 @@ namespace SafeHandlesTests{
     public class ChildSafeFileHandle : SafeFileHandle
     {
         //each SafeHandle subclass will expose a static method for instance creation
-        [DllImport("api-ms-win-core-file-l1-2-1", EntryPoint = "CreateFileW", SetLastError = true)]
+        [DllImport("Kernel32", EntryPoint = "CreateFileW", SetLastError = true)]
         public static extern ChildSafeFileHandle CreateChildSafeFileHandle(String lpFileName,
             DesiredAccess dwDesiredAccess, ShareMode dwShareMode,
             IntPtr lpSecurityAttributes, CreationDisposition dwCreationDisposition,
@@ -77,7 +77,7 @@ namespace SafeHandlesTests{
         }
 
         //each SafeHandle subclass will expose a static method for instance creation
-        [DllImport("api-ms-win-core-file-l1-2-1", EntryPoint = "CreateFileW", SetLastError = true)]
+        [DllImport("Kernel32", EntryPoint = "CreateFileW", SetLastError = true)]
         public static extern SFH_NoCloseHandle CreateFile(String lpFileName,
                                                 DesiredAccess dwDesiredAccess, ShareMode dwShareMode,
                                                 IntPtr lpSecurityAttributes, CreationDisposition dwCreationDisposition,
@@ -126,12 +126,12 @@ namespace SafeHandlesTests{
         }
 
         [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
-        [DllImport("api-ms-win-core-handle-l1-1-0", SetLastError = true)]
+        [DllImport("Kernel32", SetLastError = true)]
         private static extern bool CloseHandle(IntPtr handle);
 
 
         //each SafeHandle subclass will expose a static method for instance creation
-        [DllImport("api-ms-win-core-file-l1-2-1", EntryPoint = "CreateFileW", SetLastError = true)]
+        [DllImport("Kernel32", EntryPoint = "CreateFileW", SetLastError = true)]
         public static extern SafeFileHandle CreateFile(String lpFileName,
                                                 DesiredAccess dwDesiredAccess, ShareMode dwShareMode,
                                                 IntPtr lpSecurityAttributes, CreationDisposition dwCreationDisposition,