[WIN32] fixed: use wide string methods to create the dump file and the stacktrace.
authorwsoltys <wiso@no.way>
Fri, 26 Apr 2013 17:45:31 +0000 (19:45 +0200)
committerwsoltys <wiso@no.way>
Fri, 26 Apr 2013 17:45:31 +0000 (19:45 +0200)
xbmc/threads/platform/win/Win32Exception.cpp

index a709244..756b42e 100644 (file)
@@ -24,6 +24,7 @@
 #include "Util.h"
 #include "WIN32Util.h"
 #include "utils/StringUtils.h"
+#include "utils/CharsetConverter.h"
 
 #define LOG if(logger) logger->Log
 
@@ -115,6 +116,7 @@ bool win32_exception::write_minidump(EXCEPTION_POINTERS* pEp)
   // Create the dump file where the xbmc.exe resides
   bool returncode = false;
   CStdString dumpFileName;
+  CStdStringW dumpFileNameW;
   SYSTEMTIME stLocalTime;
   GetLocalTime(&stLocalTime);
 
@@ -125,7 +127,8 @@ bool win32_exception::write_minidump(EXCEPTION_POINTERS* pEp)
 
   dumpFileName.Format("%s\\%s", CWIN32Util::GetProfilePath().c_str(), CUtil::MakeLegalFileName(dumpFileName));
 
-  HANDLE hDumpFile = CreateFile(dumpFileName.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
+  g_charsetConverter.utf8ToW(dumpFileName, dumpFileNameW, false);
+  HANDLE hDumpFile = CreateFileW(dumpFileNameW.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
 
   if (hDumpFile == INVALID_HANDLE_VALUE)
   {
@@ -186,6 +189,7 @@ bool win32_exception::write_stacktrace(EXCEPTION_POINTERS* pEp)
   #define STACKWALK_MAX_NAMELEN 1024
 
   std::string dumpFileName, strOutput;
+  CStdStringW dumpFileNameW;
   CHAR cTemp[STACKWALK_MAX_NAMELEN];
   DWORD dwBytes;
   SYSTEMTIME stLocalTime;
@@ -223,7 +227,8 @@ bool win32_exception::write_stacktrace(EXCEPTION_POINTERS* pEp)
 
   dumpFileName = StringUtils::Format("%s\\%s", CWIN32Util::GetProfilePath().c_str(), CUtil::MakeLegalFileName(dumpFileName));
 
-  HANDLE hDumpFile = CreateFile(dumpFileName.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
+  g_charsetConverter.utf8ToW(dumpFileName, dumpFileNameW, false);
+  HANDLE hDumpFile = CreateFileW(dumpFileNameW.c_str(), GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
 
   if (hDumpFile == INVALID_HANDLE_VALUE)
   {