aboutsummaryrefslogtreecommitdiffstats
path: root/agent/gpg-agent.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2008-10-14 18:18:21 +0000
committerWerner Koch <[email protected]>2008-10-14 18:18:21 +0000
commitd0ca9530146bea3764bf87f8a01e897c2e88448c (patch)
tree6e37e741dccd468bcd9ee8e1018a9dbf0b5aed1d /agent/gpg-agent.c
parentAdd --delete-keys as alias for --delete-key. (diff)
downloadgnupg-d0ca9530146bea3764bf87f8a01e897c2e88448c.tar.gz
gnupg-d0ca9530146bea3764bf87f8a01e897c2e88448c.zip
SCD changes for PC/SC under W32.
Diffstat (limited to '')
-rw-r--r--agent/gpg-agent.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index dc13c9908..bc3c43eaf 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -1268,12 +1268,34 @@ get_agent_scd_notify_event (void)
if (!the_event)
{
+ HANDLE h, h2;
SECURITY_ATTRIBUTES sa = { sizeof (SECURITY_ATTRIBUTES), NULL, TRUE};
- the_event = CreateEvent ( &sa, FALSE, FALSE, NULL);
- if (!the_event)
+ /* We need to use manual reset evet object due to the way our
+ w32-pth wait function works: If we would use an automatic
+ reset event we are not able to figure out which handle has
+ been signaled because at the time we single out the signaled
+ handles using WFSO the event has already been reset due to
+ the WFMO. */
+ h = CreateEvent (&sa, TRUE, FALSE, NULL);
+ if (!h)
log_error ("can't create scd notify event: %s\n", w32_strerror (-1) );
+ else if (!DuplicateHandle (GetCurrentProcess(), h,
+ GetCurrentProcess(), &h2,
+ EVENT_MODIFY_STATE|SYNCHRONIZE, TRUE, 0))
+ {
+ log_error ("setting syncronize for scd notify event failed: %s\n",
+ w32_strerror (-1) );
+ CloseHandle (h);
+ }
+ else
+ {
+ CloseHandle (h);
+ the_event = h2;
+ }
}
+
+ log_debug ("returning notify handle %p\n", the_event);
return the_event;
}
#endif /*HAVE_W32_SYSTEM*/