[Pkg-gnupg-commit] [libassuan] 302/437: Add options and documentation for gpgcedev.
Eric Dorland
eric at moszumanska.debian.org
Fri May 22 05:33:56 UTC 2015
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository libassuan.
commit 5c0a0af4344df1175104dc95ad63b81dceea2306
Author: Werner Koch <wk at gnupg.org>
Date: Fri Mar 5 17:55:57 2010 +0000
Add options and documentation for gpgcedev.
---
README | 20 ++++++++++++++++
src/ChangeLog | 4 ++++
src/gpgcemgr.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
3 files changed, 95 insertions(+), 3 deletions(-)
diff --git a/README b/README
index bf6f23f..91cf382 100644
--- a/README
+++ b/README
@@ -13,3 +13,23 @@ category "libassuan".
The primary FTP site is ftp://ftp.gnupg.org/gcrypt/libassuan.
+
+
+Notes for Windows CE:
+----------------------
+
+Libassuan supports WindowsCE (tested with WindowsMobile 6.5). To
+install it, copy libassuan-0.dll into a location where DLL are found
+and install the included gpgcedev driver: First copy "gpgcedev.dll"
+into the root directory, second run the included program gpgcemgr on
+the device: "gpgcemgr --register". This creates the necessary
+registry keys. In case the copy step fails, the driver may still be
+in use: Close all applications using that driver, run "gpgcemgr
+--deactivate" to deactivate the running driver and try again.
+
+Registry keys created by "gpgcemgr --register" are:
+
+ Drivers\\GnuPG_Device\dll -> "gpgcedev.dll"
+ Drivers\\GnuPG_Device\prefix -> "GPG"
+ Drivers\\GnuPG_Device\Index -> 1 (dword)
+
diff --git a/src/ChangeLog b/src/ChangeLog
index 0fc7019..d3af990 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2010-03-05 Werner Koch <wk at g10code.com>
+
+ * gpgcemgr.c: Add options to register a device and activate it.
+
2010-02-24 Werner Koch <wk at g10code.com>
* gpgcemgr.c: New.
diff --git a/src/gpgcemgr.c b/src/gpgcemgr.c
index da51602..d5d354e 100644
--- a/src/gpgcemgr.c
+++ b/src/gpgcemgr.c
@@ -24,10 +24,44 @@
#define PGM "gpgcemgr"
-#warning Fixme: Add support to create the device.
+#define GPGCEDEV_KEY_NAME L"Drivers\\GnuPG_Device"
+#define GPGCEDEV_DLL_NAME L"gpgcedev.dll"
+#define GPGCEDEV_PREFIX L"GPG"
-int
-main (int argc, char **argv)
+
+static int
+install (void)
+{
+ HKEY handle;
+ DWORD disp, dw;
+
+ if (RegCreateKeyEx (HKEY_LOCAL_MACHINE, GPGCEDEV_KEY_NAME, 0, NULL, 0,
+ KEY_WRITE, NULL, &handle, &disp))
+ {
+ fprintf (stderr, PGM": error creating registry key: rc=%d\n",
+ (int)GetLastError ());
+ return 1;
+ }
+
+ RegSetValueEx (handle, L"dll", 0, REG_SZ,
+ (void*)GPGCEDEV_DLL_NAME, sizeof (GPGCEDEV_DLL_NAME));
+ RegSetValueEx (handle, L"prefix", 0, REG_SZ,
+ (void*)GPGCEDEV_PREFIX, sizeof (GPGCEDEV_PREFIX));
+
+ dw = 1;
+ RegSetValueEx (handle, L"Index", 0, REG_DWORD, (void*)&dw, sizeof dw);
+
+ RegCloseKey (handle);
+
+ fprintf (stderr, PGM": registry key created\n");
+
+
+ return 0;
+}
+
+
+static int
+deinstall (void)
{
int result = 0;
HANDLE shd;
@@ -63,6 +97,40 @@ main (int argc, char **argv)
}
FindClose (shd);
}
+
+ return result;
+}
+
+
+
+int
+main (int argc, char **argv)
+{
+ int result = 0;
+
+ if (argc > 1 && !strcmp (argv[1], "--register"))
+ result = install ();
+ else if (argc > 1 && !strcmp (argv[1], "--deactivate"))
+ result = deinstall ();
+ else if (argc > 1 && !strcmp (argv[1], "--activate"))
+ {
+ /* This is mainly for testing. The activation is usually done
+ right before the device is opened. */
+ if (ActivateDevice (GPGCEDEV_DLL_NAME, 0) == INVALID_HANDLE_VALUE)
+ {
+ fprintf (stderr, PGM": ActivateDevice failed: rc=%d\n",
+ (int)GetLastError ());
+ result = 1;
+ }
+ else
+ fprintf (stderr, PGM": device activated\n");
+ }
+ else
+ {
+ fprintf (stderr, "usage: " PGM " --register|--deactivate|--activate\n");
+ result = 1;
+ }
+
fflush (stdout);
fflush (stderr);
Sleep (1000);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git
More information about the Pkg-gnupg-commit
mailing list