summaryrefslogtreecommitdiff
path: root/sal/osl/w32
AgeCommit message (Collapse)Author
2018-07-27Related: rhbz#1602589 add comments to coverity annotationsCaolán McNamara
Change-Id: I88c941832a0d682ea4b6028c28edd48cf5df38f7 Reviewed-on: https://gerrit.libreoffice.org/58093 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-07-23Missing includes (--disable-pch)Stephan Bergmann
Change-Id: Ie3427dfbbdf6ecf96b4fc36c534022dc881b3957
2018-06-12tdf#96099 Remove some trivial std::vector typedefsArkadiy Illarionov
Cleanup package, reportdesign, sal. Change-Id: I8622465886f7ec97700b00740ea37d40767ec98e Reviewed-on: https://gerrit.libreoffice.org/55616 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com>
2018-04-03osl: Fix possible memleakTakeshi Abe
Change-Id: I162993df6b802bd51e4e079b3dc530476b220e4e Reviewed-on: https://gerrit.libreoffice.org/52325 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-07Intermediate dir may come into existence during osl_createDirectoryPathStephan Bergmann
...when some other entity creates it in parallel. This used to stop creating any subsequent sub-directories in the chain, and instead return a misleading osl_File_E_EXIST. I assume this is the underlying issue of the sporadic Jenkins "Daily Screenshot Build on Windows" failures. (After the previous attempt at getting at that, d15ff312ad80e4d1f210636e3374a81c14c229a2 "Normalize computation of directory and file-in-directory URLs", <https://ci.libreoffice.org/job/lo_tb_master_win_screenshot/333/console> now failed for a different file after all, workdir/screenshots/modules/schart/ui/datarangedialog/DataRangeDialog.png during CppunitTest_chart2_dialogs_test.) Change-Id: I00ee67c1ef634c5390c677693e143c26266eeda7 Reviewed-on: https://gerrit.libreoffice.org/50892 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-02-22Use long path prefix in osl_getFileStatusSamuel Mehrbrodt
When installing an extension e.g., paths can get very long and they hit the 255 char limit, thus the installation fails. So we need to prefix the path with the long file name prefix when its longer than MAX_PATH for windows api calls to succeed. Change-Id: Ie62644192ba40a9d4802772cd9837fc84fae947a Reviewed-on: https://gerrit.libreoffice.org/50079 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-02-02sal: MSVC: pragma warning: make more specific, remove obsoleteMike Kaganski
Change-Id: Ib7ad23257a966447d627b4f73698d9298790f759 Reviewed-on: https://gerrit.libreoffice.org/49042 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-01-29tdf#49134 tdf#114466 Transfer privilege to become foreground processMike Kaganski
... to already open soffice process from newly spawned one on Windows. When an application takes user input, a timeout is started during which other processes cannot create foreground windows that might steal focus, and thus interrupt user input. The timeout is defined by SPI_SETFOREGROUNDLOCKTIMEOUT (see SystemParametersInfo) and ForegroundLockTimeout registry setting (see https://technet.microsoft.com/en-us/library/cc957208). If an application that currently doesn't have right to become foreground tries to show popups in this interval, the popup will stay on background, and only flash in taskbar. The application that has the right to steal focus (see the list in https://msdn.microsoft.com/en-us/library/ms632668) may transfer its right to another process using AllowSetForegroundWindow function. So, the intended effect is this: 1. User interacts with some foreground process (e.g., Explorer); a timeout is started to prevent non-privileged processes from stealing focus; 2. As the result, the process launches a new soffice process, which has privilege to create foreground windows (as it is started by foreground process); 3. It communicates with already started soffice process, which is currently in background, and so doesn't have privilege to create foreground windows until timeout expires; 4. It transfers its right to the already started soffice process, and then issues the required commands that might lead to need to show popup windows. Change-Id: I4208665c2ae4106fa06e72269f4c3804af40d582 Reviewed-on: https://gerrit.libreoffice.org/48839 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-01-25Remove stdlib.h from sal/config.hStephan Bergmann
This reverts 5da3337c007e0572028283d70bad43e9a29d45c1 "readded include stdlib.h, because of missing NULL definition in many headers, #100000, #101685", which is no longer relevant. Change-Id: I544ed9a7afbf7b611bc481b8d50acca3193d93de Reviewed-on: https://gerrit.libreoffice.org/48131 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-25Fix typosAndrea Gelmini
Change-Id: I13acf050d83099be8874514688936bb4ddbb1a26 Reviewed-on: https://gerrit.libreoffice.org/48543 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-23More loplugin:cstylecast on WindowsStephan Bergmann
Automatic rewrite (of loplugin:cstylecast and loplugin:unnecessaryparen) after cab0427cadddb3aaf1349c66f2fa13a4234ba4b2 "Enable loplugin:cstylecast for some more cases" and a409d32e7f6fc09e041079d6dbc3c927497adfed "More loplugin:cstylecast" Change-Id: Ib3355159dd08333e1b7a8d091caf2069cdcc7862 Reviewed-on: https://gerrit.libreoffice.org/48317 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-16Missing includeStephan Bergmann
Change-Id: I3bcc4ff11e37afe29b847ff65f722c7b0ba2c0b0 Reviewed-on: https://gerrit.libreoffice.org/47929 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-15convert a<b?a:b to std::min(a,b)Noel Grandin
with something like git grep -nP '(.*)\s*<\s*(.*)\s*\?\s*\g1\s*:\s*\g2' -- *.?xx Change-Id: Id5078b35961847feb78a66204fdb7598ee63fd23 Note: we also convert a>b?b:a Reviewed-on: https://gerrit.libreoffice.org/47736 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-13sal: remove no longer needed CheckTokenMembership_StubChris Sherlock
CheckTokenMembership_Stub was added in commit ce20f0702 because there was a problem with patching/replacing UWINAPI on Windows ME. To resolve this, CheckTokenMembership was not exported to stay compatible which is no longer an issue. Change-Id: I654a5f5ececa918f844eca541942b9d552fcfa7f Reviewed-on: https://gerrit.libreoffice.org/47217 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-01-11convert (a>b?a:b) to std::max(a,b)Noel Grandin
with something like: git grep -nP '(.*)\s*>\s*(.*)\s*\?\s*\g1\s*:\s*\g2' Change-Id: I60b9a3a2a09162bc0de4c13fdde2c209696e5413 Reviewed-on: https://gerrit.libreoffice.org/47602 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-01sal: (win32) readd comment explaining about buffer size decisionChris Sherlock
Readd comment explaining why we allocate a large buffer for GetEnvironmentVariableW which was removed in commit f78a2bcce88dd5c12052ae3e55c561cdd48b05fe: re-base on ALv2 code. Includes: Patch contributed by Herbert Duerr: #i118662# remove berkeleyDB from module xmlhelp (author=orwitt) http://svn.apache.org/viewvc?view=revision&revision=1213188 #i119141# remove ISCII converter for now http://svn.apache.org/viewvc?view=revision&revision=1306246 make exceptions for cppunittester verbose http://svn.apache.org/viewvc?view=revision&revision=1174831 Patches contributed by Pedro Giffuni: Avoid some uses of non portable #!/bin/bash in shell scripts. http://svn.apache.org/viewvc?view=revision&revision=1235297 Patch contributed by Oliver-Rainer Wittmann 88652: applied patch, remove unicows deps http://svn.apache.org/viewvc?view=revision&revision=1177585 drop OS/2 code, remove in-line assembler ARM atomics, and obsolete armarch header. Change-Id: I75a222393e202e40d78f10fc97f5eb4aad2df743 Reviewed-on: https://gerrit.libreoffice.org/47018 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-19inline use-once typedefsNoel Grandin
Change-Id: I5c3ffc03c26b3428f1f336e6ecba7838a1cf1157 Reviewed-on: https://gerrit.libreoffice.org/46764 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-15loplugin:salcall (clang-cl)Stephan Bergmann
Change-Id: Idda630320bb5e02e1ea675b3b3786c9ec6ac166b Reviewed-on: https://gerrit.libreoffice.org/46504 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-06Function LookupAccountSidW takes number of characters, not bytesMike Kaganski
Change-Id: Ie01feea2c5025f64a7888b85cb5de0c8f6c6f5c2 Reviewed-on: https://gerrit.libreoffice.org/45955 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-11-29loplugin:unnecessaryparen (clang-cl)Stephan Bergmann
Change-Id: I3a2b7ed3fdef3b77c0a052b10f88918aa616779e Reviewed-on: https://gerrit.libreoffice.org/45469 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-27loplugin:unnecessaryparen (clang-cl)Stephan Bergmann
Change-Id: I5452235287fd5986de25ee542edd57bf1abded52 Reviewed-on: https://gerrit.libreoffice.org/45338 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-13Fix typosAndrea Gelmini
Change-Id: I677512213d97d01832bebe162fbf7de2998bf4d0 Reviewed-on: https://gerrit.libreoffice.org/44664 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-11-13IsValidFilePath: fix correction of double path delimitersMike Kaganski
Wuthout this fix, it had always tried to replace in original path, thus second occurence of double path delimiter, like in C:\dir1\\dir2\dir3\\file would result in invalid path reported. Change-Id: I63ce97b620229601e18f10016a759275aceeec4d Reviewed-on: https://gerrit.libreoffice.org/44675 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-11-04Make Windows error reporting more robustMike Kaganski
https://msdn.microsoft.com/en-us/library/ms679351 describes that "it is unsafe to take an arbitrary system error code returned from an API and use FORMAT_MESSAGE_FROM_SYSTEM without FORMAT_MESSAGE_IGNORE_INSERTS" Previously in case when an error string would contain inserts, function returned error, so the error message wasn't shown (at least it didn't crash, thanks to nullptr as the function's last argument). As the function may fail, we now pre-nullify the buffer pointer to avoid dereferencing uninitialized pointer later (though at least for some Windows versions, the function nullifies the pointer in case of FORMAT_MESSAGE_ALLOCATE_BUFFER, but there's no explicit guarantee of this). Also release of allocated buffer is changed to recommended use of HeapFree. The code that doesn't make use of OUString is left directly calling FormatMessage, to avoid introducing new dependencies. Where it makes sense, we now use WindowsErrorString from <comphelper/windowserrorstring.hxx> Change-Id: I834c08eb6d92987e7d3d01e2c36ec55e42aea848 Reviewed-on: https://gerrit.libreoffice.org/44206 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-27loplugin:includeform: sal (Windows)Stephan Bergmann
Change-Id: Id60bcfadbfdf4b37f276159b12360347bde30a2e
2017-10-27-Werror,-Wtautological-constant-compare (clang-cl)Stephan Bergmann
...fixed similarly to recent fixes to sal/osl/unx/file.cxx Change-Id: I2c82366095e156cd0085a8f60f54f8c822655dcc
2017-10-05Rename and move SAL_U/W to o3tl::toU/WMike Kaganski
Previosly (since commit 9ac98e6e3488e434bf4864ecfb13a121784f640b) it was expected to gradually remove SAL_U/W usage in Windows code by replacing with reinterpret_cast or changing to some bettertypes. But as it's useful to make use of fact that LibreOffice and Windows use compatible representation of strings, this commit puts these functions to a better-suited o3tl, and recommends that the functions be consistently used throughout Windows-specific code to reflect the compatibility and keep the casts safe. Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6 Reviewed-on: https://gerrit.libreoffice.org/43150 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-04lookupProfile: drop unreachable codeMike Kaganski
The check for -userid switch has never worked - its condition was broken since initial commit 9399c662f36c385b0c705eb34e636a9aec450282 Since this wasn't caught earlier, the functionality is unused (and was deprecated anyway - see https://wiki.openoffice.org/wiki/Framework/Article/Command_Line_Arguments), this commit just drops the code. Change-Id: Iae79f9cb7db454d72b11fb3954ebc456c7207d96 Reviewed-on: https://gerrit.libreoffice.org/43123 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-10-03Replace more reinterpret_cast with SAL_W/SAL_UMike Kaganski
Change-Id: Ia632e4083222ad9e7f17c2ad0d0825f189c700cc Reviewed-on: https://gerrit.libreoffice.org/43071 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-30Use explicit function names for fooA/fooW WinAPI; prefer fooWMike Kaganski
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 <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-28Missing includes (--disable-pch)Stephan Bergmann
Change-Id: Iaa87663255f815e4f837df25d5338439d79c70dd
2017-09-27SAL: use more Unicode on WindowsMike Kaganski
Change-Id: I9f54c8e8c4e617cc1ed6b436ca8c162d381ecab3 Reviewed-on: https://gerrit.libreoffice.org/42828 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-25Fix typosAndrea Gelmini
Change-Id: I879a52820d78d9151ef64dd21612379f617f66e2 Reviewed-on: https://gerrit.libreoffice.org/42726 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2017-09-18Some more WIN32_LEAN_AND_MEANMike Kaganski
Change-Id: Iadb0ebb66809c192fb817b8c7cf2f8cdb4d0b874 Reviewed-on: https://gerrit.libreoffice.org/42419 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-18Put back some #include (needed for e.g. --disable-pch)Stephan Bergmann
...that had been removed too eagerly with 1f543b817a7e8bdef9482c4c61bc1672bf04e39f "osl/w32: don't use 8-bit string functions" Change-Id: I9d16cc5ff9b779457d8d70c7f206d5e684342c63
2017-09-18Use even more WIN32_LEAN_AND_MEANMike Kaganski
Change-Id: I538fe5b41156366e0e87b3a93e58a3947afd18f5 Reviewed-on: https://gerrit.libreoffice.org/42398 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-16Use more WIN32_LEAN_AND_MEANMike Kaganski
https://msdn.microsoft.com/en-us/aa383745 Change-Id: I83528dc8e6a5e119e7aa816219d35f1ea3723b96 Reviewed-on: https://gerrit.libreoffice.org/42338 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-15osl/w32: don't use 8-bit string functionsMike Kaganski
Change-Id: I1f09d7a0f6c0c87b8b672d6bffcaa397ed4ff6e6 Reviewed-on: https://gerrit.libreoffice.org/42317 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-15Assert flags passed to rtl_convertTextToUnicode/UnicodeToText are validStephan Bergmann
...so that at least some typos of using OUSTRING_TO_OSTRING_CVTFLAGS (0x566) instead of OSTRING_TO_OUSTRING_CVTFLAGS (0x333) can be found. (Unfortunately, in the other direction, 0x333 is a valid combination of RTL_UNICODETOTEXT_FLAGS_*.) Change-Id: I7cfb3677b103ae90de88833cc93b0a5384607e15 Reviewed-on: https://gerrit.libreoffice.org/42288 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-15sal/osl/w32/security.cxx: don't use 8-bit string functionsMike Kaganski
We don't support Windows versions that don't have Unicode support. In all currently-supported Windows versions, all FooA() functions are actually wrappers for FooW() variants. We don't need to fallback to A functions, and also don't need to do useless Unicode<->8-bit conversions that also may result in data loss. Change-Id: Ie21337c150ec0b9b4386c27d46f6596c14c4dd9f Reviewed-on: https://gerrit.libreoffice.org/42281 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-14tdf#103525: a blind fix: try Unicode function firstMike Kaganski
Change-Id: If088efdcbf41807ac8fad2410953abb685c8ea01 Reviewed-on: https://gerrit.libreoffice.org/42274 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2017-09-06Clean up sal/backtrace.hxxStephan Bergmann
Change-Id: Id78e9c0ca29ff2e52591f3d446431ac23c20ab7a Reviewed-on: https://gerrit.libreoffice.org/41926 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-08-29loplugin:cstylecast/nullptr (clang-cl)Stephan Bergmann
Change-Id: I04be0f4fe8c98909b37586080096ee05341f956f
2017-08-28Fix type of errno/WSAGetLastError()Stephan Bergmann
...as got broken with 3d5be8cd31bcf6fce8772133298d2ae076361362 "osl: give warning on socket error (win32), move Flag definition (unx)" Change-Id: Ib68540596b0bc2cda3e809e765c7d41ca45dda71
2017-08-28osl: cleanup osl_(acquire|release|close)SocketChris Sherlock
Change-Id: Ifc0b88963bcd28e5709accdf892b2cb16b2b55eb
2017-08-27osl: rename win32 socket internal function namesChris Sherlock
Change-Id: Ie58189e254f31d77cb4adafe599c48e64ef6a1a3 Reviewed-on: https://gerrit.libreoffice.org/41611 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-08-27osl: give warning on socket error (win32), move Flag definition (unx)Chris Sherlock
Change-Id: I34b773f32a055dfe85ec9c42e72a9f51ee8fea10 Reviewed-on: https://gerrit.libreoffice.org/41610 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-08-22loplugin:unnecessaryparen (clang-cl)Stephan Bergmann
Change-Id: I61b006051e708636f0bba83b16de36f4571b8da7
2017-08-18missing include (--disable-pch)Stephan Bergmann
Change-Id: I4e8ae42e2e0c285d34098bebd637ad6d4abaf6a0
2017-08-16Dead codeStephan Bergmann
...introduced with aeb3853a21435f00f225d751e56184e875bc46ed "osl: (Win32) check allocated pipe succeeded, otherwise needs to fail" Change-Id: Ieeb0b1755e74f583d1b52447eb84f7512eb07914