Send UTF16 dump file name (dotnet/coreclr#24475)
authorMike McLaughlin <mikem@microsoft.com>
Wed, 8 May 2019 21:45:42 +0000 (14:45 -0700)
committerGitHub <noreply@github.com>
Wed, 8 May 2019 21:45:42 +0000 (14:45 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/75cde8dc8854c2f488094c2e33002c8871d4a592

src/coreclr/src/vm/diagnosticprotocolhelper.cpp

index c7b07c8..2813a7d 100644 (file)
@@ -44,25 +44,33 @@ void DiagnosticProtocolHelper::GenerateCoreDump(IpcStream* pStream)
     if (fSuccess)
     {
         // The protocol buffer is defined as:
-        //   string - dumpName (array<char> where the last char must = 0) or (length = 0)
+        //   string - dumpName (UTF16)
         //   int - dumpType
         //   int - diagnostics
         // returns
         //   ulong - status
-        LPCSTR dumpName;
+        LPCWSTR pwszDumpName;
         INT dumpType;
         INT diagnostics;
 
         uint8_t *pBufferCursor = buffer;
         uint32_t bufferLen = nNumberOfBytesRead;
 
-        if (TryParseString(pBufferCursor, bufferLen, dumpName) &&
+        if (TryParseString(pBufferCursor, bufferLen, pwszDumpName) &&
             TryParse(pBufferCursor, bufferLen, dumpType) &&
             TryParse(pBufferCursor, bufferLen, diagnostics))
         {
-            if (!PAL_GenerateCoreDump(dumpName, dumpType, diagnostics))
+            MAKE_UTF8PTR_FROMWIDE_NOTHROW(szDumpName, pwszDumpName);
+            if (szDumpName != nullptr)
             {
-                hr = E_FAIL;
+                if (!PAL_GenerateCoreDump(szDumpName, dumpType, diagnostics))
+                {
+                    hr = E_FAIL;
+                }
+            }
+            else 
+            {
+                hr = E_OUTOFMEMORY;
             }
         }
         else