Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
JarredTheCoder authored Oct 21, 2022
1 parent 7a464f5 commit f640fda
Show file tree
Hide file tree
Showing 28 changed files with 1,994 additions and 0 deletions.
58 changes: 58 additions & 0 deletions FilterHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// FilterHandler.h : Declaration of the filter handler

#pragma once
#include "resource.h" // main symbols

#include <atlhandler.h>
#include <atlhandlerimpl.h>
#include "..\JarredBrowser\JarredBrowserDoc.h"
#include "JarredBrowserHandlers_i.h"

using namespace ATL;

// CFilterHandler

class ATL_NO_VTABLE CFilterHandler :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<CFilterHandler, &CLSID_Search>,
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)
28 changes: 28 additions & 0 deletions FilterHandler.rgs
Original file line number Diff line number Diff line change
@@ -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}'
}
}
Binary file added JarredBrowserHandlers.aps
Binary file not shown.
83 changes: 83 additions & 0 deletions JarredBrowserHandlers.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
10 changes: 10 additions & 0 deletions JarredBrowserHandlers.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
; JarredBrowserHandlers.def : Declares the module parameters.

LIBRARY

EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllInstall PRIVATE
69 changes: 69 additions & 0 deletions JarredBrowserHandlers.idl
Original file line number Diff line number Diff line change
@@ -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";
116 changes: 116 additions & 0 deletions JarredBrowserHandlers.rc
Original file line number Diff line number Diff line change
@@ -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: <Company name>"
VALUE "FileDescription", "TODO: <File description>"
VALUE "FileVersion", "1.0.0.1"
VALUE "LegalCopyright", "TODO: (c) <Company name>. All rights reserved."
VALUE "InternalName", "JarredBrowserHandlers.dll"
VALUE "OriginalFilename", "JarredBrowserHandlers.dll"
VALUE "ProductName", "TODO: <Product name>"
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

3 changes: 3 additions & 0 deletions JarredBrowserHandlers.rgs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
HKCR
{
}
Loading

0 comments on commit f640fda

Please sign in to comment.