Skip to content

Commit

Permalink
Add xyz-thumbnailer for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Sep 26, 2015
1 parent d5466dc commit b15f4dc
Show file tree
Hide file tree
Showing 20 changed files with 1,267 additions and 0 deletions.
16 changes: 16 additions & 0 deletions LcfTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xyz2png", "xyz2png\xyz2png.
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblcf", "lib\liblcf\builds\vs2010\liblcf.vcxproj", "{D892967A-6B8E-4AC5-9D38-785D748796D0}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xyz-thumbnailer", "xyz-thumbnailer\windows\xyz-thumbnailer.vcxproj", "{145AB33E-71A1-42C3-8223-E107CFC162F4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_XML|Win32 = Debug_XML|Win32
Expand Down Expand Up @@ -101,6 +103,20 @@ Global
{D892967A-6B8E-4AC5-9D38-785D748796D0}.Release|Win32.Build.0 = Release_XML|Win32
{D892967A-6B8E-4AC5-9D38-785D748796D0}.Release|x64.ActiveCfg = Release_XML|x64
{D892967A-6B8E-4AC5-9D38-785D748796D0}.Release|x64.Build.0 = Release_XML|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug_XML|Win32.ActiveCfg = Debug|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug_XML|x64.ActiveCfg = Debug|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug_XML|x64.Build.0 = Debug|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Win32.ActiveCfg = Debug|Win32
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Win32.Build.0 = Debug|Win32
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x64.ActiveCfg = Debug|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x64.Build.0 = Debug|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release_XML|Win32.ActiveCfg = Release|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release_XML|x64.ActiveCfg = Release|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release_XML|x64.Build.0 = Release|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Win32.ActiveCfg = Release|Win32
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Win32.Build.0 = Release|Win32
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x64.ActiveCfg = Release|x64
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions xyz-thumbnailer/windows/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Microsoft Limited Public License (Ms-LPL)

This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.

1. Definitions

The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. A "contribution" is the original software, or any additions or changes to the software. A "contributor" is any person that distributes its contribution under this license. "Licensed patents" are a contributor's patent claims that read directly on its contribution.

2. Grant of Rights

(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.

3. Conditions and Limitations

(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.

4. (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend only to the software or derivative works that you create that run on a Microsoft Windows operating system product.
99 changes: 99 additions & 0 deletions xyz-thumbnailer/windows/ClassFactory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/******************************** Module Header ********************************\
This source is subject to the Microsoft Public License.
See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
All other rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\*******************************************************************************/

#include "ClassFactory.h"
#include "RpgMakerXyzThumbnailProvider.h"
#include <new>
#include <Shlwapi.h>
#pragma comment(lib, "shlwapi.lib")


extern long g_cDllRef;


ClassFactory::ClassFactory() : m_cRef(1)
{
InterlockedIncrement(&g_cDllRef);
}

ClassFactory::~ClassFactory()
{
InterlockedDecrement(&g_cDllRef);
}


//
// IUnknown
//

IFACEMETHODIMP ClassFactory::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] =
{
QITABENT(ClassFactory, IClassFactory),
{ 0 },
};
return QISearch(this, qit, riid, ppv);
}

IFACEMETHODIMP_(ULONG) ClassFactory::AddRef()
{
return InterlockedIncrement(&m_cRef);
}

IFACEMETHODIMP_(ULONG) ClassFactory::Release()
{
ULONG cRef = InterlockedDecrement(&m_cRef);
if (0 == cRef)
{
delete this;
}
return cRef;
}


//
// IClassFactory
//

IFACEMETHODIMP ClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv)
{
HRESULT hr = CLASS_E_NOAGGREGATION;

// pUnkOuter is used for aggregation. We do not support it in the sample.
if (pUnkOuter == NULL)
{
hr = E_OUTOFMEMORY;

// Create the COM component.
RpgMakerXyzThumbnailProvider *pExt = new (std::nothrow) RpgMakerXyzThumbnailProvider();
if (pExt)
{
// Query the specified interface.
hr = pExt->QueryInterface(riid, ppv);
pExt->Release();
}
}

return hr;
}

IFACEMETHODIMP ClassFactory::LockServer(BOOL fLock)
{
if (fLock)
{
InterlockedIncrement(&g_cDllRef);
}
else
{
InterlockedDecrement(&g_cDllRef);
}
return S_OK;
}
36 changes: 36 additions & 0 deletions xyz-thumbnailer/windows/ClassFactory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/****************************** Module Header ******************************\
This source is subject to the Microsoft Public License.
See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
All other rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/

#pragma once

#include <unknwn.h> // For IClassFactory
#include <windows.h>


class ClassFactory : public IClassFactory
{
public:
// IUnknown
IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv);
IFACEMETHODIMP_(ULONG) AddRef();
IFACEMETHODIMP_(ULONG) Release();

// IClassFactory
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
IFACEMETHODIMP LockServer(BOOL fLock);

ClassFactory();

protected:
~ClassFactory();

private:
long m_cRef;
};
6 changes: 6 additions & 0 deletions xyz-thumbnailer/windows/GlobalExportFunctions.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LIBRARY "EasyRpgXyzShellExtThumbnailHandler"
EXPORTS
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
29 changes: 29 additions & 0 deletions xyz-thumbnailer/windows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

# xyz-thumbnailer

Generates thumbnails from RPG Maker 2000/2003 XYZ graphics format for view in
the Windows Explorer.

## Screenshot

![screenshot](assets/screenshot.png)

## Installation

Enter folder `bin\Release\x86` (32bit) or `bin\Release\amd64` (64bit)
and open a elevated command prompt (admin).

$ regsvr32 EasyRpgXyzShellExtThumbnailHandler.dll

Important: Don't delete the file, this will break the shell handler!

## Uninstallation

Same steps as above.

$ regsvr32 /u EasyRpgXyzShellExtThumbnailHandler.dll

## Usage

Enter any directory containing xyz files and choose an explorer view with
huge symbols.
Loading

0 comments on commit b15f4dc

Please sign in to comment.