diff --git a/comphelper/source/windows/windows_process.cxx b/comphelper/source/windows/windows_process.cxx index 8e7fd19f0b30..fc91145bbbf2 100644 --- a/comphelper/source/windows/windows_process.cxx +++ b/comphelper/source/windows/windows_process.cxx @@ -179,12 +179,8 @@ WinLaunchChild(const wchar_t *exePath, return FALSE; } - STARTUPINFOW si; - std::memset(&si, 0, sizeof si); - si.cb = sizeof(STARTUPINFOW); - si.lpDesktop = const_cast(L"winsta0\\Default"); - PROCESS_INFORMATION pi; - std::memset(&pi, 0, sizeof pi); + STARTUPINFOW si{ .cb = sizeof(si), .lpDesktop = const_cast(L"winsta0\\Default") }; + PROCESS_INFORMATION pi{}; if (userToken == nullptr) { diff --git a/desktop/win32/source/QuickStart/QuickStart.cxx b/desktop/win32/source/QuickStart/QuickStart.cxx index 707f60341823..4ea17f705368 100644 --- a/desktop/win32/source/QuickStart/QuickStart.cxx +++ b/desktop/win32/source/QuickStart/QuickStart.cxx @@ -59,10 +59,7 @@ static bool launchSoffice( ) imagename[_MAX_PATH] = 0; _snwprintf(imagename, _MAX_PATH, L"\"%s\" --quickstart", filename ); - STARTUPINFOW aStartupInfo; - ZeroMemory(&aStartupInfo, sizeof(aStartupInfo)); - aStartupInfo.cb = sizeof(aStartupInfo); - aStartupInfo.wShowWindow = SW_SHOW; + STARTUPINFOW aStartupInfo{ .cb = sizeof(aStartupInfo), .wShowWindow = SW_SHOW }; PROCESS_INFORMATION aProcessInfo; bool bSuccess = CreateProcessW(filename, imagename, nullptr, nullptr, TRUE, 0, nullptr, nullptr, &aStartupInfo, &aProcessInfo); if ( !bSuccess ) diff --git a/desktop/win32/source/applauncher/launcher.cxx b/desktop/win32/source/applauncher/launcher.cxx index 1ec8caf13555..ab5725214ef5 100644 --- a/desktop/win32/source/applauncher/launcher.cxx +++ b/desktop/win32/source/applauncher/launcher.cxx @@ -29,7 +29,7 @@ extern "C" int APIENTRY wWinMain( HINSTANCE, HINSTANCE, LPWSTR, int ) { // Retrieve startup info - STARTUPINFOW aStartupInfo{ sizeof(aStartupInfo) }; + STARTUPINFOW aStartupInfo{ .cb = sizeof(aStartupInfo) }; GetStartupInfoW( &aStartupInfo ); // Retrieve command line diff --git a/desktop/win32/source/loader.cxx b/desktop/win32/source/loader.cxx index 3e306dbdd70c..4246f3f7b7c2 100644 --- a/desktop/win32/source/loader.cxx +++ b/desktop/win32/source/loader.cxx @@ -206,9 +206,7 @@ int officeloader_impl(bool bAllowConsole) { const auto& [szTargetFileName, szIniDirectory] = extendLoaderEnvironment(); - STARTUPINFOW aStartupInfo; - ZeroMemory(&aStartupInfo, sizeof(aStartupInfo)); - aStartupInfo.cb = sizeof(aStartupInfo); + STARTUPINFOW aStartupInfo{ .cb = sizeof(aStartupInfo) }; // Create process with same command line, environment and stdio handles which // are directed to the created pipes @@ -380,8 +378,7 @@ int unopkgloader_impl(bool bAllowConsole) { const auto& [szTargetFileName, szIniDirectory] = extendLoaderEnvironment(); - STARTUPINFOW aStartupInfo{}; - aStartupInfo.cb = sizeof(aStartupInfo); + STARTUPINFOW aStartupInfo{ .cb = sizeof(aStartupInfo) }; GetStartupInfoW(&aStartupInfo); DWORD dwExitCode = DWORD(-1); diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx index 198b092846cd..933531526f7a 100644 --- a/extensions/source/scanner/scanwin.cxx +++ b/extensions/source/scanner/scanwin.cxx @@ -264,8 +264,7 @@ void Twain::ShimListenerThread::execute() // We need a WinAPI HANDLE of the process to be able to wait on it and detect the process // termination; so use WinAPI to start the process, not osl_executeProcess. - STARTUPINFOW si{}; - si.cb = sizeof(si); + STARTUPINFOW si{ .cb = sizeof(si) }; PROCESS_INFORMATION pi; if (!CreateProcessW(nullptr, const_cast(o3tl::toW(sCmdLine.getStr())), nullptr, diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx index 77c2e0031b61..a65067bf3509 100644 --- a/pyuno/zipcore/python.cxx +++ b/pyuno/zipcore/python.cxx @@ -189,9 +189,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { exit(EXIT_FAILURE); } } - STARTUPINFOW startinfo; - ZeroMemory(&startinfo, sizeof (STARTUPINFOW)); - startinfo.cb = sizeof (STARTUPINFOW); + STARTUPINFOW startinfo{ .cb = sizeof(startinfo) }; PROCESS_INFORMATION procinfo; if (!CreateProcessW( pythonexe.data(), cl, nullptr, nullptr, FALSE, CREATE_UNICODE_ENVIRONMENT, nullptr, diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx index d271c391eed7..1af2a45eeaf6 100644 --- a/sal/osl/w32/procimpl.cxx +++ b/sal/osl/w32/procimpl.cxx @@ -467,10 +467,9 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( if ((Options & osl_Process_DETACHED) && !(flags & CREATE_NEW_CONSOLE)) flags |= DETACHED_PROCESS; - STARTUPINFOW startup_info = {}; - startup_info.cb = sizeof(startup_info); - startup_info.dwFlags = STARTF_USESHOWWINDOW; - startup_info.lpDesktop = const_cast(L""); + STARTUPINFOW startup_info{ .cb = sizeof(startup_info), + .lpDesktop = const_cast(L""), + .dwFlags = STARTF_USESHOWWINDOW }; /* Create pipes for redirected IO */ HANDLE hInputRead = nullptr; diff --git a/setup_native/source/win32/customactions/reg_dlls/reg_dlls.cxx b/setup_native/source/win32/customactions/reg_dlls/reg_dlls.cxx index 8231e3c5e3cb..cc0d8b74c5b4 100644 --- a/setup_native/source/win32/customactions/reg_dlls/reg_dlls.cxx +++ b/setup_native/source/win32/customactions/reg_dlls/reg_dlls.cxx @@ -162,8 +162,7 @@ void RegDLL(MSIHANDLE hInst, const std::wstring& sArgs, bool bUnreg) sCmd += sArgs; WriteLog(hInst, "Prepared regsvr32 command:", sCmd); - STARTUPINFOW si{}; - si.cb = sizeof(si); + STARTUPINFOW si{ .cb = sizeof(si) }; PROCESS_INFORMATION pi{}; if (!CreateProcessW(sRegSvr32.c_str(), const_cast(sCmd.c_str()), nullptr, nullptr, FALSE, CREATE_NO_WINDOW, nullptr, nullptr, &si, &pi)) diff --git a/shell/source/win32/spsupp/COMOpenDocuments.cxx b/shell/source/win32/spsupp/COMOpenDocuments.cxx index 87a61691d476..701deef38f50 100644 --- a/shell/source/win32/spsupp/COMOpenDocuments.cxx +++ b/shell/source/win32/spsupp/COMOpenDocuments.cxx @@ -26,10 +26,7 @@ HRESULT LOStart(Args... args) std::wstring sCmdLine((quote(GetHelperExe()) + ... + (L" " + quote(args)))); LPWSTR pCmdLine = const_cast(sCmdLine.c_str()); - STARTUPINFOW si = {}; - si.cb = sizeof si; - si.dwFlags = STARTF_USESHOWWINDOW; - si.wShowWindow = SW_SHOW; + STARTUPINFOW si{ .cb = sizeof(si), .dwFlags = STARTF_USESHOWWINDOW, .wShowWindow = SW_SHOW }; PROCESS_INFORMATION pi = {}; if (!CreateProcessW(nullptr, pCmdLine, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) return HRESULT_FROM_WIN32(GetLastError()); diff --git a/shell/source/win32/spsupp/spsuppHelper.cxx b/shell/source/win32/spsupp/spsuppHelper.cxx index 5867a5ea393d..88d2ccf19485 100644 --- a/shell/source/win32/spsupp/spsuppHelper.cxx +++ b/shell/source/win32/spsupp/spsuppHelper.cxx @@ -126,10 +126,7 @@ DWORD LOStart(const wchar_t* sModeArg, const wchar_t* sFilePath) + o3tl::toU(sFilePath) + "\""; LPWSTR pCmdLine = const_cast(o3tl::toW(sCmdLine.getStr())); - STARTUPINFOW si = {}; - si.cb = sizeof si; - si.dwFlags = STARTF_USESHOWWINDOW; - si.wShowWindow = SW_SHOW; + STARTUPINFOW si{ .cb = sizeof(si), .dwFlags = STARTF_USESHOWWINDOW, .wShowWindow = SW_SHOW }; PROCESS_INFORMATION pi{}; if (!CreateProcessW(nullptr, pCmdLine, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) { diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index 3dad25b4da62..a5812bfdf30c 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -332,8 +332,7 @@ VCLPLUG_WIN_PUBLIC SalInstance* create_SalInstance() { SalData* pSalData = new SalData(); - STARTUPINFOW aSI; - aSI.cb = sizeof( aSI ); + STARTUPINFOW aSI{ .cb = sizeof(aSI) }; GetStartupInfoW( &aSI ); pSalData->mhInst = GetModuleHandleW( nullptr ); pSalData->mnCmdShow = aSI.wShowWindow;