2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Use /permissive- flag for Visual Studio builds.

This commit is contained in:
John Preston
2017-11-11 21:53:23 +04:00
parent aa160e775c
commit 5c12b0e5fa
7 changed files with 82 additions and 50 deletions

View File

@@ -532,15 +532,23 @@ QString SystemLanguage() {
namespace {
void _psLogError(const char *str, LSTATUS code) {
LPTSTR errorText = NULL, errorTextDefault = L"(Unknown error)";
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&errorText, 0, 0);
if (!errorText) {
errorText = errorTextDefault;
}
LPWSTR errorTextFormatted = nullptr;
auto formatFlags = FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_IGNORE_INSERTS;
FormatMessage(
formatFlags,
NULL,
code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&errorTextFormatted,
0,
0);
auto errorText = errorTextFormatted
? errorTextFormatted
: L"(Unknown error)";
LOG((str).arg(code).arg(QString::fromStdWString(errorText)));
if (errorText != errorTextDefault) {
LocalFree(errorText);
}
LocalFree(errorTextFormatted);
}
bool _psOpenRegKey(LPCWSTR key, PHKEY rkey) {