summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/app/crashreport.cxx12
-rw-r--r--desktop/source/minidump/minidump.cxx15
-rw-r--r--desktop/source/minidump/minidump_upload.cxx15
-rw-r--r--include/desktop/minidump.hxx2
4 files changed, 43 insertions, 1 deletions
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 3689613cb359..2b6a1a57003e 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -76,7 +76,19 @@ static bool dumpCallback(const wchar_t* path, const wchar_t* id,
void CrashReporter::writeToFile(std::ios_base::openmode Openmode)
{
+#if defined _WIN32
+ const std::string iniPath = getIniFileName();
+ std::wstring iniPathW;
+ const int nChars = MultiByteToWideChar(CP_UTF8, 0, iniPath.c_str(), -1, nullptr, 0);
+ auto buf = std::make_unique<wchar_t[]>(nChars);
+ if (MultiByteToWideChar(CP_UTF8, 0, iniPath.c_str(), -1, buf.get(), nChars) != 0)
+ iniPathW = buf.get();
+
+ std::ofstream ini_file
+ = iniPathW.empty() ? std::ofstream(iniPath, Openmode) : std::ofstream(iniPathW, Openmode);
+#else
std::ofstream ini_file(getIniFileName(), Openmode);
+#endif
for (auto& keyValue : maKeyValues)
{
diff --git a/desktop/source/minidump/minidump.cxx b/desktop/source/minidump/minidump.cxx
index 5c245abde693..d61922cdaac6 100644
--- a/desktop/source/minidump/minidump.cxx
+++ b/desktop/source/minidump/minidump.cxx
@@ -16,6 +16,11 @@
#include <curl/curl.h>
+#ifdef _WIN32
+#include <memory>
+#include <windows.h>
+#endif
+
const char kUserAgent[] = "Breakpad/1.0 (Linux)";
static std::map<std::string, std::string> readStrings(std::istream& file)
@@ -192,7 +197,17 @@ namespace crashreport {
bool readConfig(const std::string& iniPath, std::string * response)
{
+#if defined _WIN32
+ std::wstring iniPathW;
+ const int nChars = MultiByteToWideChar(CP_UTF8, 0, iniPath.c_str(), -1, nullptr, 0);
+ auto buf = std::make_unique<wchar_t[]>(nChars);
+ if (MultiByteToWideChar(CP_UTF8, 0, iniPath.c_str(), -1, buf.get(), nChars) != 0)
+ iniPathW = buf.get();
+
+ std::ifstream file = iniPathW.empty() ? std::ifstream(iniPath) : std::ifstream(iniPathW);
+#else
std::ifstream file(iniPath);
+#endif
std::map<std::string, std::string> parameters = readStrings(file);
// make sure that at least the mandatory parameters are in there
diff --git a/desktop/source/minidump/minidump_upload.cxx b/desktop/source/minidump/minidump_upload.cxx
index 15af26430764..0434fda68445 100644
--- a/desktop/source/minidump/minidump_upload.cxx
+++ b/desktop/source/minidump/minidump_upload.cxx
@@ -12,7 +12,14 @@
#include <iostream>
#include <string>
+#ifdef _WIN32
+#include <memory>
+#include <windows.h>
+
+int wmain(int argc, wchar_t** argv)
+#else
int main(int argc, char** argv)
+#endif
{
if (argc < 2)
{
@@ -20,7 +27,15 @@ int main(int argc, char** argv)
return EXIT_FAILURE;
}
+#ifdef _WIN32
+ const int nBytes = WideCharToMultiByte(CP_UTF8, 0, argv[1], -1, nullptr, 0, nullptr, nullptr);
+ auto buf = std::make_unique<char[]>(nBytes);
+ if (WideCharToMultiByte(CP_UTF8, 0, argv[1], -1, buf.get(), nBytes, nullptr, nullptr) == 0)
+ return EXIT_FAILURE;
+ std::string iniPath(buf.get());
+#else
std::string iniPath(argv[1]);
+#endif
std::string response;
if (!crashreport::readConfig(iniPath, &response))
return EXIT_FAILURE;
diff --git a/include/desktop/minidump.hxx b/include/desktop/minidump.hxx
index 0f49075fad5e..93c02f3e091b 100644
--- a/include/desktop/minidump.hxx
+++ b/include/desktop/minidump.hxx
@@ -19,7 +19,7 @@ namespace crashreport
// when response = nullptr only make test
/** Read+Send, Test and send info from the Dump.ini .
- @param [in] iniPath Path-file to the read/test ini-file
+ @param [in] iniPath Path-file to the read/test ini-file (UTF-8 on Windows)
@param [in] response=nullptr in this case made the Test only
@param [in] response!=nullptr in this case made the Read+Send