Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F25781919
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
10 KB
Subscribers
None
View Options
diff --git a/src/ChangeLog b/src/ChangeLog
index c3034ca..ae03d9c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,104 +1,107 @@
2007-09-05 Marcus Brinkmann <marcus@g10code.de>
+ * gpgex.h (class gpgex_t): Make destructor virtual to silence
+ compiler warning.
+
* Makefile.am (ICON_NAMES, ICON_SIZES, ICONS): New variables.
(gpgex_SOURCES): Add $(ICONS).
* Makefile.am (gpgex_LDADD): More -lws2_32 after ./libassuan.a.
2007-09-04 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Remove $(GPGME_CFLAGS),
add $(LIBASSUAN_CFLAGS) and $(GPG_ERROR_CFLAGS).
(gpgex_SOURCES): Add client.h and client.cc.
(libgpg-error.a, libassuan.a, clean-local): New targets.
(gpgex_LDADD): Add ./libassuan.a and ./libgpg-error.a.
* client.h, client.cc: New files.
* gpgex.cc: Include client.h.
(gpgex_t::InvokeCommand): Use client class to implement bunch of
functionality.
* main.h: Include <gpg-error.h>.
(DEBUG_ASSUAN, REGKEY, TRACE_GPGERR): New macros.
* main.cc: Include <gpg-error.h> and <assuan.h>.
(REGKEY): Deleted.
(debug_init): Free filename and add DEBUG_ASSUAN to debug flags.
(DllMain): Set assuan log stream and prefix, and the error source.
2007-09-03 Marcus Brinkmann <marcus@g10code.de>
* bitmaps.h, bitmaps.cc, icons.rc, icon-key-12.bmp,
icon-key-16.bmp: New files.
* Makefile.am (gpgex_SOURCES): Add icons.rc, bitmaps.h and
bitmaps.cc.
(noinst_gpgex_SOURCES): Add versioninfo.rc.
(gpgex_LDADD): Add -lgdi32.
(resource.o): Remove target.
* gpgex.h: Include bitmaps.h.
(class gpgex_t): New member key_bitmap.
(gpgex_t::gpgex_t, gpgex_t::~gpgex_t): Initialize and deinitialize
it.
* gpgex.cc (gpgex_t::QueryContextMenu): Add dummy bitmap for menu.
2007-08-31 Marcus Brinkmann <marcus@g10code.de>
* gpgex.cc (gpgex_t::QueryContextMenu): Fix menu separators.
2007-08-30 Marcus Brinkmann <marcus@g10code.de>
* gpgex.h (ID_CMD_HELP, ID_CMD_VERIFY_DECRYPT)
(ID_CMD_SIGN_ENCRYPT, ID_CMD_IMPORT, ID_CMD_MAX)
(ID_CMD_STR_HELP, ID_CMD_STR_VERIFY_DECRYPT)
(ID_CMD_STR_SIGN_ENCRYPT, ID_CMD_STR_IMPORT): New macros.
(class gpgex_t): New member ALL_FILES_GPG.
* gpgex.cc (gpgex_t::reset): Initialize THIS->all_files_gpg.
(gpgex_t::Initialize): Check ending of added files.
(gpgex_t::QueryContextMenu): Create a more involved dummy menu.
(gpgex_t::InvokeCommand): Show different commands being invoked.
* gpgex-class.cc (gpgex_class::init): Also register the shell
extension for directories.
(gpgex_class::deinit): Unregister shell extension for directories.
2007-08-28 Marcus Brinkmann <marcus@g10code.de>
* main.cc (DllRegisterServer): Do not trash gpgex_server::instance.
* gpgex-class.cc (gpgex_class::init): Now that DllMain loads, we
can access the DLL file name.
* main.cc (DllMain): Change return type to "STADPI" to get an
extern "C" declaration.
(_gpgex_debug): Remove lazy initialization cruft. DllMain is
called now, and initialization works properly.
* Makefile.am (gpgex_LDADD): Add -lole32.
* gpgex.def: Rename functions to not carry the @NR thingie.
* main.h: Many TRACE macros added.
(DEBUG_INIT, DEBUG_CONTEXT_MENU, STRINGIFY, GUID_FMT, GUID_ARG):
New macros.
(_gpgex_debug): New prototype.
* main.cc: Include <stdarg.h>, <stdio.h> and <shlobj.h>. Add
debugging traces.
(debug_lock, debug_flags, debug_file): New statics.
(get_debug_file, debug_init, debug_deinit): New static functions.
(_gpgex_debug): New function.
(DllMain): Call debug_init.
(DllRegisterServer, DllUnregisterServer): Call SHChangeNotify.
* gpgex.h: Include <vector> and <string>. Use std::vector and
std::string namespaces.
(class gpgex_t): New member filenames, and new method reset.
* gpgex.cc: Include <vector>, <string>, <stdexcept> and use
std::vector and std::string namespaces. Add debugging traces.
(gpgex_t::reset): New function.
(gpgex_t::Initialize): Implement dummy function.
(gpgex_t::QueryContextMenu): Implement dummy function.
(gpgex_t::GetCommandString): Implement dummy function.
(gpgex_t::InvokeCommand): Implement dummy function.
* gpgex-factory.cc: Add debugging traces.
* gpgex-class.cc (gpgex_class::init): Implement registration of
shell extension.
(gpgex_class::deinit): Implement corresponding unregistration.
2007-08-23 Marcus Brinkmann <marcus@g10code.de>
* Initial commit.
diff --git a/src/gpgex.h b/src/gpgex.h
index 8d57aeb..ac6de4c 100644
--- a/src/gpgex.h
+++ b/src/gpgex.h
@@ -1,162 +1,163 @@
/* gpgex.h - gpgex prototypes
Copyright (C) 2007 g10 Code GmbH
This file is part of GpgEX.
GpgEX is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GpgEX 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 for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#ifndef GPGEX_H
#define GPGEX_H
#include <vector>
#include <string>
using std::vector;
using std::string;
#include <windows.h>
#include <shlobj.h>
#include "bitmaps.h"
/* For context menus. */
#define ID_CMD_HELP 0
#define ID_CMD_VERIFY_DECRYPT 1
#define ID_CMD_SIGN_ENCRYPT 2
#define ID_CMD_IMPORT 3
#define ID_CMD_MAX 3
#define ID_CMD_STR_HELP _("Help on GpgEX")
#define ID_CMD_STR_VERIFY_DECRYPT _("Decrypt and verify")
#define ID_CMD_STR_SIGN_ENCRYPT _("Sign and encrypt")
#define ID_CMD_STR_IMPORT _("Import keys")
/* Our shell extension interface. We use multiple inheritance to
achieve polymorphy.
NOTE 1: By this we save some effort, but we can only provide one
implementation for each virtual function signature. The overlap in
the IUnknown interface does not matter, in fact it is a plus that
we only have to implement it once. For other functions, it might
be more of a problem. If this needs to be avoided, one can derive
intermediate classes which inherit only one of the overlapping
classes and contain a implementations for the overlapping method
that call a purely virtual function of different, unambiguous
names. For example, if there is bar::foo and baz::foo, classes
mybar : public bar and mybaz : public baz can be defined with
mybar::foo calling mybar::bar_foo and mybaz::foo calling
mybaz::baz_foo. Then the final class can inherit mybar and mybaz
and implement the virtual functions bar_foo and baz_foo, leading to
the desired result.
NOTE 2: It is not obvious why this approach works at all!
Ignorance is bliss, I guess, because the multiple-inheritance
approach is documented in many places, but rarely it is explained
why it works. The naive explanation is that there is a virtual
function table for each base class, and we can just use the address
of the pointer to that table as our COM object pointer. However,
what is missing from this description is that now the THIS pointer
is incorrect, and needs to be adjusted by subtracting the offset of
the base class inside the object when a function implementation is
invoked (which exists in the derived class and overrides the
abstract base class). Recent compilers seem to implement this by
replacing the function pointer in the VTBL with an "adjustor thunk"
which subtracts this offset and jumps to the actual function
implementation (see the C++ ABI for GCC
http://www.codesourcery.com/cxx-abi/abi.html and
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvc/html/jangrayhood.asp
for MSVC++). But this is not the only possible implementation:
Other compilers use a displacement field in each VTBL entry. The
displacement field is often zero, and in this case an adjustor
thunk is a good optimization. However, if a displacement field is
used by the compiler, it changes the VTBL layout in memory and
makes it non-compliant with COM! So let's all be happy that modern
compilers agree on using adjustor thunks and cross our fingers, as
there is no possible way we can even sanely check if the compiler
complies. And you thought C++ was easy? */
class gpgex_t : public IShellExtInit, public IContextMenu3
{
private:
/* Per-object reference count. */
LONG refcount;
/* Support for IShellExtInit. */
vector<string> filenames;
/* TRUE if all files in filenames are directly related to GPG. */
BOOL all_files_gpg;
/* Support for the context menu. */
HBITMAP key_bitmap;
public:
/* Constructors and destructors. For these, we update the global
component reference counter. */
gpgex_t (void)
: refcount (0)
{
TRACE_BEG (DEBUG_INIT, "gpgex_t::gpgex_t", this);
gpgex_server::add_ref ();
this->key_bitmap = gpgex_bitmaps.load_bitmap ("Key");
(void) TRACE_SUC ();
}
- ~gpgex_t (void)
+ /* The "virtual" fixes a compile time warning. */
+ virtual ~gpgex_t (void)
{
TRACE_BEG (DEBUG_INIT, "gpgex_t::~gpgex_t", this);
if (this->key_bitmap != NULL)
DeleteObject (this->key_bitmap);
gpgex_server::release ();
(void) TRACE_SUC ();
}
/* Reset the instance between operations. */
void reset (void);
public:
/* IUnknown methods. */
STDMETHODIMP QueryInterface (REFIID riid, void **ppv);
STDMETHODIMP_(ULONG) AddRef (void);
STDMETHODIMP_(ULONG) Release (void);
/* IShellExtInit methods. */
STDMETHODIMP Initialize (LPCITEMIDLIST pIDFolder, IDataObject *pDataObj,
HKEY hRegKey);
/* IContextMenu methods. */
STDMETHODIMP QueryContextMenu (HMENU hMenu, UINT indexMenu, UINT idCmdFirst,
UINT idCmdLast, UINT uFlags);
STDMETHODIMP GetCommandString (UINT idCommand, UINT uFlags, LPUINT lpReserved,
LPSTR pszName, UINT uMaxNameLen);
STDMETHODIMP InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi);
/* IContextMenu2 methods. */
STDMETHODIMP HandleMenuMsg (UINT uMsg, WPARAM wParam, LPARAM lParam);
/* IContextMenu3 methods. */
STDMETHODIMP HandleMenuMsg2 (UINT uMsg, WPARAM wParam, LPARAM lParam,
LRESULT *plResult);
};
#endif /* ! GPGEX_H */
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jul 12, 10:32 AM (1 d, 10 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ed/d0/5ae6ebd4dc9847fc2dbf1fad52e2
Attached To
rX GpgEX
Event Timeline
Log In to Comment