Skip to content
This repository
Browse code

[WIN32] fixed: use wide string methods to create the dump file and th…

…e stacktrace.
  • Loading branch information...
commit 555cf97cbe3d94332e3d28a765c49539b8e4a41c 1 parent f3229d4
wsoltys authored April 26, 2013
9  xbmc/threads/platform/win/Win32Exception.cpp
@@ -24,6 +24,7 @@
24 24
 #include "Util.h"
25 25
 #include "WIN32Util.h"
26 26
 #include "utils/StringUtils.h"
  27
+#include "utils/CharsetConverter.h"
27 28
 
28 29
 #define LOG if(logger) logger->Log
29 30
 
@@ -115,6 +116,7 @@ bool win32_exception::write_minidump(EXCEPTION_POINTERS* pEp)
115 116
   // Create the dump file where the xbmc.exe resides
116 117
   bool returncode = false;
117 118
   CStdString dumpFileName;
  119
+  CStdStringW dumpFileNameW;
118 120
   SYSTEMTIME stLocalTime;
119 121
   GetLocalTime(&stLocalTime);
120 122
 
@@ -125,7 +127,8 @@ bool win32_exception::write_minidump(EXCEPTION_POINTERS* pEp)
125 127
 
126 128
   dumpFileName.Format("%s\\%s", CWIN32Util::GetProfilePath().c_str(), CUtil::MakeLegalFileName(dumpFileName));
127 129
 
128  
-  HANDLE hDumpFile = CreateFile(dumpFileName.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
  130
+  g_charsetConverter.utf8ToW(dumpFileName, dumpFileNameW, false);
  131
+  HANDLE hDumpFile = CreateFileW(dumpFileNameW.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
129 132
 
130 133
   if (hDumpFile == INVALID_HANDLE_VALUE)
131 134
   {
@@ -186,6 +189,7 @@ bool win32_exception::write_stacktrace(EXCEPTION_POINTERS* pEp)
186 189
   #define STACKWALK_MAX_NAMELEN 1024
187 190
 
188 191
   std::string dumpFileName, strOutput;
  192
+  CStdStringW dumpFileNameW;
189 193
   CHAR cTemp[STACKWALK_MAX_NAMELEN];
190 194
   DWORD dwBytes;
191 195
   SYSTEMTIME stLocalTime;
@@ -223,7 +227,8 @@ bool win32_exception::write_stacktrace(EXCEPTION_POINTERS* pEp)
223 227
 
224 228
   dumpFileName = StringUtils::Format("%s\\%s", CWIN32Util::GetProfilePath().c_str(), CUtil::MakeLegalFileName(dumpFileName));
225 229
 
226  
-  HANDLE hDumpFile = CreateFile(dumpFileName.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
  230
+  g_charsetConverter.utf8ToW(dumpFileName, dumpFileNameW, false);
  231
+  HANDLE hDumpFile = CreateFileW(dumpFileNameW.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
227 232
 
228 233
   if (hDumpFile == INVALID_HANDLE_VALUE)
229 234
   {

0 notes on commit 555cf97

Please sign in to comment.
Something went wrong with that request. Please try again.