Fix ProjectN build break and work around MCG bug (dotnet/corert#5576)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Mon, 19 Mar 2018 18:08:34 +0000 (19:08 +0100)
committerJan Kotas <jkotas@microsoft.com>
Mon, 19 Mar 2018 21:08:10 +0000 (14:08 -0700)
Unblocks integration to TFS.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs
src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs
src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs
src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs

index e64129b..2f3aad8 100644 (file)
@@ -21,7 +21,7 @@ internal partial class Interop
         {
             fixed (char* pBuffer = &lpBuffer)
             fixed (char* pFileName = &lpFileName)
-                return GetFullPathNameW(pFileName, nBufferLength, pBuffer, mustBeZero);
+                return GetFullPathNameW(pFileName, nBufferLength, pBuffer, lpFilePart);
         }
 #else
         internal static extern uint GetFullPathNameW(ref char lpFileName, uint nBufferLength, ref char lpBuffer, IntPtr lpFilePart);
index 09e98d0..ef8fd36 100644 (file)
@@ -14,13 +14,14 @@ internal partial class Interop
         /// </summary>
         [DllImport(Libraries.Kernel32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
 #if PROJECTN
-        internal static extern unsafe uint GetLongPathNameW(ref char lpszShortPath, char* lpszLongPath, uint cchBuffer);
+        internal static extern unsafe uint GetLongPathNameW(char* lpszShortPath, char* lpszLongPath, uint cchBuffer);
 
         // Works around https://devdiv.visualstudio.com/web/wi.aspx?pcguid=011b8bdf-6d56-4f87-be0d-0092136884d9&id=575202
         internal static unsafe uint GetLongPathNameW(ref char lpszShortPath, ref char lpszLongPath, uint cchBuffer)
         {
             fixed (char* plpszLongPath = &lpszLongPath)
-                return GetLongPathNameW(ref lpszShortPath, plpszLongPath, cchBuffer);
+            fixed (char* plpszShortPath = &lpszShortPath)
+                return GetLongPathNameW(plpszShortPath, plpszLongPath, cchBuffer);
         }
 #else
         internal static extern uint GetLongPathNameW(ref char lpszShortPath, ref char lpszLongPath, uint cchBuffer);
index 97e1d82..92da88c 100644 (file)
@@ -9,6 +9,18 @@ internal partial class Interop
     internal partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
+#if PROJECTN
+        internal static extern unsafe uint GetTempFileNameW(char* lpPathName, string lpPrefixString, uint uUnique, char* lpTempFileName);
+
+        // Works around https://devdiv.visualstudio.com/web/wi.aspx?pcguid=011b8bdf-6d56-4f87-be0d-0092136884d9&id=575202
+        internal static unsafe uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName)
+        {
+            fixed (char* plpPathName = &lpPathName)
+            fixed (char* plpTempFileName = &lpTempFileName)
+                return GetTempFileNameW(plpPathName, lpPrefixString, uUnique, plpTempFileName);
+        }
+#else
         internal static extern uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName);
+#endif
     }
 }
index 7f7bb77..19dbae3 100644 (file)
@@ -9,6 +9,17 @@ internal partial class Interop
     internal partial class Kernel32
     {
         [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false)]
+#if PROJECTN
+        internal static extern unsafe uint GetTempPathW(int bufferLen, char* buffer);
+
+        // Works around https://devdiv.visualstudio.com/web/wi.aspx?pcguid=011b8bdf-6d56-4f87-be0d-0092136884d9&id=575202
+        internal static unsafe uint GetTempPathW(int bufferLen, ref char buffer)
+        {
+            fixed (char* pbuffer = &buffer)
+                return GetTempPathW(bufferLen, pbuffer);
+        }
+#else
         internal static extern uint GetTempPathW(int bufferLen, ref char buffer);
+#endif
     }
 }