Skip to content

Commit 53f2d8b

Browse files
committed
Version 0.1
First Working Version 0.1
0 parents  commit 53f2d8b

18 files changed

Lines changed: 2360 additions & 0 deletions

License.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 James Yang
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
ZipFolderEx
2+
======================
3+
4+
A Brief Intro
5+
-------------------
6+
7+
ZipFolderEx is a utility that extends the built-in ZIP compress functionality of Windows.
8+
With ZipFolderEx, you can easily to unzip files wihout third-party softwares.
9+
10+
Screenshot:
11+
12+
![zipfolderex](https://cloud.githubusercontent.com/assets/6334728/6682350/72c6047e-ccdc-11e4-8311-8cc1b7c6eddd.png)
13+
14+
15+
This project is base on the [CppShellExtContextMenuHandler](https://code.msdn.microsoft.com/windowsdesktop/cppshellextcontextmenuhandl-410a709a) project on Microsoft Dev Center.
16+
17+
References:
18+
19+
1. [Themed menu’s icons, a complete Vista and XP solution](http://www.nanoant.com/programming/themed-menus-icons-a-complete-vista-xp-solution)
20+
2. [How to zip/unzip files](https://vcpptips.wordpress.com/tag/copyhere/)
21+
22+
23+
If you have any question or would like to contribute code, please email to xiaofaye@msn.com.
24+
25+
Usage
26+
-------------------
27+
28+
(Run cmd as Administrator)
29+
30+
Registering and unregistering .DLL:
31+
32+
regsvr32 ZipFolderEx.dll (for Windows 32bit)
33+
regsvr32 ZipFolderEx64.dll (for Windows 64bit)
34+
35+
regsvr32 ZipFolderEx.dll /u (for Windows 32bit)
36+
regsvr32 ZipFolderEx64.dll /u (for Windows 64bit)
37+
38+
Note: After unregister the DLL, you might need to log off then log in to delete the DLL file, this is a windows behavior.
39+
40+
Version History
41+
-------------------
42+
* v0.1 First working version
43+
1. Add "Extract Here" and "Extract to XXX" menu items in Shell Context Menu for Zip files.
44+
2. Use Zip file associated icon for these 2 menu items.

ZipFolderEx.sln

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZipFolderEx", "ZipFolderEx\ZipFolderEx.vcxproj", "{3D1EDCCE-C4D7-4E77-9E1C-1A689D188A9A}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Win32 = Debug|Win32
9+
Debug|x64 = Debug|x64
10+
Release|Win32 = Release|Win32
11+
Release|x64 = Release|x64
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{3D1EDCCE-C4D7-4E77-9E1C-1A689D188A9A}.Debug|Win32.ActiveCfg = Debug|Win32
15+
{3D1EDCCE-C4D7-4E77-9E1C-1A689D188A9A}.Debug|Win32.Build.0 = Debug|Win32
16+
{3D1EDCCE-C4D7-4E77-9E1C-1A689D188A9A}.Debug|x64.ActiveCfg = Debug|x64
17+
{3D1EDCCE-C4D7-4E77-9E1C-1A689D188A9A}.Debug|x64.Build.0 = Debug|x64
18+
{3D1EDCCE-C4D7-4E77-9E1C-1A689D188A9A}.Release|Win32.ActiveCfg = Release|Win32
19+
{3D1EDCCE-C4D7-4E77-9E1C-1A689D188A9A}.Release|Win32.Build.0 = Release|Win32
20+
{3D1EDCCE-C4D7-4E77-9E1C-1A689D188A9A}.Release|x64.ActiveCfg = Release|x64
21+
{3D1EDCCE-C4D7-4E77-9E1C-1A689D188A9A}.Release|x64.Build.0 = Release|x64
22+
EndGlobalSection
23+
GlobalSection(SolutionProperties) = preSolution
24+
HideSolutionNode = FALSE
25+
EndGlobalSection
26+
EndGlobal

ZipFolderEx/ClassFactory.cpp

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/****************************** Module Header ******************************\
2+
Module Name: ClassFactory.cpp
3+
Project: CppShellExtContextMenuHandler
4+
Copyright (c) Microsoft Corporation.
5+
6+
The file implements the class factory for the FileContextMenuExt COM class.
7+
8+
This source is subject to the Microsoft Public License.
9+
See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
10+
All other rights reserved.
11+
12+
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
13+
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
14+
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
15+
\***************************************************************************/
16+
17+
#include "ClassFactory.h"
18+
//#include "FileContextMenuExt.h"
19+
#include "ContextMenuExtractTo.h"
20+
#include <new>
21+
#include <Shlwapi.h>
22+
#pragma comment(lib, "shlwapi.lib")
23+
24+
25+
extern long g_cDllRef;
26+
27+
28+
ClassFactory::ClassFactory() : m_cRef(1)
29+
{
30+
InterlockedIncrement(&g_cDllRef);
31+
}
32+
33+
ClassFactory::~ClassFactory()
34+
{
35+
InterlockedDecrement(&g_cDllRef);
36+
}
37+
38+
39+
//
40+
// IUnknown
41+
//
42+
43+
IFACEMETHODIMP ClassFactory::QueryInterface(REFIID riid, void **ppv)
44+
{
45+
static const QITAB qit[] =
46+
{
47+
QITABENT(ClassFactory, IClassFactory),
48+
{ 0 },
49+
};
50+
return QISearch(this, qit, riid, ppv);
51+
}
52+
53+
IFACEMETHODIMP_(ULONG) ClassFactory::AddRef()
54+
{
55+
return InterlockedIncrement(&m_cRef);
56+
}
57+
58+
IFACEMETHODIMP_(ULONG) ClassFactory::Release()
59+
{
60+
ULONG cRef = InterlockedDecrement(&m_cRef);
61+
if (0 == cRef)
62+
{
63+
delete this;
64+
}
65+
return cRef;
66+
}
67+
68+
69+
//
70+
// IClassFactory
71+
//
72+
73+
IFACEMETHODIMP ClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv)
74+
{
75+
HRESULT hr = CLASS_E_NOAGGREGATION;
76+
77+
// pUnkOuter is used for aggregation. We do not support it in the sample.
78+
if (pUnkOuter == NULL)
79+
{
80+
hr = E_OUTOFMEMORY;
81+
82+
// Create the COM component.
83+
//FileContextMenuExt *pExt = new (std::nothrow) FileContextMenuExt();
84+
//if (pExt)
85+
//{
86+
// // Query the specified interface.
87+
// hr = pExt->QueryInterface(riid, ppv);
88+
// pExt->Release();
89+
//}
90+
91+
ContextMenuExtractTo *pExt2 = new (std::nothrow) ContextMenuExtractTo();
92+
if (pExt2)
93+
{
94+
// Query the specified interface.
95+
hr = pExt2->QueryInterface(riid, ppv);
96+
pExt2->Release();
97+
}
98+
}
99+
100+
return hr;
101+
}
102+
103+
IFACEMETHODIMP ClassFactory::LockServer(BOOL fLock)
104+
{
105+
if (fLock)
106+
{
107+
InterlockedIncrement(&g_cDllRef);
108+
}
109+
else
110+
{
111+
InterlockedDecrement(&g_cDllRef);
112+
}
113+
return S_OK;
114+
}

ZipFolderEx/ClassFactory.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/****************************** Module Header ******************************\
2+
Module Name: ClassFactory.h
3+
Project: CppShellExtContextMenuHandler
4+
Copyright (c) Microsoft Corporation.
5+
6+
The file declares the class factory for the FileContextMenuExt COM class.
7+
8+
This source is subject to the Microsoft Public License.
9+
See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
10+
All other rights reserved.
11+
12+
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
13+
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
14+
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
15+
\***************************************************************************/
16+
17+
#pragma once
18+
19+
#include <unknwn.h> // For IClassFactory
20+
#include <windows.h>
21+
22+
23+
class ClassFactory : public IClassFactory
24+
{
25+
public:
26+
// IUnknown
27+
IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv);
28+
IFACEMETHODIMP_(ULONG) AddRef();
29+
IFACEMETHODIMP_(ULONG) Release();
30+
31+
// IClassFactory
32+
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
33+
IFACEMETHODIMP LockServer(BOOL fLock);
34+
35+
ClassFactory();
36+
37+
protected:
38+
~ClassFactory();
39+
40+
private:
41+
long m_cRef;
42+
};

0 commit comments

Comments
 (0)