w32: Fix and improve CancelSynchronousIo use.

* src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Fix name of DLL
and print trace info only on error.
--

Fixes-commit: 63ba09b541
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2018-11-02 08:47:44 +01:00
parent 63ba09b541
commit acef4f775f
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

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