Kaydet (Commit) e80aef4e authored tarafından Mike Kaganski's avatar Mike Kaganski

shell: use Unicode on Windows

Change-Id: I9f7962db320f8832879ba327108425a7592b4b77
Reviewed-on: https://gerrit.libreoffice.org/42885Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 09917566
......@@ -28,6 +28,7 @@
#include "xml_parser.hxx"
#include "zipfile.hxx"
#include <filepath.hxx>
class CBaseReader : public i_xml_parser_event_handler
{
......@@ -35,7 +36,7 @@ public:
virtual ~CBaseReader() override;
protected: // protected because its only an implementation relevant class
CBaseReader( const std::string& DocumentName );
CBaseReader( const Filepath_t& DocumentName );
CBaseReader( StreamInterface *stream );
......
......@@ -22,6 +22,7 @@
#include "basereader.hxx"
#include <stack>
#include <filepath.hxx>
class ITag;
class StreamInterface;
......@@ -31,7 +32,7 @@ class CContentReader : public CBaseReader
public:
virtual ~CContentReader() override;
CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale );
CContentReader( const Filepath_t& DocumentName, LocaleSet_t const & DocumentLocale );
CContentReader( StreamInterface* stream, LocaleSet_t const & DocumentLocale );
......
......@@ -23,6 +23,7 @@
#include "global.hxx"
#include <string>
#include <filepath.hxx>
// A simple table with information about the currently used OO file extensions
// for instance ".sxw" and information about windows registry keys which are
......@@ -34,20 +35,19 @@
*/
struct FileExtensionEntry
{
const char* ExtensionAnsi; // e.g. ".sxw"
const wchar_t* ExtensionUnicode; // e.g. L".sxw"
const char* RegistryForwardKey; // e.g. "soffice.StarWriterDocument.6"
const char* ExtensionA; // e.g. ".sxw"
const wchar_t* ExtensionU; // e.g. L".sxw"
const wchar_t* RegistryForwardKey; // e.g. "soffice.StarWriterDocument.6"
};
extern const FileExtensionEntry OOFileExtensionTable[];
extern const size_t OOFileExtensionTableSize;
/** Return the extension of a file
name without the '.'
*/
std::string get_file_name_extension(const std::string& file_name);
Filepath_t get_file_name_extension(const Filepath_t& file_name);
/** Return the type of a file
......@@ -55,7 +55,7 @@ std::string get_file_name_extension(const std::string& file_name);
enum File_Type_t { UNKNOWN, WRITER, CALC, DRAW, IMPRESS, MATH, WEB, DATABASE };
File_Type_t get_file_type(const std::string& file_name);
File_Type_t get_file_type(const Filepath_t& file_name);
#endif
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SHELL_INC_INTERNAL_FILEPATH_HXX
#define INCLUDED_SHELL_INC_INTERNAL_FILEPATH_HXX
// typedefs to allow using Unicode paths on Windows
#include <string>
#if defined _WIN32
typedef wchar_t Filepath_char_t;
typedef std::wstring Filepath_t;
#else
typedef char Filepath_char_t;
typedef std::string Filepath_t;
#endif
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -30,6 +30,7 @@
#pragma warning(pop)
#endif
#include <string>
#include <filepath.hxx>
class CInfoTip : public IQueryInfo, public IPersistFile
{
......@@ -84,9 +85,9 @@ public:
/* [out] */ LPOLESTR __RPC_FAR *ppszFileName) override;
private:
long m_RefCnt;
char m_szFileName[MAX_PATH];
std::wstring m_FileNameOnly;
long m_RefCnt;
Filepath_char_t m_szFileName[MAX_PATH];
std::wstring m_FileNameOnly;
};
#endif
......
......@@ -23,6 +23,7 @@
#include "basereader.hxx"
#include "types.hxx"
#include <stack>
#include <filepath.hxx>
class ITag;
class CKeywordsTag;
......@@ -34,7 +35,7 @@ class CMetaInfoReader : public CBaseReader
public:
virtual ~CMetaInfoReader() override;
CMetaInfoReader( const std::string& DocumentName );
CMetaInfoReader( const Filepath_t& DocumentName );
CMetaInfoReader( StreamInterface* stream );
......
......@@ -31,6 +31,7 @@
#endif
#include <string>
#include <memory>
#include <filepath.hxx>
class CPropertySheet : public IShellExtInit, public IShellPropSheetExt
{
......@@ -80,7 +81,7 @@ private:
private:
long m_RefCnt;
char m_szFileName[MAX_PATH];
Filepath_char_t m_szFileName[MAX_PATH];
};
#endif
......
......@@ -32,30 +32,31 @@
#pragma warning(pop)
#endif
#include <string>
#include <filepath.hxx>
/** Sets a value of the specified registry key, an empty ValueName sets the default
value
Returns true on success
*/
bool SetRegistryKey(HKEY RootKey, const char* KeyName, const char* ValueName, const char* Value);
bool SetRegistryKey(HKEY RootKey, const Filepath_char_t* KeyName, const Filepath_char_t* ValueName, const Filepath_char_t* Value);
/** Deletes the specified registry key and all of its subkeys
Returns true on success
*/
bool DeleteRegistryKey(HKEY RootKey, const char* KeyName);
bool DeleteRegistryKey(HKEY RootKey, const Filepath_char_t* KeyName);
/** May be used to determine if the specified registry key has subkeys
The function returns true on success else if an error occurs false
*/
bool HasSubkeysRegistryKey(HKEY RootKey, const char* KeyName, bool& bResult);
bool HasSubkeysRegistryKey(HKEY RootKey, const Filepath_char_t* KeyName, bool& bResult);
/** Converts a GUID to its string representation
*/
std::string ClsidToString(const CLSID& clsid);
Filepath_t ClsidToString(const CLSID& clsid);
/** Get the content of a specific key.
*/
bool QueryRegistryKey(HKEY RootKey, const char* KeyName, const char* ValueName, char *pszData, DWORD dwBufLen);
bool QueryRegistryKey(HKEY RootKey, const Filepath_char_t* KeyName, const Filepath_char_t* ValueName, Filepath_char_t *pszData, DWORD dwBufLen);
#endif
......
......@@ -21,6 +21,7 @@
#define INCLUDED_SHELL_INC_INTERNAL_STREAM_HELPER_HXX
#include "types.hxx"
#include <filepath.hxx>
struct IStream;
......@@ -39,7 +40,7 @@ private:
class FileStream : public StreamInterface
{
public:
FileStream(const char *filename);
FileStream(const Filepath_char_t *filename);
~FileStream() override;
unsigned long sread (unsigned char *buf, unsigned long size) override;
long stell () override;
......
......@@ -92,18 +92,18 @@ LCID LocaleSetToLCID( const LocaleSet_t & Locale );
#ifdef DEBUG
inline void OutputDebugStringFormatA( LPCSTR pFormat, ... )
inline void OutputDebugStringFormatW( LPCWSTR pFormat, ... )
{
CHAR buffer[1024];
WCHAR buffer[1024];
va_list args;
va_start( args, pFormat );
StringCchVPrintfA( buffer, sizeof(buffer), pFormat, args );
StringCchVPrintfW( buffer, sizeof(buffer)/sizeof(*buffer), pFormat, args );
va_end( args );
OutputDebugStringA( buffer );
OutputDebugStringW( buffer );
}
#else
static inline void OutputDebugStringFormatA( LPCSTR, ... )
static inline void OutputDebugStringFormatW( LPCWSTR, ... )
{
}
#endif
......
......@@ -25,6 +25,7 @@
#include <string>
#include <vector>
#include <memory>
#include <filepath.hxx>
class StreamInterface;
......@@ -34,7 +35,6 @@ class StreamInterface;
class ZipFile
{
public:
typedef std::vector<std::string> Directory_t;
typedef std::unique_ptr<Directory_t> DirectoryPtr_t;
typedef std::vector<char> ZipContentBuffer_t;
......@@ -54,7 +54,7 @@ public:
IOException if the specified file doesn't exist
AccessViolationException if read access to the file is denied
*/
static bool IsZipFile(const std::string &FileName);
static bool IsZipFile(const Filepath_t &FileName);
static bool IsZipFile(void *stream);
......@@ -74,7 +74,7 @@ public:
IOException if the specified file doesn't exist or is no zip file
AccessViolationException if read access to the file is denied
*/
static bool IsValidZipFileVersionNumber(const std::string &FileName);
static bool IsValidZipFileVersionNumber(const Filepath_t &FileName);
static bool IsValidZipFileVersionNumber(void *stream);
......@@ -92,7 +92,7 @@ public:
WrongZipVersionException if the zip file cannot be uncompressed
with the used zlib version
*/
ZipFile(const std::string &FileName);
ZipFile(const Filepath_t &FileName);
ZipFile(StreamInterface *stream);
......
......@@ -42,7 +42,7 @@ using namespace std;
class Test : public CppUnit::TestFixture
{
private:
string documentName;
wstring documentName;
LPSTREAM pStream;
public:
Test();
......@@ -66,16 +66,16 @@ CPPUNIT_TEST_SUITE_REGISTRATION(Test);
Test::Test() : documentName(), pStream(nullptr)
{
const char* pSrcRoot = getenv( "SRC_ROOT" );
const wchar_t* pSrcRoot = _wgetenv(L"SRC_ROOT");
if (pSrcRoot)
{
documentName.append(pSrcRoot);
documentName.append("/");
documentName.append(L"/");
}
documentName.append("shell/qa/zip/simpledocument.odt");
documentName.append(L"shell/qa/zip/simpledocument.odt");
// Create an IStream pointer from the file
HANDLE hFile = CreateFileA(documentName.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr);
HANDLE hFile = CreateFileW(documentName.c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr);
DWORD dwFileSize = GetFileSize(hFile, nullptr);
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, dwFileSize);
......
......@@ -44,17 +44,17 @@
css::beans::Optional<css::uno::Any> ImplGetLocale(LCID lcid)
{
CHAR buffer[8];
PSTR cp = buffer;
WCHAR buffer[8];
PWSTR cp = buffer;
cp += GetLocaleInfoA( lcid, LOCALE_SISO639LANGNAME , buffer, 4 );
cp += GetLocaleInfoW( lcid, LOCALE_SISO639LANGNAME, buffer, 4 );
if( cp > buffer )
{
if( 0 < GetLocaleInfoA( lcid, LOCALE_SISO3166CTRYNAME, cp, buffer + 8 - cp) )
if( 0 < GetLocaleInfoW( lcid, LOCALE_SISO3166CTRYNAME, cp, buffer + 8 - cp) )
// #i50822# minus character must be written before cp
*(cp - 1) = '-';
return {true, css::uno::Any(OUString::createFromAscii(buffer))};
return {true, css::uno::Any(OUString(SAL_U(buffer)))};
}
return {false, {}};
......
......@@ -35,7 +35,7 @@
#pragma warning(pop)
#endif
#define WININET_DLL_NAME "wininet.dll"
#define WININET_DLL_NAME L"wininet.dll"
#define EQUAL_SIGN '='
#define COLON ':'
#define SPACE ' '
......@@ -102,14 +102,14 @@ namespace
WinInetBackend::WinInetBackend()
{
Library hWinInetDll( LoadLibrary( WININET_DLL_NAME ) );
Library hWinInetDll( LoadLibraryW( WININET_DLL_NAME ) );
if( hWinInetDll.module )
{
typedef BOOL ( WINAPI *InternetQueryOption_Proc_T )( HINTERNET, DWORD, LPVOID, LPDWORD );
InternetQueryOption_Proc_T lpfnInternetQueryOption =
reinterpret_cast< InternetQueryOption_Proc_T >(
GetProcAddress( hWinInetDll.module, "InternetQueryOptionA" ) );
GetProcAddress( hWinInetDll.module, "InternetQueryOptionW" ) );
if (lpfnInternetQueryOption)
{
// Some Windows versions would fail the InternetQueryOption call
......@@ -120,7 +120,7 @@ WinInetBackend::WinInetBackend()
// reallocation:
INTERNET_PROXY_INFO pi;
LPINTERNET_PROXY_INFO lpi = &pi;
DWORD dwLength = sizeof (INTERNET_PROXY_INFO);
DWORD dwLength = sizeof (pi);
BOOL ok = lpfnInternetQueryOption(
nullptr,
INTERNET_OPTION_PROXY,
......@@ -165,8 +165,10 @@ WinInetBackend::WinInetBackend()
// an empty proxy list, so we don't have to check if
// proxy is enabled or not
OUString aProxyList = OUString::createFromAscii( lpi->lpszProxy );
OUString aProxyBypassList = OUString::createFromAscii( lpi->lpszProxyBypass );
// We use a W-version of InternetQueryOption; it returns struct with pointers to wide strings
// There's no INTERNET_PROXY_INFOW, so we simply cast returned struct's members
OUString aProxyList = reinterpret_cast<const sal_Unicode*>( lpi->lpszProxy );
OUString aProxyBypassList = reinterpret_cast<const sal_Unicode*>( lpi->lpszProxyBypass );
// override default for ProxyType, which is "0" meaning "No proxies".
valueProxyType_.IsPresent = true;
......
......@@ -30,19 +30,19 @@
typedef HRESULT (__stdcall *lpfnDllRegisterServer)();
typedef HRESULT (__stdcall *lpfnDllUnregisterServer)();
bool IsUnregisterParameter(const char* Param)
bool IsUnregisterParameter(const wchar_t* Param)
{
return ((0 == _stricmp(Param, "/u")) ||
(0 == _stricmp(Param, "-u")));
return ((0 == _wcsicmp(Param, L"/u")) ||
(0 == _wcsicmp(Param, L"-u")));
}
int main(int argc, char* argv[])
int wmain(int argc, wchar_t* argv[])
{
HMODULE hmod;
if (2 == argc)
{
hmod = LoadLibraryA(argv[1]);
hmod = LoadLibraryW(argv[1]);
if (hmod)
{
......@@ -57,7 +57,7 @@ int main(int argc, char* argv[])
}
else if (3 == argc && IsUnregisterParameter(argv[1]))
{
hmod = LoadLibraryA(argv[2]);
hmod = LoadLibraryW(argv[2]);
if (hmod)
{
......
......@@ -297,8 +297,8 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
ZeroMemory(&sei, sizeof( sei));
sei.cbSize = sizeof(sei);
sei.lpFile = reinterpret_cast<LPCWSTR>(preprocessed_command.getStr());
sei.lpParameters = reinterpret_cast<LPCWSTR>(aParameter.getStr());
sei.lpFile = SAL_W(preprocessed_command.getStr());
sei.lpParameters = SAL_W(aParameter.getStr());
sei.nShow = SW_SHOWNORMAL;
if (NO_SYSTEM_ERROR_MESSAGE & nFlags)
......
......@@ -26,7 +26,7 @@
/** constructor of CBaseReader.
*/
CBaseReader::CBaseReader(const std::string& DocumentName):
CBaseReader::CBaseReader(const std::wstring& DocumentName):
m_ZipFile( DocumentName )
{
}
......
......@@ -26,7 +26,7 @@
/** constructor.
*/
CContentReader::CContentReader( const std::string& DocumentName, LocaleSet_t const & DocumentLocale ):
CContentReader::CContentReader( const std::wstring& DocumentName, LocaleSet_t const & DocumentLocale ):
CBaseReader( DocumentName )
{
try
......
......@@ -26,7 +26,7 @@
/** constructor.
*/
CMetaInfoReader::CMetaInfoReader( const std::string& DocumentName ):
CMetaInfoReader::CMetaInfoReader( const std::wstring& DocumentName ):
CBaseReader( DocumentName )
{
try
......
......@@ -45,7 +45,7 @@ bool IsOOFileExtension(wchar_t const * Extension)
{
for (size_t i = 0; i < OOFileExtensionTableSize; i++)
{
if (0 == _wcsicmp(Extension, OOFileExtensionTable[i].ExtensionUnicode))
if (0 == _wcsicmp(Extension, OOFileExtensionTable[i].ExtensionU))
return true;
}
......@@ -139,7 +139,7 @@ HRESULT STDMETHODCALLTYPE CColumnInfo::GetItemData(LPCSHCOLUMNID pscid, LPCSHCOL
{
std::wstring fname = getShortPathName( std::wstring( pscd->wszFile ) );
CMetaInfoReader meta_info_accessor(WStringToString(fname));
CMetaInfoReader meta_info_accessor(fname);
VariantClear(pvarData);
......
......@@ -101,23 +101,23 @@ ULONG STDMETHODCALLTYPE CInfoTip::Release()
/** get file type information from registry.
*/
std::wstring getFileTypeInfo(const std::string& file_extension)
std::wstring getFileTypeInfo(const std::wstring& file_extension)
{
char extKeyValue[MAX_STRING];
char typeKeyValue[MAX_STRING];
::std::string sDot(".");
if (QueryRegistryKey(HKEY_CLASSES_ROOT, (sDot.append(file_extension)).c_str(), "", extKeyValue, MAX_STRING))
if (QueryRegistryKey( HKEY_CLASSES_ROOT, extKeyValue, "",typeKeyValue, MAX_STRING))
return StringToWString(typeKeyValue);
wchar_t extKeyValue[MAX_STRING];
wchar_t typeKeyValue[MAX_STRING];
::std::wstring sDot(L".");
if (QueryRegistryKey(HKEY_CLASSES_ROOT, (sDot.append(file_extension)).c_str(), L"", extKeyValue, MAX_STRING))
if (QueryRegistryKey( HKEY_CLASSES_ROOT, extKeyValue, L"",typeKeyValue, MAX_STRING))
return typeKeyValue;
return EMPTY_STRING;
}
/** get file size.
*/
DWORD getSizeOfFile( char const * FileName )
DWORD getSizeOfFile( wchar_t const * FileName )
{
HANDLE hFile = CreateFile(StringToWString(FileName).c_str(), // open file
HANDLE hFile = CreateFileW(FileName, // open file
GENERIC_READ, // open for reading
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, // share for all operations
nullptr, // no security
......@@ -178,7 +178,7 @@ std::wstring formatSizeOfFile( DWORD dwSize )
/** get file size information.
*/
std::wstring getFileSizeInfo(char const * FileName)
std::wstring getFileSizeInfo(wchar_t const * FileName)
{
DWORD dwSize=getSizeOfFile(FileName);
if (dwSize != INVALID_FILE_SIZE)
......@@ -329,13 +329,11 @@ HRESULT STDMETHODCALLTYPE CInfoTip::Load(LPCOLESTR pszFileName, DWORD /*dwMode*/
fname = getShortPathName( fname );
std::string fnameA = WStringToString(fname);
// ZeroMemory because strncpy doesn't '\0'-terminates the destination
// string; reserve the last place in the buffer for the final '\0'
// that's why '(sizeof(m_szFileName) - 1)'
ZeroMemory(m_szFileName, sizeof(m_szFileName));
strncpy(m_szFileName, fnameA.c_str(), (sizeof(m_szFileName) - 1));
wcsncpy(m_szFileName, fname.c_str(), (sizeof(m_szFileName)/sizeof(*m_szFileName) - 1));
return S_OK;
}
......
......@@ -571,10 +571,10 @@ SCODE STDMETHODCALLTYPE COooFilter::Load(LPCWSTR pszFileName, DWORD /*dwMode*/)
try
{
delete m_pMetaInfoReader;
m_pMetaInfoReader = new CMetaInfoReader(WStringToString(m_pwszFileName));
m_pMetaInfoReader = new CMetaInfoReader(m_pwszFileName);
delete m_pContentReader;
m_pContentReader = new CContentReader(WStringToString(m_pwszFileName), m_pMetaInfoReader->getDefaultLocale());
m_pContentReader = new CContentReader(m_pwszFileName, m_pMetaInfoReader->getDefaultLocale());
}
catch (const std::exception&)
{
......
......@@ -106,11 +106,11 @@ long BufferStream::sseek (long offset, int origin)
return -1;
}
FileStream::FileStream(const char *filename) :
FileStream::FileStream(const wchar_t *filename) :
file(nullptr)
{
// fdo#67534: avoid locking to not interfere with soffice opening the file
file = _fsopen(filename, "rb", _SH_DENYNO);
file = _wfsopen(filename, L"rb", _SH_DENYNO);
}
FileStream::~FileStream()
......
......@@ -63,7 +63,7 @@ CPropertyHdl::CPropertyHdl( long nRefCnt ) :
m_RefCnt( nRefCnt ),
m_pCache( nullptr )
{
OutputDebugStringFormatA( "CPropertyHdl: CTOR\n" );
OutputDebugStringFormatW( L"CPropertyHdl: CTOR\n" );
InterlockedIncrement( &g_DllRefCnt );
}
......@@ -87,7 +87,7 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::QueryInterface(REFIID riid, void __RPC_F
if (IID_IUnknown == riid || IID_IPropertyStore == riid)
{
OutputDebugStringFormatA( "CPropertyHdl: QueryInterface (IID_IPropertyStore)\n" );
OutputDebugStringFormatW( L"CPropertyHdl: QueryInterface (IID_IPropertyStore)\n" );
IUnknown* pUnk = static_cast<IPropertyStore*>(this);
pUnk->AddRef();
*ppvObject = pUnk;
......@@ -95,7 +95,7 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::QueryInterface(REFIID riid, void __RPC_F
}
else if (IID_IPropertyStoreCapabilities == riid)
{
OutputDebugStringFormatA( "CPropertyHdl: QueryInterface (IID_IPropertyStoreCapabilities)\n" );
OutputDebugStringFormatW( L"CPropertyHdl: QueryInterface (IID_IPropertyStoreCapabilities)\n" );
IUnknown* pUnk = static_cast<IPropertyStore*>(this);
pUnk->AddRef();
*ppvObject = pUnk;
......@@ -103,13 +103,13 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::QueryInterface(REFIID riid, void __RPC_F
}
else if (IID_IInitializeWithStream == riid)
{
OutputDebugStringFormatA( "CPropertyHdl: QueryInterface (IID_IInitializeWithStream)\n" );
OutputDebugStringFormatW( L"CPropertyHdl: QueryInterface (IID_IInitializeWithStream)\n" );
IUnknown* pUnk = static_cast<IInitializeWithStream*>(this);
pUnk->AddRef();
*ppvObject = pUnk;
return S_OK;
}
OutputDebugStringFormatA( "CPropertyHdl: QueryInterface (something different)\n" );
OutputDebugStringFormatW( L"CPropertyHdl: QueryInterface (something different)\n" );
return E_NOINTERFACE;
}
......@@ -208,7 +208,7 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::Initialize( IStream *pStream, DWORD grfM
if ( !m_pCache )
{
if ( FAILED( PSCreateMemoryPropertyStore( IID_PPV_ARGS( &m_pCache ) ) ) )
OutputDebugStringFormatA( "CPropertyHdl::Initialize: PSCreateMemoryPropertyStore failed" );
OutputDebugStringFormatW( L"CPropertyHdl::Initialize: PSCreateMemoryPropertyStore failed" );
BufferStream tmpStream(pStream);
......@@ -222,7 +222,9 @@ HRESULT STDMETHODCALLTYPE CPropertyHdl::Initialize( IStream *pStream, DWORD grfM
}
catch (const std::exception& e)
{
OutputDebugStringFormatA( "CPropertyHdl::Initialize: Caught exception [%s]", e.what() );
// To output 8-bit string using unicode version of formatting functions, use capital %S type
// see https://msdn.microsoft.com/en-us/library/hf4y5e3w
OutputDebugStringFormatW( L"CPropertyHdl::Initialize: Caught exception [%S]", e.what() );
return E_FAIL;
}
}
......@@ -238,37 +240,37 @@ HRESULT GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex, PROPVARIANT
case 0: {
pVarData->vt = VT_BSTR;
pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagData( META_INFO_TITLE ).c_str() );
OutputDebugStringFormatA( "CPropertyHdl::GetItemData: Title=%S.\n", pMetaInfoReader->getTagData( META_INFO_TITLE ).c_str() );
OutputDebugStringFormatW( L"CPropertyHdl::GetItemData: Title=%s.\n", pMetaInfoReader->getTagData( META_INFO_TITLE ).c_str() );
return S_OK;
}
case 1: {
pVarData->vt = VT_BSTR;
pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagData( META_INFO_AUTHOR ).c_str() );
OutputDebugStringFormatA( "CPropertyHdl::GetItemData: Author=%S.\n", pMetaInfoReader->getTagData( META_INFO_AUTHOR ).c_str() );
OutputDebugStringFormatW( L"CPropertyHdl::GetItemData: Author=%s.\n", pMetaInfoReader->getTagData( META_INFO_AUTHOR ).c_str() );
return S_OK;
}
case 2: {
pVarData->vt = VT_BSTR;
pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagData( META_INFO_SUBJECT ).c_str() );
OutputDebugStringFormatA( "CPropertyHdl::GetItemData: Subject=%S.\n", pMetaInfoReader->getTagData( META_INFO_SUBJECT ).c_str() );
OutputDebugStringFormatW( L"CPropertyHdl::GetItemData: Subject=%s.\n", pMetaInfoReader->getTagData( META_INFO_SUBJECT ).c_str() );
return S_OK;
}
case 3: {
pVarData->vt = VT_BSTR;
pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagData( META_INFO_KEYWORDS ).c_str() );
OutputDebugStringFormatA( "CPropertyHdl::GetItemData: Keywords=%S.\n", pMetaInfoReader->getTagData( META_INFO_KEYWORDS ).c_str() );
OutputDebugStringFormatW( L"CPropertyHdl::GetItemData: Keywords=%s.\n", pMetaInfoReader->getTagData( META_INFO_KEYWORDS ).c_str() );
return S_OK;
}
case 4: {
pVarData->vt = VT_BSTR;
pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagData( META_INFO_DESCRIPTION ).c_str() );
OutputDebugStringFormatA( "CPropertyHdl::GetItemData: Description=%S.\n", pMetaInfoReader->getTagData( META_INFO_DESCRIPTION ).c_str() );
OutputDebugStringFormatW( L"CPropertyHdl::GetItemData: Description=%s.\n", pMetaInfoReader->getTagData( META_INFO_DESCRIPTION ).c_str() );
return S_OK;
}
case 5: {
pVarData->vt = VT_BSTR;
pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagAttribute( META_INFO_DOCUMENT_STATISTIC, META_INFO_PAGES ).c_str() );
OutputDebugStringFormatA( "CPropertyHdl::GetItemData: Pages=%S.\n", pMetaInfoReader->getTagAttribute( META_INFO_DOCUMENT_STATISTIC, META_INFO_PAGES ).c_str() );
OutputDebugStringFormatW( L"CPropertyHdl::GetItemData: Pages=%s.\n", pMetaInfoReader->getTagAttribute( META_INFO_DOCUMENT_STATISTIC, META_INFO_PAGES ).c_str() );
return S_OK;
}
}
......@@ -280,7 +282,7 @@ HRESULT GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex, PROPVARIANT
void CPropertyHdl::LoadProperties( CMetaInfoReader *pMetaInfoReader )
{
OutputDebugStringFormatA( "CPropertyHdl: LoadProperties\n" );
OutputDebugStringFormatW( L"CPropertyHdl: LoadProperties\n" );
PROPVARIANT propvarValues;
for ( UINT i = 0; i < (UINT)gPropertyMapTableSize; ++i )
......@@ -403,7 +405,7 @@ bool CClassFactory::IsLocked()
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
{
OutputDebugStringFormatA( "DllGetClassObject.\n" );
OutputDebugStringFormatW( L"DllGetClassObject.\n" );
*ppv = nullptr;
if ( rclsid != CLSID_PROPERTY_HANDLER )
......@@ -420,7 +422,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
STDAPI DllCanUnloadNow()
{
OutputDebugStringFormatA( "DllCanUnloadNow.\n" );
OutputDebugStringFormatW( L"DllCanUnloadNow.\n" );
if (CClassFactory::IsLocked() || g_DllRefCnt > 0)
return S_FALSE;
......@@ -430,7 +432,7 @@ STDAPI DllCanUnloadNow()