summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2010-02-15 15:07:47 +0100
committerVladimir Glazunov <vg@openoffice.org>2010-02-15 15:07:47 +0100
commit4c5ed8017b3d4235b75e9998b4892c65dd352efa (patch)
tree6333d0bf3bdad1bc255265ead3f30b132b6bd4bd /shell
parent28bf0d7b7731420c7c237dfb39553c52f380b1d9 (diff)
parent7c411e2bf9d8e3648506ee2478943098d23e4b9e (diff)
CWS-TOOLING: integrate CWS dv17
Diffstat (limited to 'shell')
-rwxr-xr-x[-rw-r--r--]shell/inc/internal/metainforeader.hxx2
-rwxr-xr-xshell/inc/internal/propertyhdl.hxx126
-rwxr-xr-x[-rw-r--r--]shell/inc/internal/shlxthdl.hxx0
-rwxr-xr-xshell/inc/internal/stream_helper.hxx35
-rwxr-xr-x[-rw-r--r--]shell/prj/build.lst5
-rw-r--r--[-rwxr-xr-x]shell/prj/d.lst1
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/classfactory.cxx0
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/makefile.mk9
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/ooofilt/makefile.mk6
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx114
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx47
-rwxr-xr-xshell/source/win32/shlxthandler/ooofilt/stream_helper.cxx181
-rwxr-xr-xshell/source/win32/shlxthandler/prophdl/exports.dxp2
-rwxr-xr-xshell/source/win32/shlxthandler/prophdl/makefile.mk130
-rwxr-xr-xshell/source/win32/shlxthandler/prophdl/propertyhdl.cxx459
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/propsheets/propsheets.cxx57
-rwxr-xr-x[-rw-r--r--]shell/source/win32/shlxthandler/shlxthdl.cxx11
17 files changed, 1006 insertions, 179 deletions
diff --git a/shell/inc/internal/metainforeader.hxx b/shell/inc/internal/metainforeader.hxx
index 3a494cd34b..9c9b962617 100644..100755
--- a/shell/inc/internal/metainforeader.hxx
+++ b/shell/inc/internal/metainforeader.hxx
@@ -46,7 +46,7 @@ public:
CMetaInfoReader( const std::string& DocumentName );
- CMetaInfoReader( void* stream, zlib_filefunc_def* fa);
+ CMetaInfoReader( void* stream, zlib_filefunc_def* fa);
/** check if the Tag is in the target meta.xml file.
diff --git a/shell/inc/internal/propertyhdl.hxx b/shell/inc/internal/propertyhdl.hxx
new file mode 100755
index 0000000000..2b1b50255c
--- /dev/null
+++ b/shell/inc/internal/propertyhdl.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: PropertyHdl.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef PROPERTYHDL_HXX_INCLUDED
+#define PROPERTYHDL_HXX_INCLUDED
+
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#pragma warning(disable:4917)
+#endif
+#include <shlobj.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+// {AE424E85-F6DF-4910-A6A9-438797986431}
+const CLSID CLSID_PROPERTY_HANDLER =
+{ 0xae424e85, 0xf6df, 0x4910, { 0xa6, 0xa9, 0x43, 0x87, 0x97, 0x98, 0x64, 0x31 } };
+
+class CMetaInfoReader;
+
+class CPropertyHdl : public IPropertyStore,
+ public IPropertyStoreCapabilities,
+ public IInitializeWithStream
+{
+public:
+ CPropertyHdl(long RefCnt = 1);
+ virtual ~CPropertyHdl();
+
+ //-----------------------------
+ // IUnknown methods
+ //-----------------------------
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(
+ REFIID riid,
+ void __RPC_FAR *__RPC_FAR *ppvObject );
+ virtual ULONG STDMETHODCALLTYPE AddRef( void );
+ virtual ULONG STDMETHODCALLTYPE Release( void );
+
+ //-----------------------------
+ // IPropertyStore
+ //-----------------------------
+ virtual HRESULT STDMETHODCALLTYPE GetCount( DWORD *pcProps );
+ virtual HRESULT STDMETHODCALLTYPE GetAt( DWORD iProp, PROPERTYKEY *pkey );
+ virtual HRESULT STDMETHODCALLTYPE GetValue( REFPROPERTYKEY key, PROPVARIANT *pPropVar );
+ virtual HRESULT STDMETHODCALLTYPE SetValue( REFPROPERTYKEY key, REFPROPVARIANT propVar );
+ virtual HRESULT STDMETHODCALLTYPE Commit();
+
+ //-----------------------------
+ // IPropertyStoreCapabilities
+ //-----------------------------
+ virtual HRESULT STDMETHODCALLTYPE IsPropertyWritable( REFPROPERTYKEY key );
+
+ //-----------------------------
+ // IInitializeWithStream
+ //-----------------------------
+ virtual HRESULT STDMETHODCALLTYPE Initialize(IStream *pStream, DWORD grfMode);
+
+private:
+ void LoadProperties( CMetaInfoReader *pMetaInfoReader );
+ HRESULT GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex, PROPVARIANT *pVarData );
+
+private:
+ long m_RefCnt;
+ IPropertyStoreCache* m_pCache;
+};
+
+class CClassFactory : public IClassFactory
+{
+public:
+ CClassFactory( const CLSID& clsid );
+ virtual ~CClassFactory();
+
+ //-----------------------------
+ // IUnknown methods
+ //-----------------------------
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(
+ REFIID riid,
+ void __RPC_FAR *__RPC_FAR *ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef( void );
+ virtual ULONG STDMETHODCALLTYPE Release( void );
+
+ //-----------------------------
+ // IClassFactory methods
+ //-----------------------------
+ virtual HRESULT STDMETHODCALLTYPE CreateInstance(
+ IUnknown __RPC_FAR *pUnkOuter,
+ REFIID riid,
+ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ virtual HRESULT STDMETHODCALLTYPE LockServer( BOOL fLock );
+ static bool IsLocked();
+
+private:
+ long m_RefCnt;
+ CLSID m_Clsid;
+ static long s_ServerLocks;
+};
+
+#endif
diff --git a/shell/inc/internal/shlxthdl.hxx b/shell/inc/internal/shlxthdl.hxx
index 0806d9df6e..0806d9df6e 100644..100755
--- a/shell/inc/internal/shlxthdl.hxx
+++ b/shell/inc/internal/shlxthdl.hxx
diff --git a/shell/inc/internal/stream_helper.hxx b/shell/inc/internal/stream_helper.hxx
new file mode 100755
index 0000000000..d7eb99bd18
--- /dev/null
+++ b/shell/inc/internal/stream_helper.hxx
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef STREAM_HELPER_HXX_INCLUDED
+#define STREAM_HELPER_HXX_INCLUDED
+
+#include "internal/types.hxx"
+
+IStream* PrepareIStream( IStream* pStream, zlib_filefunc_def &zFileFunc );
+
+#endif
diff --git a/shell/prj/build.lst b/shell/prj/build.lst
index becde6d21f..0d8559f1e0 100644..100755
--- a/shell/prj/build.lst
+++ b/shell/prj/build.lst
@@ -16,13 +16,16 @@ sl shell\source\all\zipfile nmake - w sl_all_zipfil
sl shell\source\all\zipfile nmake - p sl_all_zipfile sl_inc NULL
sl shell\source\all\ooofilereader nmake - w sl_all_ooofilereader sl_all_zipfile.w sl_all sl_inc NULL
sl shell\source\all\ooofilereader nmake - p sl_all_ooofilereader sl_all_zipfile.w sl_all sl_inc NULL
+sl shell\source\win32\shlxthandler\ooofilt\proxy nmake - w sl_win32_ooofiltproxy sl_inc NULL
sl shell\source\win32\shlxthandler\res nmake - w sl_win32_shlxthandler_res sl_win32_lngconv.w sl_inc NULL
sl shell\source\win32\shlxthandler\util nmake - w sl_win32_shlxthandler_util sl_inc NULL
sl shell\source\win32\shlxthandler\propsheets nmake - w sl_win32_shlxthandler_propsheets sl_inc NULL
sl shell\source\win32\shlxthandler\infotips nmake - w sl_win32_shlxthandler_infotips sl_inc NULL
sl shell\source\win32\shlxthandler\columninfo nmake - w sl_win32_shlxthandler_columninfo sl_inc NULL
sl shell\source\win32\shlxthandler\thumbviewer nmake - w sl_win32_shlxthandler_thumbviewer sl_inc NULL
-sl shell\source\win32\shlxthandler nmake - w sl_win32_shlxthandler sl_win32_lngconv.w sl_win32_shlxthandler_res.w sl_win32_shlxthandler_util.w sl_all_zipfile.w sl_all_ooofilereader.w sl_win32_shlxthandler_propsheets.w sl_win32_shlxthandler_infotips.w sl_win32_shlxthandler_columninfo.w sl_win32_shlxthandler_thumbviewer.w sl_inc NULL
+sl shell\source\win32\shlxthandler\prophdl nmake - w sl_win32_shlxthandler_prophdl sl_win32_shlxthandler_ooofilt.w sl_inc NULL
+sl shell\source\win32\shlxthandler\ooofilt nmake - w sl_win32_shlxthandler_ooofilt sl_all_zipfile.w sl_all_ooofilereader.w sl_win32_shlxthandler_util.w sl_all sl_inc NULL
+sl shell\source\win32\shlxthandler nmake - w sl_win32_shlxthandler sl_win32_lngconv.w sl_win32_shlxthandler_res.w sl_win32_shlxthandler_util.w sl_all_zipfile.w sl_all_ooofilereader.w sl_win32_shlxthandler_propsheets.w sl_win32_shlxthandler_infotips.w sl_win32_shlxthandler_columninfo.w sl_win32_shlxthandler_thumbviewer.w sl_win32_shlxthandler_prophdl.w sl_inc sl_win32_shlxthandler_ooofilt.w NULL
sl shell\source\backends\localebe nmake - all sl_backends_localebe sl_inc NULL
sl shell\source\backends\wininetbe nmake - w sl_backends_wininetbe sl_inc NULL
sl shell\source\backends\macbe nmake - u sl_backends_macbe sl_inc NULL
diff --git a/shell/prj/d.lst b/shell/prj/d.lst
index eee13ef34f..ea8be0bbaf 100755..100644
--- a/shell/prj/d.lst
+++ b/shell/prj/d.lst
@@ -7,6 +7,7 @@
..\%__SRC%\bin\x64\shlxthdl.dll %_DEST%\bin%_EXT%\shlxthdl_x64.dll
..\%__SRC%\bin\x64\ooofiltproxy.dll %_DEST%\bin%_EXT%\ooofiltproxy_x64.dll
..\%__SRC%\bin\x64\ooofilt.dll %_DEST%\bin%_EXT%\ooofilt_x64.dll
+..\%__SRC%\bin\x64\propertyhdl.dll %_DEST%\bin%_EXT%\propertyhdl_x64.dll
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
diff --git a/shell/source/win32/shlxthandler/classfactory.cxx b/shell/source/win32/shlxthandler/classfactory.cxx
index a7b729d03a..a7b729d03a 100644..100755
--- a/shell/source/win32/shlxthandler/classfactory.cxx
+++ b/shell/source/win32/shlxthandler/classfactory.cxx
diff --git a/shell/source/win32/shlxthandler/makefile.mk b/shell/source/win32/shlxthandler/makefile.mk
index d85e5d4d5f..a22479d360 100644..100755
--- a/shell/source/win32/shlxthandler/makefile.mk
+++ b/shell/source/win32/shlxthandler/makefile.mk
@@ -6,10 +6,6 @@
#
# OpenOffice.org - a multi-platform office productivity suite
#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.14 $
-#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
@@ -58,7 +54,7 @@ SLOFILES=$(SLO)$/classfactory.obj\
$(SLO)$/shlxthdl.obj\
$(SLO)$/listviewbuilder.obj\
$(SLO)$/document_statistic.obj\
- $(SLO)$/thumbviewer.obj
+ $(SLO)$/thumbviewer.obj\
SHL1TARGET=$(TARGET)
@@ -81,6 +77,7 @@ SHL1STDLIBS+=\
$(GDI32LIB)\
$(GDIPLUSLIB)\
msvcprt.lib
+ $(SHLWAPILIB)
SHL1LIBS+=$(SLB)$/util.lib\
$(SLB)$/ooofilereader.lib
@@ -109,7 +106,7 @@ SLOFILES_X64= \
$(SLO_X64)$/shlxthdl.obj\
$(SLO_X64)$/listviewbuilder.obj\
$(SLO_X64)$/document_statistic.obj\
- $(SLO_X64)$/thumbviewer.obj
+ $(SLO_X64)$/thumbviewer.obj\
SHL1TARGET_X64=$(TARGET)
SHL1LIBS_X64=$(SOLARLIBDIR_X64)$/zlib.lib\
diff --git a/shell/source/win32/shlxthandler/ooofilt/makefile.mk b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
index f8e53d030b..2f1c69548a 100644..100755
--- a/shell/source/win32/shlxthandler/ooofilt/makefile.mk
+++ b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
@@ -55,7 +55,8 @@ CDEFS+=-D_WIN32_IE=0x501
# --- Files --------------------------------------------------------
SLOFILES=$(SLO)$/ooofilt.obj\
- $(SLO)$/propspec.obj
+ $(SLO)$/propspec.obj\
+ $(SLO)$/stream_helper.obj
# $(SLO)$/utilities.obj
# $(SLO)$/dbgmacros.obj
@@ -99,7 +100,8 @@ CDEFS_X64+=-D_WIN32_IE=0x501
USE_DEFFILE_X64=TRUE
SLOFILES_X64=$(SLO_X64)$/ooofilt.obj\
- $(SLO_X64)$/propspec.obj
+ $(SLO_X64)$/propspec.obj\
+ $(SLO_X64)$/stream_helper.obj
SHL1TARGET_X64=$(TARGET)
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
index a20192748d..669685b06f 100644..100755
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx
@@ -86,6 +86,7 @@
using ::std::min;
#endif
+#include "internal/stream_helper.hxx"
//C-------------------------------------------------------------------------
//
@@ -738,23 +739,9 @@ SCODE STDMETHODCALLTYPE COooFilter::SaveCompleted(LPCWSTR /*pszFileName*/)
//--------------------------------------------------------------------------
SCODE STDMETHODCALLTYPE COooFilter::Load(IStream *pStm)
{
-
- // These next few lines work around the "Seek pointer" bug found on Vista.
-
- char buf[20];
- unsigned long count;
- HRESULT hr;
- ULARGE_INTEGER NewPosition;
- LARGE_INTEGER Move;
- Move.QuadPart = 0;
- hr = pStm->Seek (Move, STREAM_SEEK_SET, &NewPosition);
- hr = pStm->Read (buf, 20, &count);
-
zlib_filefunc_def z_filefunc;
- fill_stream_filefunc (&z_filefunc);
- z_filefunc.opaque = (void*)pStm;
- m_pStream = pStm;
+ m_pStream = PrepareIStream( pStm, z_filefunc );
try
{
@@ -1504,100 +1491,3 @@ STDAPI DllUnregisterServer()
*/
return S_OK;
}
-
-extern "C" {
-
- // IStream callback
- voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* /*filename*/, int /*mode*/) {
- return opaque;
- }
-
- uLong ZCALLBACK cb_sread (voidpf /*opaque*/, voidpf stream, void* buf, uLong size) {
- unsigned long newsize;
- HRESULT hr;
-
- hr = ((IStream *)stream)->Read (buf, size, &newsize);
- if (hr == S_OK){
- return (unsigned long)newsize;
- }
- else {
- return (uLong)0;
- }
- }
-
- long ZCALLBACK cb_sseek (voidpf /*opaque*/, voidpf stream, uLong offset, int origin) {
- // IStream::Seek parameters
- HRESULT hr;
- LARGE_INTEGER Move;
- DWORD dwOrigin;
- Move.QuadPart = (__int64)offset;
-
- switch (origin) {
- case SEEK_CUR:
- dwOrigin = STREAM_SEEK_CUR;
- break;
- case SEEK_END:
- dwOrigin = STREAM_SEEK_END;
- break;
- case SEEK_SET:
- dwOrigin = STREAM_SEEK_SET;
- break;
- default:
- return -1;
- }
-
- hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
- if (hr == S_OK){
- return 0;
- }
- else {
- return -1;
- }
- }
-
- long ZCALLBACK cb_stell (voidpf /*opaque*/, voidpf stream) {
- // IStream::Seek parameters
- HRESULT hr;
- LARGE_INTEGER Move;
- ULARGE_INTEGER NewPosition;
- Move.QuadPart = 0;
- NewPosition.QuadPart = 0;
-
- hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
- if (hr == S_OK){
- return (long) NewPosition.QuadPart;
- }
- else {
- return -1;
- }
- }
-
- int ZCALLBACK cb_sclose (voidpf /*opaque*/, voidpf /*stream*/) {
- return 0;
- }
-
- int ZCALLBACK cb_serror (voidpf /*opaque*/, voidpf /*stream*/) {
- return 0; //RJK - for now
- }
-
- uLong ZCALLBACK cb_swrite (voidpf /*opaque*/, voidpf stream, const void* buf, uLong size) {
- HRESULT hr;
- unsigned long writecount;
- hr = ((IStream*)stream)->Write (buf, size, &writecount);
- if (hr == S_OK)
- return (unsigned int)writecount;
- else
- return (uLong)0;
- }
-
- void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) {
- pzlib_filefunc_def->zopen_file = cb_sopen;
- pzlib_filefunc_def->zread_file = cb_sread;
- pzlib_filefunc_def->zwrite_file = cb_swrite;
- pzlib_filefunc_def->ztell_file = cb_stell;
- pzlib_filefunc_def->zseek_file = cb_sseek;
- pzlib_filefunc_def->zclose_file = cb_sclose;
- pzlib_filefunc_def->zerror_file = cb_serror;
- }
-}
-
diff --git a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
index f63a9942f5..1a094b90ce 100644..100755
--- a/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
+++ b/shell/source/win32/shlxthandler/ooofilt/ooofilt.hxx
@@ -96,7 +96,7 @@ enum FilterState
FilteringContent, // Filtering the content property
FilteringProperty // Filtering the pseudo property
};
-class COooFilter : public IFilter, public IPersistFile, public IPersistStream
+class COooFilter : public IFilter, public IPersistFile, public IPersistStream
{
public:
// From IUnknown
@@ -143,16 +143,16 @@ public:
virtual SCODE STDMETHODCALLTYPE GetCurFile(
LPWSTR * ppszFileName);
- // From IPersistStream
- virtual SCODE STDMETHODCALLTYPE Load(
- IStream *pStm);
-
- virtual SCODE STDMETHODCALLTYPE Save(
- IStream *pStm,
- BOOL fClearDirty);
-
- virtual SCODE STDMETHODCALLTYPE GetSizeMax(
- ULARGE_INTEGER *pcbSize);
+ // From IPersistStream
+ virtual SCODE STDMETHODCALLTYPE Load(
+ IStream *pStm);
+
+ virtual SCODE STDMETHODCALLTYPE Save(
+ IStream *pStm,
+ BOOL fClearDirty);
+
+ virtual SCODE STDMETHODCALLTYPE GetSizeMax(
+ ULARGE_INTEGER *pcbSize);
private:
@@ -177,7 +177,7 @@ private:
ULONG m_ChunkPosition; // Chunk pointer to specify the current Chunk;
ULONG m_cAttributes; // Count of attributes
CFullPropSpec * m_pAttributes; // Attributes to filter
- IStream * m_pStream;
+ IStream * m_pStream;
};
@@ -219,26 +219,3 @@ private:
long m_lRefs; // Reference count
};
-
-extern "C" {
-
- voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode));
- uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size));
- uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
- long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream));
- long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin));
- int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream));
- int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream));
-
- void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
-
-}
-
-
-
-
-
-
-
-
-
diff --git a/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx b/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
new file mode 100755
index 0000000000..dc5966ea28
--- /dev/null
+++ b/shell/source/win32/shlxthandler/ooofilt/stream_helper.cxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+
+#if defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#include <windows.h>
+#if defined _MSC_VER
+#pragma warning(pop)
+#endif
+
+#include <stdio.h>
+#include <objidl.h>
+
+/*#include <string.h>
+#include <filter.h>
+#include <filterr.h>
+#include <ntquery.h>
+#include "assert.h"
+#include "propspec.hxx"
+#ifdef __MINGW32__
+#include <algorithm>
+using ::std::min;
+#endif
+*/
+
+#include "internal/stream_helper.hxx"
+
+extern "C" {
+ voidpf ZCALLBACK cb_sopen OF((voidpf opaque, const char * filename, int mode));
+ uLong ZCALLBACK cb_sread OF((voidpf opaque, voidpf stream, void* vuf, uLong size));
+ uLong ZCALLBACK cb_swrite OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+ long ZCALLBACK cb_stell OF((voidpf opaque, voidpf stream));
+ long ZCALLBACK cb_sseek OF((voidpf opaque, voidpf stream, uLong offset, int origin));
+ int ZCALLBACK cb_sclose OF((voidpf opaque, voidpf stream));
+ int ZCALLBACK cb_serror OF((voidpf opaque, voidpf stream));
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
+}
+
+//-----------------------------
+IStream* PrepareIStream( IStream* pStream, zlib_filefunc_def &zFileFunc )
+{
+ // These next few lines work around the "Seek pointer" bug found on Vista.
+ char cBuf[20];
+ unsigned long nCount;
+ HRESULT hr;
+ ULARGE_INTEGER nNewPosition;
+ LARGE_INTEGER nMove;
+ nMove.QuadPart = 0;
+ hr = pStream->Seek( nMove, STREAM_SEEK_SET, &nNewPosition );
+ hr = pStream->Read( cBuf, 20, &nCount );
+
+ fill_stream_filefunc( &zFileFunc );
+ zFileFunc.opaque = (void*)pStream;
+
+ return pStream;
+}
+
+extern "C" {
+
+ // IStream callback
+ voidpf ZCALLBACK cb_sopen (voidpf opaque, const char* /*filename*/, int /*mode*/) {
+ return opaque;
+ }
+
+ uLong ZCALLBACK cb_sread (voidpf /*opaque*/, voidpf stream, void* buf, uLong size) {
+ unsigned long newsize;
+ HRESULT hr;
+
+ hr = ((IStream *)stream)->Read (buf, size, &newsize);
+ if (hr == S_OK){
+ return (unsigned long)newsize;
+ }
+ else {
+ return (uLong)0;
+ }
+ }
+
+ long ZCALLBACK cb_sseek (voidpf /*opaque*/, voidpf stream, uLong offset, int origin) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ DWORD dwOrigin;
+ Move.QuadPart = (__int64)offset;
+
+ switch (origin) {
+ case SEEK_CUR:
+ dwOrigin = STREAM_SEEK_CUR;
+ break;
+ case SEEK_END:
+ dwOrigin = STREAM_SEEK_END;
+ break;
+ case SEEK_SET:
+ dwOrigin = STREAM_SEEK_SET;
+ break;
+ default:
+ return -1;
+ }
+
+ hr = ((IStream*)stream)->Seek (Move, dwOrigin, NULL);
+ if (hr == S_OK){
+ return 0;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ long ZCALLBACK cb_stell (voidpf /*opaque*/, voidpf stream) {
+ // IStream::Seek parameters
+ HRESULT hr;
+ LARGE_INTEGER Move;
+ ULARGE_INTEGER NewPosition;
+ Move.QuadPart = 0;
+ NewPosition.QuadPart = 0;
+
+ hr = ((IStream*)stream)->Seek (Move, STREAM_SEEK_CUR, &NewPosition);
+ if (hr == S_OK){
+ return (long) NewPosition.QuadPart;
+ }
+ else {
+ return -1;
+ }
+ }
+
+ int ZCALLBACK cb_sclose (voidpf /*opaque*/, voidpf /*stream*/) {
+ return 0;
+ }
+
+ int ZCALLBACK cb_serror (voidpf /*opaque*/, voidpf /*stream*/) {
+ return 0; //RJK - for now
+ }
+
+ uLong ZCALLBACK cb_swrite (voidpf /*opaque*/, voidpf stream, const void* buf, uLong size) {
+ HRESULT hr;
+ unsigned long writecount;
+ hr = ((IStream*)stream)->Write (buf, size, &writecount);
+ if (hr == S_OK)
+ return (unsigned int)writecount;
+ else
+ return (uLong)0;
+ }
+
+ void fill_stream_filefunc (zlib_filefunc_def* pzlib_filefunc_def) {
+ pzlib_filefunc_def->zopen_file = cb_sopen;
+ pzlib_filefunc_def->zread_file = cb_sread;
+ pzlib_filefunc_def->zwrite_file = cb_swrite;
+ pzlib_filefunc_def->ztell_file = cb_stell;
+ pzlib_filefunc_def->zseek_file = cb_sseek;
+ pzlib_filefunc_def->zclose_file = cb_sclose;
+ pzlib_filefunc_def->zerror_file = cb_serror;
+ }
+}
diff --git a/shell/source/win32/shlxthandler/prophdl/exports.dxp b/shell/source/win32/shlxthandler/prophdl/exports.dxp
new file mode 100755
index 0000000000..2ada8255f8
--- /dev/null
+++ b/shell/source/win32/shlxthandler/prophdl/exports.dxp
@@ -0,0 +1,2 @@
+DllGetClassObject PRIVATE
+DllCanUnloadNow PRIVATE \ No newline at end of file
diff --git a/shell/source/win32/shlxthandler/prophdl/makefile.mk b/shell/source/win32/shlxthandler/prophdl/makefile.mk
new file mode 100755
index 0000000000..b9153bf014
--- /dev/null
+++ b/shell/source/win32/shlxthandler/prophdl/makefile.mk
@@ -0,0 +1,130 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2010 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..
+PRJNAME=shell
+TARGET=propertyhdl
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+USE_DEFFILE=TRUE
+.IF "$(BUILD_X64)"!=""
+USE_DEFFILE_X64=TRUE
+.ENDIF
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+UWINAPILIB =
+UWINAPILIB_X64 =
+
+CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501
+CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
+CDEFS+=-D_WIN32_IE=0x501
+
+# --- Files --------------------------------------------------------
+
+SLOFILES=$(SLO)$/$(TARGET).obj\
+ $(SLO)$/stream_helper.obj
+
+SHL1TARGET=$(TARGET)
+
+.IF "$(COM)"=="GCC"
+SHL1STDLIBS=$(ZLIB3RDLIB) $(EXPAT3RDLIB) $(COMCTL32LIB)
+SHL1LIBS=
+.ELSE
+SHL1STDLIBS=
+SHL1LIBS=$(SOLARLIBDIR)$/zlib.lib\
+ $(SOLARLIBDIR)$/expat_xmlparse.lib\
+ $(SOLARLIBDIR)$/expat_xmltok.lib
+.ENDIF
+SHL1STDLIBS+=\
+ $(OLEAUT32LIB)\
+ $(ADVAPI32LIB)\
+ $(OLE32LIB)\
+ $(UUIDLIB)\
+ $(SHELL32LIB)\
+ $(KERNEL32LIB)\
+ $(GDI32LIB)\
+ $(GDIPLUSLIB)\
+ $(SHLWAPILIB)\
+ $(PROPSYSLIB)
+
+SHL1LIBS+=$(SLB)$/util.lib\
+ $(SLB)$/ooofilereader.lib
+
+SHL1DEPN=
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+# -------------------- x64 -----------------------
+.IF "$(BUILD_X64)"!=""
+CFLAGS_X64+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK -DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501
+CFLAGS_X64+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
+CDEFS_X64+=-D_WIN32_IE=0x501
+SLOFILES_X64=$(SLO_X64)$/$(TARGET).obj
+
+SLOFILES_X64= \
+ $(SLO_X64)$/propertyhdl.obj\
+ $(SLO_X64)$/stream_helper.obj\
+
+SHL1TARGET_X64=$(TARGET)
+SHL1LIBS_X64=$(SOLARLIBDIR_X64)$/zlib.lib\
+ $(SOLARLIBDIR_X64)$/expat_xmlparse.lib\
+ $(SOLARLIBDIR_X64)$/expat_xmltok.lib
+
+SHL1STDLIBS_X64+=\
+ $(OLEAUT32LIB_X64)\
+ $(ADVAPI32LIB_X64)\
+ $(OLE32LIB_X64)\
+ $(UUIDLIB_X64)\
+ $(SHELL32LIB_X64)\
+ $(KERNEL32LIB_X64)\
+ $(GDI32LIB_X64)\
+ $(USER32LIB_X64) \
+ $(GDIPLUSLIB_X64) \
+ $(MSVCRT_X64) \
+ $(MSVCPRT_X64) \
+ $(OLDNAMESLIB_X64)\
+ $(PROPSYSLIB_X64)
+
+SHL1LIBS_X64+=$(SLB_X64)$/util.lib\
+ $(SLB_X64)$/ooofilereader.lib
+SHL1OBJS_X64=$(SLOFILES_X64)
+SHL1DEF_X64=$(MISC_X64)$/$(SHL1TARGET).def
+
+DEF1NAME_X64=$(SHL1TARGET_X64)
+DEF1EXPORTFILE_X64=exports.dxp
+
+.ENDIF # "$(BUILD_X64)"!=""
+
+# --- Targets ------------------------------------------------------
+.INCLUDE : set_wntx64.mk
+.INCLUDE : target.mk
+.INCLUDE : tg_wntx64.mk \ No newline at end of file
diff --git a/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
new file mode 100755
index 0000000000..cbe4638658
--- /dev/null
+++ b/shell/source/win32/shlxthandler/prophdl/propertyhdl.cxx
@@ -0,0 +1,459 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2010 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_shell.hxx"
+#include "internal/global.hxx"
+#include "internal/PropertyHdl.hxx"
+#include "internal/fileextensions.hxx"
+#include "internal/metainforeader.hxx"
+#include "internal/utilities.hxx"
+#include "internal/config.hxx"
+
+#include <propkey.h>
+#include <propvarutil.h>
+
+#include <malloc.h>
+#include <strsafe.h>
+
+#include "internal/stream_helper.hxx"
+
+//---------------------------
+// Module global
+//---------------------------
+long g_DllRefCnt = 0;
+HINSTANCE g_hModule = NULL;
+
+//
+// Map of property keys to the locations of their value(s) in the .??? XML schema
+//
+struct PROPERTYMAP
+{
+ PROPERTYKEY key;
+ PCWSTR pszXPathParent;
+ PCWSTR pszValueNodeName;
+};
+
+PROPERTYMAP g_rgPROPERTYMAP[] =
+{
+ { PKEY_Title, L"OpenOffice.org", L"Title" },
+ { PKEY_Author, L"OpenOffice.org", L"Author" },
+ { PKEY_Subject, L"OpenOffice.org", L"Subject" },
+ { PKEY_Keywords, L"OpenOffice.org", L"Keyword" },
+ { PKEY_Comment, L"OpenOffice.org", L"Comments" },
+};
+
+size_t gPropertyMapTableSize = sizeof(g_rgPROPERTYMAP)/sizeof(g_rgPROPERTYMAP[0]);
+
+//----------------------------
+//
+//----------------------------
+
+CPropertyHdl::CPropertyHdl( long nRefCnt ) :
+ m_RefCnt( nRefCnt ),
+ m_pCache( NULL )
+{
+ OutputDebugStringFormat( "CPropertyHdl: CTOR\n" );
+ InterlockedIncrement( &g_DllRefCnt );
+}
+
+//----------------------------
+//
+//----------------------------
+
+CPropertyHdl::~CPropertyHdl()
+{
+ if ( m_pCache )
+ {
+ m_pCache->Release();
+ m_pCache = NULL;
+ }
+ InterlockedDecrement( &g_DllRefCnt );
+}
+
+//-----------------------------
+// IUnknown methods
+//-----------------------------
+HRESULT STDMETHODCALLTYPE CPropertyHdl::QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
+{
+ *ppvObject = 0;
+
+ if (IID_IUnknown == riid || IID_IPropertyStore == riid)
+ {
+ OutputDebugStringFormat( "CPropertyHdl: QueryInterface (IID_IPropertyStore)\n" );
+ IUnknown* pUnk = static_cast<IPropertyStore*>(this);
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
+ else if (IID_IPropertyStoreCapabilities == riid)
+ {
+ OutputDebugStringFormat( "CPropertyHdl: QueryInterface (IID_IPropertyStoreCapabilities)\n" );
+ IUnknown* pUnk = static_cast<IPropertyStore*>(this);
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
+ else if (IID_IInitializeWithStream == riid)
+ {
+ OutputDebugStringFormat( "CPropertyHdl: QueryInterface (IID_IInitializeWithStream)\n" );
+ IUnknown* pUnk = static_cast<IInitializeWithStream*>(this);
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
+ OutputDebugStringFormat( "CPropertyHdl: QueryInterface (something different)\n" );
+
+ return E_NOINTERFACE;
+}
+
+//----------------------------
+ULONG STDMETHODCALLTYPE CPropertyHdl::AddRef( void )
+{
+ return InterlockedIncrement( &m_RefCnt );
+}
+
+//----------------------------
+ULONG STDMETHODCALLTYPE CPropertyHdl::Release( void )
+{
+ long refcnt = InterlockedDecrement( &m_RefCnt );
+
+ if ( 0 == m_RefCnt )
+ delete this;
+
+ return refcnt;
+}
+
+//-----------------------------
+// IPropertyStore
+//-----------------------------
+HRESULT STDMETHODCALLTYPE CPropertyHdl::GetCount( DWORD *pcProps )
+{
+ HRESULT hr = E_UNEXPECTED;
+ if ( m_pCache && pcProps )
+ {
+ hr = m_pCache->GetCount( pcProps );
+ }
+
+ return hr;
+}
+
+//-----------------------------
+HRESULT STDMETHODCALLTYPE CPropertyHdl::GetAt( DWORD iProp, PROPERTYKEY *pKey )
+{
+ HRESULT hr = E_UNEXPECTED;
+ if ( m_pCache )
+ {
+ hr = m_pCache->GetAt( iProp, pKey );
+ }
+
+ return hr;
+}
+
+//-----------------------------
+HRESULT STDMETHODCALLTYPE CPropertyHdl::GetValue( REFPROPERTYKEY key, PROPVARIANT *pPropVar )
+{
+ HRESULT hr = E_UNEXPECTED;
+ if ( m_pCache )
+ {
+ hr = m_pCache->GetValue( key, pPropVar );
+ }
+
+ return hr;
+}
+
+//-----------------------------
+HRESULT STDMETHODCALLTYPE CPropertyHdl::SetValue( REFPROPERTYKEY key, REFPROPVARIANT propVar )
+{
+ HRESULT hr = E_UNEXPECTED;
+ if ( m_pCache )
+ {
+ hr = STG_E_ACCESSDENIED;
+ }
+ return hr;
+}
+
+//-----------------------------
+HRESULT STDMETHODCALLTYPE CPropertyHdl::Commit()
+{
+ return S_OK;
+}
+
+//-----------------------------
+// IPropertyStore
+//-----------------------------
+HRESULT STDMETHODCALLTYPE CPropertyHdl::IsPropertyWritable( REFPROPERTYKEY key )
+{
+ // We start with read only properties only
+ return S_FALSE;
+}
+
+//-----------------------------
+// IInitializeWithStream
+//-----------------------------
+HRESULT STDMETHODCALLTYPE CPropertyHdl::Initialize( IStream *pStream, DWORD grfMode )
+{
+ if ( grfMode & STGM_READWRITE )
+ return STG_E_ACCESSDENIED;
+
+ if ( !m_pCache )
+ {
+ if ( FAILED( PSCreateMemoryPropertyStore( IID_PPV_ARGS( &m_pCache ) ) ) )
+ OutputDebugStringFormat( "CPropertyHdl::Initialize: PSCreateMemoryPropertyStore failed" );
+
+ zlib_filefunc_def z_filefunc;
+ pStream = PrepareIStream( pStream, z_filefunc );
+
+ CMetaInfoReader *pMetaInfoReader = NULL;
+
+ try
+ {
+ pMetaInfoReader = new CMetaInfoReader( (void*)pStream, &z_filefunc );
+ }
+ catch (const std::exception& e)
+ {
+ OutputDebugStringFormat( "CPropertyHdl::Initialize: Caught exception [%s]", e.what() );
+ return E_FAIL;
+ }
+
+ LoadProperties( pMetaInfoReader );
+/*
+ // load extended properties and search content
+ _LoadExtendedProperties();
+ _LoadSearchContent();
+*/
+ }
+
+ return S_OK;
+}
+
+//-----------------------------
+void CPropertyHdl::LoadProperties( CMetaInfoReader *pMetaInfoReader )
+{
+ OutputDebugStringFormat( "CPropertyHdl: LoadProperties\n" );
+ PROPVARIANT propvarValues;
+
+ for ( UINT i = 0; i < (UINT)gPropertyMapTableSize; ++i )
+ {
+ PropVariantClear( &propvarValues );
+ HRESULT hr = GetItemData( pMetaInfoReader, i, &propvarValues);
+ if (hr == S_OK)
+ {
+ // coerce the value(s) to the appropriate type for the property key
+ hr = PSCoerceToCanonicalValue( g_rgPROPERTYMAP[i].key, &propvarValues );
+ if (SUCCEEDED(hr))
+ {
+ // cache the value(s) loaded
+ hr = m_pCache->SetValueAndState( g_rgPROPERTYMAP[i].key, &propvarValues, PSC_NORMAL );
+ }
+ }
+ }
+}
+
+//-----------------------------
+HRESULT CPropertyHdl::GetItemData( CMetaInfoReader *pMetaInfoReader, UINT nIndex, PROPVARIANT *pVarData )
+{
+ switch (nIndex) {
+ case 0: {
+ pVarData->vt = VT_BSTR;
+ pVarData->bstrVal = SysAllocString( pMetaInfoReader->getTagData( META_INFO_TITLE ).c_str() );
+ OutputDebugStringFormat( "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() );
+ OutputDebugStringFormat( "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() );
+ OutputDebugStringFormat( "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() );
+ OutputDebugStringFormat( "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() );
+ OutputDebugStringFormat( "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() );
+ OutputDebugStringFormat( "CPropertyHdl::GetItemData: Pages=%S.\n", pMetaInfoReader->getTagAttribute( META_INFO_DOCUMENT_STATISTIC, META_INFO_PAGES ).c_str() );
+ return S_OK;
+ }
+ }
+
+ return S_FALSE;
+}
+
+//-----------------------------------------------------------------------------
+// CClassFactory
+//-----------------------------------------------------------------------------
+
+long CClassFactory::s_ServerLocks = 0;
+
+//-----------------------------------------------------------------------------
+CClassFactory::CClassFactory( const CLSID& clsid ) :
+ m_RefCnt(1),
+ m_Clsid(clsid)
+{
+ InterlockedIncrement( &g_DllRefCnt );
+}
+
+//-----------------------------------------------------------------------------
+CClassFactory::~CClassFactory()
+{
+ InterlockedDecrement( &g_DllRefCnt );
+}
+
+//-----------------------------------------------------------------------------
+// IUnknown methods
+//-----------------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE CClassFactory::QueryInterface( REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject )
+{
+ *ppvObject = 0;
+
+ if ( IID_IUnknown == riid || IID_IClassFactory == riid )
+ {
+ IUnknown* pUnk = this;
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
+
+ return E_NOINTERFACE;
+}
+
+//-----------------------------------------------------------------------------
+ULONG STDMETHODCALLTYPE CClassFactory::AddRef( void )
+{
+ return InterlockedIncrement( &m_RefCnt );
+}
+
+//-----------------------------------------------------------------------------
+ULONG STDMETHODCALLTYPE CClassFactory::Release( void )
+{
+ long refcnt = InterlockedDecrement( &m_RefCnt );
+
+ if (0 == refcnt)
+ delete this;
+
+ return refcnt;
+}
+
+//-----------------------------------------------------------------------------
+// IClassFactory methods
+//-----------------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE CClassFactory::CreateInstance(
+ IUnknown __RPC_FAR *pUnkOuter,
+ REFIID riid,
+ void __RPC_FAR *__RPC_FAR *ppvObject)
+{
+ if ( pUnkOuter != NULL )
+ return CLASS_E_NOAGGREGATION;
+
+ IUnknown* pUnk = 0;
+
+ if ( CLSID_PROPERTY_HANDLER == m_Clsid )
+ pUnk = static_cast<IPropertyStore*>( new CPropertyHdl() );
+
+ POST_CONDITION(pUnk != 0, "Could not create COM object");
+
+ if (0 == pUnk)
+ return E_OUTOFMEMORY;
+
+ HRESULT hr = pUnk->QueryInterface( riid, ppvObject );
+
+ // if QueryInterface failed the component will destroy itself
+ pUnk->Release();
+
+ return hr;
+}
+
+//-----------------------------------------------------------------------------
+HRESULT STDMETHODCALLTYPE CClassFactory::LockServer( BOOL fLock )
+{
+ if ( fLock )
+ InterlockedIncrement( &s_ServerLocks );
+ else
+ InterlockedDecrement( &s_ServerLocks );
+
+ return S_OK;
+}
+
+//-----------------------------------------------------------------------------
+bool CClassFactory::IsLocked()
+{
+ return ( s_ServerLocks > 0 );
+}
+
+//-----------------------------------------------------------------------------
+extern "C" STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
+{
+ OutputDebugStringFormat( "DllGetClassObject.\n" );
+ *ppv = 0;
+
+ if ( rclsid != CLSID_PROPERTY_HANDLER )
+ return CLASS_E_CLASSNOTAVAILABLE;
+
+ if ( (riid != IID_IUnknown) && (riid != IID_IClassFactory) )
+ return E_NOINTERFACE;
+
+ IUnknown* pUnk = new CClassFactory( rclsid );
+ if ( 0 == pUnk )
+ return E_OUTOFMEMORY;
+
+ *ppv = pUnk;
+ return S_OK;
+}
+
+//-----------------------------------------------------------------------------
+extern "C" STDAPI DllCanUnloadNow( void )
+{
+ OutputDebugStringFormat( "DllCanUnloadNow.\n" );
+ if (CClassFactory::IsLocked() || g_DllRefCnt > 0)
+ return S_FALSE;
+
+ return S_OK;
+}
+
+//-----------------------------------------------------------------------------
+BOOL WINAPI DllMain( HINSTANCE hInst, ULONG /*ul_reason_for_call*/, LPVOID /*lpReserved*/ )
+{
+ OutputDebugStringFormat( "DllMain.\n" );
+ g_hModule = hInst;
+ return TRUE;
+}
diff --git a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
index 7172fa8348..06b94d1846 100644..100755
--- a/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
+++ b/shell/source/win32/shlxthandler/propsheets/propsheets.cxx
@@ -51,6 +51,7 @@
#include <string>
#include <vector>
#include <utility>
+#include <strsafe.h>
/*---------------------------------------------
@@ -70,6 +71,7 @@
CPropertySheet::CPropertySheet(long RefCnt) :
m_RefCnt(RefCnt)
{
+ OutputDebugStringFormat("CPropertySheet::CTor [%d], [%d]", m_RefCnt, g_DllRefCnt );
InterlockedIncrement(&g_DllRefCnt);
}
@@ -79,6 +81,7 @@ CPropertySheet::CPropertySheet(long RefCnt) :
CPropertySheet::~CPropertySheet()
{
+ OutputDebugStringFormat("CPropertySheet::DTor [%d], [%d]", m_RefCnt, g_DllRefCnt );
InterlockedDecrement(&g_DllRefCnt);
}
@@ -116,6 +119,7 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::QueryInterface(
ULONG STDMETHODCALLTYPE CPropertySheet::AddRef(void)
{
+ OutputDebugStringFormat("CPropertySheet::AddRef [%d]", m_RefCnt );
return InterlockedIncrement(&m_RefCnt);
}
@@ -125,6 +129,7 @@ ULONG STDMETHODCALLTYPE CPropertySheet::AddRef(void)
ULONG STDMETHODCALLTYPE CPropertySheet::Release(void)
{
+ OutputDebugStringFormat("CPropertySheet::Release [%d]", m_RefCnt );
long refcnt = InterlockedDecrement(&m_RefCnt);
if (0 == refcnt)
@@ -177,41 +182,51 @@ HRESULT STDMETHODCALLTYPE CPropertySheet::Initialize(
HRESULT STDMETHODCALLTYPE CPropertySheet::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
{
- PROPSHEETPAGE psp;
+ // Get OS version (we don't need the summary page on Windows Vista or later)
+ OSVERSIONINFO sInfoOS;
- // add the summary property page
+ ZeroMemory( &sInfoOS, sizeof(OSVERSIONINFO) );
+ sInfoOS.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
+ GetVersionEx( &sInfoOS );
+ bool bIsVistaOrLater = (sInfoOS.dwMajorVersion >= 6);
- ZeroMemory(&psp, sizeof(PROPSHEETPAGEA));
+ std::wstring proppage_header;
- std::wstring proppage_header = GetResString(IDS_PROPPAGE_SUMMARY_TITLE);
+ PROPSHEETPAGE psp;
+ ZeroMemory(&psp, sizeof(PROPSHEETPAGEA));
+ // add the summary property page
psp.dwSize = sizeof(PROPSHEETPAGE);
psp.dwFlags = PSP_DEFAULT | PSP_USETITLE | PSP_USECALLBACK;
psp.hInstance = GetModuleHandle(MODULE_NAME);
- psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_SUMMARY);
- psp.pszTitle = proppage_header.c_str();
- psp.pfnDlgProc = reinterpret_cast<DLGPROC>(CPropertySheet::PropPageSummaryProc);
psp.lParam = reinterpret_cast<LPARAM>(this);
psp.pfnCallback = reinterpret_cast<LPFNPSPCALLBACK>(CPropertySheet::PropPageSummaryCallback);
- HPROPSHEETPAGE hPage = CreatePropertySheetPage(&psp);
-
- // keep this instance alive
- // will be released when the
- // the page is about to be
- // destroyed in the callback
- // function
+ HPROPSHEETPAGE hPage = NULL;
- if (hPage)
+ if ( !bIsVistaOrLater )
{
- if (lpfnAddPage(hPage, lParam))
- AddRef();
- else
- DestroyPropertySheetPage(hPage);
+ proppage_header = GetResString(IDS_PROPPAGE_SUMMARY_TITLE);
+
+ psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_SUMMARY);
+ psp.pszTitle = proppage_header.c_str();
+ psp.pfnDlgProc = reinterpret_cast<DLGPROC>(CPropertySheet::PropPageSummaryProc);
+
+ hPage = CreatePropertySheetPage(&psp);
+
+ // keep this instance alive, will be released when the
+ // the page is about to be destroyed in the callback function
+
+ if (hPage)
+ {
+ if (lpfnAddPage(hPage, lParam))
+ AddRef();
+ else
+ DestroyPropertySheetPage(hPage);
+ }
}
-
- // add the statistics property page
+ // add the statistics property page
proppage_header = GetResString(IDS_PROPPAGE_STATISTICS_TITLE);
psp.pszTemplate = MAKEINTRESOURCE(IDD_PROPPAGE_STATISTICS);
diff --git a/shell/source/win32/shlxthandler/shlxthdl.cxx b/shell/source/win32/shlxthandler/shlxthdl.cxx
index 95d7f59d02..dd01ecdacc 100644..100755
--- a/shell/source/win32/shlxthandler/shlxthdl.cxx
+++ b/shell/source/win32/shlxthandler/shlxthdl.cxx
@@ -397,7 +397,16 @@ extern "C" STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv)
if ((riid != IID_IUnknown) && (riid != IID_IClassFactory))
return E_NOINTERFACE;
-
+
+ if ( rclsid == CLSID_INFOTIP_HANDLER )
+ OutputDebugStringFormat( "DllGetClassObject: Create CLSID_INFOTIP_HANDLER\n" );
+ else if ( rclsid == CLSID_COLUMN_HANDLER )
+ OutputDebugStringFormat( "DllGetClassObject: Create CLSID_COLUMN_HANDLER\n" );
+ else if ( rclsid == CLSID_PROPERTYSHEET_HANDLER )
+ OutputDebugStringFormat( "DllGetClassObject: Create CLSID_PROPERTYSHEET_HANDLER\n" );
+ else if ( rclsid == CLSID_THUMBVIEWER_HANDLER )
+ OutputDebugStringFormat( "DllGetClassObject: Create CLSID_THUMBVIEWER_HANDLER\n" );
+
IUnknown* pUnk = new CClassFactory(rclsid);
if (0 == pUnk)
return E_OUTOFMEMORY;