diff --git a/FilterHandler.h b/FilterHandler.h new file mode 100644 index 0000000..0a9c3fd --- /dev/null +++ b/FilterHandler.h @@ -0,0 +1,58 @@ +// FilterHandler.h : Declaration of the filter handler + +#pragma once +#include "resource.h" // main symbols + +#include +#include +#include "..\JarredBrowser\JarredBrowserDoc.h" +#include "JarredBrowserHandlers_i.h" + +using namespace ATL; + +// CFilterHandler + +class ATL_NO_VTABLE CFilterHandler : + public CComObjectRootEx, + public CComCoClass, + public CSearchFilterImpl +{ +public: + CFilterHandler() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_FILTER_HANDLER) +DECLARE_NOT_AGGREGATABLE(CFilterHandler) + +BEGIN_COM_MAP(CFilterHandler) + COM_INTERFACE_ENTRY(IPersistStream) + COM_INTERFACE_ENTRY(IPersistFile) + COM_INTERFACE_ENTRY(IFilter) +END_COM_MAP() + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + HRESULT FinalConstruct() + { + return S_OK; + } + + void FinalRelease() + { + CSearchFilterImpl::FinalRelease(); + } + +public: + // IPersistStream implementation + IFACEMETHODIMP GetClassID(CLSID* pClassID) + { + *pClassID = CLSID_Search; + return S_OK; + } + +protected: + DECLARE_DOCUMENT(CJarredBrowserDoc) +}; + +OBJECT_ENTRY_AUTO(__uuidof(Search), CFilterHandler) diff --git a/FilterHandler.rgs b/FilterHandler.rgs new file mode 100644 index 0000000..2c84be9 --- /dev/null +++ b/FilterHandler.rgs @@ -0,0 +1,28 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {65F1ADA6-6BB5-4791-BC4E-C41C0E45396C} = s 'Filter Handler Class' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + TypeLib = s '{0FA15EC8-B70B-4823-AED2-ADED180DAD22}' + Version = s '1.0' + } + + ForceRemove {FAA8750A-AC80-4612-B008-620D973EF956} = s 'Filter Handler Class' + { + ForceRemove PersistentAddinsRegistered = s '' + { + {89BCB740-6119-101A-BCB7-00DD010655AF} = s '{65F1ADA6-6BB5-4791-BC4E-C41C0E45396C}' + } + } + } + + NoRemove .html + { + NoRemove PersistentHandler = s '{FAA8750A-AC80-4612-B008-620D973EF956}' + } +} diff --git a/JarredBrowserHandlers.aps b/JarredBrowserHandlers.aps new file mode 100644 index 0000000..88121eb Binary files /dev/null and b/JarredBrowserHandlers.aps differ diff --git a/JarredBrowserHandlers.cpp b/JarredBrowserHandlers.cpp new file mode 100644 index 0000000..1c0cb64 --- /dev/null +++ b/JarredBrowserHandlers.cpp @@ -0,0 +1,83 @@ +// JarredBrowserHandlers.cpp : Implementation of DLL Exports. + +#include "stdafx.h" +#include "resource.h" +#include "JarredBrowserHandlers_i.h" +#include "dllmain.h" +#include "xdlldata.h" + +#include "PreviewHandler.h" +#include "ThumbnailHandler.h" +#include "FilterHandler.h" + +// Used to determine whether the DLL can be unloaded by OLE. +STDAPI DllCanUnloadNow(void) +{ + HRESULT hr = PrxDllCanUnloadNow(); + if (hr != S_OK) + return hr; + AFX_MANAGE_STATE(AfxGetStaticModuleState()); + return (AfxDllCanUnloadNow()==S_OK && _AtlModule.GetLockCount()==0) ? S_OK : S_FALSE; +} + +// Returns a class factory to create an object of the requested type. +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK) + return S_OK; + return _AtlModule.DllGetClassObject(rclsid, riid, ppv); +} + +// DllRegisterServer - Adds entries to the system registry. +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + HRESULT hr = _AtlModule.DllRegisterServer(); + if (FAILED(hr)) + return hr; + hr = PrxDllRegisterServer(); + return hr; +} + +// DllUnregisterServer - Removes entries from the system registry. +STDAPI DllUnregisterServer(void) +{ + HRESULT hr = _AtlModule.DllUnregisterServer(); + if (FAILED(hr)) + return hr; + hr = PrxDllRegisterServer(); + if (FAILED(hr)) + return hr; + hr = PrxDllUnregisterServer(); + return hr; +} + +// DllInstall - Adds/Removes entries to the system registry per user per machine. +STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine) +{ + HRESULT hr = E_FAIL; + static const wchar_t szUserSwitch[] = _T("user"); + + if (pszCmdLine != NULL) + { + if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0) + { + ATL::AtlSetPerUserRegistration(true); + } + } + + if (bInstall) + { + hr = DllRegisterServer(); + if (FAILED(hr)) + { + DllUnregisterServer(); + } + } + else + { + hr = DllUnregisterServer(); + } + + return hr; +} diff --git a/JarredBrowserHandlers.def b/JarredBrowserHandlers.def new file mode 100644 index 0000000..36c799a --- /dev/null +++ b/JarredBrowserHandlers.def @@ -0,0 +1,10 @@ +; JarredBrowserHandlers.def : Declares the module parameters. + +LIBRARY + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE + DllInstall PRIVATE diff --git a/JarredBrowserHandlers.idl b/JarredBrowserHandlers.idl new file mode 100644 index 0000000..6b99128 --- /dev/null +++ b/JarredBrowserHandlers.idl @@ -0,0 +1,69 @@ +// JarredBrowserHandlers.idl : IDL source for JarredBrowserHandlers +// + +// This file will be processed by the MIDL tool to +// produce the type library (JarredBrowserHandlers.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; + +[ + object, + uuid(5D700C3D-0E75-44F8-B89B-9585627FD6C1), + pointer_default(unique) +] +interface IPreview : IUnknown +{ +}; + +[ + object, + uuid(22E6D8D8-D891-451D-9743-4C4DA2EF7C8F), + pointer_default(unique) +] +interface IThumbnail : IUnknown +{ +}; + +[ + object, + uuid(61464977-D0D1-4A7B-BD1B-ACCC69E24D15), + pointer_default(unique) +] +interface ISearch : IUnknown +{ +}; + +[ + uuid(0FA15EC8-B70B-4823-AED2-ADED180DAD22), + version(1.0), +] +library JarredBrowserHandlersLib +{ + importlib("stdole2.tlb"); + [ + uuid(22DE8E58-0BC1-49DE-8DCD-2C9F9E2109F7) + ] + coclass Preview + { + [default] interface IPreviewHandler; + }; + [ + uuid(1C71462E-B57B-457B-B8D6-3042667CD7C6) + ] + coclass Thumbnail + { + [default] interface IThumbnailProvider; + }; + [ + uuid(65F1ADA6-6BB5-4791-BC4E-C41C0E45396C) + ] + coclass Search + { + [default] interface IFilter; + }; +}; + +import "shobjidl.idl"; +import "thumbcache.idl"; +import "filter.idl"; diff --git a/JarredBrowserHandlers.rc b/JarredBrowserHandlers.rc new file mode 100644 index 0000000..a0bbd22 --- /dev/null +++ b/JarredBrowserHandlers.rc @@ -0,0 +1,116 @@ +//Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#ifndef APSTUDIO_INVOKED +#include "targetver.h" +#endif +#include "afxres.h" +#include "verrsrc.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#ifndef APSTUDIO_INVOKED\r\n" + "#include ""targetver.h""\r\n" + "#endif\r\n" + "#include ""afxres.h""\r\n" + "#include ""verrsrc.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "1 TYPELIB ""JarredBrowserHandlers.tlb""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "TODO: " + VALUE "FileDescription", "TODO: " + VALUE "FileVersion", "1.0.0.1" + VALUE "LegalCopyright", "TODO: (c) . All rights reserved." + VALUE "InternalName", "JarredBrowserHandlers.dll" + VALUE "OriginalFilename", "JarredBrowserHandlers.dll" + VALUE "ProductName", "TODO: " + VALUE "ProductVersion", "1.0.0.1" + VALUE "OLESelfRegister", "" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1200 + END +END + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_PROJNAME "JarredBrowserHandlers" +END + +IDR_JARREDBROWSERHANDLERS REGISTRY "JarredBrowserHandlers.rgs" +IDR_PREVIEW_HANDLER REGISTRY "PreviewHandler.rgs" +IDR_THUMBNAIL_HANDLER REGISTRY "ThumbnailHandler.rgs" +IDR_FILTER_HANDLER REGISTRY "FilterHandler.rgs" +//////////////////////////////////////////////////////////////////////////// + + +#endif + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +1 TYPELIB "JarredBrowserHandlers.tlb" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/JarredBrowserHandlers.rgs b/JarredBrowserHandlers.rgs new file mode 100644 index 0000000..8219d93 --- /dev/null +++ b/JarredBrowserHandlers.rgs @@ -0,0 +1,3 @@ +HKCR +{ +} diff --git a/JarredBrowserHandlers.vcxproj b/JarredBrowserHandlers.vcxproj new file mode 100644 index 0000000..b024dfa --- /dev/null +++ b/JarredBrowserHandlers.vcxproj @@ -0,0 +1,192 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {23B4B362-B64B-4B71-9BD8-7DDB1D1B373D} + AtlProj + + + + DynamicLibrary + true + Dynamic + Unicode + Static + + + DynamicLibrary + false + Dynamic + Unicode + Static + + + + + + + + + + + + + true + true + + + true + false + + + + Use + Level3 + Disabled + WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) + + + false + Win32 + _DEBUG;%(PreprocessorDefinitions) + JarredBrowserHandlers_i.h + JarredBrowserHandlers_i.c + JarredBrowserHandlers_p.c + true + $(IntDir)JarredBrowserHandlers.tlb + + + true + + + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + + + Windows + .\JarredBrowserHandlers.def + true + true + + + Setting permissions on handler DLL (to enable load by SearchFilterHost.exe)... + cacls.exe "$(TargetPath)" /G users:r /E + + + + + Use + Level3 + MaxSpeed + WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) + + + false + Win32 + NDEBUG;%(PreprocessorDefinitions) + JarredBrowserHandlers_i.h + JarredBrowserHandlers_i.c + JarredBrowserHandlers_p.c + true + $(IntDir)JarredBrowserHandlers.tlb + + + true + + + 0x0409 + $(IntDir);%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + + + Windows + .\JarredBrowserHandlers.def + true + true + true + true + + + Setting permissions on handler DLL (to enable load by SearchFilterHost.exe)... + cacls.exe "$(TargetPath)" /G users:r /E + + + + + + + false + + + false + + + + + + false + + + false + + + + + Create + Create + + + false + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/JarredBrowserHandlers.vcxproj.filters b/JarredBrowserHandlers.vcxproj.filters new file mode 100644 index 0000000..c4bd305 --- /dev/null +++ b/JarredBrowserHandlers.vcxproj.filters @@ -0,0 +1,107 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {88b6e314-a75e-438b-812e-8f10b86ec2e5} + False + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Generated Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Generated Files + + + + + Resource Files + + + + + + Resource Files + + + Source Files + + + Resource Files + + + Resource Files + + + Resource Files + + + + + Source Files + + + \ No newline at end of file diff --git a/JarredBrowserHandlers.vcxproj.user b/JarredBrowserHandlers.vcxproj.user new file mode 100644 index 0000000..695b5c7 --- /dev/null +++ b/JarredBrowserHandlers.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/JarredBrowserHandlers_i.c b/JarredBrowserHandlers_i.c new file mode 100644 index 0000000..f193b0a --- /dev/null +++ b/JarredBrowserHandlers_i.c @@ -0,0 +1,97 @@ + + +/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ + +/* link this file in with the server and any clients */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* at Wed Oct 19 10:01:19 2022 + */ +/* Compiler settings for JarredBrowserHandlers.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +#ifdef __cplusplus +extern "C"{ +#endif + + +#include +#include + +#ifdef _MIDL_USE_GUIDDEF_ + +#ifndef INITGUID +#define INITGUID +#include +#undef INITGUID +#else +#include +#endif + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) + +#else // !_MIDL_USE_GUIDDEF_ + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef struct _IID +{ + unsigned long x; + unsigned short s1; + unsigned short s2; + unsigned char c[8]; +} IID; + +#endif // __IID_DEFINED__ + +#ifndef CLSID_DEFINED +#define CLSID_DEFINED +typedef IID CLSID; +#endif // CLSID_DEFINED + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} + +#endif !_MIDL_USE_GUIDDEF_ + +MIDL_DEFINE_GUID(IID, IID_IPreview,0x5D700C3D,0x0E75,0x44F8,0xB8,0x9B,0x95,0x85,0x62,0x7F,0xD6,0xC1); + + +MIDL_DEFINE_GUID(IID, IID_IThumbnail,0x22E6D8D8,0xD891,0x451D,0x97,0x43,0x4C,0x4D,0xA2,0xEF,0x7C,0x8F); + + +MIDL_DEFINE_GUID(IID, IID_ISearch,0x61464977,0xD0D1,0x4A7B,0xBD,0x1B,0xAC,0xCC,0x69,0xE2,0x4D,0x15); + + +MIDL_DEFINE_GUID(IID, LIBID_JarredBrowserHandlersLib,0x0FA15EC8,0xB70B,0x4823,0xAE,0xD2,0xAD,0xED,0x18,0x0D,0xAD,0x22); + + +MIDL_DEFINE_GUID(CLSID, CLSID_Preview,0x22DE8E58,0x0BC1,0x49DE,0x8D,0xCD,0x2C,0x9F,0x9E,0x21,0x09,0xF7); + + +MIDL_DEFINE_GUID(CLSID, CLSID_Thumbnail,0x1C71462E,0xB57B,0x457B,0xB8,0xD6,0x30,0x42,0x66,0x7C,0xD7,0xC6); + + +MIDL_DEFINE_GUID(CLSID, CLSID_Search,0x65F1ADA6,0x6BB5,0x4791,0xBC,0x4E,0xC4,0x1C,0x0E,0x45,0x39,0x6C); + +#undef MIDL_DEFINE_GUID + +#ifdef __cplusplus +} +#endif + + + diff --git a/JarredBrowserHandlers_i.h b/JarredBrowserHandlers_i.h new file mode 100644 index 0000000..996638b --- /dev/null +++ b/JarredBrowserHandlers_i.h @@ -0,0 +1,366 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* at Wed Oct 19 10:01:19 2022 + */ +/* Compiler settings for JarredBrowserHandlers.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of +#endif // __RPCNDR_H_VERSION__ + +#ifndef COM_NO_WINDOWS_H +#include "windows.h" +#include "ole2.h" +#endif /*COM_NO_WINDOWS_H*/ + +#ifndef __JarredBrowserHandlers_i_h__ +#define __JarredBrowserHandlers_i_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IPreview_FWD_DEFINED__ +#define __IPreview_FWD_DEFINED__ +typedef interface IPreview IPreview; +#endif /* __IPreview_FWD_DEFINED__ */ + + +#ifndef __IThumbnail_FWD_DEFINED__ +#define __IThumbnail_FWD_DEFINED__ +typedef interface IThumbnail IThumbnail; +#endif /* __IThumbnail_FWD_DEFINED__ */ + + +#ifndef __ISearch_FWD_DEFINED__ +#define __ISearch_FWD_DEFINED__ +typedef interface ISearch ISearch; +#endif /* __ISearch_FWD_DEFINED__ */ + + +#ifndef __Preview_FWD_DEFINED__ +#define __Preview_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class Preview Preview; +#else +typedef struct Preview Preview; +#endif /* __cplusplus */ + +#endif /* __Preview_FWD_DEFINED__ */ + + +#ifndef __Thumbnail_FWD_DEFINED__ +#define __Thumbnail_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class Thumbnail Thumbnail; +#else +typedef struct Thumbnail Thumbnail; +#endif /* __cplusplus */ + +#endif /* __Thumbnail_FWD_DEFINED__ */ + + +#ifndef __Search_FWD_DEFINED__ +#define __Search_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class Search Search; +#else +typedef struct Search Search; +#endif /* __cplusplus */ + +#endif /* __Search_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "oaidl.h" +#include "ocidl.h" +#include "shobjidl.h" +#include "thumbcache.h" +#include "filter.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +#ifndef __IPreview_INTERFACE_DEFINED__ +#define __IPreview_INTERFACE_DEFINED__ + +/* interface IPreview */ +/* [unique][uuid][object] */ + + +EXTERN_C const IID IID_IPreview; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5D700C3D-0E75-44F8-B89B-9585627FD6C1") + IPreview : public IUnknown + { + public: + }; + +#else /* C style interface */ + + typedef struct IPreviewVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IPreview * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IPreview * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IPreview * This); + + END_INTERFACE + } IPreviewVtbl; + + interface IPreview + { + CONST_VTBL struct IPreviewVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IPreview_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IPreview_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IPreview_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IPreview_INTERFACE_DEFINED__ */ + + +#ifndef __IThumbnail_INTERFACE_DEFINED__ +#define __IThumbnail_INTERFACE_DEFINED__ + +/* interface IThumbnail */ +/* [unique][uuid][object] */ + + +EXTERN_C const IID IID_IThumbnail; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("22E6D8D8-D891-451D-9743-4C4DA2EF7C8F") + IThumbnail : public IUnknown + { + public: + }; + +#else /* C style interface */ + + typedef struct IThumbnailVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IThumbnail * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IThumbnail * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IThumbnail * This); + + END_INTERFACE + } IThumbnailVtbl; + + interface IThumbnail + { + CONST_VTBL struct IThumbnailVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IThumbnail_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IThumbnail_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IThumbnail_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IThumbnail_INTERFACE_DEFINED__ */ + + +#ifndef __ISearch_INTERFACE_DEFINED__ +#define __ISearch_INTERFACE_DEFINED__ + +/* interface ISearch */ +/* [unique][uuid][object] */ + + +EXTERN_C const IID IID_ISearch; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("61464977-D0D1-4A7B-BD1B-ACCC69E24D15") + ISearch : public IUnknown + { + public: + }; + +#else /* C style interface */ + + typedef struct ISearchVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + ISearch * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + __RPC__deref_out void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + ISearch * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + ISearch * This); + + END_INTERFACE + } ISearchVtbl; + + interface ISearch + { + CONST_VTBL struct ISearchVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define ISearch_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define ISearch_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define ISearch_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __ISearch_INTERFACE_DEFINED__ */ + + + +#ifndef __JarredBrowserHandlersLib_LIBRARY_DEFINED__ +#define __JarredBrowserHandlersLib_LIBRARY_DEFINED__ + +/* library JarredBrowserHandlersLib */ +/* [version][uuid] */ + + +EXTERN_C const IID LIBID_JarredBrowserHandlersLib; + +EXTERN_C const CLSID CLSID_Preview; + +#ifdef __cplusplus + +class DECLSPEC_UUID("22DE8E58-0BC1-49DE-8DCD-2C9F9E2109F7") +Preview; +#endif + +EXTERN_C const CLSID CLSID_Thumbnail; + +#ifdef __cplusplus + +class DECLSPEC_UUID("1C71462E-B57B-457B-B8D6-3042667CD7C6") +Thumbnail; +#endif + +EXTERN_C const CLSID CLSID_Search; + +#ifdef __cplusplus + +class DECLSPEC_UUID("65F1ADA6-6BB5-4791-BC4E-C41C0E45396C") +Search; +#endif +#endif /* __JarredBrowserHandlersLib_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/JarredBrowserHandlers_p.c b/JarredBrowserHandlers_p.c new file mode 100644 index 0000000..d14cfd6 --- /dev/null +++ b/JarredBrowserHandlers_p.c @@ -0,0 +1,372 @@ + + +/* this ALWAYS GENERATED file contains the proxy stub code */ + + + /* File created by MIDL compiler version 7.00.0555 */ +/* at Wed Oct 19 10:01:19 2022 + */ +/* Compiler settings for JarredBrowserHandlers.idl: + Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#if !defined(_M_IA64) && !defined(_M_AMD64) + + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif + +#pragma warning( disable: 4211 ) /* redefine extern to static */ +#pragma warning( disable: 4232 ) /* dllimport identity*/ +#pragma warning( disable: 4024 ) /* array to pointer mapping*/ +#pragma warning( disable: 4152 ) /* function/data pointer conversion in expression */ +#pragma warning( disable: 4100 ) /* unreferenced arguments in x86 call */ + +#pragma optimize("", off ) + +#define USE_STUBLESS_PROXY + + +/* verify that the version is high enough to compile this file*/ +#ifndef __REDQ_RPCPROXY_H_VERSION__ +#define __REQUIRED_RPCPROXY_H_VERSION__ 475 +#endif + + +#include "rpcproxy.h" +#ifndef __RPCPROXY_H_VERSION__ +#error this stub requires an updated version of +#endif /* __RPCPROXY_H_VERSION__ */ + + +#include "JarredBrowserHandlers_i.h" + +#define TYPE_FORMAT_STRING_SIZE 3 +#define PROC_FORMAT_STRING_SIZE 1 +#define EXPR_FORMAT_STRING_SIZE 1 +#define TRANSMIT_AS_TABLE_SIZE 0 +#define WIRE_MARSHAL_TABLE_SIZE 0 + +typedef struct _JarredBrowserHandlers_MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } JarredBrowserHandlers_MIDL_TYPE_FORMAT_STRING; + +typedef struct _JarredBrowserHandlers_MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } JarredBrowserHandlers_MIDL_PROC_FORMAT_STRING; + +typedef struct _JarredBrowserHandlers_MIDL_EXPR_FORMAT_STRING + { + long Pad; + unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; + } JarredBrowserHandlers_MIDL_EXPR_FORMAT_STRING; + + +static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax = +{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; + + +extern const JarredBrowserHandlers_MIDL_TYPE_FORMAT_STRING JarredBrowserHandlers__MIDL_TypeFormatString; +extern const JarredBrowserHandlers_MIDL_PROC_FORMAT_STRING JarredBrowserHandlers__MIDL_ProcFormatString; +extern const JarredBrowserHandlers_MIDL_EXPR_FORMAT_STRING JarredBrowserHandlers__MIDL_ExprFormatString; + + +extern const MIDL_STUB_DESC Object_StubDesc; + + +extern const MIDL_SERVER_INFO IPreview_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IPreview_ProxyInfo; + + +extern const MIDL_STUB_DESC Object_StubDesc; + + +extern const MIDL_SERVER_INFO IThumbnail_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO IThumbnail_ProxyInfo; + + +extern const MIDL_STUB_DESC Object_StubDesc; + + +extern const MIDL_SERVER_INFO ISearch_ServerInfo; +extern const MIDL_STUBLESS_PROXY_INFO ISearch_ProxyInfo; + + + +#if !defined(__RPC_WIN32__) +#error Invalid build platform for this stub. +#endif + +#if !(TARGET_IS_NT50_OR_LATER) +#error You need Windows 2000 or later to run this stub because it uses these features: +#error /robust command line switch. +#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems. +#error This app will fail with the RPC_X_WRONG_STUB_VERSION error. +#endif + + +static const JarredBrowserHandlers_MIDL_PROC_FORMAT_STRING JarredBrowserHandlers__MIDL_ProcFormatString = + { + 0, + { + + 0x0 + } + }; + +static const JarredBrowserHandlers_MIDL_TYPE_FORMAT_STRING JarredBrowserHandlers__MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ + + 0x0 + } + }; + + +/* Object interface: IUnknown, ver. 0.0, + GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ + + +/* Object interface: IPreview, ver. 0.0, + GUID={0x5D700C3D,0x0E75,0x44F8,{0xB8,0x9B,0x95,0x85,0x62,0x7F,0xD6,0xC1}} */ + +#pragma code_seg(".orpc") +static const unsigned short IPreview_FormatStringOffsetTable[] = + { + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IPreview_ProxyInfo = + { + &Object_StubDesc, + JarredBrowserHandlers__MIDL_ProcFormatString.Format, + &IPreview_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IPreview_ServerInfo = + { + &Object_StubDesc, + 0, + JarredBrowserHandlers__MIDL_ProcFormatString.Format, + &IPreview_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(3) _IPreviewProxyVtbl = +{ + 0, + &IID_IPreview, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy +}; + +const CInterfaceStubVtbl _IPreviewStubVtbl = +{ + &IID_IPreview, + &IPreview_ServerInfo, + 3, + 0, /* pure interpreted */ + CStdStubBuffer_METHODS +}; + + +/* Object interface: IThumbnail, ver. 0.0, + GUID={0x22E6D8D8,0xD891,0x451D,{0x97,0x43,0x4C,0x4D,0xA2,0xEF,0x7C,0x8F}} */ + +#pragma code_seg(".orpc") +static const unsigned short IThumbnail_FormatStringOffsetTable[] = + { + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO IThumbnail_ProxyInfo = + { + &Object_StubDesc, + JarredBrowserHandlers__MIDL_ProcFormatString.Format, + &IThumbnail_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO IThumbnail_ServerInfo = + { + &Object_StubDesc, + 0, + JarredBrowserHandlers__MIDL_ProcFormatString.Format, + &IThumbnail_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(3) _IThumbnailProxyVtbl = +{ + 0, + &IID_IThumbnail, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy +}; + +const CInterfaceStubVtbl _IThumbnailStubVtbl = +{ + &IID_IThumbnail, + &IThumbnail_ServerInfo, + 3, + 0, /* pure interpreted */ + CStdStubBuffer_METHODS +}; + + +/* Object interface: ISearch, ver. 0.0, + GUID={0x61464977,0xD0D1,0x4A7B,{0xBD,0x1B,0xAC,0xCC,0x69,0xE2,0x4D,0x15}} */ + +#pragma code_seg(".orpc") +static const unsigned short ISearch_FormatStringOffsetTable[] = + { + 0 + }; + +static const MIDL_STUBLESS_PROXY_INFO ISearch_ProxyInfo = + { + &Object_StubDesc, + JarredBrowserHandlers__MIDL_ProcFormatString.Format, + &ISearch_FormatStringOffsetTable[-3], + 0, + 0, + 0 + }; + + +static const MIDL_SERVER_INFO ISearch_ServerInfo = + { + &Object_StubDesc, + 0, + JarredBrowserHandlers__MIDL_ProcFormatString.Format, + &ISearch_FormatStringOffsetTable[-3], + 0, + 0, + 0, + 0}; +CINTERFACE_PROXY_VTABLE(3) _ISearchProxyVtbl = +{ + 0, + &IID_ISearch, + IUnknown_QueryInterface_Proxy, + IUnknown_AddRef_Proxy, + IUnknown_Release_Proxy +}; + +const CInterfaceStubVtbl _ISearchStubVtbl = +{ + &IID_ISearch, + &ISearch_ServerInfo, + 3, + 0, /* pure interpreted */ + CStdStubBuffer_METHODS +}; + +static const MIDL_STUB_DESC Object_StubDesc = + { + 0, + NdrOleAllocate, + NdrOleFree, + 0, + 0, + 0, + 0, + 0, + JarredBrowserHandlers__MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x50002, /* Ndr library version */ + 0, + 0x700022b, /* MIDL Version 7.0.555 */ + 0, + 0, + 0, /* notify & notify_flag routine table */ + 0x1, /* MIDL flag */ + 0, /* cs routines */ + 0, /* proxy/server info */ + 0 + }; + +const CInterfaceProxyVtbl * const _JarredBrowserHandlers_ProxyVtblList[] = +{ + ( CInterfaceProxyVtbl *) &_IPreviewProxyVtbl, + ( CInterfaceProxyVtbl *) &_ISearchProxyVtbl, + ( CInterfaceProxyVtbl *) &_IThumbnailProxyVtbl, + 0 +}; + +const CInterfaceStubVtbl * const _JarredBrowserHandlers_StubVtblList[] = +{ + ( CInterfaceStubVtbl *) &_IPreviewStubVtbl, + ( CInterfaceStubVtbl *) &_ISearchStubVtbl, + ( CInterfaceStubVtbl *) &_IThumbnailStubVtbl, + 0 +}; + +PCInterfaceName const _JarredBrowserHandlers_InterfaceNamesList[] = +{ + "IPreview", + "ISearch", + "IThumbnail", + 0 +}; + + +#define _JarredBrowserHandlers_CHECK_IID(n) IID_GENERIC_CHECK_IID( _JarredBrowserHandlers, pIID, n) + +int __stdcall _JarredBrowserHandlers_IID_Lookup( const IID * pIID, int * pIndex ) +{ + IID_BS_LOOKUP_SETUP + + IID_BS_LOOKUP_INITIAL_TEST( _JarredBrowserHandlers, 3, 2 ) + IID_BS_LOOKUP_NEXT_TEST( _JarredBrowserHandlers, 1 ) + IID_BS_LOOKUP_RETURN_RESULT( _JarredBrowserHandlers, 3, *pIndex ) + +} + +const ExtendedProxyFileInfo JarredBrowserHandlers_ProxyFileInfo = +{ + (PCInterfaceProxyVtblList *) & _JarredBrowserHandlers_ProxyVtblList, + (PCInterfaceStubVtblList *) & _JarredBrowserHandlers_StubVtblList, + (const PCInterfaceName * ) & _JarredBrowserHandlers_InterfaceNamesList, + 0, /* no delegation */ + & _JarredBrowserHandlers_IID_Lookup, + 3, + 2, + 0, /* table of [async_uuid] interfaces */ + 0, /* Filler1 */ + 0, /* Filler2 */ + 0 /* Filler3 */ +}; +#pragma optimize("", on ) +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + + +#endif /* !defined(_M_IA64) && !defined(_M_AMD64)*/ + diff --git a/PreviewHandler.h b/PreviewHandler.h new file mode 100644 index 0000000..a1621cc --- /dev/null +++ b/PreviewHandler.h @@ -0,0 +1,97 @@ +// PreviewHandler.h : Declaration of the preview handler + +#pragma once +#include "resource.h" // main symbols + +#include +#include +#include +#include "..\JarredBrowser\JarredBrowserDoc.h" +#include "..\JarredBrowser\JarredBrowserView.h" +#include "JarredBrowserHandlers_i.h" + +using namespace ATL; + +// CPreviewHandler + +class ATL_NO_VTABLE CPreviewHandler : + public CComObjectRootEx, + public CComCoClass, + public CPreviewHandlerImpl +{ +public: + CPreviewHandler() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_PREVIEW_HANDLER) +DECLARE_NOT_AGGREGATABLE(CPreviewHandler) + +BEGIN_COM_MAP(CPreviewHandler) + COM_INTERFACE_ENTRY(IObjectWithSite) + COM_INTERFACE_ENTRY(IOleWindow) + COM_INTERFACE_ENTRY(IInitializeWithStream) + COM_INTERFACE_ENTRY(IPreviewHandler) + COM_INTERFACE_ENTRY(IPreviewHandlerVisuals) +END_COM_MAP() + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + HRESULT FinalConstruct() + { + return S_OK; + } + + void FinalRelease() + { + CPreviewHandlerImpl::FinalRelease(); + } + +protected: + virtual IPreviewCtrl* CreatePreviewControl() + { + // create your preview control here + CMFCPreviewCtrlImpl *pPreviewCtrl = NULL; + ATLTRY(pPreviewCtrl = new CMFCPreviewCtrlImpl()); + return pPreviewCtrl; + } + + DECLARE_DOCUMENT(CJarredBrowserDoc) + +public: + virtual HRESULT InitializeDocumentPreview(HWND hWndParent, RECT* prc) + { + m_pPreviewCtrl = CreatePreviewControl(); + CMFCPreviewCtrlImpl* pCtrl = DYNAMIC_DOWNCAST(CMFCPreviewCtrlImpl, (CObject*) m_pPreviewCtrl); + if (pCtrl == NULL) + { + ATLTRACE2(atlTraceGeneral, 4, L"InitializeDocumentPreview: pointer to preview control is NULL.\n"); + return E_POINTER; + } + + ASSERT_VALID(pCtrl); + + CCreateContext ctx; + ctx.m_pNewViewClass = RUNTIME_CLASS(CJarredBrowserView); + + m_pDocument = CreateDocument(); + + if (m_pDocument == NULL) + { + ATLTRACE2(atlTraceGeneral, 4, L"InitializeDocumentPreview: pointer to document is NULL.\n"); + return E_POINTER; + } + + m_pDocument->AddRef(); + ctx.m_pCurrentDoc = DYNAMIC_DOWNCAST(CJarredBrowserDoc, (CObject*) m_pDocument->GetContainer()); + + if (!pCtrl->Create(hWndParent, prc, &ctx)) + { + ATLTRACE2(atlTraceGeneral, 4, L"InitializeDocumentPreview: preview control creation failed. Error Code: %d\n", GetLastError()); + return E_FAIL; + } + return S_OK; + } +}; + +OBJECT_ENTRY_AUTO(__uuidof(Preview), CPreviewHandler) diff --git a/PreviewHandler.rgs b/PreviewHandler.rgs new file mode 100644 index 0000000..20dc9d3 --- /dev/null +++ b/PreviewHandler.rgs @@ -0,0 +1,46 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {22DE8E58-0BC1-49DE-8DCD-2C9F9E2109F7} = s 'Preview Handler Class' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + TypeLib = s '{0FA15EC8-B70B-4823-AED2-ADED180DAD22}' + Version = s '1.0' + val AppID = s '{6d2b5079-2f0b-48dd-ab7f-97cec514d30b}' + val DisplayName = s '@%MODULE%,-101' + val Icon = s '%MODULE%,201' + } + } + + NoRemove .html + { + NoRemove ShellEx + { + ForceRemove {8895b1c6-b41f-4c1c-a562-0d564250836f} = s '{22DE8E58-0BC1-49DE-8DCD-2C9F9E2109F7}' + } + } +} + +HKLM +{ + NoRemove Software + { + NoRemove Microsoft + { + NoRemove Windows + { + NoRemove CurrentVersion + { + NoRemove PreviewHandlers + { + val {22DE8E58-0BC1-49DE-8DCD-2C9F9E2109F7} = s 'Preview Handler Class' + } + } + } + } + } +} diff --git a/ReadMe.txt b/ReadMe.txt new file mode 100644 index 0000000..83ccad0 --- /dev/null +++ b/ReadMe.txt @@ -0,0 +1,68 @@ +======================================================================== + ACTIVE TEMPLATE LIBRARY : JarredBrowserHandlers Project Overview +======================================================================== + +AppWizard has created this JarredBrowserHandlers project for you to use as the starting point for +writing your Dynamic Link Library (DLL). + +This file contains a summary of what you will find in each of the files that +make up your project. + +JarredBrowserHandlers.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +JarredBrowserHandlers.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the assciation between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +JarredBrowserHandlers.idl + This file contains the IDL definitions of the type library, the interfaces + and co-classes defined in your project. + This file will be processed by the MIDL compiler to generate: + C++ interface definitions and GUID declarations (JarredBrowserHandlers.h) + GUID definitions (JarredBrowserHandlers_i.c) + A type library (JarredBrowserHandlers.tlb) + Marshaling code (JarredBrowserHandlers_p.c and dlldata.c) + +JarredBrowserHandlers.h + This file contains the C++ interface definitions and GUID declarations of the + items defined in JarredBrowserHandlers.idl. It will be regenerated by MIDL during compilation. + +JarredBrowserHandlers.cpp + This file contains the object map and the implementation of your DLL's exports. + +JarredBrowserHandlers.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. + +JarredBrowserHandlers.def + This module-definition file provides the linker with information about the exports + required by your DLL. It contains exports for: + DllGetClassObject + DllCanUnloadNow + DllRegisterServer + DllUnregisterServer + DllInstall + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named JarredBrowserHandlers.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file that defines resource IDs. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + + The MFC Support option builds the Microsoft Foundation Class libraries into your skeleton application, + making MFC classes, objects and functions available to you. +///////////////////////////////////////////////////////////////////////////// diff --git a/Resource.h b/Resource.h new file mode 100644 index 0000000..4f05fe0 --- /dev/null +++ b/Resource.h @@ -0,0 +1,21 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by JarredBrowserHandlers.rc +// + +#define IDS_PROJNAME 100 +#define IDR_JARREDBROWSERHANDLERS 101 +#define IDR_PREVIEW_HANDLER 103 +#define IDR_THUMBNAIL_HANDLER 104 +#define IDR_FILTER_HANDLER 105 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 201 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 106 +#endif +#endif diff --git a/ThumbnailHandler.h b/ThumbnailHandler.h new file mode 100644 index 0000000..b818078 --- /dev/null +++ b/ThumbnailHandler.h @@ -0,0 +1,66 @@ +// ThumbnailHandler.h : Declaration of the thumbnail handler + +#pragma once +#include "resource.h" // main symbols + +#include +#include +#include "..\JarredBrowser\JarredBrowserDoc.h" +#include "JarredBrowserHandlers_i.h" + +using namespace ATL; + +// CThumbnailHandler + +class ATL_NO_VTABLE CThumbnailHandler : + public CComObjectRootEx, + public CComCoClass, + public CThumbnailProviderImpl +{ +public: + CThumbnailHandler() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_THUMBNAIL_HANDLER) +DECLARE_NOT_AGGREGATABLE(CThumbnailHandler) + +BEGIN_COM_MAP(CThumbnailHandler) + COM_INTERFACE_ENTRY(IInitializeWithStream) + COM_INTERFACE_ENTRY(IThumbnailProvider) +END_COM_MAP() + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + HRESULT FinalConstruct() + { + return S_OK; + } + + void FinalRelease() + { + CThumbnailProviderImpl::FinalRelease(); + } + +protected: + virtual HRESULT GetBitmap(UINT cx, HBITMAP *phbmp, WTS_ALPHATYPE *pdwAlpha) + { + if (m_pDocument == NULL) + { + return E_NOTIMPL; + } + + // Implement OnDrawThumbnail in IDocument derived class + static int const nDocDimensions = 256; + if (!m_pDocument->GetThumbnail(nDocDimensions, phbmp, pdwAlpha)) + { + return E_FAIL; + } + + return S_OK; + } + + DECLARE_DOCUMENT(CJarredBrowserDoc) +}; + +OBJECT_ENTRY_AUTO(__uuidof(Thumbnail), CThumbnailHandler) diff --git a/ThumbnailHandler.rgs b/ThumbnailHandler.rgs new file mode 100644 index 0000000..bef8bf6 --- /dev/null +++ b/ThumbnailHandler.rgs @@ -0,0 +1,23 @@ +HKCR +{ + NoRemove CLSID + { + ForceRemove {1C71462E-B57B-457B-B8D6-3042667CD7C6} = s 'Thumbnail Handler Class' + { + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + TypeLib = s '{0FA15EC8-B70B-4823-AED2-ADED180DAD22}' + Version = s '1.0' + } + } + + NoRemove .html + { + NoRemove ShellEx + { + ForceRemove {E357FCCD-A995-4576-B01F-234630154E96} = s '{1C71462E-B57B-457B-B8D6-3042667CD7C6}' + } + } +} diff --git a/dlldata.c b/dlldata.c new file mode 100644 index 0000000..0f3f171 --- /dev/null +++ b/dlldata.c @@ -0,0 +1,37 @@ +/********************************************************* + DllData file -- generated by MIDL compiler + + DO NOT ALTER THIS FILE + + This file is regenerated by MIDL on every IDL file compile. + + To completely reconstruct this file, delete it and rerun MIDL + on all the IDL files in this DLL, specifying this file for the + /dlldata command line option + +*********************************************************/ + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +EXTERN_PROXY_FILE( JarredBrowserHandlers ) + + +PROXYFILE_LIST_START +/* Start of list */ + REFERENCE_PROXY_FILE( JarredBrowserHandlers ), +/* End of list */ +PROXYFILE_LIST_END + + +DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) + +#ifdef __cplusplus +} /*extern "C" */ +#endif + +/* end of generated dlldata file */ diff --git a/dllmain.cpp b/dllmain.cpp new file mode 100644 index 0000000..5df8ca4 --- /dev/null +++ b/dllmain.cpp @@ -0,0 +1,37 @@ +// dllmain.cpp : Implementation of DllMain. + +#include "stdafx.h" +#include "resource.h" +#include "JarredBrowserHandlers_i.h" +#include "dllmain.h" +#include "xdlldata.h" + +CJarredBrowserHandlersModule _AtlModule; + +class CJarredBrowserHandlersApp : public CWinApp +{ +public: + +// Overrides + virtual BOOL InitInstance(); + virtual int ExitInstance(); + + DECLARE_MESSAGE_MAP() +}; + +BEGIN_MESSAGE_MAP(CJarredBrowserHandlersApp, CWinApp) +END_MESSAGE_MAP() + +CJarredBrowserHandlersApp theApp; + +BOOL CJarredBrowserHandlersApp::InitInstance() +{ + if (!PrxDllMain(m_hInstance, DLL_PROCESS_ATTACH, NULL)) + return FALSE; + return CWinApp::InitInstance(); +} + +int CJarredBrowserHandlersApp::ExitInstance() +{ + return CWinApp::ExitInstance(); +} diff --git a/dllmain.h b/dllmain.h new file mode 100644 index 0000000..13abc27 --- /dev/null +++ b/dllmain.h @@ -0,0 +1,10 @@ +// dllmain.h : Declaration of module class. + +class CJarredBrowserHandlersModule : public ATL::CAtlDllModuleT< CJarredBrowserHandlersModule > +{ +public : + DECLARE_LIBID(LIBID_JarredBrowserHandlersLib) + DECLARE_REGISTRY_APPID_RESOURCEID(IDR_JARREDBROWSERHANDLERS, "{D97C944B-470F-4AD5-9AAC-C0A4D1C128C5}") +}; + +extern class CJarredBrowserHandlersModule _AtlModule; diff --git a/stdafx.cpp b/stdafx.cpp new file mode 100644 index 0000000..5c2bde9 --- /dev/null +++ b/stdafx.cpp @@ -0,0 +1,5 @@ +// stdafx.cpp : source file that includes just the standard includes +// JarredBrowserHandlers.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" diff --git a/stdafx.h b/stdafx.h new file mode 100644 index 0000000..312882e --- /dev/null +++ b/stdafx.h @@ -0,0 +1,48 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +#ifndef STRICT +#define STRICT +#endif + +#include "targetver.h" + +#define _ATL_APARTMENT_THREADED +#define _ATL_NO_AUTOMATIC_NAMESPACE + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +#ifdef _MANAGED +#error File type handlers cannot be built as managed assemblies. Set the Common Language Runtime options to no CLR support in project properties. +#endif + +#ifndef _UNICODE +#error File type handlers must be built Unicode. Set the Character Set option to Unicode in project properties. +#endif + +#define SHARED_HANDLERS + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC Automation classes +#endif // _AFX_NO_OLE_SUPPORT + +#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW + +#include "resource.h" +#include +#include +#include diff --git a/targetver.h b/targetver.h new file mode 100644 index 0000000..90e767b --- /dev/null +++ b/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/xdlldata.c b/xdlldata.c new file mode 100644 index 0000000..167879c --- /dev/null +++ b/xdlldata.c @@ -0,0 +1,14 @@ +// wrapper for dlldata.c + +#define REGISTER_PROXY_DLL //DllRegisterServer, etc. + +#define _WIN32_WINNT 0x0500 //for WinNT 4.0 or Win95 with DCOM +#define USE_STUBLESS_PROXY //defined only with MIDL switch /Oicf + +#pragma comment(lib, "rpcns4.lib") +#pragma comment(lib, "rpcrt4.lib") + +#define ENTRY_PREFIX Prx + +#include "dlldata.c" +#include "JarredBrowserHandlers_p.c" diff --git a/xdlldata.h b/xdlldata.h new file mode 100644 index 0000000..53d6cfb --- /dev/null +++ b/xdlldata.h @@ -0,0 +1,10 @@ +#pragma once + +extern "C" +{ +BOOL WINAPI PrxDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved); +STDAPI PrxDllCanUnloadNow(void); +STDAPI PrxDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv); +STDAPI PrxDllRegisterServer(void); +STDAPI PrxDllUnregisterServer(void); +}