summaryrefslogtreecommitdiff
path: root/sal/osl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-15 12:43:52 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-15 14:48:31 +0200
commit1f543b817a7e8bdef9482c4c61bc1672bf04e39f (patch)
treed1fdb1f2935c823251398d557f0224f523e9afc1 /sal/osl
parent186e31689661e23824b123dd014a65b713bedd8c (diff)
osl/w32: don't use 8-bit string functions
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>
Diffstat (limited to 'sal/osl')
-rw-r--r--sal/osl/w32/file.cxx21
-rw-r--r--sal/osl/w32/file_dirvol.cxx92
-rw-r--r--sal/osl/w32/file_error.cxx7
-rw-r--r--sal/osl/w32/file_url.cxx54
-rw-r--r--sal/osl/w32/module.cxx10
-rw-r--r--sal/osl/w32/nlsupport.cxx44
-rw-r--r--sal/osl/w32/process.cxx13
-rw-r--r--sal/osl/w32/procimpl.cxx52
-rw-r--r--sal/osl/w32/signal.cxx17
-rw-r--r--sal/osl/w32/tempfile.cxx5
-rw-r--r--sal/osl/w32/time.cxx2
11 files changed, 114 insertions, 203 deletions
diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx
index 5a5a16b9f9c0..f654c1add897 100644
--- a/sal/osl/w32/file.cxx
+++ b/sal/osl/w32/file.cxx
@@ -17,26 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#define UNICODE
-#define _UNICODE
#include <systools/win32/uwinapi.h>
-#include <osl/file.hxx>
-#include <osl/diagnose.h>
-#include <rtl/alloc.h>
-#include <rtl/byteseq.h>
-#include <rtl/ustring.hxx>
-
-#include "file-impl.hxx"
#include "file_url.hxx"
#include "file_error.hxx"
-#include <cassert>
-#include <cstdio>
-#include <algorithm>
-#include <limits>
-#include <tchar.h>
-
#ifdef max /* conflict w/ std::numeric_limits<T>::max() */
#undef max
#endif
@@ -811,7 +796,7 @@ oslFileError SAL_CALL osl_mapFile(
return osl_File_E_OVERFLOW;
SIZE_T const nLength = sal::static_int_cast< SIZE_T >(uLength);
- FileMapping aMap(::CreateFileMapping(pImpl->m_hFile, nullptr, SEC_COMMIT | PAGE_READONLY, 0, 0, nullptr));
+ FileMapping aMap(::CreateFileMappingW(pImpl->m_hFile, nullptr, SEC_COMMIT | PAGE_READONLY, 0, 0, nullptr));
if (!IsValidHandle(aMap.m_handle))
return oslTranslateFileError(GetLastError());
@@ -1080,7 +1065,7 @@ oslFileError SAL_CALL osl_removeFile(rtl_uString* strPath)
if (error == osl_File_E_None)
{
- if (DeleteFile(SAL_W(rtl_uString_getStr(strSysPath))))
+ if (DeleteFileW(SAL_W(rtl_uString_getStr(strSysPath))))
error = osl_File_E_None;
else
error = oslTranslateFileError(GetLastError());
@@ -1130,7 +1115,7 @@ oslFileError SAL_CALL osl_moveFile(rtl_uString* strPath, rtl_uString *strDestPat
LPCWSTR src = SAL_W(rtl_uString_getStr(strSysPath));
LPCWSTR dst = SAL_W(rtl_uString_getStr(strSysDestPath));
- if (MoveFileEx(src, dst, MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH | MOVEFILE_REPLACE_EXISTING))
+ if (MoveFileExW(src, dst, MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH | MOVEFILE_REPLACE_EXISTING))
error = osl_File_E_None;
else
error = oslTranslateFileError(GetLastError());
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 7e75d4922c60..752d6470ec67 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -17,26 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#define UNICODE
-#define _UNICODE
#include "systools/win32/uwinapi.h"
-#include "osl/file.h"
-
#include "file_url.hxx"
#include <filetime.hxx>
-#include <sal/macros.h>
#include "file_error.hxx"
#include "path_helper.hxx"
-#include "osl/diagnose.h"
-#include "osl/time.h"
#include "rtl/alloc.h"
#include "rtl/ustring.hxx"
-#include <rtl/character.hxx>
-
-#include <tchar.h>
static const wchar_t UNC_PREFIX[] = L"\\\\";
static const wchar_t BACKSLASH = '\\';
@@ -232,8 +222,8 @@ struct DirectoryItem_Impl
{
UINT uType;
union {
- WIN32_FIND_DATA FindData;
- WCHAR cDriveString[MAX_PATH];
+ WIN32_FIND_DATAW FindData;
+ WCHAR cDriveString[MAX_PATH];
};
rtl_uString* m_pFullPath;
BOOL bFullPathNormalized;
@@ -266,7 +256,7 @@ static HANDLE WINAPI OpenLogicalDrivesEnum()
LPDRIVEENUM pEnum = static_cast<LPDRIVEENUM>(HeapAlloc( GetProcessHeap(), 0, sizeof(DRIVEENUM) ));
if ( pEnum )
{
- DWORD dwNumCopied = GetLogicalDriveStrings( (sizeof(pEnum->cBuffer) - 1) / sizeof(WCHAR), pEnum->cBuffer );
+ DWORD dwNumCopied = GetLogicalDriveStringsW( (sizeof(pEnum->cBuffer) - 1) / sizeof(WCHAR), pEnum->cBuffer );
if ( dwNumCopied && dwNumCopied < sizeof(pEnum->cBuffer) / sizeof(WCHAR) )
{
@@ -289,7 +279,7 @@ static BOOL WINAPI EnumLogicalDrives(HANDLE hEnum, LPWSTR lpBuffer)
if ( pEnum )
{
- int nLen = _tcslen( pEnum->lpCurrent );
+ int nLen = wcslen( pEnum->lpCurrent );
if ( nLen )
{
@@ -324,8 +314,8 @@ static BOOL WINAPI CloseLogicalDrivesEnum(HANDLE hEnum)
typedef struct tagDIRECTORY
{
- HANDLE hFind;
- WIN32_FIND_DATA aFirstData;
+ HANDLE hFind;
+ WIN32_FIND_DATAW aFirstData;
} DIRECTORY, *PDIRECTORY, FAR *LPDIRECTORY;
static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
@@ -353,11 +343,11 @@ static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
WCHAR* szFileMask = static_cast< WCHAR* >( rtl_allocateMemory( sizeof( WCHAR ) * ( nLen + nSuffLen + 1 ) ) );
- _tcscpy( szFileMask, SAL_W(rtl_uString_getStr( pPath )) );
- _tcscat( szFileMask, pSuffix );
+ wcscpy( szFileMask, SAL_W(rtl_uString_getStr( pPath )) );
+ wcscat( szFileMask, pSuffix );
pDirectory = static_cast<LPDIRECTORY>(HeapAlloc(GetProcessHeap(), 0, sizeof(DIRECTORY)));
- pDirectory->hFind = FindFirstFile(szFileMask, &pDirectory->aFirstData);
+ pDirectory->hFind = FindFirstFileW(szFileMask, &pDirectory->aFirstData);
if (!IsValidHandle(pDirectory->hFind))
{
@@ -374,7 +364,7 @@ static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
return static_cast<HANDLE>(pDirectory);
}
-BOOL WINAPI EnumDirectory(HANDLE hDirectory, LPWIN32_FIND_DATA pFindData)
+BOOL WINAPI EnumDirectory(HANDLE hDirectory, LPWIN32_FIND_DATAW pFindData)
{
BOOL fSuccess = FALSE;
LPDIRECTORY pDirectory = static_cast<LPDIRECTORY>(hDirectory);
@@ -392,14 +382,14 @@ BOOL WINAPI EnumDirectory(HANDLE hDirectory, LPWIN32_FIND_DATA pFindData)
pDirectory->aFirstData.cFileName[0] = 0;
}
else if ( IsValidHandle( pDirectory->hFind ) )
- fSuccess = FindNextFile( pDirectory->hFind, pFindData );
+ fSuccess = FindNextFileW( pDirectory->hFind, pFindData );
else
{
fSuccess = FALSE;
SetLastError( ERROR_NO_MORE_FILES );
}
- fValid = fSuccess && _tcscmp( TEXT("."), pFindData->cFileName ) != 0 && _tcscmp( TEXT(".."), pFindData->cFileName ) != 0;
+ fValid = fSuccess && wcscmp( L".", pFindData->cFileName ) != 0 && wcscmp( L"..", pFindData->cFileName ) != 0;
} while( fSuccess && !fValid );
}
@@ -725,7 +715,7 @@ oslFileError SAL_CALL osl_removeDirectory(rtl_uString* strPath)
if ( osl_File_E_None == error )
{
- if ( RemoveDirectory( SAL_W(rtl_uString_getStr( strSysPath ) )) )
+ if ( RemoveDirectoryW( SAL_W(rtl_uString_getStr( strSysPath ) )) )
error = osl_File_E_None;
else
error = oslTranslateFileError( GetLastError() );
@@ -783,7 +773,7 @@ static oslFileError SAL_CALL osl_getNextNetResource(
dwCount = 1;
dwBufSize = sizeof(buffer);
- dwError = WNetEnumResource( pDirImpl->hDirectory, &dwCount, lpNetResource, &dwBufSize );
+ dwError = WNetEnumResourceW( pDirImpl->hDirectory, &dwCount, lpNetResource, &dwBufSize );
switch ( dwError )
{
@@ -1049,11 +1039,11 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
osl_acquireDirectoryItem( static_cast<oslDirectoryItem>(pItemImpl) );
- _tcscpy( pItemImpl->cDriveString, SAL_W(strSysFilePath->buffer) );
+ wcscpy( pItemImpl->cDriveString, SAL_W(strSysFilePath->buffer) );
pItemImpl->cDriveString[0] = rtl::toAsciiUpperCase( pItemImpl->cDriveString[0] );
- if ( pItemImpl->cDriveString[_tcslen(pItemImpl->cDriveString) - 1] != '\\' )
- _tcscat( pItemImpl->cDriveString, TEXT( "\\" ) );
+ if ( pItemImpl->cDriveString[wcslen(pItemImpl->cDriveString) - 1] != '\\' )
+ wcscat( pItemImpl->cDriveString, L"\\" );
*pItem = pItemImpl;
}
@@ -1064,12 +1054,12 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
case PATHTYPE_FILE:
{
HANDLE hFind;
- WIN32_FIND_DATA aFindData;
+ WIN32_FIND_DATAW aFindData;
if ( strSysFilePath->length > 0 && strSysFilePath->buffer[strSysFilePath->length - 1] == '\\' )
rtl_uString_newFromStr_WithLength( &strSysFilePath, strSysFilePath->buffer, strSysFilePath->length - 1 );
- hFind = FindFirstFile( SAL_W(rtl_uString_getStr(strSysFilePath)), &aFindData );
+ hFind = FindFirstFileW( SAL_W(rtl_uString_getStr(strSysFilePath)), &aFindData );
if ( hFind != INVALID_HANDLE_VALUE )
{
@@ -1079,7 +1069,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
ZeroMemory( pItemImpl, sizeof(DirectoryItem_Impl) );
osl_acquireDirectoryItem( static_cast<oslDirectoryItem>(pItemImpl) );
- CopyMemory( &pItemImpl->FindData, &aFindData, sizeof(WIN32_FIND_DATA) );
+ CopyMemory( &pItemImpl->FindData, &aFindData, sizeof(WIN32_FIND_DATAW) );
rtl_uString_newFromString( &pItemImpl->m_pFullPath, strSysFilePath );
// MT: This costs 600ms startup time on fast v60x!
@@ -1167,16 +1157,16 @@ bool is_floppy_volume_mount_point(const rtl::OUString& path)
osl::systemPathEnsureSeparator(p);
WCHAR vn[51];
- if (GetVolumeNameForVolumeMountPoint(SAL_W(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
+ if (GetVolumeNameForVolumeMountPointW(SAL_W(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
{
WCHAR vnfloppy[51];
if (is_floppy_A_present() &&
- GetVolumeNameForVolumeMountPoint(FLOPPY_A, vnfloppy, SAL_N_ELEMENTS(vnfloppy)) &&
+ GetVolumeNameForVolumeMountPointW(FLOPPY_A, vnfloppy, SAL_N_ELEMENTS(vnfloppy)) &&
(0 == wcscmp(vn, vnfloppy)))
return true;
if (is_floppy_B_present() &&
- GetVolumeNameForVolumeMountPoint(FLOPPY_B, vnfloppy, SAL_N_ELEMENTS(vnfloppy)) &&
+ GetVolumeNameForVolumeMountPointW(FLOPPY_B, vnfloppy, SAL_N_ELEMENTS(vnfloppy)) &&
(0 == wcscmp(vn, vnfloppy)))
return true;
}
@@ -1185,7 +1175,7 @@ bool is_floppy_volume_mount_point(const rtl::OUString& path)
static bool is_floppy_drive(const rtl::OUString& path)
{
- static const LPCWSTR FLOPPY_DRV_LETTERS = TEXT("AaBb");
+ static const LPCWSTR FLOPPY_DRV_LETTERS = L"AaBb";
// we must take into account that even a floppy
// drive may be mounted to a directory so checking
@@ -1206,13 +1196,13 @@ static bool is_volume_mount_point(const rtl::OUString& path)
if (!is_floppy_drive(p))
{
- DWORD fattr = GetFileAttributes(SAL_W(p.getStr()));
+ DWORD fattr = GetFileAttributesW(SAL_W(p.getStr()));
if ((INVALID_FILE_ATTRIBUTES != fattr) &&
(FILE_ATTRIBUTE_REPARSE_POINT & fattr))
{
- WIN32_FIND_DATA find_data;
- HANDLE h_find = FindFirstFile(SAL_W(p.getStr()), &find_data);
+ WIN32_FIND_DATAW find_data;
+ HANDLE h_find = FindFirstFileW(SAL_W(p.getStr()), &find_data);
if (IsValidHandle(h_find) &&
(FILE_ATTRIBUTE_REPARSE_POINT & find_data.dwFileAttributes) &&
@@ -1230,14 +1220,14 @@ static bool is_volume_mount_point(const rtl::OUString& path)
static UINT get_volume_mount_point_drive_type(const rtl::OUString& path)
{
if (0 == path.getLength())
- return GetDriveType(nullptr);
+ return GetDriveTypeW(nullptr);
rtl::OUString p(path);
osl::systemPathEnsureSeparator(p);
WCHAR vn[51];
- if (GetVolumeNameForVolumeMountPoint(SAL_W(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
- return GetDriveType(vn);
+ if (GetVolumeNameForVolumeMountPointW(SAL_W(p.getStr()), vn, SAL_N_ELEMENTS(vn)))
+ return GetDriveTypeW(vn);
return DRIVE_NO_ROOT_DIR;
}
@@ -1256,7 +1246,7 @@ static oslFileError osl_get_drive_type(
if (is_volume_mount_point(path))
drive_type = get_volume_mount_point_drive_type(path);
else
- drive_type = GetDriveType(SAL_W(path.getStr()));
+ drive_type = GetDriveTypeW(SAL_W(path.getStr()));
if (DRIVE_NO_ROOT_DIR == drive_type)
return oslTranslateFileError(ERROR_INVALID_DRIVE);
@@ -1304,7 +1294,7 @@ static inline bool is_volume_space_info_request(sal_uInt32 field_mask)
static void get_volume_space_information(
const rtl::OUString& path, oslVolumeInfo *pInfo)
{
- BOOL ret = GetDiskFreeSpaceEx(
+ BOOL ret = GetDiskFreeSpaceExW(
SAL_W(path.getStr()),
reinterpret_cast<PULARGE_INTEGER>(&pInfo->uFreeSpace),
reinterpret_cast<PULARGE_INTEGER>(&pInfo->uTotalSpace),
@@ -1353,7 +1343,7 @@ static oslFileError get_filesystem_attributes(
DWORD flags;
LPCWSTR pszPath = SAL_W(path.getStr());
- if (GetVolumeInformation(pszPath, vn, MAX_PATH+1, &serial, &mcl, &flags, fsn, MAX_PATH+1))
+ if (GetVolumeInformationW(pszPath, vn, MAX_PATH+1, &serial, &mcl, &flags, fsn, MAX_PATH+1))
{
// Currently sal does not use this value, instead MAX_PATH is used
pInfo->uValidFields |= osl_VolumeInfo_Mask_MaxNameLength;
@@ -1446,8 +1436,8 @@ static oslFileError SAL_CALL osl_getDriveInfo(
oslDirectoryItem Item, oslFileStatus *pStatus, sal_uInt32 uFieldMask)
{
DirectoryItem_Impl *pItemImpl = static_cast<DirectoryItem_Impl *>(Item);
- WCHAR cDrive[3] = TEXT("A:");
- WCHAR cRoot[4] = TEXT("A:\\");
+ WCHAR cDrive[3] = L"A:";
+ WCHAR cRoot[4] = L"A:\\";
if ( !pItemImpl )
return osl_File_E_INVAL;
@@ -1474,7 +1464,7 @@ static oslFileError SAL_CALL osl_getDriveInfo(
pStatus->uValidFields |= osl_FileStatus_Mask_FileName;
}
}
- else switch ( GetDriveType( cRoot ) )
+ else switch ( GetDriveTypeW( cRoot ) )
{
case DRIVE_REMOTE:
{
@@ -1482,7 +1472,7 @@ static oslFileError SAL_CALL osl_getDriveInfo(
DWORD const dwBufsizeConst = SAL_N_ELEMENTS(szBuffer);
DWORD dwBufsize = dwBufsizeConst;
- DWORD dwResult = WNetGetConnection( cDrive, szBuffer, &dwBufsize );
+ DWORD dwResult = WNetGetConnectionW( cDrive, szBuffer, &dwBufsize );
if ( NO_ERROR == dwResult )
{
WCHAR szFileName[dwBufsizeConst + 16];
@@ -1500,7 +1490,7 @@ static oslFileError SAL_CALL osl_getDriveInfo(
WCHAR szVolumeNameBuffer[1024];
DWORD const dwBufsizeConst = SAL_N_ELEMENTS(szVolumeNameBuffer);
- if ( GetVolumeInformation( cRoot, szVolumeNameBuffer, dwBufsizeConst, nullptr, nullptr, nullptr, nullptr, 0 ) )
+ if ( GetVolumeInformationW( cRoot, szVolumeNameBuffer, dwBufsizeConst, nullptr, nullptr, nullptr, nullptr, 0 ) )
{
WCHAR szFileName[dwBufsizeConst + 16];
@@ -1583,7 +1573,7 @@ oslFileError SAL_CALL osl_getFileStatus(
if ( uFieldMask & osl_FileStatus_Mask_Validate )
{
- HANDLE hFind = FindFirstFile( SAL_W(rtl_uString_getStr( pItemImpl->m_pFullPath )), &pItemImpl->FindData );
+ HANDLE hFind = FindFirstFileW( SAL_W(rtl_uString_getStr( pItemImpl->m_pFullPath )), &pItemImpl->FindData );
if ( hFind != INVALID_HANDLE_VALUE )
FindClose( hFind );
@@ -1691,7 +1681,7 @@ oslFileError SAL_CALL osl_setFileAttributes(
if ( osl_File_E_None != error )
return error;
- dwFileAttributes = GetFileAttributes( SAL_W(rtl_uString_getStr(ustrSysPath)) );
+ dwFileAttributes = GetFileAttributesW( SAL_W(rtl_uString_getStr(ustrSysPath)) );
if ( (DWORD)-1 != dwFileAttributes )
{
@@ -1703,7 +1693,7 @@ oslFileError SAL_CALL osl_setFileAttributes(
if ( uAttributes & osl_File_Attribute_Hidden )
dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN;
- fSuccess = SetFileAttributes( SAL_W(rtl_uString_getStr(ustrSysPath)), dwFileAttributes );
+ fSuccess = SetFileAttributesW( SAL_W(rtl_uString_getStr(ustrSysPath)), dwFileAttributes );
}
else
{
diff --git a/sal/osl/w32/file_error.cxx b/sal/osl/w32/file_error.cxx
index 01d4a97d6ee6..bfa55bff9009 100644
--- a/sal/osl/w32/file_error.cxx
+++ b/sal/osl/w32/file_error.cxx
@@ -17,13 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#define UNICODE
-#include "systools/win32/uwinapi.h"
-
#include "file_error.hxx"
-
-#include "osl/thread.hxx"
-#include <sal/macros.h>
+#include "winerror.h"
/* OS error to oslFileError values mapping table */
struct osl_file_error_entry
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index bb6cd00215b6..1a62385bd7e9 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -17,25 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#define UNICODE
-#define _UNICODE
#include "systools/win32/uwinapi.h"
#include "file_url.hxx"
-#include <sal/macros.h>
#include "file_error.hxx"
#include "rtl/alloc.h"
#include <rtl/ustring.hxx>
-#include "osl/diagnose.h"
-#include "osl/file.h"
#include "osl/mutex.h"
#include "path_helper.hxx"
-#include <stdio.h>
-#include <tchar.h>
-
#define WSTR_SYSTEM_ROOT_PATH L"\\\\.\\"
#define WSTR_LONG_PATH_PREFIX L"\\\\?\\"
#define WSTR_LONG_PATH_PREFIX_UNC L"\\\\?\\UNC\\"
@@ -184,7 +176,7 @@ DWORD IsValidFilePath(rtl_uString *path, DWORD dwFlags, rtl_uString **corrected)
/* This is long path */
lpComponent = lpszPath + SAL_N_ELEMENTS(WSTR_LONG_PATH_PREFIX) - 1;
- if ( _istalpha( lpComponent[0] ) && ':' == lpComponent[1] )
+ if ( iswalpha( lpComponent[0] ) && ':' == lpComponent[1] )
{
lpComponent += 2;
dwCandidatPathType = PATHTYPE_ABSOLUTE_LOCAL | PATHTYPE_IS_LONGPATH;
@@ -196,7 +188,7 @@ DWORD IsValidFilePath(rtl_uString *path, DWORD dwFlags, rtl_uString **corrected)
lpComponent = lpszPath + 2;
dwCandidatPathType = PATHTYPE_ABSOLUTE_UNC;
}
- else if ( _istalpha( lpszPath[0] ) && ':' == lpszPath[1] )
+ else if ( iswalpha( lpszPath[0] ) && ':' == lpszPath[1] )
{
/* Local path verification. Must start with <drive>: */
lpComponent = lpszPath + 2;
@@ -317,13 +309,13 @@ static sal_Int32 PathRemoveFileSpec(LPWSTR lpPath, LPWSTR lpFileName, sal_Int32
if ( nFileBufLen )
{
lpFileName[0] = 0;
- LPWSTR lpLastBkSlash = _tcsrchr( lpPath, '\\' );
- LPWSTR lpLastSlash = _tcsrchr( lpPath, '/' );
+ LPWSTR lpLastBkSlash = wcsrchr( lpPath, '\\' );
+ LPWSTR lpLastSlash = wcsrchr( lpPath, '/' );
LPWSTR lpLastDelimiter = lpLastSlash > lpLastBkSlash ? lpLastSlash : lpLastBkSlash;
if ( lpLastDelimiter )
{
- sal_Int32 nDelLen = _tcslen( lpLastDelimiter );
+ sal_Int32 nDelLen = wcslen( lpLastDelimiter );
if ( 1 == nDelLen )
{
if ( lpLastDelimiter > lpPath && *(lpLastDelimiter - 1) != ':' )
@@ -335,7 +327,7 @@ static sal_Int32 PathRemoveFileSpec(LPWSTR lpPath, LPWSTR lpFileName, sal_Int32
}
else if ( nDelLen && nDelLen - 1 < nFileBufLen )
{
- _tcscpy( lpFileName, lpLastDelimiter + 1 );
+ wcscpy( lpFileName, lpLastDelimiter + 1 );
*(++lpLastDelimiter) = 0;
nRemoved = nDelLen - 1;
}
@@ -352,7 +344,7 @@ static LPWSTR PathAddBackslash(LPWSTR lpPath, sal_uInt32 nBufLen)
if ( lpPath )
{
- std::size_t nLen = _tcslen(lpPath);
+ std::size_t nLen = wcslen(lpPath);
if ( !nLen || ( lpPath[nLen-1] != '\\' && lpPath[nLen-1] != '/' && nLen < nBufLen - 1 ) )
{
@@ -385,12 +377,12 @@ static DWORD GetCaseCorrectPathNameEx(
{
bool bSkipThis = false;
- if ( 0 == _tcscmp( szFile, TEXT("..") ) )
+ if ( 0 == wcscmp( szFile, L".." ) )
{
bSkipThis = true;
nSkipLevels += 1;
}
- else if ( 0 == _tcscmp( szFile, TEXT(".") ) )
+ else if ( 0 == wcscmp( szFile, L"." ) )
{
bSkipThis = true;
}
@@ -413,15 +405,15 @@ static DWORD GetCaseCorrectPathNameEx(
if ( bCheckExistence )
{
::osl::LongPathBuffer< WCHAR > aShortPath( MAX_LONG_PATH );
- _tcscpy( aShortPath, lpszPath );
- _tcscat( aShortPath, szFile );
+ wcscpy( aShortPath, lpszPath );
+ wcscat( aShortPath, szFile );
- WIN32_FIND_DATA aFindFileData;
- HANDLE hFind = FindFirstFile( aShortPath, &aFindFileData );
+ WIN32_FIND_DATAW aFindFileData;
+ HANDLE hFind = FindFirstFileW( aShortPath, &aFindFileData );
if ( IsValidHandle(hFind) )
{
- _tcscat( lpszPath, aFindFileData.cFileName[0] ? aFindFileData.cFileName : aFindFileData.cAlternateFileName );
+ wcscat( lpszPath, aFindFileData.cFileName[0] ? aFindFileData.cFileName : aFindFileData.cAlternateFileName );
FindClose( hFind );
}
@@ -431,7 +423,7 @@ static DWORD GetCaseCorrectPathNameEx(
else
{
/* add the segment name back */
- _tcscat( lpszPath, szFile );
+ wcscat( lpszPath, szFile );
}
}
}
@@ -443,10 +435,10 @@ static DWORD GetCaseCorrectPathNameEx(
if ( nSkipLevels )
lpszPath[0] = 0;
else
- _tcsupr( lpszPath );
+ _wcsupr( lpszPath );
}
- return _tcslen( lpszPath );
+ return wcslen( lpszPath );
}
DWORD GetCaseCorrectPathName(
@@ -471,9 +463,9 @@ DWORD GetCaseCorrectPathName(
}
else if ( lpszShortPath )
{
- if ( _tcslen( lpszShortPath ) <= cchBuffer )
+ if ( wcslen( lpszShortPath ) <= cchBuffer )
{
- _tcscpy( lpszLongPath, lpszShortPath );
+ wcscpy( lpszLongPath, lpszShortPath );
return GetCaseCorrectPathNameEx( lpszLongPath, cchBuffer, 0, bCheckExistence );
}
}
@@ -493,7 +485,7 @@ static bool osl_decodeURL_( rtl_String* strUTF8, rtl_uString** pstrDecodedURL )
/* The resulting decoded string length is shorter or equal to the source length */
nSrcLen = rtl_string_getLength(strUTF8);
- pBuffer = static_cast<sal_Char*>(rtl_allocateMemory(nSrcLen + 1));
+ pBuffer = static_cast<sal_Char*>(rtl_allocateMemory((nSrcLen + 1) * sizeof(sal_Char)));
pDest = pBuffer;
pSrc = rtl_string_getStr(strUTF8);
@@ -906,7 +898,7 @@ oslFileError SAL_CALL osl_searchFileURL(
static_cast<LPWSTR>(rtl_reallocateMemory(lpBuffer, nBufferLength * sizeof(WCHAR))) :
static_cast<LPWSTR>(rtl_allocateMemory(nBufferLength * sizeof(WCHAR)));
- dwResult = SearchPath( lpszSearchPath, lpszSearchFile, nullptr, nBufferLength, lpBuffer, &lpszFilePart );
+ dwResult = SearchPathW( lpszSearchPath, lpszSearchFile, nullptr, nBufferLength, lpBuffer, &lpszFilePart );
} while ( dwResult && dwResult >= nBufferLength );
/* ... until an error occurs or buffer is large enough.
@@ -919,13 +911,13 @@ oslFileError SAL_CALL osl_searchFileURL(
}
else
{
- WIN32_FIND_DATA aFindFileData;
+ WIN32_FIND_DATAW aFindFileData;
HANDLE hFind;
/* something went wrong, perhaps the path was absolute */
error = oslTranslateFileError( GetLastError() );
- hFind = FindFirstFile( SAL_W(ustrSysPath->buffer), &aFindFileData );
+ hFind = FindFirstFileW( SAL_W(ustrSysPath->buffer), &aFindFileData );
if ( IsValidHandle(hFind) )
{
diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx
index 795a9bf05e8f..cdf1665509de 100644
--- a/sal/osl/w32/module.cxx
+++ b/sal/osl/w32/module.cxx
@@ -96,9 +96,9 @@ oslModule SAL_CALL osl_loadModuleAscii(const sal_Char *pModuleName, sal_Int32 )
SAL_INFO( "sal.osl", "osl_loadModule: " << pModuleName );
OSL_ASSERT(pModuleName);
- h = LoadLibrary(pModuleName);
+ h = LoadLibraryA(pModuleName);
if (h == nullptr)
- h = LoadLibraryEx(pModuleName, nullptr,
+ h = LoadLibraryExA(pModuleName, nullptr,
LOAD_WITH_ALTERED_SEARCH_PATH);
ret = static_cast<oslModule>(h);
@@ -236,10 +236,10 @@ static bool SAL_CALL osl_addressGetModuleURL_NT4_( void *pv, rtl_uString **pustr
the root when calling SymInitialize(), so we preferr DBGHELP.DLL
which exports the same symbols and is shipped with OOo */
- HMODULE hModImageHelp = LoadLibrary( "DBGHELP.DLL" );
+ HMODULE hModImageHelp = LoadLibraryW( L"DBGHELP.DLL" );
if ( !hModImageHelp )
- hModImageHelp = LoadLibrary( "IMAGEHLP.DLL" );
+ hModImageHelp = LoadLibraryW( L"IMAGEHLP.DLL" );
if ( hModImageHelp )
{
@@ -337,7 +337,7 @@ static bool SAL_CALL osl_addressGetModuleURL_NT_( void *pv, rtl_uString **pustrU
static HMODULE hModPsapi = nullptr;
if ( !hModPsapi )
- hModPsapi = LoadLibrary( "PSAPI.DLL" );
+ hModPsapi = LoadLibraryW( L"PSAPI.DLL" );
if ( hModPsapi )
{
diff --git a/sal/osl/w32/nlsupport.cxx b/sal/osl/w32/nlsupport.cxx
index 1ca7f6b31d1c..c3136ae65aa5 100644
--- a/sal/osl/w32/nlsupport.cxx
+++ b/sal/osl/w32/nlsupport.cxx
@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#define UNICODE
+#define WIN32_LEAN_AND_MEAN
#ifdef _MSC_VER
#pragma warning(push,1) /* disable warnings within system headers */
#endif
@@ -59,39 +59,25 @@ static DWORD g_dwTLSLocaleEncId = (DWORD) -1;
/*****************************************************************************
* callback function test
- *
- * osl_getTextEncodingFromLocale calls EnumSystemLocalesA, so that we don't
- * need to provide a unicode wrapper for this function under Win9x
- * that means the callback function has an ansi prototype and receives
- * the locale strings as ansi strings
*****************************************************************************/
-BOOL CALLBACK EnumLocalesProcA( LPSTR lpLocaleStringA )
+BOOL CALLBACK EnumLocalesProcW( LPWSTR lpLocaleStringW )
{
- struct EnumLocalesParams * params;
-
- LCID localeId;
- LPSTR pszEndA;
+ /* check params received via TLS */
+ EnumLocalesParams * params = static_cast<EnumLocalesParams *>(TlsGetValue( g_dwTLSLocaleEncId ));
+ if( nullptr == params || '\0' == params->Language[0] )
+ return FALSE;
+ LPWSTR pszEnd;
WCHAR langCode[ELP_LANGUAGE_FIELD_LENGTH];
/* convert hex-string to LCID */
- localeId = strtol( lpLocaleStringA, &pszEndA, 16 );
-
- /* check params received via TLS */
- params = static_cast<struct EnumLocalesParams *>(TlsGetValue( g_dwTLSLocaleEncId ));
- if( nullptr == params || '\0' == params->Language[0] )
- return FALSE;
+ LCID localeId = wcstol(lpLocaleStringW, &pszEnd, 16);
/*
get the ISO language code for this locale
-
- remember: we call the GetLocaleInfoW function
- because the ansi version of this function returns
- an error under WinNT/2000 when called with an
- unicode only lcid
*/
- if( GetLocaleInfo( localeId, LOCALE_SISO639LANGNAME , langCode, ELP_LANGUAGE_FIELD_LENGTH ) )
+ if( GetLocaleInfoW( localeId, LOCALE_SISO639LANGNAME , langCode, ELP_LANGUAGE_FIELD_LENGTH ) )
{
WCHAR ctryCode[ELP_COUNTRY_FIELD_LENGTH];
@@ -100,10 +86,10 @@ BOOL CALLBACK EnumLocalesProcA( LPSTR lpLocaleStringA )
return TRUE;
/* check if country code is set and equals the current locale */
- if( '\0' != params->Country[0] && GetLocaleInfo( localeId,
+ if( '\0' != params->Country[0] && GetLocaleInfoW( localeId,
LOCALE_SISO3166CTRYNAME , ctryCode, ELP_COUNTRY_FIELD_LENGTH ) )
{
- /* save return value in TLS and break if found desired locale */
+ /* save return value in TLS and break if found desired locale */
if( 0 == wcscmp( ctryCode, params->Country ) )
{
params->Locale = localeId;
@@ -135,7 +121,7 @@ rtl_TextEncoding GetTextEncodingFromLCID( LCID localeId )
WCHAR ansiCP[6];
/* query ansi codepage for given locale */
- if( localeId && GetLocaleInfo( localeId, LOCALE_IDEFAULTANSICODEPAGE, ansiCP, 6 ) )
+ if( localeId && GetLocaleInfoW( localeId, LOCALE_IDEFAULTANSICODEPAGE, ansiCP, 6 ) )
{
/* if GetLocaleInfo returns "0", it is a UNICODE only locale */
if( 0 != wcscmp( ansiCP, L"0" ) )
@@ -190,7 +176,7 @@ rtl_TextEncoding SAL_CALL osl_getTextEncodingFromLocale( rtl_Locale * pLocale )
TlsSetValue( g_dwTLSLocaleEncId, &params );
/* enum all locales known to Windows */
- EnumSystemLocalesA( EnumLocalesProcA, LCID_SUPPORTED );
+ EnumSystemLocalesW( EnumLocalesProcW, LCID_SUPPORTED );
/* use the LCID found in iteration */
return GetTextEncodingFromLCID( params.Locale );
@@ -211,8 +197,8 @@ void imp_getProcessLocale( rtl_Locale ** ppLocale )
localeId = GetUserDefaultLCID();
/* call GetLocaleInfo to retrieve the iso codes */
- if( GetLocaleInfo( localeId, LOCALE_SISO639LANGNAME , langCode, ELP_LANGUAGE_FIELD_LENGTH ) &&
- GetLocaleInfo( localeId, LOCALE_SISO3166CTRYNAME , ctryCode, ELP_COUNTRY_FIELD_LENGTH ) )
+ if( GetLocaleInfoW( localeId, LOCALE_SISO639LANGNAME , langCode, ELP_LANGUAGE_FIELD_LENGTH ) &&
+ GetLocaleInfoW( localeId, LOCALE_SISO3166CTRYNAME , ctryCode, ELP_COUNTRY_FIELD_LENGTH ) )
{
*ppLocale = rtl_locale_register( SAL_U(langCode), SAL_U(ctryCode), u"" );
}
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 758100fc3417..efe4b8e92860 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#define UNICODE
#include "system.h"
#include <string.h>
#ifdef _MSC_VER
@@ -31,19 +30,13 @@
#include <cassert>
#include <memory>
-#include <osl/security.h>
#include <osl/nlsupport.h>
-#include <osl/mutex.h>
-#include <osl/thread.h>
-#include <sal/log.hxx>
#include <filetime.hxx>
#include <nlsupport.hxx>
#include "procimpl.hxx"
-#include "sockimpl.hxx"
#include "file_url.hxx"
#include "path_helper.hxx"
-#include <rtl/ustrbuf.h>
#include <rtl/alloc.h>
oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process)
@@ -112,7 +105,7 @@ oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process)
// immediately, doesn't call any termination handlers and doesn't notify any dlls
// that it is detaching from them
- HINSTANCE hKernel = GetModuleHandleA("kernel32.dll");
+ HINSTANCE hKernel = GetModuleHandleW(L"kernel32.dll");
FARPROC pfnExitProc = GetProcAddress(hKernel, "ExitProcess");
hRemoteThread = CreateRemoteThread(
hProcess, /* process handle */
@@ -351,7 +344,7 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char **)
::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
DWORD dwResult = 0;
- dwResult = SearchPath (
+ dwResult = SearchPathW (
nullptr, reinterpret_cast<LPCWSTR>(ppArgs[0]->buffer), L".exe", aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), nullptr);
if ((0 < dwResult) && (dwResult < aBuffer.getBufSizeInSymbols()))
{
@@ -501,7 +494,7 @@ oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir
DWORD dwLen = 0;
osl_acquireMutex( g_CurrentDirectoryMutex );
- dwLen = GetCurrentDirectory( aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer) );
+ dwLen = GetCurrentDirectoryW( aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer) );
osl_releaseMutex( g_CurrentDirectoryMutex );
if ( dwLen && dwLen < aBuffer.getBufSizeInSymbols() )
diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx
index ed0b5b3580bd..af5b75e5891f 100644
--- a/sal/osl/w32/procimpl.cxx
+++ b/sal/osl/w32/procimpl.cxx
@@ -17,20 +17,16 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#define UNICODE
-#define _UNICODE
-
#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
# ifdef _MSC_VER
# pragma warning(push,1) /* disable warnings within system headers */
# endif
-# include <windows.h>
+# include <windows.h>
# ifdef _MSC_VER
# pragma warning(pop)
# endif
-# include <tchar.h>
-# undef WIN32_LEAN_AND_MEAN
+# undef WIN32_LEAN_AND_MEAN
#endif
#include <file-impl.hxx>
@@ -38,17 +34,8 @@
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include "secimpl.hxx"
-#include <osl/file.hxx>
#include <vector>
-#include <algorithm>
-#include <string>
-#include <string.h>
-
-const sal_Unicode NAME_VALUE_SEPARATOR = TEXT('=');
-const sal_Char SPACE[] = " ";
-const rtl::OUString ENV_COMSPEC ("COMSPEC");
-const rtl::OUString QUOTE("\"");
namespace /* private */
{
@@ -68,17 +55,17 @@ namespace /* private */
{
bool operator() (const rtl::OUString& lhs, const rtl::OUString& rhs) const
{
- OSL_ENSURE((lhs.indexOf(NAME_VALUE_SEPARATOR) > -1) &&
- (rhs.indexOf(NAME_VALUE_SEPARATOR) > -1),
+ OSL_ENSURE((lhs.indexOf(L'=') > -1) &&
+ (rhs.indexOf(L'=') > -1),
"Malformed environment variable");
// Windows compares environment variables uppercase
// so we do it, too
return (rtl_ustr_compare_WithLength(
lhs.toAsciiUpperCase().pData->buffer,
- lhs.indexOf(NAME_VALUE_SEPARATOR),
+ lhs.indexOf(L'='),
rhs.toAsciiUpperCase().pData->buffer,
- rhs.indexOf(NAME_VALUE_SEPARATOR)) < 0);
+ rhs.indexOf(L'=')) < 0);
}
};
@@ -118,15 +105,15 @@ namespace /* private */
{
// GetEnvironmentStrings returns a sorted list, Windows
// sorts environment variables upper case
- LPWSTR env = GetEnvironmentStrings();
+ LPWSTR env = GetEnvironmentStringsW();
LPWSTR p = env;
- while (size_t l = _tcslen(p))
+ while (size_t l = wcslen(p))
{
environment->push_back(SAL_U(p));
p += l + 1;
}
- FreeEnvironmentStrings(env);
+ FreeEnvironmentStringsW(env);
// it is apparently possible that the environment is not completely
// sorted; Cygwin may append entries, which breaks the equal_range
@@ -160,7 +147,7 @@ namespace /* private */
env_var,
less_environment_variable());
- if (env_var.indexOf(NAME_VALUE_SEPARATOR) == -1)
+ if (env_var.indexOf(L'=') == -1)
{
merged_env->erase(iter_pair.first, iter_pair.second);
}
@@ -265,13 +252,13 @@ namespace /* private */
rtl::OUString quote_string(const rtl::OUString& string)
{
rtl::OUStringBuffer quoted;
- if (string.indexOf(QUOTE) != 0)
- quoted.append(QUOTE);
+ if (string.indexOf(L'"') != 0)
+ quoted.append('"');
quoted.append(string);
- if (string.lastIndexOf(QUOTE) != (string.getLength() - 1))
- quoted.append(QUOTE);
+ if (string.lastIndexOf(L'"') != (string.getLength() - 1))
+ quoted.append('"');
return quoted.makeStringAndClear();
}
@@ -360,6 +347,7 @@ namespace /* private */
ext.equalsIgnoreAsciiCase("btm"));
}
+ const rtl::OUString ENV_COMSPEC ("COMSPEC");
rtl::OUString get_batch_processor()
{
rtl::OUString comspec;
@@ -452,7 +440,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
start at 1 instead of 0 */
for (sal_uInt32 n = (nullptr != ustrImageName) ? 0 : 1; n < nArguments; n++)
{
- command_line.append(SPACE);
+ command_line.append(" ");
/* Quote arguments containing blanks */
if (rtl::OUString(ustrArguments[n]).indexOf(' ') != -1)
@@ -483,7 +471,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
if ((Options & osl_Process_DETACHED) && !(flags & CREATE_NEW_CONSOLE))
flags |= DETACHED_PROCESS;
- STARTUPINFO startup_info;
+ STARTUPINFOW startup_info;
memset(&startup_info, 0, sizeof(STARTUPINFO));
startup_info.cb = sizeof(STARTUPINFO);
@@ -541,7 +529,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
if ((Security != nullptr) && (static_cast<oslSecurityImpl*>(Security)->m_hToken != nullptr))
{
- bRet = CreateProcessAsUser(
+ bRet = CreateProcessAsUserW(
static_cast<oslSecurityImpl*>(Security)->m_hToken,
nullptr, const_cast<LPWSTR>(SAL_W(cmdline.getStr())), nullptr, nullptr,
b_inherit_handles, flags, p_environment, p_cwd,
@@ -549,7 +537,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO(
}
else
{
- bRet = CreateProcess(
+ bRet = CreateProcessW(
nullptr, const_cast<LPWSTR>(SAL_W(cmdline.getStr())), nullptr, nullptr,
b_inherit_handles, flags, p_environment, p_cwd,
&startup_info, &process_info);
diff --git a/sal/osl/w32/signal.cxx b/sal/osl/w32/signal.cxx
index 623cfdca3d90..0f6bc08dc9dc 100644
--- a/sal/osl/w32/signal.cxx
+++ b/sal/osl/w32/signal.cxx
@@ -17,23 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <sal/config.h>
-#include <config_features.h>
-
#include <signalshared.hxx>
-/* system headers */
-#include "system.h"
-#include <tchar.h>
-
-#include "file_url.hxx"
-#include "path_helper.hxx"
-
-#include <osl/signal.h>
-#include <DbgHelp.h>
-#include <errorrep.h>
#include <systools/win32/uwinapi.h>
-#include <sal/macros.h>
+#include <errorrep.h>
namespace
{
@@ -46,7 +33,7 @@ bool onInitSignal()
{
pPreviousHandler = SetUnhandledExceptionFilter(signalHandlerFunction);
- HMODULE hFaultRep = LoadLibrary( "faultrep.dll" );
+ HMODULE hFaultRep = LoadLibraryW( L"faultrep.dll" );
if ( hFaultRep )
{
pfn_ADDEREXCLUDEDAPPLICATIONW pfn = reinterpret_cast<pfn_ADDEREXCLUDEDAPPLICATIONW>(GetProcAddress( hFaultRep, "AddERExcludedApplicationW" ));
diff --git a/sal/osl/w32/tempfile.cxx b/sal/osl/w32/tempfile.cxx
index d69491324931..d765bd843e6b 100644
--- a/sal/osl/w32/tempfile.cxx
+++ b/sal/osl/w32/tempfile.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#define UNICODE
-#define _UNICODE
#include "systools/win32/uwinapi.h"
#include "osl/file.h"
@@ -28,10 +26,7 @@
#include "file_url.hxx"
#include "path_helper.hxx"
-#include "osl/diagnose.h"
-
#include <malloc.h>
-#include <tchar.h>
#include <cassert>
// Allocate n number of t's on the stack return a pointer to it in p
diff --git a/sal/osl/w32/time.cxx b/sal/osl/w32/time.cxx
index 1a6e6ceaa181..b503a05e81dc 100644
--- a/sal/osl/w32/time.cxx
+++ b/sal/osl/w32/time.cxx
@@ -42,7 +42,7 @@ sal_Bool SAL_CALL osl_getSystemTime(TimeValue* pTimeVal)
if ( !hModule )
{
- hModule = GetModuleHandleA( "Kernel32.dll" );
+ hModule = GetModuleHandleW( L"Kernel32.dll" );
if ( hModule )
pGetSystemTimePreciseAsFileTime = reinterpret_cast<GetSystemTimePreciseAsFileTime_PROC>(
GetProcAddress(hModule, "GetSystemTimePreciseAsFileTime"));