From 362a21d3a129b90149f6ef645c127f5e86e0ba61 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 26 Sep 2017 11:28:57 +0300 Subject: Use explicit function names for fooA/fooW WinAPI; prefer fooW We should only use generic foo function name when it takes params that are also dependent on UNICODE define, like LoadCursor( nullptr, IDC_ARROW ) where IDC_ARROW is defined in MSVC headers synchronised with LoadCursor definition. We should always use Unicode API for any file paths operations, because otherwise we will get "?" for any character in path that is not in current non-unicode codepage, which will result in failed file operations. Change-Id: I3a7f453ca0f893002d8a9764318919709fd8b633 Reviewed-on: https://gerrit.libreoffice.org/42935 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- desktop/source/app/app.cxx | 6 +++--- desktop/source/app/cmdlinehelp.cxx | 10 +++++----- desktop/source/deployment/misc/lockfile.cxx | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'desktop') diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index b08e928dd32c..7c194f890db9 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2633,12 +2633,12 @@ void Desktop::CheckFirstRun( ) #ifdef _WIN32 // Check if Quickstarter should be started (on Windows only) - TCHAR szValue[8192]; + WCHAR szValue[8192]; DWORD nValueSize = sizeof(szValue); HKEY hKey; - if ( ERROR_SUCCESS == RegOpenKey( HKEY_LOCAL_MACHINE, "Software\\LibreOffice", &hKey ) ) + if ( ERROR_SUCCESS == RegOpenKeyW( HKEY_LOCAL_MACHINE, L"Software\\LibreOffice", &hKey ) ) { - if ( ERROR_SUCCESS == RegQueryValueEx( hKey, TEXT("RunQuickstartAtFirstStart"), nullptr, nullptr, reinterpret_cast(szValue), &nValueSize ) ) + if ( ERROR_SUCCESS == RegQueryValueExW( hKey, L"RunQuickstartAtFirstStart", nullptr, nullptr, reinterpret_cast(szValue), &nValueSize ) ) { css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*bAutostart*/); diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index a4b3114cf3bb..43028a72fd10 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -187,9 +187,9 @@ namespace desktop { if (GetStdHandle(STD_OUTPUT_HANDLE) == nullptr) // application does not have associated standard handles { - STARTUPINFOA aStartupInfo; + STARTUPINFOW aStartupInfo; aStartupInfo.cb = sizeof(aStartupInfo); - GetStartupInfoA(&aStartupInfo); + GetStartupInfoW(&aStartupInfo); if ((aStartupInfo.dwFlags & STARTF_USESTDHANDLES) == STARTF_USESTDHANDLES) { // If standard handles had been passed to this process, use them @@ -247,11 +247,11 @@ namespace desktop ke.bKeyDown = TRUE; ke.wRepeatCount = 1; ke.wVirtualKeyCode = VK_RETURN; - ke.wVirtualScanCode = MapVirtualKeyA(VK_RETURN, MAPVK_VK_TO_VSC); - ke.uChar.AsciiChar = '\r'; + ke.wVirtualScanCode = MapVirtualKeyW(VK_RETURN, MAPVK_VK_TO_VSC); + ke.uChar.UnicodeChar = L'\r'; ke.dwControlKeyState = 0; DWORD nEvents; - WriteConsoleInputA(GetStdHandle(STD_INPUT_HANDLE), &ir, 1, &nEvents); + WriteConsoleInputW(GetStdHandle(STD_INPUT_HANDLE), &ir, 1, &nEvents); break; } case allocated: diff --git a/desktop/source/deployment/misc/lockfile.cxx b/desktop/source/deployment/misc/lockfile.cxx index 11530d0be892..0544f434bd14 100644 --- a/desktop/source/deployment/misc/lockfile.cxx +++ b/desktop/source/deployment/misc/lockfile.cxx @@ -55,7 +55,7 @@ static OString impl_getHostname() */ DWORD sz = MAX_COMPUTERNAME_LENGTH + 1; auto szHost = std::unique_ptr(new char[sz]); - if (GetComputerName(szHost.get(), &sz)) + if (GetComputerNameA(szHost.get(), &sz)) aHost = OString(szHost.get()); else aHost = OString("UNKNOWN"); -- cgit