summaryrefslogtreecommitdiffstats
path: root/desktop/win32/source/guistdio/guistdio.inc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2017-09-20 20:20:44 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-09-22 20:53:30 +0200
commiteef4c133e9649ebd690918bd7b83c2d5dc0dfcff (patch)
tree1a8d084c5b16056a15258770a05b9cd2d53a40bc /desktop/win32/source/guistdio/guistdio.inc
parentPut definition of _CRT_RAND_S into bin/update_pch (diff)
downloadcore-eef4c133e9649ebd690918bd7b83c2d5dc0dfcff.tar.gz
core-eef4c133e9649ebd690918bd7b83c2d5dc0dfcff.zip
Windows: avoid dependence on UNICODE define; prefer W functions
Change-Id: I95b90128e93f0d88ed73601bcc5a7ca9279d4cf1 Reviewed-on: https://gerrit.libreoffice.org/42560 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'desktop/win32/source/guistdio/guistdio.inc')
-rw-r--r--desktop/win32/source/guistdio/guistdio.inc28
1 files changed, 12 insertions, 16 deletions
diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc
index 5617d889a402..5d6634bb9c5c 100644
--- a/desktop/win32/source/guistdio/guistdio.inc
+++ b/desktop/win32/source/guistdio/guistdio.inc
@@ -17,7 +17,6 @@
* 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
@@ -27,9 +26,6 @@
#pragma warning(pop)
#endif
-#define _UNICODE
-#include <tchar.h>
-
#include <string.h>
#include <stdlib.h>
#include <systools/win32/uwinapi.h>
@@ -250,7 +246,7 @@ DWORD WINAPI WaitForUIThread( LPVOID pParam )
#ifndef UNOPKG
HANDLE hProcess = (HANDLE)pParam;
- if ( !_tgetenv( TEXT("UNOPKG") ) )
+ if ( !wgetenv( L"UNOPKG" ) )
WaitForInputIdle( hProcess, INFINITE );
#else
(void) pParam;
@@ -274,10 +270,10 @@ BOOL WINAPI CtrlBreakHandler(
return TRUE;
}
-int _tmain( int, _TCHAR ** )
+int wmain( int, wchar_t** )
{
- TCHAR szTargetFileName[MAX_PATH] = TEXT("");
- STARTUPINFO aStartupInfo;
+ WCHAR szTargetFileName[MAX_PATH] = L"";
+ STARTUPINFOW aStartupInfo;
PROCESS_INFORMATION aProcessInfo;
ZeroMemory( &aStartupInfo, sizeof(aStartupInfo) );
@@ -331,23 +327,23 @@ int _tmain( int, _TCHAR ** )
// Get image path with same name but with .exe extension
- TCHAR szModuleFileName[MAX_PATH];
+ WCHAR szModuleFileName[MAX_PATH];
- GetModuleFileName( nullptr, szModuleFileName, MAX_PATH );
- _TCHAR *lpLastDot = _tcsrchr( szModuleFileName, '.' );
- if ( lpLastDot && 0 == _tcsicmp( lpLastDot, _T(".COM") ) )
+ GetModuleFileNameW( nullptr, szModuleFileName, MAX_PATH );
+ WCHAR *lpLastDot = wcsrchr( szModuleFileName, '.' );
+ if ( lpLastDot && 0 == wcsicmp( lpLastDot, L".COM" ) )
{
size_t len = lpLastDot - szModuleFileName;
- _tcsncpy( szTargetFileName, szModuleFileName, len );
- _tcsncpy( szTargetFileName + len, _T(".EXE"), SAL_N_ELEMENTS(szTargetFileName) - len );
+ wcsncpy( szTargetFileName, szModuleFileName, len );
+ wcsncpy( szTargetFileName + len, L".EXE", SAL_N_ELEMENTS(szTargetFileName) - len );
}
// Create process with same command line, environment and stdio handles which
// are directed to the created pipes
- BOOL fSuccess = CreateProcess(
+ BOOL fSuccess = CreateProcessW(
szTargetFileName,
- GetCommandLine(),
+ GetCommandLineW(),
nullptr,
nullptr,
TRUE,