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>
This commit is contained in:
@@ -755,16 +755,6 @@ def generate(includes, libname, filename, module):
|
|||||||
"""
|
"""
|
||||||
f.write(sal_define)
|
f.write(sal_define)
|
||||||
|
|
||||||
# svx needs this (sendreportw32.cxx)
|
|
||||||
if module == 'svx' and libname == 'svx':
|
|
||||||
svx_define = """
|
|
||||||
#ifdef _WIN32
|
|
||||||
# define UNICODE
|
|
||||||
# define _UNICODE
|
|
||||||
#endif
|
|
||||||
"""
|
|
||||||
f.write(svx_define)
|
|
||||||
|
|
||||||
# Dump the headers.
|
# Dump the headers.
|
||||||
f.write('\n')
|
f.write('\n')
|
||||||
for i in includes:
|
for i in includes:
|
||||||
|
@@ -17,23 +17,6 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Use UNICODE Windows and C API.
|
|
||||||
#define _UNICODE
|
|
||||||
#define UNICODE
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push, 1)
|
|
||||||
#endif
|
|
||||||
#if !defined WIN32_LEAN_AND_MEAN
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
#include "native_share.h"
|
#include "native_share.h"
|
||||||
|
|
||||||
#include "rtl/bootstrap.hxx"
|
#include "rtl/bootstrap.hxx"
|
||||||
|
@@ -18,10 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
#define _UNICODE
|
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push, 1)
|
#pragma warning(push, 1)
|
||||||
#pragma warning(disable:4005)
|
#pragma warning(disable:4005)
|
||||||
@@ -31,7 +27,6 @@
|
|||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shellapi.h>
|
|
||||||
#include <sqlext.h>
|
#include <sqlext.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -50,19 +45,19 @@ int displayLastError()
|
|||||||
DWORD dwError = GetLastError();
|
DWORD dwError = GetLastError();
|
||||||
|
|
||||||
LPVOID lpMsgBuf;
|
LPVOID lpMsgBuf;
|
||||||
FormatMessage(
|
FormatMessageW(
|
||||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
nullptr,
|
nullptr,
|
||||||
dwError,
|
dwError,
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||||
reinterpret_cast<LPTSTR>(&lpMsgBuf),
|
reinterpret_cast<LPWSTR>(&lpMsgBuf),
|
||||||
0,
|
0,
|
||||||
nullptr
|
nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
// Display the string.
|
// Display the string.
|
||||||
MessageBox( nullptr, static_cast<LPCTSTR>(lpMsgBuf), nullptr, MB_OK | MB_ICONERROR );
|
MessageBoxW( nullptr, static_cast<LPCWSTR>(lpMsgBuf), nullptr, MB_OK | MB_ICONERROR );
|
||||||
|
|
||||||
// Free the buffer.
|
// Free the buffer.
|
||||||
LocalFree( lpMsgBuf );
|
LocalFree( lpMsgBuf );
|
||||||
@@ -74,11 +69,11 @@ int displayLastError()
|
|||||||
*/
|
*/
|
||||||
BOOL registerWindowClass( HINSTANCE _hAppInstance )
|
BOOL registerWindowClass( HINSTANCE _hAppInstance )
|
||||||
{
|
{
|
||||||
WNDCLASSEX wcx;
|
WNDCLASSEXW wcx;
|
||||||
|
|
||||||
wcx.cbSize = sizeof(wcx); // size of structure
|
wcx.cbSize = sizeof(wcx); // size of structure
|
||||||
wcx.style = CS_HREDRAW | CS_VREDRAW; // redraw if size changes
|
wcx.style = CS_HREDRAW | CS_VREDRAW; // redraw if size changes
|
||||||
wcx.lpfnWndProc = DefWindowProc; // points to window procedure
|
wcx.lpfnWndProc = DefWindowProcW; // points to window procedure
|
||||||
wcx.cbClsExtra = 0; // no extra class memory
|
wcx.cbClsExtra = 0; // no extra class memory
|
||||||
wcx.cbWndExtra = 0; // no extra window memory
|
wcx.cbWndExtra = 0; // no extra window memory
|
||||||
wcx.hInstance = _hAppInstance; // handle to instance
|
wcx.hInstance = _hAppInstance; // handle to instance
|
||||||
@@ -89,13 +84,13 @@ BOOL registerWindowClass( HINSTANCE _hAppInstance )
|
|||||||
wcx.lpszClassName = L"ODBCConfigMainClass"; // name of window class
|
wcx.lpszClassName = L"ODBCConfigMainClass"; // name of window class
|
||||||
wcx.hIconSm = nullptr; // small class icon
|
wcx.hIconSm = nullptr; // small class icon
|
||||||
|
|
||||||
return ( !!RegisterClassEx( &wcx ) );
|
return ( !!RegisterClassExW( &wcx ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/// initializes the application instances
|
/// initializes the application instances
|
||||||
HWND initInstance( HINSTANCE _hAppInstance )
|
HWND initInstance( HINSTANCE _hAppInstance )
|
||||||
{
|
{
|
||||||
HWND hWindow = CreateWindow(
|
HWND hWindow = CreateWindowW(
|
||||||
L"ODBCConfigMainClass", // name of window class
|
L"ODBCConfigMainClass", // name of window class
|
||||||
L"ODBC Config Wrapper", // title-bar string
|
L"ODBC Config Wrapper", // title-bar string
|
||||||
WS_OVERLAPPEDWINDOW, // top-level window
|
WS_OVERLAPPEDWINDOW, // top-level window
|
||||||
@@ -114,7 +109,7 @@ HWND initInstance( HINSTANCE _hAppInstance )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// main window function
|
// main window function
|
||||||
extern "C" int APIENTRY _tWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPTSTR, int )
|
extern "C" int APIENTRY wWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPWSTR, int )
|
||||||
{
|
{
|
||||||
if ( !registerWindowClass( _hAppInstance ) )
|
if ( !registerWindowClass( _hAppInstance ) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@@ -47,7 +47,6 @@
|
|||||||
#include <salhelper/linkhelper.hxx>
|
#include <salhelper/linkhelper.hxx>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define UNICODE
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
@@ -39,35 +39,39 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
bool SofficeRuns()
|
bool SofficeRuns()
|
||||||
{
|
{
|
||||||
// check for soffice by searching the communication window
|
// check for soffice by searching the communication window
|
||||||
return FindWindowEx( nullptr, nullptr, QUICKSTART_CLASSNAME, nullptr ) != nullptr;
|
return FindWindowExW( nullptr, nullptr, QUICKSTART_CLASSNAME, nullptr ) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool launchSoffice( )
|
bool launchSoffice( )
|
||||||
{
|
{
|
||||||
if ( !SofficeRuns() )
|
if ( !SofficeRuns() )
|
||||||
{
|
{
|
||||||
char filename[_MAX_PATH + 1];
|
wchar_t filename[_MAX_PATH + 1];
|
||||||
|
|
||||||
filename[_MAX_PATH] = 0;
|
filename[_MAX_PATH] = 0;
|
||||||
GetModuleFileName( nullptr, filename, _MAX_PATH ); // soffice resides in the same dir
|
GetModuleFileNameW( nullptr, filename, _MAX_PATH ); // soffice resides in the same dir
|
||||||
char *p = strrchr( filename, '\\' );
|
wchar_t *p = wcsrchr( filename, L'\\' );
|
||||||
if ( !p )
|
if ( !p )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
strncpy( p+1, "soffice.exe", _MAX_PATH - (p+1 - filename) );
|
wcsncpy( p+1, L"soffice.exe", _MAX_PATH - (p+1 - filename) );
|
||||||
|
|
||||||
char imagename[_MAX_PATH + 1];
|
wchar_t imagename[_MAX_PATH + 1];
|
||||||
|
|
||||||
imagename[_MAX_PATH] = 0;
|
imagename[_MAX_PATH] = 0;
|
||||||
_snprintf(imagename, _MAX_PATH, "\"%s\" --quickstart", filename );
|
_snwprintf(imagename, _MAX_PATH, L"\"%s\" --quickstart", filename );
|
||||||
|
|
||||||
UINT ret = WinExec( imagename, SW_SHOW );
|
STARTUPINFOW aStartupInfo;
|
||||||
if ( ret < 32 )
|
ZeroMemory(&aStartupInfo, sizeof(aStartupInfo));
|
||||||
|
aStartupInfo.cb = sizeof(aStartupInfo);
|
||||||
|
aStartupInfo.wShowWindow = SW_SHOW;
|
||||||
|
PROCESS_INFORMATION aProcessInfo;
|
||||||
|
BOOL bSuccess = CreateProcessW(filename, imagename, nullptr, nullptr, TRUE, 0, nullptr, nullptr, &aStartupInfo, &aProcessInfo);
|
||||||
|
if ( !bSuccess )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -76,10 +80,10 @@ bool launchSoffice( )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int APIENTRY WinMain(HINSTANCE /*hInstance*/,
|
int APIENTRY wWinMain(HINSTANCE /*hInstance*/,
|
||||||
HINSTANCE /*hPrevInstance*/,
|
HINSTANCE /*hPrevInstance*/,
|
||||||
LPSTR /*lpCmdLine*/,
|
LPWSTR /*lpCmdLine*/,
|
||||||
int /*nCmdShow*/)
|
int /*nCmdShow*/)
|
||||||
{
|
{
|
||||||
// Look for --killtray argument
|
// Look for --killtray argument
|
||||||
|
|
||||||
@@ -87,12 +91,12 @@ int APIENTRY WinMain(HINSTANCE /*hInstance*/,
|
|||||||
{
|
{
|
||||||
if ( 0 == strcmp( __argv[i], "--killtray" ) )
|
if ( 0 == strcmp( __argv[i], "--killtray" ) )
|
||||||
{
|
{
|
||||||
HWND hwndTray = FindWindow( QUICKSTART_CLASSNAME, nullptr );
|
HWND hwndTray = FindWindowW( QUICKSTART_CLASSNAME, nullptr );
|
||||||
|
|
||||||
if ( hwndTray )
|
if ( hwndTray )
|
||||||
{
|
{
|
||||||
UINT uMsgKillTray = RegisterWindowMessage( SHUTDOWN_QUICKSTART_MESSAGE );
|
UINT uMsgKillTray = RegisterWindowMessageW( SHUTDOWN_QUICKSTART_MESSAGE );
|
||||||
SendMessage( hwndTray, uMsgKillTray, 0, 0 );
|
SendMessageW( hwndTray, uMsgKillTray, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push,1) // disable warnings within system headers
|
#pragma warning(push,1) // disable warnings within system headers
|
||||||
@@ -27,9 +26,6 @@
|
|||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _UNICODE
|
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <systools/win32/uwinapi.h>
|
#include <systools/win32/uwinapi.h>
|
||||||
@@ -250,7 +246,7 @@ DWORD WINAPI WaitForUIThread( LPVOID pParam )
|
|||||||
#ifndef UNOPKG
|
#ifndef UNOPKG
|
||||||
HANDLE hProcess = (HANDLE)pParam;
|
HANDLE hProcess = (HANDLE)pParam;
|
||||||
|
|
||||||
if ( !_tgetenv( TEXT("UNOPKG") ) )
|
if ( !wgetenv( L"UNOPKG" ) )
|
||||||
WaitForInputIdle( hProcess, INFINITE );
|
WaitForInputIdle( hProcess, INFINITE );
|
||||||
#else
|
#else
|
||||||
(void) pParam;
|
(void) pParam;
|
||||||
@@ -274,10 +270,10 @@ BOOL WINAPI CtrlBreakHandler(
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _tmain( int, _TCHAR ** )
|
int wmain( int, wchar_t** )
|
||||||
{
|
{
|
||||||
TCHAR szTargetFileName[MAX_PATH] = TEXT("");
|
WCHAR szTargetFileName[MAX_PATH] = L"";
|
||||||
STARTUPINFO aStartupInfo;
|
STARTUPINFOW aStartupInfo;
|
||||||
PROCESS_INFORMATION aProcessInfo;
|
PROCESS_INFORMATION aProcessInfo;
|
||||||
|
|
||||||
ZeroMemory( &aStartupInfo, sizeof(aStartupInfo) );
|
ZeroMemory( &aStartupInfo, sizeof(aStartupInfo) );
|
||||||
@@ -331,23 +327,23 @@ int _tmain( int, _TCHAR ** )
|
|||||||
|
|
||||||
// Get image path with same name but with .exe extension
|
// Get image path with same name but with .exe extension
|
||||||
|
|
||||||
TCHAR szModuleFileName[MAX_PATH];
|
WCHAR szModuleFileName[MAX_PATH];
|
||||||
|
|
||||||
GetModuleFileName( nullptr, szModuleFileName, MAX_PATH );
|
GetModuleFileNameW( nullptr, szModuleFileName, MAX_PATH );
|
||||||
_TCHAR *lpLastDot = _tcsrchr( szModuleFileName, '.' );
|
WCHAR *lpLastDot = wcsrchr( szModuleFileName, '.' );
|
||||||
if ( lpLastDot && 0 == _tcsicmp( lpLastDot, _T(".COM") ) )
|
if ( lpLastDot && 0 == wcsicmp( lpLastDot, L".COM" ) )
|
||||||
{
|
{
|
||||||
size_t len = lpLastDot - szModuleFileName;
|
size_t len = lpLastDot - szModuleFileName;
|
||||||
_tcsncpy( szTargetFileName, szModuleFileName, len );
|
wcsncpy( szTargetFileName, szModuleFileName, len );
|
||||||
_tcsncpy( szTargetFileName + len, _T(".EXE"), SAL_N_ELEMENTS(szTargetFileName) - len );
|
wcsncpy( szTargetFileName + len, L".EXE", SAL_N_ELEMENTS(szTargetFileName) - len );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create process with same command line, environment and stdio handles which
|
// Create process with same command line, environment and stdio handles which
|
||||||
// are directed to the created pipes
|
// are directed to the created pipes
|
||||||
|
|
||||||
BOOL fSuccess = CreateProcess(
|
BOOL fSuccess = CreateProcessW(
|
||||||
szTargetFileName,
|
szTargetFileName,
|
||||||
GetCommandLine(),
|
GetCommandLineW(),
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
TRUE,
|
TRUE,
|
||||||
|
@@ -35,7 +35,10 @@
|
|||||||
// characters in the debug information
|
// characters in the debug information
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define UNICODE
|
#if !defined WINVER
|
||||||
|
#define WINVER 0x0400
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <osl/diagnose.h>
|
#include <osl/diagnose.h>
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
|
|
||||||
@@ -54,8 +57,8 @@ using osl::ClearableMutexGuard;
|
|||||||
|
|
||||||
namespace /* private */
|
namespace /* private */
|
||||||
{
|
{
|
||||||
char CLIPSRV_DLL_NAME[] = "sysdtrans.dll";
|
wchar_t CLIPSRV_DLL_NAME[] = L"sysdtrans.dll";
|
||||||
char g_szWndClsName[] = "MtaOleReqWnd###";
|
wchar_t g_szWndClsName[] = L"MtaOleReqWnd###";
|
||||||
|
|
||||||
// messages constants
|
// messages constants
|
||||||
|
|
||||||
@@ -86,7 +89,7 @@ namespace /* private */
|
|||||||
// ctor
|
// ctor
|
||||||
Win32Condition()
|
Win32Condition()
|
||||||
{
|
{
|
||||||
m_hEvent = CreateEvent(
|
m_hEvent = CreateEventW(
|
||||||
nullptr, /* no security */
|
nullptr, /* no security */
|
||||||
true, /* manual reset */
|
true, /* manual reset */
|
||||||
false, /* initial state not signaled */
|
false, /* initial state not signaled */
|
||||||
@@ -119,7 +122,7 @@ namespace /* private */
|
|||||||
queue that's what we want, messages from the PostMessage
|
queue that's what we want, messages from the PostMessage
|
||||||
queue stay untouched */
|
queue stay untouched */
|
||||||
MSG msg;
|
MSG msg;
|
||||||
PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE);
|
PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -248,7 +251,7 @@ CMtaOleClipboard::CMtaOleClipboard( ) :
|
|||||||
m_ClipboardChangedEventCount( 0 )
|
m_ClipboardChangedEventCount( 0 )
|
||||||
{
|
{
|
||||||
// signals that the thread was successfully setup
|
// signals that the thread was successfully setup
|
||||||
m_hEvtThrdReady = CreateEventA( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr );
|
m_hEvtThrdReady = CreateEventW( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr );
|
||||||
|
|
||||||
OSL_ASSERT( nullptr != m_hEvtThrdReady );
|
OSL_ASSERT( nullptr != m_hEvtThrdReady );
|
||||||
|
|
||||||
@@ -260,10 +263,10 @@ CMtaOleClipboard::CMtaOleClipboard( ) :
|
|||||||
|
|
||||||
// setup the clipboard changed notifier thread
|
// setup the clipboard changed notifier thread
|
||||||
|
|
||||||
m_hClipboardChangedNotifierEvents[0] = CreateEventA( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr );
|
m_hClipboardChangedNotifierEvents[0] = CreateEventW( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr );
|
||||||
OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[0] );
|
OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[0] );
|
||||||
|
|
||||||
m_hClipboardChangedNotifierEvents[1] = CreateEventA( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr );
|
m_hClipboardChangedNotifierEvents[1] = CreateEventW( nullptr, MANUAL_RESET, INIT_NONSIGNALED, nullptr );
|
||||||
OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[1] );
|
OSL_ASSERT( nullptr != m_hClipboardChangedNotifierEvents[1] );
|
||||||
|
|
||||||
unsigned uThreadId;
|
unsigned uThreadId;
|
||||||
@@ -315,7 +318,7 @@ CMtaOleClipboard::~CMtaOleClipboard( )
|
|||||||
CloseHandle( m_hEvtThrdReady );
|
CloseHandle( m_hEvtThrdReady );
|
||||||
|
|
||||||
if ( m_MtaOleReqWndClassAtom )
|
if ( m_MtaOleReqWndClassAtom )
|
||||||
UnregisterClassA( g_szWndClsName, nullptr );
|
UnregisterClassW( g_szWndClsName, nullptr );
|
||||||
|
|
||||||
OSL_ENSURE( ( nullptr == m_pfncClipViewerCallback ) &&
|
OSL_ENSURE( ( nullptr == m_pfncClipViewerCallback ) &&
|
||||||
!IsWindow( m_hwndNextClipViewer ),
|
!IsWindow( m_hwndNextClipViewer ),
|
||||||
@@ -516,7 +519,7 @@ LRESULT CMtaOleClipboard::onChangeCBChain( HWND hWndRemove, HWND hWndNext )
|
|||||||
{
|
{
|
||||||
// forward the message to the next one
|
// forward the message to the next one
|
||||||
DWORD_PTR dwpResult;
|
DWORD_PTR dwpResult;
|
||||||
SendMessageTimeoutA(
|
SendMessageTimeoutW(
|
||||||
m_hwndNextClipViewer,
|
m_hwndNextClipViewer,
|
||||||
WM_CHANGECBCHAIN,
|
WM_CHANGECBCHAIN,
|
||||||
reinterpret_cast<WPARAM>(hWndRemove),
|
reinterpret_cast<WPARAM>(hWndRemove),
|
||||||
@@ -549,7 +552,7 @@ LRESULT CMtaOleClipboard::onDrawClipboard( )
|
|||||||
if ( IsWindow( m_hwndNextClipViewer ) )
|
if ( IsWindow( m_hwndNextClipViewer ) )
|
||||||
{
|
{
|
||||||
DWORD_PTR dwpResult;
|
DWORD_PTR dwpResult;
|
||||||
SendMessageTimeoutA(
|
SendMessageTimeoutW(
|
||||||
m_hwndNextClipViewer,
|
m_hwndNextClipViewer,
|
||||||
WM_DRAWCLIPBOARD,
|
WM_DRAWCLIPBOARD,
|
||||||
static_cast< WPARAM >( 0 ),
|
static_cast< WPARAM >( 0 ),
|
||||||
@@ -567,7 +570,7 @@ LRESULT CMtaOleClipboard::onDrawClipboard( )
|
|||||||
|
|
||||||
LRESULT CMtaOleClipboard::sendMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
LRESULT CMtaOleClipboard::sendMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
return ::SendMessageA( m_hwndMtaOleReqWnd, msg, wParam, lParam );
|
return ::SendMessageW( m_hwndMtaOleReqWnd, msg, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
// PostMessage so we don't need to supply the HWND if we send
|
// PostMessage so we don't need to supply the HWND if we send
|
||||||
@@ -575,7 +578,7 @@ LRESULT CMtaOleClipboard::sendMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
|||||||
|
|
||||||
bool CMtaOleClipboard::postMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
bool CMtaOleClipboard::postMessage( UINT msg, WPARAM wParam, LPARAM lParam )
|
||||||
{
|
{
|
||||||
BOOL const ret = PostMessageA(m_hwndMtaOleReqWnd, msg, wParam, lParam);
|
BOOL const ret = PostMessageW(m_hwndMtaOleReqWnd, msg, wParam, lParam);
|
||||||
SAL_WARN_IF(0 == ret, "dtrans", "ERROR: PostMessage() failed!");
|
SAL_WARN_IF(0 == ret, "dtrans", "ERROR: PostMessage() failed!");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -658,7 +661,7 @@ LRESULT CALLBACK CMtaOleClipboard::mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARA
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
lResult = DefWindowProcA( hWnd, uMsg, wParam, lParam );
|
lResult = DefWindowProcW( hWnd, uMsg, wParam, lParam );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,14 +670,14 @@ LRESULT CALLBACK CMtaOleClipboard::mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARA
|
|||||||
|
|
||||||
void CMtaOleClipboard::createMtaOleReqWnd( )
|
void CMtaOleClipboard::createMtaOleReqWnd( )
|
||||||
{
|
{
|
||||||
WNDCLASSEXA wcex;
|
WNDCLASSEXW wcex;
|
||||||
|
|
||||||
HINSTANCE hInst = GetModuleHandleA( CLIPSRV_DLL_NAME );
|
HINSTANCE hInst = GetModuleHandleW( CLIPSRV_DLL_NAME );
|
||||||
OSL_ENSURE( nullptr != hInst, "The name of the clipboard service dll must have changed" );
|
OSL_ENSURE( nullptr != hInst, "The name of the clipboard service dll must have changed" );
|
||||||
|
|
||||||
ZeroMemory( &wcex, sizeof( WNDCLASSEXA ) );
|
ZeroMemory( &wcex, sizeof(wcex) );
|
||||||
|
|
||||||
wcex.cbSize = sizeof(WNDCLASSEXA);
|
wcex.cbSize = sizeof(wcex);
|
||||||
wcex.style = 0;
|
wcex.style = 0;
|
||||||
wcex.lpfnWndProc = static_cast< WNDPROC >( CMtaOleClipboard::mtaOleReqWndProc );
|
wcex.lpfnWndProc = static_cast< WNDPROC >( CMtaOleClipboard::mtaOleReqWndProc );
|
||||||
wcex.cbClsExtra = 0;
|
wcex.cbClsExtra = 0;
|
||||||
@@ -687,10 +690,10 @@ void CMtaOleClipboard::createMtaOleReqWnd( )
|
|||||||
wcex.lpszClassName = g_szWndClsName;
|
wcex.lpszClassName = g_szWndClsName;
|
||||||
wcex.hIconSm = nullptr;
|
wcex.hIconSm = nullptr;
|
||||||
|
|
||||||
m_MtaOleReqWndClassAtom = RegisterClassExA( &wcex );
|
m_MtaOleReqWndClassAtom = RegisterClassExW( &wcex );
|
||||||
|
|
||||||
if ( 0 != m_MtaOleReqWndClassAtom )
|
if ( 0 != m_MtaOleReqWndClassAtom )
|
||||||
m_hwndMtaOleReqWnd = CreateWindowA(
|
m_hwndMtaOleReqWnd = CreateWindowW(
|
||||||
g_szWndClsName, nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr );
|
g_szWndClsName, nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, hInst, nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -710,8 +713,8 @@ unsigned int CMtaOleClipboard::run( )
|
|||||||
|
|
||||||
// pumping messages
|
// pumping messages
|
||||||
MSG msg;
|
MSG msg;
|
||||||
while( GetMessageA( &msg, nullptr, 0, 0 ) )
|
while( GetMessageW( &msg, nullptr, 0, 0 ) )
|
||||||
DispatchMessageA( &msg );
|
DispatchMessageW( &msg );
|
||||||
|
|
||||||
nRet = 0;
|
nRet = 0;
|
||||||
}
|
}
|
||||||
|
@@ -32,7 +32,6 @@
|
|||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
using namespace ::std;
|
using namespace ::std;
|
||||||
|
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <comdef.h>
|
#include <comdef.h>
|
||||||
#include <tchar.h>
|
|
||||||
#include <atlbase.h>
|
#include <atlbase.h>
|
||||||
CComModule _Module;
|
CComModule _Module;
|
||||||
#include <atlcom.h>
|
#include <atlcom.h>
|
||||||
@@ -59,11 +58,11 @@ int main( int argc, char *argv[ ], char *envp[ ] )
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
if( FAILED( hr=CoInitialize(NULL )))
|
if( FAILED( hr=CoInitialize(NULL )))
|
||||||
{
|
{
|
||||||
_tprintf(_T("CoInitialize failed \n"));
|
printf("CoInitialize failed \n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_Module.Init( ObjectMap, GetModuleHandle( NULL));
|
_Module.Init( ObjectMap, GetModuleHandleA( NULL));
|
||||||
|
|
||||||
if( FAILED(hr=doTest()))
|
if( FAILED(hr=doTest()))
|
||||||
{
|
{
|
||||||
@@ -82,7 +81,7 @@ HRESULT doTest()
|
|||||||
|
|
||||||
// create the MTA thread that is used to realize MTA calls to the services
|
// create the MTA thread that is used to realize MTA calls to the services
|
||||||
// We create the thread and wait until the thread has created its message queue
|
// We create the thread and wait until the thread has created its message queue
|
||||||
HANDLE evt= CreateEvent(NULL, FALSE, FALSE, NULL);
|
HANDLE evt= CreateEventA(NULL, FALSE, FALSE, NULL);
|
||||||
DWORD threadIdMTA=0;
|
DWORD threadIdMTA=0;
|
||||||
HANDLE hMTAThread= CreateThread( NULL, 0, MTAFunc, &evt, 0, &threadIdMTA);
|
HANDLE hMTAThread= CreateThread( NULL, 0, MTAFunc, &evt, 0, &threadIdMTA);
|
||||||
WaitForSingleObject( evt, INFINITE);
|
WaitForSingleObject( evt, INFINITE);
|
||||||
@@ -90,27 +89,27 @@ HRESULT doTest()
|
|||||||
|
|
||||||
HRESULT hr= S_OK;
|
HRESULT hr= S_OK;
|
||||||
RECT pos1={0,0,300,200};
|
RECT pos1={0,0,300,200};
|
||||||
AWindow win(_T("DnD starting in Ole STA"), threadIdMTA, pos1);
|
AWindow win("DnD starting in Ole STA", threadIdMTA, pos1);
|
||||||
|
|
||||||
RECT pos2={ 0, 205, 300, 405};
|
RECT pos2={ 0, 205, 300, 405};
|
||||||
AWindow win2( _T("DnD starting in MTA"), threadIdMTA, pos2, true);
|
AWindow win2("DnD starting in MTA", threadIdMTA, pos2, true);
|
||||||
|
|
||||||
// win3 and win4 call initialize from an MTA but they are created in an STA
|
// win3 and win4 call initialize from an MTA but they are created in an STA
|
||||||
RECT pos3={300,0,600,200};
|
RECT pos3={300,0,600,200};
|
||||||
AWindow win3(_T("DnD starting in OLE STA"), threadIdMTA, pos3, false, true);
|
AWindow win3("DnD starting in OLE STA", threadIdMTA, pos3, false, true);
|
||||||
|
|
||||||
RECT pos4={ 300, 205, 600, 405};
|
RECT pos4={ 300, 205, 600, 405};
|
||||||
AWindow win24( _T("DnD starting in Ole MTA"), threadIdMTA, pos4, true, true);
|
AWindow win24("DnD starting in Ole MTA", threadIdMTA, pos4, true, true);
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
while( GetMessage(&msg, (HWND)NULL, 0, 0) )
|
while( GetMessageA(&msg, (HWND)NULL, 0, 0) )
|
||||||
{
|
{
|
||||||
TranslateMessage( &msg);
|
TranslateMessage( &msg);
|
||||||
DispatchMessage( &msg);
|
DispatchMessageA( &msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shut down the MTA thread
|
// Shut down the MTA thread
|
||||||
PostThreadMessage( threadIdMTA, WM_QUIT, 0, 0);
|
PostThreadMessageA( threadIdMTA, WM_QUIT, 0, 0);
|
||||||
WaitForSingleObject(hMTAThread, INFINITE);
|
WaitForSingleObject(hMTAThread, INFINITE);
|
||||||
CloseHandle(hMTAThread);
|
CloseHandle(hMTAThread);
|
||||||
|
|
||||||
@@ -124,13 +123,13 @@ DWORD WINAPI MTAFunc( void* threadData)
|
|||||||
ATLASSERT( FAILED(hr) );
|
ATLASSERT( FAILED(hr) );
|
||||||
MSG msg;
|
MSG msg;
|
||||||
// force the creation of a message queue
|
// force the creation of a message queue
|
||||||
PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
PeekMessageA(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
|
||||||
SetEvent( *(HANDLE*)threadData );
|
SetEvent( *(HANDLE*)threadData );
|
||||||
|
|
||||||
RECT pos={0, 406, 300, 605};
|
RECT pos={0, 406, 300, 605};
|
||||||
AWindow win(_T("DnD, full MTA"), GetCurrentThreadId(), pos, false, true);
|
AWindow win("DnD, full MTA", GetCurrentThreadId(), pos, false, true);
|
||||||
|
|
||||||
while( GetMessage(&msg, (HWND)NULL, 0, 0) )
|
while( GetMessageA(&msg, (HWND)NULL, 0, 0) )
|
||||||
{
|
{
|
||||||
switch( msg.message)
|
switch( msg.message)
|
||||||
{
|
{
|
||||||
@@ -168,7 +167,7 @@ DWORD WINAPI MTAFunc( void* threadData)
|
|||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
TranslateMessage( &msg);
|
TranslateMessage( &msg);
|
||||||
DispatchMessage( &msg);
|
DispatchMessageA( &msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
@@ -64,8 +64,8 @@ END_OBJECT_MAP()
|
|||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define X64_LIB_NAME "so_activex_x64.dll"
|
#define X64_LIB_NAME L"so_activex_x64.dll"
|
||||||
#define X32_LIB_NAME "so_activex.dll"
|
#define X32_LIB_NAME L"so_activex.dll"
|
||||||
|
|
||||||
// to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY
|
// to provide windows xp as build systems for mingw we need to define KEY_WOW64_64KEY
|
||||||
// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems.
|
// in mingw 3.13 KEY_WOW64_64KEY isn't available < Win2003 systems.
|
||||||
@@ -196,7 +196,7 @@ const char* const aLocalPrefix = "Software\\Classes\\";
|
|||||||
|
|
||||||
BOOL createKey( HKEY hkey,
|
BOOL createKey( HKEY hkey,
|
||||||
const char* aKeyToCreate,
|
const char* aKeyToCreate,
|
||||||
REGSAM nKeyAccess,
|
REGSAM nKeyAccess,
|
||||||
const char* aValue = nullptr,
|
const char* aValue = nullptr,
|
||||||
const char* aChildName = nullptr,
|
const char* aChildName = nullptr,
|
||||||
const char* aChildValue = nullptr )
|
const char* aChildValue = nullptr )
|
||||||
@@ -220,8 +220,34 @@ BOOL createKey( HKEY hkey,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL createKey( HKEY hkey,
|
||||||
|
const wchar_t* aKeyToCreate,
|
||||||
|
REGSAM nKeyAccess,
|
||||||
|
const wchar_t* aValue = nullptr,
|
||||||
|
const wchar_t* aChildName = nullptr,
|
||||||
|
const wchar_t* aChildValue = nullptr )
|
||||||
|
{
|
||||||
|
HKEY hkey1;
|
||||||
|
|
||||||
|
return ( ERROR_SUCCESS == RegCreateKeyExW( hkey, aKeyToCreate, 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey1 , nullptr )
|
||||||
|
&& ( !aValue || ERROR_SUCCESS == RegSetValueExW( hkey1,
|
||||||
|
L"",
|
||||||
|
0,
|
||||||
|
REG_SZ,
|
||||||
|
reinterpret_cast<const BYTE*>(aValue),
|
||||||
|
sal::static_int_cast<DWORD>(wcslen(aValue)*sizeof(wchar_t))))
|
||||||
|
&& ( !aChildName || ERROR_SUCCESS == RegSetValueExW( hkey1,
|
||||||
|
aChildName,
|
||||||
|
0,
|
||||||
|
REG_SZ,
|
||||||
|
reinterpret_cast<const BYTE*>(aChildValue),
|
||||||
|
sal::static_int_cast<DWORD>(wcslen(aChildValue)*sizeof(wchar_t))))
|
||||||
|
&& ERROR_SUCCESS == RegCloseKey( hkey1 ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit );
|
STDAPI DllUnregisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit );
|
||||||
STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess, const char* pProgramPath, const char* pLibName )
|
HRESULT DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAccess, const wchar_t* pProgramPath, const wchar_t* pLibName )
|
||||||
{
|
{
|
||||||
BOOL aResult = FALSE;
|
BOOL aResult = FALSE;
|
||||||
|
|
||||||
@@ -230,7 +256,7 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc
|
|||||||
HKEY hkey2 = nullptr;
|
HKEY hkey2 = nullptr;
|
||||||
HKEY hkey3 = nullptr;
|
HKEY hkey3 = nullptr;
|
||||||
HKEY hkey4 = nullptr;
|
HKEY hkey4 = nullptr;
|
||||||
char aSubKey[513];
|
char aSubKey[513];
|
||||||
int ind;
|
int ind;
|
||||||
const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix;
|
const char* aPrefix = aLocalPrefix; // bForAllUsers ? "" : aLocalPrefix;
|
||||||
|
|
||||||
@@ -241,13 +267,13 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc
|
|||||||
if ( bForAllUsers )
|
if ( bForAllUsers )
|
||||||
DllUnregisterServerNative( nMode, false, false );
|
DllUnregisterServerNative( nMode, false, false );
|
||||||
|
|
||||||
if ( pProgramPath && strlen( pProgramPath ) < 1024 )
|
if ( pProgramPath && wcslen( pProgramPath ) < 1024 )
|
||||||
{
|
{
|
||||||
char pActiveXPath[1124];
|
wchar_t pActiveXPath[1124];
|
||||||
char pActiveXPath101[1124];
|
wchar_t pActiveXPath101[1124];
|
||||||
|
|
||||||
sprintf( pActiveXPath, "%s\\%s", pProgramPath, pLibName );
|
swprintf( pActiveXPath, L"%s\\%s", pProgramPath, pLibName );
|
||||||
sprintf( pActiveXPath101, "%s\\%s, 101", pProgramPath, pLibName );
|
swprintf( pActiveXPath101, L"%s\\%s, 101", pProgramPath, pLibName );
|
||||||
|
|
||||||
{
|
{
|
||||||
wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID );
|
wsprintfA( aSubKey, "%sCLSID\\%s", aPrefix, aClassID );
|
||||||
@@ -256,12 +282,12 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc
|
|||||||
&& ERROR_SUCCESS == RegSetValueExA( hkey, "", 0, REG_SZ, reinterpret_cast<const BYTE*>("SOActiveX Class"), 17 )
|
&& ERROR_SUCCESS == RegSetValueExA( hkey, "", 0, REG_SZ, reinterpret_cast<const BYTE*>("SOActiveX Class"), 17 )
|
||||||
&& createKey( hkey, "Control", nKeyAccess )
|
&& createKey( hkey, "Control", nKeyAccess )
|
||||||
&& createKey( hkey, "EnableFullPage", nKeyAccess )
|
&& createKey( hkey, "EnableFullPage", nKeyAccess )
|
||||||
&& createKey( hkey, "InprocServer32", nKeyAccess, pActiveXPath, "ThreadingModel", "Apartment" )
|
&& createKey( hkey, L"InprocServer32", nKeyAccess, pActiveXPath, L"ThreadingModel", L"Apartment" )
|
||||||
&& createKey( hkey, "MiscStatus", nKeyAccess, "0" )
|
&& createKey( hkey, "MiscStatus", nKeyAccess, "0" )
|
||||||
&& createKey( hkey, "MiscStatus\\1", nKeyAccess, "131473" )
|
&& createKey( hkey, "MiscStatus\\1", nKeyAccess, "131473" )
|
||||||
&& createKey( hkey, "ProgID", nKeyAccess, "so_activex.SOActiveX.1" )
|
&& createKey( hkey, "ProgID", nKeyAccess, "so_activex.SOActiveX.1" )
|
||||||
&& createKey( hkey, "Programmable", nKeyAccess )
|
&& createKey( hkey, "Programmable", nKeyAccess )
|
||||||
&& createKey( hkey, "ToolboxBitmap32", nKeyAccess, pActiveXPath101 )
|
&& createKey( hkey, L"ToolboxBitmap32", nKeyAccess, pActiveXPath101 )
|
||||||
&& createKey( hkey, "TypeLib", nKeyAccess, aTypeLib )
|
&& createKey( hkey, "TypeLib", nKeyAccess, aTypeLib )
|
||||||
&& createKey( hkey, "Version", nKeyAccess, "1.0" )
|
&& createKey( hkey, "Version", nKeyAccess, "1.0" )
|
||||||
&& createKey( hkey, "VersionIndependentProgID", nKeyAccess, "so_activex.SOActiveX" )
|
&& createKey( hkey, "VersionIndependentProgID", nKeyAccess, "so_activex.SOActiveX" )
|
||||||
@@ -281,10 +307,10 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc
|
|||||||
&& createKey( hkey2, "1.0", nKeyAccess, "wrap_activex 1.0 Type Library" )
|
&& createKey( hkey2, "1.0", nKeyAccess, "wrap_activex 1.0 Type Library" )
|
||||||
&& ERROR_SUCCESS == RegCreateKeyExA( hkey2, "1.0", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey3 , nullptr )
|
&& ERROR_SUCCESS == RegCreateKeyExA( hkey2, "1.0", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey3 , nullptr )
|
||||||
&& ERROR_SUCCESS == RegCreateKeyExA( hkey3, "0", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey4 , nullptr )
|
&& ERROR_SUCCESS == RegCreateKeyExA( hkey3, "0", 0, nullptr, REG_OPTION_NON_VOLATILE, nKeyAccess, nullptr, &hkey4 , nullptr )
|
||||||
&& createKey( hkey4, "win32", nKeyAccess, pActiveXPath )
|
&& createKey( hkey4, L"win32", nKeyAccess, pActiveXPath )
|
||||||
&& ERROR_SUCCESS == RegCloseKey( hkey4 )
|
&& ERROR_SUCCESS == RegCloseKey( hkey4 )
|
||||||
&& createKey( hkey3, "FLAGS", nKeyAccess, "0" )
|
&& createKey( hkey3, "FLAGS", nKeyAccess, "0" )
|
||||||
&& createKey( hkey3, "HELPDIR", nKeyAccess, pProgramPath )
|
&& createKey( hkey3, L"HELPDIR", nKeyAccess, pProgramPath )
|
||||||
&& ERROR_SUCCESS == RegCloseKey( hkey3 )
|
&& ERROR_SUCCESS == RegCloseKey( hkey3 )
|
||||||
&& ERROR_SUCCESS == RegCloseKey( hkey2 )
|
&& ERROR_SUCCESS == RegCloseKey( hkey2 )
|
||||||
&& ERROR_SUCCESS == RegCloseKey( hkey1 )
|
&& ERROR_SUCCESS == RegCloseKey( hkey1 )
|
||||||
@@ -363,7 +389,7 @@ STDAPI DllRegisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAc
|
|||||||
return HRESULT(aResult);
|
return HRESULT(aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit, const char* pProgramPath )
|
STDAPI DllRegisterServerNative( int nMode, BOOL bForAllUsers, BOOL bFor64Bit, const wchar_t* pProgramPath )
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
if ( bFor64Bit )
|
if ( bFor64Bit )
|
||||||
@@ -418,10 +444,10 @@ STDAPI DllUnregisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKey
|
|||||||
fErr = TRUE;
|
fErr = TRUE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( ERROR_SUCCESS != RegDeleteValue( hkey, "CLSID" ) )
|
if ( ERROR_SUCCESS != RegDeleteValueA( hkey, "CLSID" ) )
|
||||||
fErr = TRUE;
|
fErr = TRUE;
|
||||||
|
|
||||||
if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, nullptr, nullptr, nullptr,
|
if ( ERROR_SUCCESS != RegQueryInfoKeyA( hkey, nullptr, nullptr, nullptr,
|
||||||
&nSubKeys, nullptr, nullptr,
|
&nSubKeys, nullptr, nullptr,
|
||||||
&nValues, nullptr, nullptr, nullptr, nullptr ) )
|
&nValues, nullptr, nullptr, nullptr, nullptr ) )
|
||||||
{
|
{
|
||||||
@@ -443,7 +469,7 @@ STDAPI DllUnregisterServerNative_Impl( int nMode, BOOL bForAllUsers, REGSAM nKey
|
|||||||
fErr = TRUE;
|
fErr = TRUE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, nullptr, nullptr, nullptr,
|
if ( ERROR_SUCCESS != RegQueryInfoKeyA( hkey, nullptr, nullptr, nullptr,
|
||||||
&nSubKeys, nullptr, nullptr,
|
&nSubKeys, nullptr, nullptr,
|
||||||
&nValues, nullptr, nullptr, nullptr, nullptr ) )
|
&nValues, nullptr, nullptr, nullptr, nullptr ) )
|
||||||
{
|
{
|
||||||
@@ -637,15 +663,15 @@ STDAPI DllUnregisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcc
|
|||||||
fErr = TRUE;
|
fErr = TRUE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( ERROR_SUCCESS != RegDeleteValue( hkey, "Extension" ) )
|
if ( ERROR_SUCCESS != RegDeleteValueA( hkey, "Extension" ) )
|
||||||
fErr = TRUE;
|
fErr = TRUE;
|
||||||
|
|
||||||
if ( ERROR_SUCCESS != RegDeleteValue( hkey, "CLSID" ) )
|
if ( ERROR_SUCCESS != RegDeleteValueA( hkey, "CLSID" ) )
|
||||||
fErr = TRUE;
|
fErr = TRUE;
|
||||||
|
|
||||||
if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, nullptr, nullptr, nullptr,
|
if ( ERROR_SUCCESS != RegQueryInfoKeyA( hkey, nullptr, nullptr, nullptr,
|
||||||
&nSubKeys, nullptr, nullptr,
|
&nSubKeys, nullptr, nullptr,
|
||||||
&nValues, nullptr, nullptr, nullptr, nullptr ) )
|
&nValues, nullptr, nullptr, nullptr, nullptr ) )
|
||||||
{
|
{
|
||||||
RegCloseKey( hkey );
|
RegCloseKey( hkey );
|
||||||
hkey = nullptr;
|
hkey = nullptr;
|
||||||
@@ -665,12 +691,12 @@ STDAPI DllUnregisterServerDoc_Impl( int nMode, BOOL bForAllUsers, REGSAM nKeyAcc
|
|||||||
fErr = TRUE;
|
fErr = TRUE;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( ERROR_SUCCESS != RegDeleteValue( hkey, "Content Type" ) )
|
if ( ERROR_SUCCESS != RegDeleteValueA( hkey, "Content Type" ) )
|
||||||
fErr = TRUE;
|
fErr = TRUE;
|
||||||
|
|
||||||
if ( ERROR_SUCCESS != RegQueryInfoKey( hkey, nullptr, nullptr, nullptr,
|
if ( ERROR_SUCCESS != RegQueryInfoKeyA( hkey, nullptr, nullptr, nullptr,
|
||||||
&nSubKeys, nullptr, nullptr,
|
&nSubKeys, nullptr, nullptr,
|
||||||
&nValues, nullptr, nullptr, nullptr, nullptr ) )
|
&nValues, nullptr, nullptr, nullptr, nullptr ) )
|
||||||
{
|
{
|
||||||
RegCloseKey( hkey );
|
RegCloseKey( hkey );
|
||||||
hkey = nullptr;
|
hkey = nullptr;
|
||||||
@@ -709,14 +735,14 @@ STDAPI DllRegisterServer()
|
|||||||
{
|
{
|
||||||
HRESULT aResult = E_FAIL;
|
HRESULT aResult = E_FAIL;
|
||||||
|
|
||||||
HMODULE aCurModule = GetModuleHandleA( bX64 ? X64_LIB_NAME : X32_LIB_NAME );
|
HMODULE aCurModule = GetModuleHandleW( bX64 ? X64_LIB_NAME : X32_LIB_NAME );
|
||||||
DWORD nLibNameLen = sal::static_int_cast<DWORD>(
|
DWORD nLibNameLen = sal::static_int_cast<DWORD>(
|
||||||
strlen((bX64) ? X64_LIB_NAME : X32_LIB_NAME));
|
wcslen((bX64) ? X64_LIB_NAME : X32_LIB_NAME));
|
||||||
|
|
||||||
if( aCurModule )
|
if( aCurModule )
|
||||||
{
|
{
|
||||||
char pProgramPath[1024];
|
wchar_t pProgramPath[1024];
|
||||||
DWORD nLen = GetModuleFileNameA( aCurModule, pProgramPath, 1024 );
|
DWORD nLen = GetModuleFileNameW( aCurModule, pProgramPath, 1024 );
|
||||||
if ( nLen && nLen > nLibNameLen + 1 )
|
if ( nLen && nLen > nLibNameLen + 1 )
|
||||||
{
|
{
|
||||||
pProgramPath[ nLen - nLibNameLen - 1 ] = 0;
|
pProgramPath[ nLen - nLibNameLen - 1 ] = 0;
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
#pragma warning (disable:4005)
|
#pragma warning (disable:4005)
|
||||||
#pragma warning (disable:4548)
|
#pragma warning (disable:4548)
|
||||||
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <dispex.h>
|
#include <dispex.h>
|
||||||
|
|
||||||
#include <prewin.h>
|
#include <prewin.h>
|
||||||
|
@@ -30,19 +30,14 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <wininet.h>
|
#include <wininet.h>
|
||||||
|
|
||||||
#ifdef UNICODE
|
|
||||||
#define _UNICODE
|
|
||||||
#endif
|
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
// #i71984
|
// #i71984
|
||||||
extern "C" bool SAL_CALL WNT_hasInternetConnection()
|
extern "C" bool SAL_CALL WNT_hasInternetConnection()
|
||||||
{
|
{
|
||||||
DWORD dwFlags;
|
DWORD dwFlags;
|
||||||
TCHAR szConnectionName[1024];
|
WCHAR szConnectionName[1024];
|
||||||
|
|
||||||
__try {
|
__try {
|
||||||
BOOL fIsConnected = InternetGetConnectedStateEx(
|
BOOL fIsConnected = InternetGetConnectedStateExW(
|
||||||
&dwFlags,
|
&dwFlags,
|
||||||
szConnectionName,
|
szConnectionName,
|
||||||
SAL_N_ELEMENTS(szConnectionName),
|
SAL_N_ELEMENTS(szConnectionName),
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
extern CComModule _Module;
|
extern CComModule _Module;
|
||||||
#include <atlcom.h>
|
#include <atlcom.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <tchar.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
//{{AFX_INSERT_LOCATION}}
|
//{{AFX_INSERT_LOCATION}}
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <comdef.h>
|
#include <comdef.h>
|
||||||
#include <tchar.h>
|
|
||||||
#include <atlbase.h>
|
#include <atlbase.h>
|
||||||
extern CComModule _Module;
|
extern CComModule _Module;
|
||||||
#include <atlcom.h>
|
#include <atlcom.h>
|
||||||
@@ -63,23 +62,23 @@ void printResultVariantArray( VARIANT & var);
|
|||||||
void printVariant( VARIANT & var);
|
void printVariant( VARIANT & var);
|
||||||
|
|
||||||
|
|
||||||
int SAL_CALL _tmain( int argc, _TCHAR * argv[] )
|
int SAL_CALL main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
if( FAILED( hr=CoInitialize(NULL)))
|
if( FAILED( hr=CoInitialize(NULL)))
|
||||||
{
|
{
|
||||||
_tprintf(_T("CoInitialize failed \n"));
|
printf("CoInitialize failed \n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_Module.Init( ObjectMap, GetModuleHandle( NULL));
|
_Module.Init( ObjectMap, GetModuleHandleA( NULL));
|
||||||
|
|
||||||
if( FAILED(hr=doTest()))
|
if( FAILED(hr=doTest()))
|
||||||
{
|
{
|
||||||
_com_error err( hr);
|
_com_error err( hr);
|
||||||
const TCHAR * errMsg= err.ErrorMessage();
|
const CHAR * errMsg= err.ErrorMessage();
|
||||||
MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
|
MessageBoxA( NULL, errMsg, "Test failed", MB_ICONERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -292,8 +291,8 @@ HRESULT doTest()
|
|||||||
V_DISPATCHREF(&varOutXInterface)= &dispOut.p;
|
V_DISPATCHREF(&varOutXInterface)= &dispOut.p;
|
||||||
|
|
||||||
// In Parameter ( all of type Sequence ###########################################################
|
// In Parameter ( all of type Sequence ###########################################################
|
||||||
OutputDebugString( _T("In parameter of type Sequence ###########################################\n"
|
OutputDebugStringA( "In parameter of type Sequence ###########################################\n"
|
||||||
"The functions return the Sequence parameter \n\n"));
|
"The functions return the Sequence parameter \n\n");
|
||||||
|
|
||||||
OutputDebugStringA("methodByte | Params: \n");
|
OutputDebugStringA("methodByte | Params: \n");
|
||||||
printVariant( varByteArray);
|
printVariant( varByteArray);
|
||||||
@@ -338,48 +337,48 @@ HRESULT doTest()
|
|||||||
printVariant( varRet);
|
printVariant( varRet);
|
||||||
|
|
||||||
// Out Parameter ###########################################################################
|
// Out Parameter ###########################################################################
|
||||||
OutputDebugString( _T("Out parameter ###########################################\n\n"));
|
OutputDebugStringA("Out parameter ###########################################\n\n");
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodByte \n"));
|
OutputDebugStringA("testout_methodByte \n");
|
||||||
hr= oletest.InvokeN(static_cast<LPCOLESTR>(L"testout_methodByte"), &varOutByte, 1, &varRet);
|
hr= oletest.InvokeN(static_cast<LPCOLESTR>(L"testout_methodByte"), &varOutByte, 1, &varRet);
|
||||||
OutputDebugString(_T("testout_methodByte | out value: \n"));
|
OutputDebugStringA("testout_methodByte | out value: \n");
|
||||||
printVariant( varOutByte);
|
printVariant( varOutByte);
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodShort \n"));
|
OutputDebugStringA("testout_methodShort \n");
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodShort"), &varOutShort, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodShort"), &varOutShort, &varRet);
|
||||||
OutputDebugString(_T("testout_methodShort | out value: \n"));
|
OutputDebugStringA("testout_methodShort | out value: \n");
|
||||||
printVariant( varOutShort);
|
printVariant( varOutShort);
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodLong \n"));
|
OutputDebugStringA("testout_methodLong \n");
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodLong"), &varOutLong, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodLong"), &varOutLong, &varRet);
|
||||||
OutputDebugString(_T("testout_methodLong | out value: \n"));
|
OutputDebugStringA("testout_methodLong | out value: \n");
|
||||||
printVariant( varOutLong);
|
printVariant( varOutLong);
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodDouble \n"));
|
OutputDebugStringA("testout_methodDouble \n");
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodDouble"), &varOutDouble, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodDouble"), &varOutDouble, &varRet);
|
||||||
OutputDebugString(_T("testout_methodDouble | out value: \n"));
|
OutputDebugStringA("testout_methodDouble | out value: \n");
|
||||||
printVariant( varOutDouble);
|
printVariant( varOutDouble);
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodString \n"));
|
OutputDebugStringA("testout_methodString \n");
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodString"), &varOutString, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodString"), &varOutString, &varRet);
|
||||||
OutputDebugString(_T("testout_methodString | out value: \n"));
|
OutputDebugStringA("testout_methodString | out value: \n");
|
||||||
printVariant( varOutString);
|
printVariant( varOutString);
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodAny \n"));
|
OutputDebugStringA("testout_methodAny \n");
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodAny"), &varOutAny, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodAny"), &varOutAny, &varRet);
|
||||||
OutputDebugString(_T("methodAny | out value: \n"));
|
OutputDebugStringA("methodAny | out value: \n");
|
||||||
printVariant( varOutAny);
|
printVariant( varOutAny);
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodXInterface \n"));
|
OutputDebugStringA("testout_methodXInterface \n");
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodXInterface"), &varOutXInterface, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testout_methodXInterface"), &varOutXInterface, &varRet);
|
||||||
OutputDebugString(_T("methodAny | out value: \n"));
|
OutputDebugStringA("methodAny | out value: \n");
|
||||||
printVariant( varOutXInterface);
|
printVariant( varOutXInterface);
|
||||||
CComDispatchDriver outDisp( *varOutXInterface.ppdispVal);
|
CComDispatchDriver outDisp( *varOutXInterface.ppdispVal);
|
||||||
CComVariant varAttr3;
|
CComVariant varAttr3;
|
||||||
outDisp.GetPropertyByName(L"AttrAny2", &varAttr3);
|
outDisp.GetPropertyByName(L"AttrAny2", &varAttr3);
|
||||||
ATLTRACE("property OleTest.AttrAny2: %s", W2T(varAttr3.bstrVal));
|
ATLTRACE("property OleTest.AttrAny2: %s", W2A(varAttr3.bstrVal));
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodMulParams1 ( 2 out Parameter) \n"));
|
OutputDebugStringA("testout_methodMulParams1 ( 2 out Parameter) \n");
|
||||||
long longOut2=0;
|
long longOut2=0;
|
||||||
CComVariant _params[2];
|
CComVariant _params[2];
|
||||||
longOut=0;
|
longOut=0;
|
||||||
@@ -387,72 +386,72 @@ HRESULT doTest()
|
|||||||
_params[1].vt= VT_BYREF | VT_I4;
|
_params[1].vt= VT_BYREF | VT_I4;
|
||||||
V_I4REF(& _params[1])= &longOut2;
|
V_I4REF(& _params[1])= &longOut2;
|
||||||
hr= oletest.InvokeN( static_cast<LPCOLESTR>(L"testout_methodMulParams1"), (VARIANT*)&_params, 2);
|
hr= oletest.InvokeN( static_cast<LPCOLESTR>(L"testout_methodMulParams1"), (VARIANT*)&_params, 2);
|
||||||
OutputDebugString(_T("testout_methodMulParams1 | out values: \n"));
|
OutputDebugStringA("testout_methodMulParams1 | out values: \n");
|
||||||
printVariant( _params[1]);
|
printVariant( _params[1]);
|
||||||
printVariant( _params[0]);
|
printVariant( _params[0]);
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodMulParams2 ( 3 out Parameter) \n"));
|
OutputDebugStringA("testout_methodMulParams2 ( 3 out Parameter) \n");
|
||||||
CComVariant _params2[3];
|
CComVariant _params2[3];
|
||||||
_params2[2]= varOutLong;
|
_params2[2]= varOutLong;
|
||||||
_params2[1].vt= VT_BYREF | VT_I4;
|
_params2[1].vt= VT_BYREF | VT_I4;
|
||||||
V_I4REF(& _params2[1])= &longOut2;
|
V_I4REF(& _params2[1])= &longOut2;
|
||||||
_params2[0]= varOutString;
|
_params2[0]= varOutString;
|
||||||
hr= oletest.InvokeN( static_cast<LPCOLESTR>( L"testout_methodMulParams2"), (VARIANT*)&_params2, 3);
|
hr= oletest.InvokeN( static_cast<LPCOLESTR>( L"testout_methodMulParams2"), (VARIANT*)&_params2, 3);
|
||||||
OutputDebugString(_T("testout_methodMulParams2 | out values: \n"));
|
OutputDebugStringA("testout_methodMulParams2 | out values: \n");
|
||||||
printVariant( _params2[2]);
|
printVariant( _params2[2]);
|
||||||
printVariant( _params2[1]);
|
printVariant( _params2[1]);
|
||||||
printVariant( _params2[0]);
|
printVariant( _params2[0]);
|
||||||
|
|
||||||
OutputDebugString(_T("testout_methodMulParams3 ( 1 in and 1 out Parameter) \n"));
|
OutputDebugStringA("testout_methodMulParams3 ( 1 in and 1 out Parameter) \n");
|
||||||
CComVariant _params3[2];
|
CComVariant _params3[2];
|
||||||
_params3[1]= CComBSTR(L" In string");
|
_params3[1]= CComBSTR(L" In string");
|
||||||
_params3[0]= varOutString;
|
_params3[0]= varOutString;
|
||||||
hr= oletest.InvokeN( static_cast<LPCOLESTR>( L"testout_methodMulParams3"), (VARIANT*)&_params3, 2);
|
hr= oletest.InvokeN( static_cast<LPCOLESTR>( L"testout_methodMulParams3"), (VARIANT*)&_params3, 2);
|
||||||
OutputDebugString(_T("testout_methodMulParams3 | out values: \n"));
|
OutputDebugStringA("testout_methodMulParams3 | out values: \n");
|
||||||
printVariant( _params3[1]);
|
printVariant( _params3[1]);
|
||||||
printVariant( _params3[0]);
|
printVariant( _params3[0]);
|
||||||
|
|
||||||
//In Out Parameter ###########################################################################
|
//In Out Parameter ###########################################################################
|
||||||
OutputDebugString( _T("In Out parameter ###########################################\n\n"));
|
OutputDebugStringA("In Out parameter ###########################################\n\n");
|
||||||
|
|
||||||
*V_I1REF(&varOutByte)= 5;
|
*V_I1REF(&varOutByte)= 5;
|
||||||
ATLTRACE(_T("testinout_methodByte | in value: %d \n"), *V_I1REF(&varOutByte));
|
ATLTRACE("testinout_methodByte | in value: %d \n", *V_I1REF(&varOutByte));
|
||||||
hr= oletest.InvokeN(static_cast<LPCOLESTR>(L"testinout_methodByte"), &varOutByte, 1, &varRet);
|
hr= oletest.InvokeN(static_cast<LPCOLESTR>(L"testinout_methodByte"), &varOutByte, 1, &varRet);
|
||||||
OutputDebugString(_T("testinout_methodByte | out value: \n"));
|
OutputDebugStringA("testinout_methodByte | out value: \n");
|
||||||
printVariant( varOutByte);
|
printVariant( varOutByte);
|
||||||
|
|
||||||
OutputDebugString(_T("testinout_methodShort | in value= 1000 \n"));
|
OutputDebugStringA("testinout_methodShort | in value= 1000 \n");
|
||||||
*V_UI2REF(&varOutShort)= 1000;
|
*V_UI2REF(&varOutShort)= 1000;
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodShort"), &varOutShort, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodShort"), &varOutShort, &varRet);
|
||||||
OutputDebugString(_T("testinout_methodShort | out value: \n"));
|
OutputDebugStringA("testinout_methodShort | out value: \n");
|
||||||
printVariant( varOutShort);
|
printVariant( varOutShort);
|
||||||
|
|
||||||
OutputDebugString(_T("testinout_methodLong | in value= 10000 \n"));
|
OutputDebugStringA("testinout_methodLong | in value= 10000 \n");
|
||||||
*V_UI4REF(&varOutLong)= 10000;
|
*V_UI4REF(&varOutLong)= 10000;
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodLong"), &varOutLong, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodLong"), &varOutLong, &varRet);
|
||||||
OutputDebugString(_T("testinout_methodLong | out value: \n"));
|
OutputDebugStringA("testinout_methodLong | out value: \n");
|
||||||
printVariant( varOutLong);
|
printVariant( varOutLong);
|
||||||
|
|
||||||
*V_R8REF(&varOutDouble)= 3.14;
|
*V_R8REF(&varOutDouble)= 3.14;
|
||||||
ATLTRACE(_T("testinou_methodDouble in value: %f \n"),*V_R8REF(&varOutDouble));
|
ATLTRACE("testinou_methodDouble in value: %f \n",*V_R8REF(&varOutDouble));
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodDouble"), &varOutDouble, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodDouble"), &varOutDouble, &varRet);
|
||||||
OutputDebugString(_T("testinout_methodDouble | out value: \n"));
|
OutputDebugStringA("testinout_methodDouble | out value: \n");
|
||||||
printVariant( varOutDouble);
|
printVariant( varOutDouble);
|
||||||
|
|
||||||
SysFreeString( *V_BSTRREF(&varOutString));
|
SysFreeString( *V_BSTRREF(&varOutString));
|
||||||
*V_BSTRREF(&varOutString)= SysAllocString( L"this is a in string");
|
*V_BSTRREF(&varOutString)= SysAllocString( L"this is a in string");
|
||||||
ATLTRACE(_T("testinout_methodString | value: %s \n"), W2T(*V_BSTRREF(&varOutString)));
|
ATLTRACE("testinout_methodString | value: %s \n", W2A(*V_BSTRREF(&varOutString)));
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodString"), &varOutString, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodString"), &varOutString, &varRet);
|
||||||
OutputDebugString(_T("testinout_methodString | out value: \n"));
|
OutputDebugStringA("testinout_methodString | out value: \n");
|
||||||
printVariant( varOutString);
|
printVariant( varOutString);
|
||||||
|
|
||||||
CComVariant var1(CComBSTR(L" this is a string in a VARIANT"));
|
CComVariant var1(CComBSTR(L" this is a string in a VARIANT"));
|
||||||
CComVariant outVar1;
|
CComVariant outVar1;
|
||||||
outVar1.vt= VT_BYREF | VT_VARIANT;
|
outVar1.vt= VT_BYREF | VT_VARIANT;
|
||||||
outVar1.pvarVal= &var1;
|
outVar1.pvarVal= &var1;
|
||||||
ATLTRACE(_T("testinout_methodAny | parameter: %s\n"), W2T(var1.bstrVal));
|
ATLTRACE("testinout_methodAny | parameter: %s\n", W2A(var1.bstrVal));
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodAny"), &varOutAny, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodAny"), &varOutAny, &varRet);
|
||||||
OutputDebugString(_T("testinout_methodAny | out value: \n"));
|
OutputDebugStringA("testinout_methodAny | out value: \n");
|
||||||
printVariant( varOutAny);
|
printVariant( varOutAny);
|
||||||
|
|
||||||
CComPtr< IUnknown > objectIn = unk1;
|
CComPtr< IUnknown > objectIn = unk1;
|
||||||
@@ -460,22 +459,22 @@ HRESULT doTest()
|
|||||||
varOutIFace.vt= VT_BYREF | VT_UNKNOWN;
|
varOutIFace.vt= VT_BYREF | VT_UNKNOWN;
|
||||||
varOutIFace.ppunkVal= &objectIn.p;
|
varOutIFace.ppunkVal= &objectIn.p;
|
||||||
(*varOutIFace.ppunkVal)->AddRef();
|
(*varOutIFace.ppunkVal)->AddRef();
|
||||||
OutputDebugString(_T("testinout_methodXInterface | in value: \n"));
|
OutputDebugStringA("testinout_methodXInterface | in value: \n");
|
||||||
printVariant(varOutIFace);
|
printVariant(varOutIFace);
|
||||||
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodXInterface"), &varOutIFace, &varRet);
|
hr= oletest.Invoke1(static_cast<LPCOLESTR>(L"testinout_methodXInterface"), &varOutIFace, &varRet);
|
||||||
OutputDebugString(_T("testinout_methodXInterface | out value: \n"));
|
OutputDebugStringA("testinout_methodXInterface | out value: \n");
|
||||||
printVariant( varOutIFace);
|
printVariant( varOutIFace);
|
||||||
|
|
||||||
// Properties ######################################################################
|
// Properties ######################################################################
|
||||||
OutputDebugString( _T(" Properties ###########################################\n\n"));
|
OutputDebugStringA(" Properties ###########################################\n\n");
|
||||||
|
|
||||||
OutputDebugString(_T("set property \"AttrByte\" | value"));
|
OutputDebugStringA("set property \"AttrByte\" | value");
|
||||||
//CComVariant propArByte;
|
//CComVariant propArByte;
|
||||||
//propArByte.vt= VT_ARRAY | VT_I1;
|
//propArByte.vt= VT_ARRAY | VT_I1;
|
||||||
varParam1.parray= (SAFEARRAY*)arByte;
|
varParam1.parray= (SAFEARRAY*)arByte;
|
||||||
printVariant( varParam1);
|
printVariant( varParam1);
|
||||||
hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varParam1);
|
hr= oletest.PutPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varParam1);
|
||||||
OutputDebugString(_T("get property \"AttrByte\" | value:"));
|
OutputDebugStringA("get property \"AttrByte\" | value:");
|
||||||
varRet.Clear();
|
varRet.Clear();
|
||||||
hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varRet);
|
hr= oletest.GetPropertyByName( static_cast<LPCOLESTR>(L"AttrByte"), &varRet);
|
||||||
printVariant( varRet);
|
printVariant( varRet);
|
||||||
@@ -509,13 +508,13 @@ void printVariant( VARIANT & _var)
|
|||||||
double doubleValue;
|
double doubleValue;
|
||||||
IUnknown* unkValue;
|
IUnknown* unkValue;
|
||||||
BSTR bstrValue;
|
BSTR bstrValue;
|
||||||
OutputDebugString( _T("# Array \n"));
|
OutputDebugStringA("# Array \n");
|
||||||
for( long i= 0; i < count; i++)
|
for( long i= 0; i < count; i++)
|
||||||
{
|
{
|
||||||
// CComVariant variantValue;
|
// CComVariant variantValue;
|
||||||
TCHAR *buf[256];
|
CHAR buf[256];
|
||||||
wsprintf( (TCHAR*)buf, _T("%d : "), i);
|
wsprintfA( buf, "%d : ", i);
|
||||||
OutputDebugString( (TCHAR*)buf);
|
OutputDebugStringA( buf);
|
||||||
VARIANT varTemp;
|
VARIANT varTemp;
|
||||||
VariantInit( &varTemp);
|
VariantInit( &varTemp);
|
||||||
VARIANT variantValue;
|
VARIANT variantValue;
|
||||||
@@ -580,17 +579,17 @@ void printVariant( VARIANT & _var)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TCHAR buf[256];
|
CHAR buf[256];
|
||||||
switch (var.vt)
|
switch (var.vt)
|
||||||
{
|
{
|
||||||
case VT_I1: wsprintf( (TCHAR*)buf, _T(" VT_I1: %d \n"), V_I1( &var) );
|
case VT_I1: wsprintfA( buf, " VT_I1: %d \n", V_I1( &var) );
|
||||||
break;
|
break;
|
||||||
case VT_UI1: wsprintf( (TCHAR*)buf, _T(" VT_UI1: %d \n"), V_I1( &var) );
|
case VT_UI1: wsprintfA( buf, " VT_UI1: %d \n", V_I1( &var) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VT_I2: wsprintf( (TCHAR*)buf, _T(" VT_I2: %d \n"), V_I2( &var) );
|
case VT_I2: wsprintfA( buf, " VT_I2: %d \n", V_I2( &var) );
|
||||||
break;
|
break;
|
||||||
case VT_I4: wsprintf( (TCHAR*)buf, _T(" VT_I4: %d \n"), V_I4( &var) );
|
case VT_I4: wsprintfA( buf, " VT_I4: %d \n", V_I4( &var) );
|
||||||
break;
|
break;
|
||||||
case VT_R8:
|
case VT_R8:
|
||||||
{
|
{
|
||||||
@@ -601,7 +600,7 @@ void printVariant( VARIANT & _var)
|
|||||||
// double source = 3.1415926535;
|
// double source = 3.1415926535;
|
||||||
|
|
||||||
// buffer = _ecvt( V_R8(&var), precision, &decimal, &sign );
|
// buffer = _ecvt( V_R8(&var), precision, &decimal, &sign );
|
||||||
sprintf( (TCHAR*)buf, _T(" VT_R8: %f \n"),V_R8( &var) );
|
sprintf( buf, " VT_R8: %f \n",V_R8( &var) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VT_UNKNOWN:
|
case VT_UNKNOWN:
|
||||||
@@ -610,7 +609,7 @@ void printVariant( VARIANT & _var)
|
|||||||
CComDispatchDriver disp( var.punkVal);
|
CComDispatchDriver disp( var.punkVal);
|
||||||
CComVariant ret;
|
CComVariant ret;
|
||||||
hr= disp.GetPropertyByName( static_cast<LPCOLESTR>(L"Name"), &ret);
|
hr= disp.GetPropertyByName( static_cast<LPCOLESTR>(L"Name"), &ret);
|
||||||
wsprintf( (TCHAR*)buf, _T(" VT_UNKNOWN: property \"Name\": %s \n"), W2T(ret.bstrVal));
|
wsprintfA( buf, " VT_UNKNOWN: property \"Name\": %s \n", W2A(ret.bstrVal));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VT_DISPATCH:
|
case VT_DISPATCH:
|
||||||
@@ -619,9 +618,9 @@ void printVariant( VARIANT & _var)
|
|||||||
CComDispatchDriver disp( var.punkVal);
|
CComDispatchDriver disp( var.punkVal);
|
||||||
CComVariant ret;
|
CComVariant ret;
|
||||||
if( SUCCEEDED( hr= disp.GetPropertyByName( static_cast<LPCOLESTR>(L"Name"), &ret)))
|
if( SUCCEEDED( hr= disp.GetPropertyByName( static_cast<LPCOLESTR>(L"Name"), &ret)))
|
||||||
wsprintf( (TCHAR*)buf, _T(" VT_DISPATCH: property \"Name\": %s \n"), W2T(ret.bstrVal));
|
wsprintfA( buf, " VT_DISPATCH: property \"Name\": %s \n", W2A(ret.bstrVal));
|
||||||
else
|
else
|
||||||
wsprintf( (TCHAR*)buf, _T(" VT_DISPATCH \n"));
|
wsprintfA( buf, " VT_DISPATCH \n");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -629,16 +628,16 @@ void printVariant( VARIANT & _var)
|
|||||||
|
|
||||||
case VT_BSTR:
|
case VT_BSTR:
|
||||||
{
|
{
|
||||||
TCHAR* str= W2T( var.bstrVal);
|
CHAR* str= W2A( var.bstrVal);
|
||||||
wsprintf( (TCHAR*)buf, _T(" VT_BSTR: %s \n"), str);
|
wsprintfA( buf, " VT_BSTR: %s \n", str);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wsprintf( (TCHAR*)buf, _T("\n"));
|
wsprintfA( buf, "\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputDebugString( (TCHAR*) buf);
|
OutputDebugStringA( buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <comdef.h>
|
#include <comdef.h>
|
||||||
#include <tchar.h>
|
|
||||||
#include <atlbase.h>
|
#include <atlbase.h>
|
||||||
#include <atlcom.h>
|
#include <atlcom.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -49,12 +48,12 @@ bool incrementMultidimensionalIndex(
|
|||||||
const sal_Int32 * parDimensionLengths,
|
const sal_Int32 * parDimensionLengths,
|
||||||
sal_Int32 * parMultidimensionalIndex);
|
sal_Int32 * parMultidimensionalIndex);
|
||||||
|
|
||||||
int SAL_CALL _tmain( int /*argc*/, _TCHAR * /*argv[]*/ )
|
int SAL_CALL main( int /*argc*/, char** /*argv*/ )
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
if( FAILED( hr=CoInitialize(NULL)))
|
if( FAILED( hr=CoInitialize(NULL)))
|
||||||
{
|
{
|
||||||
_tprintf(_T("CoInitialize failed \n"));
|
printf("CoInitialize failed \n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,8 +61,8 @@ int SAL_CALL _tmain( int /*argc*/, _TCHAR * /*argv[]*/ )
|
|||||||
if( FAILED(hr=doTest()))
|
if( FAILED(hr=doTest()))
|
||||||
{
|
{
|
||||||
_com_error err( hr);
|
_com_error err( hr);
|
||||||
const TCHAR * errMsg= err.ErrorMessage();
|
const CHAR * errMsg= err.ErrorMessage();
|
||||||
MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
|
MessageBoxA( NULL, errMsg, "Test failed", MB_ICONERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#pragma warning(disable: 4917)
|
#pragma warning(disable: 4917)
|
||||||
#include <comdef.h>
|
#include <comdef.h>
|
||||||
#include <tchar.h>
|
|
||||||
#include <atlbase.h>
|
#include <atlbase.h>
|
||||||
#include <atlcom.h>
|
#include <atlcom.h>
|
||||||
|
|
||||||
@@ -36,15 +35,15 @@ int main(int /*argc*/, char** /*argv*/)
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
if( FAILED( hr=CoInitialize(NULL)))
|
if( FAILED( hr=CoInitialize(NULL)))
|
||||||
{
|
{
|
||||||
_tprintf(_T("CoInitialize failed \n"));
|
printf("CoInitialize failed \n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FAILED(hr=doTest()))
|
if( FAILED(hr=doTest()))
|
||||||
{
|
{
|
||||||
_com_error err( hr);
|
_com_error err( hr);
|
||||||
const TCHAR * errMsg= err.ErrorMessage();
|
const CHAR * errMsg= err.ErrorMessage();
|
||||||
MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
|
MessageBoxA( NULL, errMsg, "Test failed", MB_ICONERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
@@ -33,7 +33,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <comdef.h>
|
#include <comdef.h>
|
||||||
#include <tchar.h>
|
|
||||||
#include <atlbase.h>
|
#include <atlbase.h>
|
||||||
extern CComModule _Module;
|
extern CComModule _Module;
|
||||||
#include <atlcom.h>
|
#include <atlcom.h>
|
||||||
|
@@ -39,7 +39,6 @@
|
|||||||
//something, but do not change the name of _Module
|
//something, but do not change the name of _Module
|
||||||
extern CComModule _Module;
|
extern CComModule _Module;
|
||||||
#include <atlcom.h>
|
#include <atlcom.h>
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
//{{AFX_INSERT_LOCATION}}
|
//{{AFX_INSERT_LOCATION}}
|
||||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
@@ -20,29 +20,9 @@
|
|||||||
#ifndef INCLUDED_SYSTOOLS_WIN32_QSWIN32_H
|
#ifndef INCLUDED_SYSTOOLS_WIN32_QSWIN32_H
|
||||||
#define INCLUDED_SYSTOOLS_WIN32_QSWIN32_H
|
#define INCLUDED_SYSTOOLS_WIN32_QSWIN32_H
|
||||||
|
|
||||||
#define QUICKSTART_CLASSNAMEA "LO Listener Class"
|
#define QUICKSTART_CLASSNAME L"LO Listener Class"
|
||||||
#define QUICKSTART_WINDOWNAMEA "LO Listener Window"
|
#define QUICKSTART_WINDOWNAME L"LO Listener Window"
|
||||||
#define SHUTDOWN_QUICKSTART_MESSAGEA "LO KillTray"
|
#define SHUTDOWN_QUICKSTART_MESSAGE L"LO KillTray"
|
||||||
|
|
||||||
#define QUICKSTART_CLASSNAMEW L##QUICKSTART_CLASSNAMEA
|
|
||||||
#define QUICKSTART_WINDOWNAMEW L##QUICKSTART_WINDOWNAMEA
|
|
||||||
#define SHUTDOWN_QUICKSTART_MESSAGEW L##SHUTDOWN_QUICKSTART_MESSAGEA
|
|
||||||
|
|
||||||
#ifdef UNICODE
|
|
||||||
# define QUICKSTART_CLASSNAME QUICKSTART_CLASSNAMEW
|
|
||||||
# define QUICKSTART_WINDOWNAME QUICKSTART_WINDOWNAMEW
|
|
||||||
# define SHUTDOWN_QUICKSTART_MESSAGE SHUTDOWN_QUICKSTART_MESSAGEW
|
|
||||||
# ifndef FindWindow
|
|
||||||
# define FindWindow FindWindowW
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define QUICKSTART_CLASSNAME QUICKSTART_CLASSNAMEA
|
|
||||||
# define QUICKSTART_WINDOWNAME QUICKSTART_WINDOWNAMEA
|
|
||||||
# define SHUTDOWN_QUICKSTART_MESSAGE SHUTDOWN_QUICKSTART_MESSAGEA
|
|
||||||
# ifndef FindWindow
|
|
||||||
# define FindWindow FindWindowA
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // INCLUDED_SYSTOOLS_WIN32_QSWIN32_H
|
#endif // INCLUDED_SYSTOOLS_WIN32_QSWIN32_H
|
||||||
|
|
||||||
|
@@ -83,7 +83,6 @@ const sal_Char pBuffer_Blank[] = "";
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) // Windows
|
#if defined(_WIN32) // Windows
|
||||||
# include <tchar.h>
|
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
# define PATH_MAX MAX_PATH
|
# define PATH_MAX MAX_PATH
|
||||||
# define TEST_PLATFORM "c:/"
|
# define TEST_PLATFORM "c:/"
|
||||||
|
@@ -43,13 +43,7 @@
|
|||||||
#define RUNNING_ON_VALGRIND false
|
#define RUNNING_ON_VALGRIND false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) // Windows
|
#if !defined(_WIN32) // Windows
|
||||||
#if !defined WIN32_LEAN_AND_MEAN
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
# include <windows.h>
|
|
||||||
# include <tchar.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -18,11 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(_WIN32) // Windows
|
#if defined(_WIN32) // Windows
|
||||||
# define UNICODE
|
|
||||||
# define _UNICODE
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <tchar.h>
|
|
||||||
#else
|
#else
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -55,28 +52,26 @@ void wait_for_seconds(char* time)
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
void w_to_a(LPCTSTR _strW, LPSTR strA, DWORD size)
|
void w_to_a(LPCWSTR strW, LPSTR strA, DWORD size)
|
||||||
{
|
{
|
||||||
LPCWSTR strW = reinterpret_cast<LPCWSTR>(_strW);
|
|
||||||
WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, size, nullptr, nullptr);
|
WideCharToMultiByte(CP_ACP, 0, strW, -1, strA, size, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_env(char* file_path)
|
void dump_env(char* file_path)
|
||||||
{
|
{
|
||||||
LPTSTR env = reinterpret_cast<LPTSTR>(
|
LPWSTR env = GetEnvironmentStringsW();
|
||||||
GetEnvironmentStrings());
|
LPWSTR p = env;
|
||||||
LPTSTR p = env;
|
|
||||||
|
|
||||||
std::ofstream file(file_path);
|
std::ofstream file(file_path);
|
||||||
|
|
||||||
char buffer[32767];
|
char buffer[32767];
|
||||||
while (size_t l = _tcslen(reinterpret_cast<wchar_t*>(p)))
|
while (size_t l = wcslen(p))
|
||||||
{
|
{
|
||||||
w_to_a(p, buffer, sizeof(buffer));
|
w_to_a(p, buffer, sizeof(buffer));
|
||||||
file << buffer << '\0';
|
file << buffer << '\0';
|
||||||
p += l + 1;
|
p += l + 1;
|
||||||
}
|
}
|
||||||
FreeEnvironmentStrings(env);
|
FreeEnvironmentStringsW(env);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void dump_env(char* file_path)
|
void dump_env(char* file_path)
|
||||||
|
@@ -24,11 +24,11 @@
|
|||||||
static BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM lParam )
|
static BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM lParam )
|
||||||
{
|
{
|
||||||
MSIHANDLE hMSI = static_cast< MSIHANDLE >( lParam );
|
MSIHANDLE hMSI = static_cast< MSIHANDLE >( lParam );
|
||||||
CHAR szClassName[sizeof(QUICKSTART_CLASSNAMEA) + 1];
|
WCHAR szClassName[sizeof(QUICKSTART_CLASSNAME)/sizeof(WCHAR) + 1];
|
||||||
|
|
||||||
int nCharsCopied = GetClassNameA( hWnd, szClassName, sizeof( szClassName ) );
|
int nCharsCopied = GetClassNameW( hWnd, szClassName, sizeof(szClassName)/sizeof(szClassName[0]) );
|
||||||
|
|
||||||
if ( nCharsCopied && !_stricmp( QUICKSTART_CLASSNAMEA, szClassName ) )
|
if ( nCharsCopied && !_wcsicmp( QUICKSTART_CLASSNAME, szClassName ) )
|
||||||
{
|
{
|
||||||
DWORD dwProcessId;
|
DWORD dwProcessId;
|
||||||
|
|
||||||
@@ -39,10 +39,10 @@ static BOOL CALLBACK EnumWindowsProc( HWND hWnd, LPARAM lParam )
|
|||||||
|
|
||||||
if ( !_wcsnicmp( sImagePath.c_str(), sOfficeImageDir.c_str(), sOfficeImageDir.length() ) )
|
if ( !_wcsnicmp( sImagePath.c_str(), sOfficeImageDir.c_str(), sOfficeImageDir.length() ) )
|
||||||
{
|
{
|
||||||
UINT uMsgShutdownQuickstart = RegisterWindowMessageA( SHUTDOWN_QUICKSTART_MESSAGEA );
|
UINT uMsgShutdownQuickstart = RegisterWindowMessageW( SHUTDOWN_QUICKSTART_MESSAGE );
|
||||||
|
|
||||||
if ( uMsgShutdownQuickstart )
|
if ( uMsgShutdownQuickstart )
|
||||||
SendMessageA( hWnd, uMsgShutdownQuickstart, 0, 0 );
|
SendMessageW( hWnd, uMsgShutdownQuickstart, 0, 0 );
|
||||||
|
|
||||||
|
|
||||||
HANDLE hProcess = OpenProcess( SYNCHRONIZE, FALSE, dwProcessId );
|
HANDLE hProcess = OpenProcess( SYNCHRONIZE, FALSE, dwProcessId );
|
||||||
|
@@ -17,8 +17,6 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push, 1) /* disable warnings within system headers */
|
#pragma warning(push, 1) /* disable warnings within system headers */
|
||||||
#endif
|
#endif
|
||||||
@@ -41,7 +39,7 @@
|
|||||||
#define WRITER_COMPONENT 16
|
#define WRITER_COMPONENT 16
|
||||||
#define MATH_COMPONENT 32
|
#define MATH_COMPONENT 32
|
||||||
|
|
||||||
typedef int ( __stdcall * DllNativeRegProc ) ( int, BOOL, BOOL, const char* );
|
typedef int ( __stdcall * DllNativeRegProc ) ( int, BOOL, BOOL, const wchar_t* );
|
||||||
typedef int ( __stdcall * DllNativeUnregProc ) ( int, BOOL, BOOL );
|
typedef int ( __stdcall * DllNativeUnregProc ) ( int, BOOL, BOOL );
|
||||||
|
|
||||||
BOOL UnicodeEquals( wchar_t const * pStr1, wchar_t const * pStr2 )
|
BOOL UnicodeEquals( wchar_t const * pStr1, wchar_t const * pStr2 )
|
||||||
@@ -61,34 +59,20 @@ BOOL UnicodeEquals( wchar_t const * pStr1, wchar_t const * pStr2 )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char* UnicodeToAnsiString( wchar_t const * pUniString )
|
void RegisterActiveXNative( const wchar_t* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit )
|
||||||
{
|
{
|
||||||
int len = WideCharToMultiByte(
|
HINSTANCE hModule = LoadLibraryExW( pActiveXPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||||
CP_ACP, 0, pUniString, -1, nullptr, 0, nullptr, nullptr );
|
|
||||||
|
|
||||||
char* buff = static_cast<char*>( malloc( len ) );
|
|
||||||
|
|
||||||
WideCharToMultiByte(
|
|
||||||
CP_ACP, 0, pUniString, -1, buff, len, nullptr, nullptr );
|
|
||||||
|
|
||||||
return buff;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit )
|
|
||||||
{
|
|
||||||
HINSTANCE hModule = LoadLibraryExA( pActiveXPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH );
|
|
||||||
if( hModule )
|
if( hModule )
|
||||||
{
|
{
|
||||||
DllNativeRegProc pNativeProc = reinterpret_cast<DllNativeRegProc>(GetProcAddress( hModule, "DllRegisterServerNative" ));
|
DllNativeRegProc pNativeProc = reinterpret_cast<DllNativeRegProc>(GetProcAddress( hModule, "DllRegisterServerNative" ));
|
||||||
if( pNativeProc!=nullptr )
|
if( pNativeProc!=nullptr )
|
||||||
{
|
{
|
||||||
int nLen = strlen( pActiveXPath );
|
int nLen = wcslen( pActiveXPath );
|
||||||
int nRemoveLen = strlen( "\\so_activex.dll" );
|
int nRemoveLen = strlen( "\\so_activex.dll" );
|
||||||
if ( nLen > nRemoveLen )
|
if ( nLen > nRemoveLen )
|
||||||
{
|
{
|
||||||
char* pProgramPath = static_cast<char*>( malloc( nLen - nRemoveLen + 1 ) );
|
wchar_t* pProgramPath = static_cast<wchar_t*>( malloc( (nLen - nRemoveLen + 1) * sizeof(wchar_t) ) );
|
||||||
strncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen );
|
wcsncpy( pProgramPath, pActiveXPath, nLen - nRemoveLen );
|
||||||
pProgramPath[ nLen - nRemoveLen ] = 0;
|
pProgramPath[ nLen - nRemoveLen ] = 0;
|
||||||
|
|
||||||
( *pNativeProc )( nMode, InstallForAllUser, InstallFor64Bit, pProgramPath );
|
( *pNativeProc )( nMode, InstallForAllUser, InstallFor64Bit, pProgramPath );
|
||||||
@@ -102,9 +86,9 @@ void RegisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallFor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UnregisterActiveXNative( const char* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit )
|
void UnregisterActiveXNative( const wchar_t* pActiveXPath, int nMode, BOOL InstallForAllUser, BOOL InstallFor64Bit )
|
||||||
{
|
{
|
||||||
HINSTANCE hModule = LoadLibraryExA( pActiveXPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH );
|
HINSTANCE hModule = LoadLibraryExW( pActiveXPath, nullptr, LOAD_WITH_ALTERED_SEARCH_PATH );
|
||||||
if( hModule )
|
if( hModule )
|
||||||
{
|
{
|
||||||
DllNativeUnregProc pNativeProc = reinterpret_cast<DllNativeUnregProc>(GetProcAddress( hModule, "DllUnregisterServerNative" ));
|
DllNativeUnregProc pNativeProc = reinterpret_cast<DllNativeUnregProc>(GetProcAddress( hModule, "DllUnregisterServerNative" ));
|
||||||
@@ -135,27 +119,20 @@ BOOL GetMsiPropW( MSIHANDLE hMSI, const wchar_t* pPropName, wchar_t** ppValue )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL GetActiveXControlPath( MSIHANDLE hMSI, char** ppActiveXPath )
|
BOOL GetActiveXControlPath( MSIHANDLE hMSI, wchar_t** ppActiveXPath )
|
||||||
{
|
{
|
||||||
wchar_t* pProgPath = nullptr;
|
wchar_t* pProgPath = nullptr;
|
||||||
if ( GetMsiPropW( hMSI, L"INSTALLLOCATION", &pProgPath ) && pProgPath )
|
if ( GetMsiPropW( hMSI, L"INSTALLLOCATION", &pProgPath ) && pProgPath )
|
||||||
{
|
{
|
||||||
char* pCharProgPath = UnicodeToAnsiString( pProgPath );
|
int nLen = wcslen( pProgPath );
|
||||||
|
*ppActiveXPath = static_cast<wchar_t*>( malloc( (nLen + 23) * sizeof(wchar_t) ) );
|
||||||
|
wcsncpy( *ppActiveXPath, pProgPath, nLen );
|
||||||
|
wcsncpy( (*ppActiveXPath) + nLen, L"program\\so_activex.dll", 22 );
|
||||||
|
(*ppActiveXPath)[nLen+22] = 0;
|
||||||
|
|
||||||
if ( pCharProgPath )
|
free(pProgPath);
|
||||||
{
|
|
||||||
int nLen = strlen( pCharProgPath );
|
|
||||||
*ppActiveXPath = static_cast<char*>( malloc( nLen + 23 ) );
|
|
||||||
strncpy( *ppActiveXPath, pCharProgPath, nLen );
|
|
||||||
strncpy( (*ppActiveXPath) + nLen, "program\\so_activex.dll", 22 );
|
|
||||||
(*ppActiveXPath)[nLen+22] = 0;
|
|
||||||
|
|
||||||
free( pCharProgPath );
|
return TRUE;
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
free( pProgPath );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -172,7 +149,7 @@ BOOL GetDelta( MSIHANDLE hMSI, int& nOldInstallMode, int& nInstallMode, int& nDe
|
|||||||
INSTALLSTATE current_state;
|
INSTALLSTATE current_state;
|
||||||
INSTALLSTATE future_state;
|
INSTALLSTATE future_state;
|
||||||
|
|
||||||
if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Wrt_Bin", ¤t_state, &future_state ) )
|
if ( ERROR_SUCCESS == MsiGetFeatureStateW( hMSI, L"gm_p_Wrt_Bin", ¤t_state, &future_state ) )
|
||||||
{
|
{
|
||||||
// analyze writer installation mode
|
// analyze writer installation mode
|
||||||
if ( current_state == INSTALLSTATE_LOCAL )
|
if ( current_state == INSTALLSTATE_LOCAL )
|
||||||
@@ -189,7 +166,7 @@ BOOL GetDelta( MSIHANDLE hMSI, int& nOldInstallMode, int& nInstallMode, int& nDe
|
|||||||
// assert( FALSE );
|
// assert( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Calc_Bin", ¤t_state, &future_state ) )
|
if ( ERROR_SUCCESS == MsiGetFeatureStateW( hMSI, L"gm_p_Calc_Bin", ¤t_state, &future_state ) )
|
||||||
{
|
{
|
||||||
// analyze calc installation mode
|
// analyze calc installation mode
|
||||||
if ( current_state == INSTALLSTATE_LOCAL )
|
if ( current_state == INSTALLSTATE_LOCAL )
|
||||||
@@ -206,7 +183,7 @@ BOOL GetDelta( MSIHANDLE hMSI, int& nOldInstallMode, int& nInstallMode, int& nDe
|
|||||||
// assert( FALSE );
|
// assert( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Draw_Bin", ¤t_state, &future_state ) )
|
if ( ERROR_SUCCESS == MsiGetFeatureStateW( hMSI, L"gm_p_Draw_Bin", ¤t_state, &future_state ) )
|
||||||
{
|
{
|
||||||
// analyze draw installation mode
|
// analyze draw installation mode
|
||||||
if ( current_state == INSTALLSTATE_LOCAL )
|
if ( current_state == INSTALLSTATE_LOCAL )
|
||||||
@@ -223,7 +200,7 @@ BOOL GetDelta( MSIHANDLE hMSI, int& nOldInstallMode, int& nInstallMode, int& nDe
|
|||||||
// assert( FALSE );
|
// assert( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Impress_Bin", ¤t_state, &future_state ) )
|
if ( ERROR_SUCCESS == MsiGetFeatureStateW( hMSI, L"gm_p_Impress_Bin", ¤t_state, &future_state ) )
|
||||||
{
|
{
|
||||||
// analyze impress installation mode
|
// analyze impress installation mode
|
||||||
if ( current_state == INSTALLSTATE_LOCAL )
|
if ( current_state == INSTALLSTATE_LOCAL )
|
||||||
@@ -240,7 +217,7 @@ BOOL GetDelta( MSIHANDLE hMSI, int& nOldInstallMode, int& nInstallMode, int& nDe
|
|||||||
// assert( FALSE );
|
// assert( FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_p_Math_Bin", ¤t_state, &future_state ) )
|
if ( ERROR_SUCCESS == MsiGetFeatureStateW( hMSI, L"gm_p_Math_Bin", ¤t_state, &future_state ) )
|
||||||
{
|
{
|
||||||
// analyze math installation mode
|
// analyze math installation mode
|
||||||
if ( current_state == INSTALLSTATE_LOCAL )
|
if ( current_state == INSTALLSTATE_LOCAL )
|
||||||
@@ -293,7 +270,7 @@ extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI )
|
|||||||
INSTALLSTATE current_state;
|
INSTALLSTATE current_state;
|
||||||
INSTALLSTATE future_state;
|
INSTALLSTATE future_state;
|
||||||
|
|
||||||
if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_o_Activexcontrol", ¤t_state, &future_state ) )
|
if ( ERROR_SUCCESS == MsiGetFeatureStateW( hMSI, L"gm_o_Activexcontrol", ¤t_state, &future_state ) )
|
||||||
{
|
{
|
||||||
int nOldInstallMode = 0;
|
int nOldInstallMode = 0;
|
||||||
int nInstallMode = 0;
|
int nInstallMode = 0;
|
||||||
@@ -301,7 +278,7 @@ extern "C" UINT __stdcall InstallActiveXControl( MSIHANDLE hMSI )
|
|||||||
BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI );
|
BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI );
|
||||||
BOOL bInstallFor64Bit = MakeInstallFor64Bit( hMSI );
|
BOOL bInstallFor64Bit = MakeInstallFor64Bit( hMSI );
|
||||||
|
|
||||||
char* pActiveXPath = nullptr;
|
wchar_t* pActiveXPath = nullptr;
|
||||||
if ( GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath
|
if ( GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath
|
||||||
&& GetDelta( hMSI, nOldInstallMode, nInstallMode, nDeinstallMode ) )
|
&& GetDelta( hMSI, nOldInstallMode, nInstallMode, nDeinstallMode ) )
|
||||||
{
|
{
|
||||||
@@ -340,9 +317,9 @@ extern "C" UINT __stdcall DeinstallActiveXControl( MSIHANDLE hMSI )
|
|||||||
INSTALLSTATE current_state;
|
INSTALLSTATE current_state;
|
||||||
INSTALLSTATE future_state;
|
INSTALLSTATE future_state;
|
||||||
|
|
||||||
if ( ERROR_SUCCESS == MsiGetFeatureState( hMSI, L"gm_o_Activexcontrol", ¤t_state, &future_state ) )
|
if ( ERROR_SUCCESS == MsiGetFeatureStateW( hMSI, L"gm_o_Activexcontrol", ¤t_state, &future_state ) )
|
||||||
{
|
{
|
||||||
char* pActiveXPath = nullptr;
|
wchar_t* pActiveXPath = nullptr;
|
||||||
if ( current_state == INSTALLSTATE_LOCAL && GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath )
|
if ( current_state == INSTALLSTATE_LOCAL && GetActiveXControlPath( hMSI, &pActiveXPath ) && pActiveXPath )
|
||||||
{
|
{
|
||||||
BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI );
|
BOOL bInstallForAllUser = MakeInstallForAllUsers( hMSI );
|
||||||
|
@@ -17,8 +17,6 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push,1) // disable warnings within system headers
|
#pragma warning(push,1) // disable warnings within system headers
|
||||||
#endif
|
#endif
|
||||||
|
@@ -17,8 +17,6 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push,1) // disable warnings within system headers
|
#pragma warning(push,1) // disable warnings within system headers
|
||||||
#endif
|
#endif
|
||||||
|
@@ -16,6 +16,10 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if !defined WINVER
|
||||||
|
#define WINVER 0x0400
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sal/macros.h>
|
#include <sal/macros.h>
|
||||||
|
|
||||||
// necessary to include system headers without warnings
|
// necessary to include system headers without warnings
|
||||||
@@ -45,8 +49,8 @@ using ::com::sun::star::uno::Sequence;
|
|||||||
using ::com::sun::star::beans::PropertyValue;
|
using ::com::sun::star::beans::PropertyValue;
|
||||||
|
|
||||||
|
|
||||||
#define EXECUTER_WINDOWCLASS "SO Executer Class"
|
#define EXECUTER_WINDOWCLASS L"SO Executer Class"
|
||||||
#define EXECUTER_WINDOWNAME "SO Executer Window"
|
#define EXECUTER_WINDOWNAME L"SO Executer Window"
|
||||||
|
|
||||||
|
|
||||||
#define ID_QUICKSTART 1
|
#define ID_QUICKSTART 1
|
||||||
@@ -121,7 +125,7 @@ static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text
|
|||||||
mi.fType=MFT_STRING;
|
mi.fType=MFT_STRING;
|
||||||
mi.fState=MFS_ENABLED;
|
mi.fState=MFS_ENABLED;
|
||||||
mi.wID = id;
|
mi.wID = id;
|
||||||
mi.dwTypeData = reinterpret_cast<wchar_t *>(
|
mi.dwTypeData = SAL_W(
|
||||||
const_cast<sal_Unicode *>(text.getStr()));
|
const_cast<sal_Unicode *>(text.getStr()));
|
||||||
mi.cch = text.getLength();
|
mi.cch = text.getLength();
|
||||||
}
|
}
|
||||||
@@ -244,11 +248,11 @@ static void addTaskbarIcon( HWND hWnd )
|
|||||||
|
|
||||||
// add taskbar icon
|
// add taskbar icon
|
||||||
NOTIFYICONDATAW nid;
|
NOTIFYICONDATAW nid;
|
||||||
nid.hIcon = static_cast<HICON>(LoadImageA( GetModuleHandle( nullptr ), MAKEINTRESOURCE( ICON_LO_DEFAULT ),
|
nid.hIcon = static_cast<HICON>(LoadImageW( GetModuleHandleW( nullptr ), MAKEINTRESOURCEW( ICON_LO_DEFAULT ),
|
||||||
IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ),
|
IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ),
|
||||||
LR_DEFAULTCOLOR | LR_SHARED ));
|
LR_DEFAULTCOLOR | LR_SHARED ));
|
||||||
|
|
||||||
wcsncpy( nid.szTip, reinterpret_cast<LPCWSTR>(strTip.getStr()), 64 );
|
wcsncpy( nid.szTip, SAL_W(strTip.getStr()), 64 );
|
||||||
|
|
||||||
nid.cbSize = sizeof(nid);
|
nid.cbSize = sizeof(nid);
|
||||||
nid.hWnd = hWnd;
|
nid.hWnd = hWnd;
|
||||||
@@ -273,8 +277,8 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
{
|
{
|
||||||
// request notification when taskbar is recreated
|
// request notification when taskbar is recreated
|
||||||
// we then have to add our icon again
|
// we then have to add our icon again
|
||||||
s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
|
s_uTaskbarRestart = RegisterWindowMessageW(L"TaskbarCreated");
|
||||||
s_uMsgKillTray = RegisterWindowMessage( SHUTDOWN_QUICKSTART_MESSAGE );
|
s_uMsgKillTray = RegisterWindowMessageW( SHUTDOWN_QUICKSTART_MESSAGE );
|
||||||
|
|
||||||
// create the menu
|
// create the menu
|
||||||
if( !popupMenu )
|
if( !popupMenu )
|
||||||
@@ -303,7 +307,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
{
|
{
|
||||||
case WM_LBUTTONDBLCLK:
|
case WM_LBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_TEMPLATE, reinterpret_cast<LPARAM>(hWnd));
|
BOOL const ret = PostMessageW(aExecuterWindow, WM_COMMAND, IDM_TEMPLATE, reinterpret_cast<LPARAM>(hWnd));
|
||||||
SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!");
|
SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -348,7 +352,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL const ret2 = PostMessage(aExecuterWindow, WM_COMMAND, m, reinterpret_cast<LPARAM>(hWnd));
|
BOOL const ret2 = PostMessageW(aExecuterWindow, WM_COMMAND, m, reinterpret_cast<LPARAM>(hWnd));
|
||||||
SAL_WARN_IF(0 == ret2, "sfx.appl", "ERROR: PostMessage() failed!");
|
SAL_WARN_IF(0 == ret2, "sfx.appl", "ERROR: PostMessage() failed!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -358,7 +362,7 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
deleteSystrayMenu( popupMenu );
|
deleteSystrayMenu( popupMenu );
|
||||||
// We don't need the Systray Thread anymore
|
// We don't need the Systray Thread anymore
|
||||||
PostQuitMessage( 0 );
|
PostQuitMessage( 0 );
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
||||||
default:
|
default:
|
||||||
if( uMsg == s_uTaskbarRestart )
|
if( uMsg == s_uTaskbarRestart )
|
||||||
{
|
{
|
||||||
@@ -374,11 +378,11 @@ LRESULT CALLBACK listenerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
nid.uID = ID_QUICKSTART;
|
nid.uID = ID_QUICKSTART;
|
||||||
Shell_NotifyIconA(NIM_DELETE, &nid);
|
Shell_NotifyIconA(NIM_DELETE, &nid);
|
||||||
|
|
||||||
BOOL const ret = PostMessage(aExecuterWindow, WM_COMMAND, IDM_EXIT, reinterpret_cast<LPARAM>(hWnd));
|
BOOL const ret = PostMessageW(aExecuterWindow, WM_COMMAND, IDM_EXIT, reinterpret_cast<LPARAM>(hWnd));
|
||||||
SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!");
|
SAL_WARN_IF(0 == ret, "sfx.appl", "ERROR: PostMessage() failed!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -435,7 +439,7 @@ LRESULT CALLBACK executerWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
|||||||
break;
|
break;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
default:
|
default:
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -445,26 +449,26 @@ DWORD WINAPI SystrayThread( LPVOID /*lpParam*/ )
|
|||||||
{
|
{
|
||||||
osl_setThreadName("SystrayThread");
|
osl_setThreadName("SystrayThread");
|
||||||
|
|
||||||
aListenerWindow = CreateWindowExA(0,
|
aListenerWindow = CreateWindowExW(0,
|
||||||
QUICKSTART_CLASSNAME, // registered class name
|
QUICKSTART_CLASSNAME, // registered class name
|
||||||
QUICKSTART_WINDOWNAME, // window name
|
QUICKSTART_WINDOWNAME, // window name
|
||||||
0, // window style
|
0, // window style
|
||||||
CW_USEDEFAULT, // horizontal position of window
|
CW_USEDEFAULT, // horizontal position of window
|
||||||
CW_USEDEFAULT, // vertical position of window
|
CW_USEDEFAULT, // vertical position of window
|
||||||
CW_USEDEFAULT, // window width
|
CW_USEDEFAULT, // window width
|
||||||
CW_USEDEFAULT, // window height
|
CW_USEDEFAULT, // window height
|
||||||
nullptr, // handle to parent or owner window
|
nullptr, // handle to parent or owner window
|
||||||
nullptr, // menu handle or child identifier
|
nullptr, // menu handle or child identifier
|
||||||
GetModuleHandle( nullptr ), // handle to application instance
|
GetModuleHandleW( nullptr ), // handle to application instance
|
||||||
nullptr // window-creation data
|
nullptr // window-creation data
|
||||||
);
|
);
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
while ( GetMessage( &msg, nullptr, 0, 0 ) )
|
while ( GetMessageW( &msg, nullptr, 0, 0 ) )
|
||||||
{
|
{
|
||||||
TranslateMessage( &msg );
|
TranslateMessage( &msg );
|
||||||
DispatchMessage( &msg );
|
DispatchMessageW( &msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg.wParam; // Exit code of WM_QUIT
|
return msg.wParam; // Exit code of WM_QUIT
|
||||||
@@ -475,13 +479,13 @@ void win32_init_sys_tray()
|
|||||||
{
|
{
|
||||||
if ( ShutdownIcon::IsQuickstarterInstalled() )
|
if ( ShutdownIcon::IsQuickstarterInstalled() )
|
||||||
{
|
{
|
||||||
WNDCLASSEXA listenerClass;
|
WNDCLASSEXW listenerClass;
|
||||||
listenerClass.cbSize = sizeof(WNDCLASSEX);
|
listenerClass.cbSize = sizeof(listenerClass);
|
||||||
listenerClass.style = 0;
|
listenerClass.style = 0;
|
||||||
listenerClass.lpfnWndProc = listenerWndProc;
|
listenerClass.lpfnWndProc = listenerWndProc;
|
||||||
listenerClass.cbClsExtra = 0;
|
listenerClass.cbClsExtra = 0;
|
||||||
listenerClass.cbWndExtra = 0;
|
listenerClass.cbWndExtra = 0;
|
||||||
listenerClass.hInstance = GetModuleHandle( nullptr );
|
listenerClass.hInstance = GetModuleHandleW( nullptr );
|
||||||
listenerClass.hIcon = nullptr;
|
listenerClass.hIcon = nullptr;
|
||||||
listenerClass.hCursor = nullptr;
|
listenerClass.hCursor = nullptr;
|
||||||
listenerClass.hbrBackground = nullptr;
|
listenerClass.hbrBackground = nullptr;
|
||||||
@@ -489,15 +493,15 @@ void win32_init_sys_tray()
|
|||||||
listenerClass.lpszClassName = QUICKSTART_CLASSNAME;
|
listenerClass.lpszClassName = QUICKSTART_CLASSNAME;
|
||||||
listenerClass.hIconSm = nullptr;
|
listenerClass.hIconSm = nullptr;
|
||||||
|
|
||||||
RegisterClassExA(&listenerClass);
|
RegisterClassExW(&listenerClass);
|
||||||
|
|
||||||
WNDCLASSEXA executerClass;
|
WNDCLASSEXW executerClass;
|
||||||
executerClass.cbSize = sizeof(WNDCLASSEX);
|
executerClass.cbSize = sizeof(executerClass);
|
||||||
executerClass.style = 0;
|
executerClass.style = 0;
|
||||||
executerClass.lpfnWndProc = executerWndProc;
|
executerClass.lpfnWndProc = executerWndProc;
|
||||||
executerClass.cbClsExtra = 0;
|
executerClass.cbClsExtra = 0;
|
||||||
executerClass.cbWndExtra = 0;
|
executerClass.cbWndExtra = 0;
|
||||||
executerClass.hInstance = GetModuleHandle( nullptr );
|
executerClass.hInstance = GetModuleHandleW( nullptr );
|
||||||
executerClass.hIcon = nullptr;
|
executerClass.hIcon = nullptr;
|
||||||
executerClass.hCursor = nullptr;
|
executerClass.hCursor = nullptr;
|
||||||
executerClass.hbrBackground = nullptr;
|
executerClass.hbrBackground = nullptr;
|
||||||
@@ -505,20 +509,20 @@ void win32_init_sys_tray()
|
|||||||
executerClass.lpszClassName = EXECUTER_WINDOWCLASS;
|
executerClass.lpszClassName = EXECUTER_WINDOWCLASS;
|
||||||
executerClass.hIconSm = nullptr;
|
executerClass.hIconSm = nullptr;
|
||||||
|
|
||||||
RegisterClassExA( &executerClass );
|
RegisterClassExW( &executerClass );
|
||||||
|
|
||||||
aExecuterWindow = CreateWindowExA(0,
|
aExecuterWindow = CreateWindowExW(0,
|
||||||
EXECUTER_WINDOWCLASS, // registered class name
|
EXECUTER_WINDOWCLASS, // registered class name
|
||||||
EXECUTER_WINDOWNAME, // window name
|
EXECUTER_WINDOWNAME, // window name
|
||||||
0, // window style
|
0, // window style
|
||||||
CW_USEDEFAULT, // horizontal position of window
|
CW_USEDEFAULT, // horizontal position of window
|
||||||
CW_USEDEFAULT, // vertical position of window
|
CW_USEDEFAULT, // vertical position of window
|
||||||
CW_USEDEFAULT, // window width
|
CW_USEDEFAULT, // window width
|
||||||
CW_USEDEFAULT, // window height
|
CW_USEDEFAULT, // window height
|
||||||
nullptr, // handle to parent or owner window
|
nullptr, // handle to parent or owner window
|
||||||
nullptr, // menu handle or child identifier
|
nullptr, // menu handle or child identifier
|
||||||
GetModuleHandle( nullptr ), // handle to application instance
|
GetModuleHandleW( nullptr ), // handle to application instance
|
||||||
nullptr // window-creation data
|
nullptr // window-creation data
|
||||||
);
|
);
|
||||||
|
|
||||||
DWORD dwThreadId;
|
DWORD dwThreadId;
|
||||||
@@ -538,8 +542,8 @@ void win32_shutdown_sys_tray()
|
|||||||
DestroyWindow( aExecuterWindow );
|
DestroyWindow( aExecuterWindow );
|
||||||
aExecuterWindow = nullptr;
|
aExecuterWindow = nullptr;
|
||||||
}
|
}
|
||||||
UnregisterClassA( QUICKSTART_CLASSNAME, GetModuleHandle( nullptr ) );
|
UnregisterClassW( QUICKSTART_CLASSNAME, GetModuleHandleW( nullptr ) );
|
||||||
UnregisterClassA( EXECUTER_WINDOWCLASS, GetModuleHandle( nullptr ) );
|
UnregisterClassW( EXECUTER_WINDOWCLASS, GetModuleHandleW( nullptr ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,18 +554,18 @@ void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis)
|
|||||||
HDC hdc = GetDC(hwnd);
|
HDC hdc = GetDC(hwnd);
|
||||||
SIZE size;
|
SIZE size;
|
||||||
|
|
||||||
NONCLIENTMETRICS ncm;
|
NONCLIENTMETRICSW ncm;
|
||||||
memset(&ncm, 0, sizeof(ncm));
|
memset(&ncm, 0, sizeof(ncm));
|
||||||
ncm.cbSize = sizeof(ncm);
|
ncm.cbSize = sizeof(ncm);
|
||||||
|
|
||||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
|
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
|
||||||
|
|
||||||
// Assume every menu item can be default and printed bold
|
// Assume every menu item can be default and printed bold
|
||||||
ncm.lfMenuFont.lfWeight = FW_BOLD;
|
ncm.lfMenuFont.lfWeight = FW_BOLD;
|
||||||
|
|
||||||
HFONT hfntOld = static_cast<HFONT>(SelectObject(hdc, CreateFontIndirect( &ncm.lfMenuFont )));
|
HFONT hfntOld = static_cast<HFONT>(SelectObject(hdc, CreateFontIndirectW( &ncm.lfMenuFont )));
|
||||||
|
|
||||||
GetTextExtentPoint32W(hdc, reinterpret_cast<LPCWSTR>(pMyItem->text.getStr()),
|
GetTextExtentPoint32W(hdc, SAL_W(pMyItem->text.getStr()),
|
||||||
pMyItem->text.getLength(), &size);
|
pMyItem->text.getLength(), &size);
|
||||||
|
|
||||||
lpmis->itemWidth = size.cx + 4 + GetSystemMetrics( SM_CXSMICON );
|
lpmis->itemWidth = size.cx + 4 + GetSystemMetrics( SM_CXSMICON );
|
||||||
@@ -611,11 +615,11 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
|
|||||||
int cx = GetSystemMetrics( SM_CXSMICON );
|
int cx = GetSystemMetrics( SM_CXSMICON );
|
||||||
int cy = GetSystemMetrics( SM_CYSMICON );
|
int cy = GetSystemMetrics( SM_CYSMICON );
|
||||||
HICON hIcon( nullptr );
|
HICON hIcon( nullptr );
|
||||||
HMODULE hModule( GetModuleHandle( nullptr ) );
|
HMODULE hModule( GetModuleHandleW( nullptr ) );
|
||||||
|
|
||||||
if ( pMyItem->module.getLength() > 0 )
|
if ( pMyItem->module.getLength() > 0 )
|
||||||
{
|
{
|
||||||
LPCWSTR pModuleName = reinterpret_cast<LPCWSTR>( pMyItem->module.getStr() );
|
LPCWSTR pModuleName = SAL_W( pMyItem->module.getStr() );
|
||||||
hModule = GetModuleHandleW( pModuleName );
|
hModule = GetModuleHandleW( pModuleName );
|
||||||
if ( hModule == nullptr )
|
if ( hModule == nullptr )
|
||||||
{
|
{
|
||||||
@@ -638,21 +642,21 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis)
|
|||||||
x += cx + 4; // space for icon
|
x += cx + 4; // space for icon
|
||||||
aRect.left = x;
|
aRect.left = x;
|
||||||
|
|
||||||
NONCLIENTMETRICS ncm;
|
NONCLIENTMETRICSW ncm;
|
||||||
memset(&ncm, 0, sizeof(ncm));
|
memset(&ncm, 0, sizeof(ncm));
|
||||||
ncm.cbSize = sizeof(ncm);
|
ncm.cbSize = sizeof(ncm);
|
||||||
|
|
||||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
|
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
|
||||||
|
|
||||||
// Print default menu entry with bold font
|
// Print default menu entry with bold font
|
||||||
if ( lpdis->itemState & ODS_DEFAULT )
|
if ( lpdis->itemState & ODS_DEFAULT )
|
||||||
ncm.lfMenuFont.lfWeight = FW_BOLD;
|
ncm.lfMenuFont.lfWeight = FW_BOLD;
|
||||||
|
|
||||||
hfntOld = static_cast<HFONT>(SelectObject(lpdis->hDC, CreateFontIndirect( &ncm.lfMenuFont )));
|
hfntOld = static_cast<HFONT>(SelectObject(lpdis->hDC, CreateFontIndirectW( &ncm.lfMenuFont )));
|
||||||
|
|
||||||
|
|
||||||
SIZE size;
|
SIZE size;
|
||||||
GetTextExtentPointW( lpdis->hDC, reinterpret_cast<LPCWSTR>(pMyItem->text.getStr()), pMyItem->text.getLength(), &size );
|
GetTextExtentPointW( lpdis->hDC, SAL_W(pMyItem->text.getStr()), pMyItem->text.getLength(), &size );
|
||||||
|
|
||||||
DrawStateW( lpdis->hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(pMyItem->text.getStr()), (WPARAM)0, aRect.left, aRect.top + (height - size.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) );
|
DrawStateW( lpdis->hDC, nullptr, nullptr, reinterpret_cast<LPARAM>(pMyItem->text.getStr()), (WPARAM)0, aRect.left, aRect.top + (height - size.cy)/2, 0, 0, DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) );
|
||||||
|
|
||||||
@@ -693,7 +697,7 @@ static OUString SHGetSpecialFolder( int nFolderID )
|
|||||||
lpFolderA = ALLOC( WCHAR, 16000 );
|
lpFolderA = ALLOC( WCHAR, 16000 );
|
||||||
|
|
||||||
SHGetPathFromIDListW( pidl, lpFolderA );
|
SHGetPathFromIDListW( pidl, lpFolderA );
|
||||||
aFolder = OUString( reinterpret_cast<const sal_Unicode*>(lpFolderA) );
|
aFolder = SAL_U( lpFolderA );
|
||||||
|
|
||||||
FREE( lpFolderA );
|
FREE( lpFolderA );
|
||||||
SHFree_( pidl );
|
SHFree_( pidl );
|
||||||
@@ -709,7 +713,7 @@ OUString ShutdownIcon::GetAutostartFolderNameW32()
|
|||||||
static HRESULT WINAPI SHCoCreateInstance( LPVOID lpszReserved, REFCLSID clsid, LPUNKNOWN pUnkUnknown, REFIID iid, LPVOID *ppv )
|
static HRESULT WINAPI SHCoCreateInstance( LPVOID lpszReserved, REFCLSID clsid, LPUNKNOWN pUnkUnknown, REFIID iid, LPVOID *ppv )
|
||||||
{
|
{
|
||||||
HRESULT hResult = E_NOTIMPL;
|
HRESULT hResult = E_NOTIMPL;
|
||||||
HMODULE hModShell = GetModuleHandle( "SHELL32" );
|
HMODULE hModShell = GetModuleHandleW( L"SHELL32" );
|
||||||
|
|
||||||
if ( hModShell != nullptr )
|
if ( hModShell != nullptr )
|
||||||
{
|
{
|
||||||
@@ -727,9 +731,9 @@ BOOL CreateShortcut( const OUString& rAbsObject, const OUString& rAbsObjectPath,
|
|||||||
const OUString& rAbsShortcut, const OUString& rDescription, const OUString& rParameter )
|
const OUString& rAbsShortcut, const OUString& rDescription, const OUString& rParameter )
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
IShellLink* psl;
|
IShellLinkW* psl;
|
||||||
CLSID clsid_ShellLink = CLSID_ShellLink;
|
CLSID clsid_ShellLink = CLSID_ShellLink;
|
||||||
CLSID clsid_IShellLink = IID_IShellLink;
|
CLSID clsid_IShellLink = IID_IShellLinkW;
|
||||||
|
|
||||||
hres = CoCreateInstance( clsid_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
|
hres = CoCreateInstance( clsid_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
|
||||||
clsid_IShellLink, reinterpret_cast<void**>(&psl) );
|
clsid_IShellLink, reinterpret_cast<void**>(&psl) );
|
||||||
@@ -739,11 +743,11 @@ BOOL CreateShortcut( const OUString& rAbsObject, const OUString& rAbsObjectPath,
|
|||||||
if( SUCCEEDED(hres) )
|
if( SUCCEEDED(hres) )
|
||||||
{
|
{
|
||||||
IPersistFile* ppf;
|
IPersistFile* ppf;
|
||||||
psl->SetPath( OUStringToOString(rAbsObject, osl_getThreadTextEncoding()).getStr() );
|
psl->SetPath( SAL_W(rAbsObject.getStr()) );
|
||||||
psl->SetWorkingDirectory( OUStringToOString(rAbsObjectPath, osl_getThreadTextEncoding()).getStr() );
|
psl->SetWorkingDirectory( SAL_W(rAbsObjectPath.getStr()) );
|
||||||
psl->SetDescription( OUStringToOString(rDescription, osl_getThreadTextEncoding()).getStr() );
|
psl->SetDescription( SAL_W(rDescription.getStr()) );
|
||||||
if( rParameter.getLength() )
|
if( rParameter.getLength() )
|
||||||
psl->SetArguments( OUStringToOString(rParameter, osl_getThreadTextEncoding()).getStr() );
|
psl->SetArguments( SAL_W(rParameter.getStr()) );
|
||||||
|
|
||||||
CLSID clsid_IPersistFile = IID_IPersistFile;
|
CLSID clsid_IPersistFile = IID_IPersistFile;
|
||||||
hres = psl->QueryInterface( clsid_IPersistFile, reinterpret_cast<void**>(&ppf) );
|
hres = psl->QueryInterface( clsid_IPersistFile, reinterpret_cast<void**>(&ppf) );
|
||||||
@@ -782,7 +786,7 @@ bool ShutdownIcon::IsQuickstarterInstalled()
|
|||||||
wchar_t aPath[_MAX_PATH];
|
wchar_t aPath[_MAX_PATH];
|
||||||
GetModuleFileNameW( nullptr, aPath, _MAX_PATH-1);
|
GetModuleFileNameW( nullptr, aPath, _MAX_PATH-1);
|
||||||
|
|
||||||
OUString aOfficepath( reinterpret_cast<const sal_Unicode*>(aPath) );
|
OUString aOfficepath( SAL_U(aPath) );
|
||||||
int i = aOfficepath.lastIndexOf('\\');
|
int i = aOfficepath.lastIndexOf('\\');
|
||||||
if( i != -1 )
|
if( i != -1 )
|
||||||
aOfficepath = aOfficepath.copy(0, i);
|
aOfficepath = aOfficepath.copy(0, i);
|
||||||
@@ -790,7 +794,7 @@ bool ShutdownIcon::IsQuickstarterInstalled()
|
|||||||
OUString quickstartExe(aOfficepath);
|
OUString quickstartExe(aOfficepath);
|
||||||
quickstartExe += "\\quickstart.exe";
|
quickstartExe += "\\quickstart.exe";
|
||||||
|
|
||||||
return FileExistsW( reinterpret_cast<LPCWSTR>(quickstartExe.getStr()) );
|
return FileExistsW( SAL_W(quickstartExe.getStr()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShutdownIcon::EnableAutostartW32( const OUString &aShortcut )
|
void ShutdownIcon::EnableAutostartW32( const OUString &aShortcut )
|
||||||
@@ -798,7 +802,7 @@ void ShutdownIcon::EnableAutostartW32( const OUString &aShortcut )
|
|||||||
wchar_t aPath[_MAX_PATH];
|
wchar_t aPath[_MAX_PATH];
|
||||||
GetModuleFileNameW( nullptr, aPath, _MAX_PATH-1);
|
GetModuleFileNameW( nullptr, aPath, _MAX_PATH-1);
|
||||||
|
|
||||||
OUString aOfficepath( reinterpret_cast<const sal_Unicode*>(aPath) );
|
OUString aOfficepath( SAL_U(aPath) );
|
||||||
int i = aOfficepath.lastIndexOf('\\');
|
int i = aOfficepath.lastIndexOf('\\');
|
||||||
if( i != -1 )
|
if( i != -1 )
|
||||||
aOfficepath = aOfficepath.copy(0, i);
|
aOfficepath = aOfficepath.copy(0, i);
|
||||||
|
@@ -24,8 +24,6 @@
|
|||||||
#pragma warning (disable : 4786 4503 4917)
|
#pragma warning (disable : 4786 4503 4917)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
#ifdef _AMD64_
|
#ifdef _AMD64_
|
||||||
#define MODULE_NAME L"shlxthdl_x64.dll"
|
#define MODULE_NAME L"shlxthdl_x64.dll"
|
||||||
#else
|
#else
|
||||||
|
@@ -28,9 +28,24 @@
|
|||||||
#include "config.hxx"
|
#include "config.hxx"
|
||||||
|
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <tchar.h>
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
// Unicode-only defines to break dependance on UNICODE define
|
||||||
|
#if !defined ListView_InsertColumnW
|
||||||
|
#define ListView_InsertColumnW(hwnd, iCol, pcol) \
|
||||||
|
(int)SNDMSG((hwnd), LVM_INSERTCOLUMNW, (WPARAM)(int)(iCol), (LPARAM)(const LV_COLUMNW *)(pcol))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined ListView_InsertItemW
|
||||||
|
#define ListView_InsertItemW(hwnd, pitem) \
|
||||||
|
(int)SNDMSG((hwnd), LVM_INSERTITEMW, 0, (LPARAM)(const LV_ITEMW *)(pitem))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined ListView_SetItemW
|
||||||
|
#define ListView_SetItemW(hwnd, pitem) \
|
||||||
|
(BOOL)SNDMSG((hwnd), LVM_SETITEMW, 0, (LPARAM)(const LV_ITEMW *)(pitem))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
list_view_builder_ptr create_list_view_builder(
|
list_view_builder_ptr create_list_view_builder(
|
||||||
HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2)
|
HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2)
|
||||||
@@ -83,17 +98,17 @@ void list_view_builder::build(statistic_group_list_t& gl)
|
|||||||
void list_view_builder::setup_list_view()
|
void list_view_builder::setup_list_view()
|
||||||
{
|
{
|
||||||
HIMAGELIST h_ils = ImageList_Create(16,15,ILC_MASK, 7, 0);
|
HIMAGELIST h_ils = ImageList_Create(16,15,ILC_MASK, 7, 0);
|
||||||
HBITMAP h_bmp = LoadBitmap(GetModuleHandle(MODULE_NAME), MAKEINTRESOURCE(IDB_PROPERTY_IMAGES));
|
HBITMAP h_bmp = LoadBitmapW(GetModuleHandleW(MODULE_NAME), MAKEINTRESOURCEW(IDB_PROPERTY_IMAGES));
|
||||||
ImageList_AddMasked(h_ils, h_bmp, RGB(255, 0, 255));
|
ImageList_AddMasked(h_ils, h_bmp, RGB(255, 0, 255));
|
||||||
|
|
||||||
(void) ListView_SetImageList(hwnd_list_view_, h_ils, LVSIL_SMALL);
|
(void) ListView_SetImageList(hwnd_list_view_, h_ils, LVSIL_SMALL);
|
||||||
|
|
||||||
std::wstring header = GetResString(IDS_PROPERTY);
|
std::wstring header = GetResString(IDS_PROPERTY);
|
||||||
|
|
||||||
LVCOLUMN lvc;
|
LVCOLUMNW lvc;
|
||||||
lvc.mask = LVCF_FMT |
|
lvc.mask = LVCF_FMT |
|
||||||
LVCF_WIDTH |
|
LVCF_WIDTH |
|
||||||
LVCF_TEXT |
|
LVCF_TEXT |
|
||||||
LVCF_SUBITEM;
|
LVCF_SUBITEM;
|
||||||
|
|
||||||
lvc.iSubItem = 0;
|
lvc.iSubItem = 0;
|
||||||
@@ -101,11 +116,11 @@ void list_view_builder::setup_list_view()
|
|||||||
lvc.cx = 120;
|
lvc.cx = 120;
|
||||||
lvc.fmt = LVCFMT_LEFT;
|
lvc.fmt = LVCFMT_LEFT;
|
||||||
|
|
||||||
ListView_InsertColumn(hwnd_list_view_, 0, &lvc);
|
ListView_InsertColumnW(hwnd_list_view_, 0, &lvc);
|
||||||
lvc.iSubItem = 1;
|
lvc.iSubItem = 1;
|
||||||
header = GetResString(IDS_PROPERTY_VALUE);
|
header = GetResString(IDS_PROPERTY_VALUE);
|
||||||
lvc.pszText = const_cast<wchar_t*>(header.c_str());
|
lvc.pszText = const_cast<wchar_t*>(header.c_str());
|
||||||
ListView_InsertColumn(hwnd_list_view_, 1, &lvc);
|
ListView_InsertColumnW(hwnd_list_view_, 1, &lvc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -117,7 +132,7 @@ void list_view_builder::insert_group(const std::wstring& /*title*/)
|
|||||||
|
|
||||||
void list_view_builder::insert_item(const std::wstring& title, const std::wstring& value, bool is_editable)
|
void list_view_builder::insert_item(const std::wstring& title, const std::wstring& value, bool is_editable)
|
||||||
{
|
{
|
||||||
LVITEM lvi;
|
LVITEMW lvi;
|
||||||
|
|
||||||
lvi.iItem = ++row_index_;
|
lvi.iItem = ++row_index_;
|
||||||
lvi.iSubItem = 0;
|
lvi.iSubItem = 0;
|
||||||
@@ -137,13 +152,13 @@ void list_view_builder::insert_item(const std::wstring& title, const std::wstrin
|
|||||||
lvi.iImage = 3;
|
lvi.iImage = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView_InsertItem(hwnd_list_view_, &lvi);
|
ListView_InsertItemW(hwnd_list_view_, &lvi);
|
||||||
|
|
||||||
lvi.mask = LVIF_TEXT;
|
lvi.mask = LVIF_TEXT;
|
||||||
lvi.iSubItem = 1;
|
lvi.iSubItem = 1;
|
||||||
lvi.pszText = const_cast<wchar_t*>(value.c_str());
|
lvi.pszText = const_cast<wchar_t*>(value.c_str());
|
||||||
|
|
||||||
ListView_SetItem(hwnd_list_view_, &lvi);
|
ListView_SetItemW(hwnd_list_view_, &lvi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -193,7 +208,7 @@ void winxp_list_view_builder::insert_group(const std::wstring& name)
|
|||||||
void winxp_list_view_builder::insert_item(
|
void winxp_list_view_builder::insert_item(
|
||||||
const std::wstring& title, const std::wstring& value, bool is_editable)
|
const std::wstring& title, const std::wstring& value, bool is_editable)
|
||||||
{
|
{
|
||||||
LVITEM lvi;
|
LVITEMW lvi;
|
||||||
|
|
||||||
lvi.iItem = ++row_index_;
|
lvi.iItem = ++row_index_;
|
||||||
lvi.iSubItem = 0;
|
lvi.iSubItem = 0;
|
||||||
@@ -213,13 +228,13 @@ void winxp_list_view_builder::insert_item(
|
|||||||
lvi.iImage = 3;
|
lvi.iImage = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView_InsertItem(get_list_view(), &lvi);
|
ListView_InsertItemW(get_list_view(), &lvi);
|
||||||
|
|
||||||
lvi.mask = LVIF_TEXT;
|
lvi.mask = LVIF_TEXT;
|
||||||
lvi.iSubItem = 1;
|
lvi.iSubItem = 1;
|
||||||
lvi.pszText = const_cast<wchar_t*>(value.c_str());
|
lvi.pszText = const_cast<wchar_t*>(value.c_str());
|
||||||
|
|
||||||
ListView_SetItem(get_list_view(), &lvi);
|
ListView_SetItemW(get_list_view(), &lvi);
|
||||||
|
|
||||||
row_count_++;
|
row_count_++;
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,6 @@
|
|||||||
#include "fileextensions.hxx"
|
#include "fileextensions.hxx"
|
||||||
#include "utilities.hxx"
|
#include "utilities.hxx"
|
||||||
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
|
||||||
|
@@ -26,8 +26,6 @@
|
|||||||
|
|
||||||
#include "simplemapi.hxx"
|
#include "simplemapi.hxx"
|
||||||
|
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@@ -340,7 +338,7 @@ int main(int argc, char* argv[])
|
|||||||
if (gMapiFlags & MAPI_LOGON_UI)
|
if (gMapiFlags & MAPI_LOGON_UI)
|
||||||
oss << "--mapi-logon-ui" << std::endl;
|
oss << "--mapi-logon-ui" << std::endl;
|
||||||
|
|
||||||
MessageBox(nullptr, oss.str().c_str(), "Arguments", MB_OK | MB_ICONINFORMATION);
|
MessageBoxA(nullptr, oss.str().c_str(), "Arguments", MB_OK | MB_ICONINFORMATION);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "ddeimp.hxx"
|
#include "ddeimp.hxx"
|
||||||
@@ -157,12 +156,12 @@ DdeConnection::DdeConnection( const OUString& rService, const OUString& rTopic )
|
|||||||
pInst->nInstanceCli++;
|
pInst->nInstanceCli++;
|
||||||
if ( !pInst->hDdeInstCli )
|
if ( !pInst->hDdeInstCli )
|
||||||
{
|
{
|
||||||
pImp->nStatus = DdeInitialize( &pInst->hDdeInstCli,
|
pImp->nStatus = DdeInitializeW( &pInst->hDdeInstCli,
|
||||||
DdeInternal::CliCallback,
|
DdeInternal::CliCallback,
|
||||||
APPCLASS_STANDARD | APPCMD_CLIENTONLY |
|
APPCLASS_STANDARD | APPCMD_CLIENTONLY |
|
||||||
CBF_FAIL_ALLSVRXACTIONS |
|
CBF_FAIL_ALLSVRXACTIONS |
|
||||||
CBF_SKIP_REGISTRATIONS |
|
CBF_SKIP_REGISTRATIONS |
|
||||||
CBF_SKIP_UNREGISTRATIONS, 0L );
|
CBF_SKIP_UNREGISTRATIONS, 0L );
|
||||||
}
|
}
|
||||||
|
|
||||||
pService = new DdeString( pInst->hDdeInstCli, rService );
|
pService = new DdeString( pInst->hDdeInstCli, rService );
|
||||||
|
@@ -22,8 +22,6 @@
|
|||||||
// Format numbers to be the same! If that's not the case, we need to
|
// Format numbers to be the same! If that's not the case, we need to
|
||||||
// adapt the code here. The implementation uses the conversions here.
|
// adapt the code here. The implementation uses the conversions here.
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ddeimp.hxx"
|
#include "ddeimp.hxx"
|
||||||
#include <svl/svdde.hxx>
|
#include <svl/svdde.hxx>
|
||||||
@@ -136,7 +134,7 @@ sal_uLong DdeData::GetExternalFormat(SotClipboardFormatId nFmt)
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
OUString aName( SotExchange::GetFormatName( nFmt ) );
|
OUString aName( SotExchange::GetFormatName( nFmt ) );
|
||||||
if( !aName.isEmpty() )
|
if( !aName.isEmpty() )
|
||||||
return RegisterClipboardFormat( reinterpret_cast<LPCWSTR>(aName.getStr()) );
|
return RegisterClipboardFormatW( SAL_W(aName.getStr()) );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,10 +155,10 @@ SotClipboardFormatId DdeData::GetInternalFormat(sal_uLong nFmt)
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
if( nFmt >= CF_MAX )
|
if( nFmt >= CF_MAX )
|
||||||
{
|
{
|
||||||
TCHAR szName[ 256 ];
|
WCHAR szName[ 256 ];
|
||||||
|
|
||||||
if(GetClipboardFormatName( nFmt, szName, sizeof(szName) ))
|
if(GetClipboardFormatNameW( nFmt, szName, SAL_N_ELEMENTS(szName) ))
|
||||||
return SotExchange::RegisterFormatName( OUString(reinterpret_cast<const sal_Unicode*>(szName)) );
|
return SotExchange::RegisterFormatName( SAL_U(szName) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@@ -18,15 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
|
|
||||||
#include "ddeimp.hxx"
|
#include "ddeimp.hxx"
|
||||||
#include <svl/svdde.hxx>
|
#include <svl/svdde.hxx>
|
||||||
|
|
||||||
DdeString::DdeString( DWORD hDdeInst, const OUString& r)
|
DdeString::DdeString( DWORD hDdeInst, const OUString& r)
|
||||||
: m_aString(r)
|
: m_aString(r)
|
||||||
{
|
{
|
||||||
hString = DdeCreateStringHandle( hDdeInst, reinterpret_cast<wchar_t const *>(r.getStr()), CP_WINUNICODE );
|
hString = DdeCreateStringHandleW( hDdeInst, SAL_W(r.getStr()), CP_WINUNICODE );
|
||||||
hInst = hDdeInst;
|
hInst = hDdeInst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UNICODE
|
|
||||||
#include "ddeimp.hxx"
|
#include "ddeimp.hxx"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -79,10 +78,10 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback(
|
|||||||
{
|
{
|
||||||
int nTopics = 0;
|
int nTopics = 0;
|
||||||
|
|
||||||
TCHAR chTopicBuf[250];
|
WCHAR chTopicBuf[250];
|
||||||
if( hText1 )
|
if( hText1 )
|
||||||
DdeQueryString( pInst->hDdeInstSvr, hText1, chTopicBuf,
|
DdeQueryStringW( pInst->hDdeInstSvr, hText1, chTopicBuf,
|
||||||
sizeof(chTopicBuf)/sizeof(TCHAR), CP_WINUNICODE );
|
SAL_N_ELEMENTS(chTopicBuf), CP_WINUNICODE );
|
||||||
|
|
||||||
for (DdeServices::iterator aI = rAll.begin(); aI != rAll.end(); ++aI)
|
for (DdeServices::iterator aI = rAll.begin(); aI != rAll.end(); ++aI)
|
||||||
{
|
{
|
||||||
@@ -98,7 +97,7 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback(
|
|||||||
while( -1 != n )
|
while( -1 != n )
|
||||||
{
|
{
|
||||||
OUString s( sTopics.getToken( 0, '\t', n ));
|
OUString s( sTopics.getToken( 0, '\t', n ));
|
||||||
if( s == reinterpret_cast<const sal_Unicode*>(chTopicBuf) )
|
if( s == SAL_U(chTopicBuf) )
|
||||||
++nTopics;
|
++nTopics;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +124,7 @@ HDDEDATA CALLBACK DdeInternal::SvrCallback(
|
|||||||
{
|
{
|
||||||
OUString s( sTopics.getToken( 0, '\t', n ));
|
OUString s( sTopics.getToken( 0, '\t', n ));
|
||||||
s = s.replaceAll("\n", "").replaceAll("\r", "");
|
s = s.replaceAll("\n", "").replaceAll("\r", "");
|
||||||
if( !hText1 || s == reinterpret_cast<const sal_Unicode*>(chTopicBuf) )
|
if( !hText1 || s == SAL_U(chTopicBuf) )
|
||||||
{
|
{
|
||||||
DdeString aDStr( pInst->hDdeInstSvr, s );
|
DdeString aDStr( pInst->hDdeInstSvr, s );
|
||||||
pTopic = FindTopic( *pService, aDStr.getHSZ() );
|
pTopic = FindTopic( *pService, aDStr.getHSZ() );
|
||||||
@@ -233,15 +232,15 @@ found:
|
|||||||
OUString aRes; // Must be free not until the end!
|
OUString aRes; // Must be free not until the end!
|
||||||
if ( pTopic->IsSystemTopic() )
|
if ( pTopic->IsSystemTopic() )
|
||||||
{
|
{
|
||||||
if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_TOPICS) )
|
if ( pTopic->aItem == SZDDESYS_ITEM_TOPICS )
|
||||||
aRes = pService->Topics();
|
aRes = pService->Topics();
|
||||||
else if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_SYSITEMS) )
|
else if ( pTopic->aItem == SZDDESYS_ITEM_SYSITEMS )
|
||||||
aRes = pService->SysItems();
|
aRes = pService->SysItems();
|
||||||
else if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_STATUS) )
|
else if ( pTopic->aItem == SZDDESYS_ITEM_STATUS )
|
||||||
aRes = pService->Status();
|
aRes = pService->Status();
|
||||||
else if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_FORMATS) )
|
else if ( pTopic->aItem == SZDDESYS_ITEM_FORMATS )
|
||||||
aRes = pService->Formats();
|
aRes = pService->Formats();
|
||||||
else if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_HELP) )
|
else if ( pTopic->aItem == SZDDESYS_ITEM_HELP )
|
||||||
aRes = OUString();
|
aRes = OUString();
|
||||||
else
|
else
|
||||||
aRes = OUString();
|
aRes = OUString();
|
||||||
@@ -392,8 +391,8 @@ DdeTopic* DdeInternal::FindTopic( DdeService& rService, HSZ hTopic )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Let's query our subclass
|
// Let's query our subclass
|
||||||
TCHAR chBuf[250];
|
WCHAR chBuf[250];
|
||||||
DdeQueryString(pInst->hDdeInstSvr,hTopic,chBuf,sizeof(chBuf)/sizeof(TCHAR),CP_WINUNICODE );
|
DdeQueryStringW(pInst->hDdeInstSvr,hTopic,chBuf,SAL_N_ELEMENTS(chBuf),CP_WINUNICODE );
|
||||||
bContinue = false;
|
bContinue = false;
|
||||||
// We need to search again
|
// We need to search again
|
||||||
}
|
}
|
||||||
@@ -422,9 +421,9 @@ DdeItem* DdeInternal::FindItem( DdeTopic& rTopic, HSZ hItem )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Let's query our subclass
|
// Let's query our subclass
|
||||||
TCHAR chBuf[250];
|
WCHAR chBuf[250];
|
||||||
DdeQueryString(pInst->hDdeInstSvr,hItem,chBuf,sizeof(chBuf)/sizeof(TCHAR),CP_WINUNICODE );
|
DdeQueryStringW(pInst->hDdeInstSvr,hItem,chBuf,SAL_N_ELEMENTS(chBuf),CP_WINUNICODE );
|
||||||
bContinue = rTopic.MakeItem( reinterpret_cast<const sal_Unicode*>(chBuf) );
|
bContinue = rTopic.MakeItem( SAL_U(chBuf) );
|
||||||
// We need to search again
|
// We need to search again
|
||||||
}
|
}
|
||||||
while( bContinue );
|
while( bContinue );
|
||||||
@@ -443,11 +442,11 @@ DdeService::DdeService( const OUString& rService )
|
|||||||
if ( !pInst->hDdeInstSvr )
|
if ( !pInst->hDdeInstSvr )
|
||||||
{
|
{
|
||||||
nStatus = sal::static_int_cast< short >(
|
nStatus = sal::static_int_cast< short >(
|
||||||
DdeInitialize( &pInst->hDdeInstSvr,
|
DdeInitializeW( &pInst->hDdeInstSvr,
|
||||||
DdeInternal::SvrCallback,
|
DdeInternal::SvrCallback,
|
||||||
APPCLASS_STANDARD |
|
APPCLASS_STANDARD |
|
||||||
CBF_SKIP_REGISTRATIONS |
|
CBF_SKIP_REGISTRATIONS |
|
||||||
CBF_SKIP_UNREGISTRATIONS, 0L ) );
|
CBF_SKIP_UNREGISTRATIONS, 0L ) );
|
||||||
pInst->pServicesSvr = new DdeServices;
|
pInst->pServicesSvr = new DdeServices;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -468,12 +467,12 @@ DdeService::DdeService( const OUString& rService )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
AddFormat( SotClipboardFormatId::STRING );
|
AddFormat( SotClipboardFormatId::STRING );
|
||||||
pSysTopic = new DdeTopic( reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC) );
|
pSysTopic = new DdeTopic( SZDDESYS_TOPIC );
|
||||||
pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_TOPICS) ) );
|
pSysTopic->AddItem( DdeItem( SZDDESYS_ITEM_TOPICS ) );
|
||||||
pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_SYSITEMS) ) );
|
pSysTopic->AddItem( DdeItem( SZDDESYS_ITEM_SYSITEMS ) );
|
||||||
pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_STATUS) ) );
|
pSysTopic->AddItem( DdeItem( SZDDESYS_ITEM_STATUS ) );
|
||||||
pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_FORMATS) ) );
|
pSysTopic->AddItem( DdeItem( SZDDESYS_ITEM_FORMATS ) );
|
||||||
pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_HELP) ) );
|
pSysTopic->AddItem( DdeItem( SZDDESYS_ITEM_HELP ) );
|
||||||
AddTopic( *pSysTopic );
|
AddTopic( *pSysTopic );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,7 +607,7 @@ const OUString DdeTopic::GetName() const
|
|||||||
|
|
||||||
bool DdeTopic::IsSystemTopic()
|
bool DdeTopic::IsSystemTopic()
|
||||||
{
|
{
|
||||||
return GetName() == reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC);
|
return GetName() == SZDDESYS_TOPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
DdeItem* DdeTopic::AddItem( const DdeItem& r )
|
DdeItem* DdeTopic::AddItem( const DdeItem& r )
|
||||||
@@ -859,7 +858,7 @@ OUString DdeService::SysItems()
|
|||||||
std::vector<DdeItem*>::iterator iterItem;
|
std::vector<DdeItem*>::iterator iterItem;
|
||||||
for ( iter = aTopics.begin(); iter != aTopics.end(); ++iter )
|
for ( iter = aTopics.begin(); iter != aTopics.end(); ++iter )
|
||||||
{
|
{
|
||||||
if ( (*iter)->GetName() == reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC) )
|
if ( (*iter)->GetName() == SZDDESYS_TOPIC )
|
||||||
{
|
{
|
||||||
short n = 0;
|
short n = 0;
|
||||||
for ( iterItem = (*iter)->aItems.begin(); iterItem != (*iter)->aItems.end(); ++iterItem, n++ )
|
for ( iterItem = (*iter)->aItems.begin(); iterItem != (*iter)->aItems.end(); ++iterItem, n++ )
|
||||||
@@ -913,9 +912,9 @@ OUString DdeService::Formats()
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
TCHAR buf[128];
|
WCHAR buf[128];
|
||||||
GetClipboardFormatName( (UINT)f, buf, sizeof(buf) / sizeof(TCHAR) );
|
GetClipboardFormatNameW( (UINT)f, buf, SAL_N_ELEMENTS(buf) );
|
||||||
s += OUString(reinterpret_cast<sal_Unicode*>(buf));
|
s += SAL_U(buf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -20,11 +20,6 @@
|
|||||||
./bin/update_pch_bisect ./svx/inc/pch/precompiled_svx.hxx "/opt/lo/bin/make svx.build" --find-conflicts
|
./bin/update_pch_bisect ./svx/inc/pch/precompiled_svx.hxx "/opt/lo/bin/make svx.build" --find-conflicts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define UNICODE
|
|
||||||
#define _UNICODE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
@@ -29,6 +29,9 @@
|
|||||||
#pragma warning (push, 1)
|
#pragma warning (push, 1)
|
||||||
#pragma warning (disable: 4005)
|
#pragma warning (disable: 4005)
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined WINVER
|
||||||
|
# define WINVER 0x0400
|
||||||
|
#endif
|
||||||
#if !defined WIN32_LEAN_AND_MEAN
|
#if !defined WIN32_LEAN_AND_MEAN
|
||||||
# define WIN32_LEAN_AND_MEAN
|
# define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
@@ -36,7 +39,6 @@
|
|||||||
#if defined _MSC_VER
|
#if defined _MSC_VER
|
||||||
#pragma warning (pop)
|
#pragma warning (pop)
|
||||||
#endif
|
#endif
|
||||||
#include <tchar.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace ::ooo::vba;
|
using namespace ::ooo::vba;
|
||||||
@@ -97,7 +99,7 @@ uno::Any PrivateProfileStringListener::getValueEvent()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get key/value from windows register
|
// get key/value from Windows registry
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HKEY hBaseKey = nullptr;
|
HKEY hBaseKey = nullptr;
|
||||||
OString sSubKey;
|
OString sSubKey;
|
||||||
@@ -105,21 +107,23 @@ uno::Any PrivateProfileStringListener::getValueEvent()
|
|||||||
if( hBaseKey != nullptr )
|
if( hBaseKey != nullptr )
|
||||||
{
|
{
|
||||||
HKEY hKey = nullptr;
|
HKEY hKey = nullptr;
|
||||||
LONG lResult;
|
LPCSTR lpSubKey = sSubKey.getStr();
|
||||||
LPCTSTR lpSubKey = TEXT( sSubKey.getStr());
|
// We use RegOpenKeyExA here for convenience, because we already have subkey name as 8-bit string
|
||||||
TCHAR szBuffer[1024];
|
LONG lResult = RegOpenKeyExA( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
|
||||||
DWORD cbData = sizeof( szBuffer );
|
|
||||||
lResult = RegOpenKeyEx( hBaseKey, lpSubKey, 0, KEY_QUERY_VALUE, &hKey );
|
|
||||||
if( ERROR_SUCCESS == lResult )
|
if( ERROR_SUCCESS == lResult )
|
||||||
{
|
{
|
||||||
LPCTSTR lpValueName = TEXT(maKey.getStr());
|
OUString sUValName = OStringToOUString(maKey, RTL_TEXTENCODING_DONTKNOW);
|
||||||
lResult = RegQueryValueEx( hKey, lpValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer), &cbData );
|
LPCWSTR lpValueName = SAL_W(sUValName.getStr());
|
||||||
|
WCHAR szBuffer[1024];
|
||||||
|
DWORD cbData = sizeof(szBuffer);
|
||||||
|
lResult = RegQueryValueExW( hKey, lpValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(szBuffer), &cbData );
|
||||||
RegCloseKey( hKey );
|
RegCloseKey( hKey );
|
||||||
sValue = OUString::createFromAscii(szBuffer);
|
// https://msdn.microsoft.com/en-us/ms724911 mentions that
|
||||||
|
// "the string may not have been stored with the proper terminating null characters"
|
||||||
|
szBuffer[std::min(size_t(cbData / sizeof(szBuffer[0])), SAL_N_ELEMENTS(szBuffer)-1)] = 0;
|
||||||
|
sValue = SAL_U(szBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return uno::makeAny( sValue );
|
|
||||||
#else
|
#else
|
||||||
throw uno::RuntimeException("Only support on Windows" );
|
throw uno::RuntimeException("Only support on Windows" );
|
||||||
#endif
|
#endif
|
||||||
@@ -142,7 +146,7 @@ void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//set value into windows register
|
//set value into Windows registry
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HKEY hBaseKey = nullptr;
|
HKEY hBaseKey = nullptr;
|
||||||
OString sSubKey;
|
OString sSubKey;
|
||||||
@@ -150,15 +154,15 @@ void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
|
|||||||
if( hBaseKey != nullptr )
|
if( hBaseKey != nullptr )
|
||||||
{
|
{
|
||||||
HKEY hKey = nullptr;
|
HKEY hKey = nullptr;
|
||||||
LONG lResult;
|
LPCSTR lpSubKey = sSubKey.getStr();
|
||||||
LPCTSTR lpSubKey = TEXT( sSubKey.getStr());
|
// We use RegCreateKeyExA here for convenience, because we already have subkey name as 8-bit string
|
||||||
lResult = RegCreateKeyEx( hBaseKey, lpSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &hKey, nullptr );
|
LONG lResult = RegCreateKeyExA( hBaseKey, lpSubKey, 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &hKey, nullptr );
|
||||||
if( ERROR_SUCCESS == lResult )
|
if( ERROR_SUCCESS == lResult )
|
||||||
{
|
{
|
||||||
OString aUTF8Value = OUStringToOString( aValue, RTL_TEXTENCODING_UTF8 );
|
DWORD cbData = sizeof(WCHAR) * (aValue.getLength() + 1);
|
||||||
DWORD cbData = sizeof(TCHAR) * (_tcslen(aUTF8Value.getStr()) + 1);
|
OUString sUValName = OStringToOUString(maKey, RTL_TEXTENCODING_DONTKNOW);
|
||||||
LPCTSTR lpValueName = TEXT(maKey.getStr());
|
LPCWSTR lpValueName = SAL_W(sUValName.getStr());
|
||||||
lResult = RegSetValueEx( hKey, lpValueName, 0 /* Reserved */, REG_SZ, reinterpret_cast<BYTE const *>(aUTF8Value.getStr()), cbData );
|
lResult = RegSetValueExW( hKey, lpValueName, 0 /* Reserved */, REG_SZ, reinterpret_cast<BYTE const *>(aValue.getStr()), cbData );
|
||||||
RegCloseKey( hKey );
|
RegCloseKey( hKey );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user