w32: Fix and improve CancelSynchronousIo use.
authorWerner Koch <wk@gnupg.org>
Fri, 2 Nov 2018 07:47:44 +0000 (08:47 +0100)
committerWerner Koch <wk@gnupg.org>
Fri, 2 Nov 2018 07:47:44 +0000 (08:47 +0100)
* src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Fix name of DLL
and print trace info only on error.
--

Fixes-commit: 63ba09b541dabbe838253926896e721cb9be564a
Signed-off-by: Werner Koch <wk@gnupg.org>
src/w32-util.c

index 8a04c8c..798f42b 100644 (file)
@@ -251,7 +251,7 @@ _gpgme_w32_cancel_synchronous_io (HANDLE thread)
     {
       /* Available since Vista; thus we dynload it.  */
       initialized = 1;
-      handle = dlopen ("kerner32.dll", RTLD_LAZY);
+      handle = dlopen ("kernel32.dll", RTLD_LAZY);
       if (handle)
         {
           func = dlsym (handle, "CancelSynchronousIo");
@@ -265,9 +265,11 @@ _gpgme_w32_cancel_synchronous_io (HANDLE thread)
 
   if (func)
     {
-      int rc = func (thread);
-      TRACE2 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0,
-             "called for thread %p; result=%d", thread, rc);
+      if (!func (thread) && GetLastError() != ERROR_NOT_FOUND)
+        {
+          TRACE2 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0,
+                  "called for thread %p: ec=%d", thread, GetLastError ());
+        }
     }
   else
     {