diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2010-07-05 11:07:57 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2010-07-05 11:55:35 (GMT) |
commit | 0a333e3e4f3ceb43ddad74e7a62605072ca1efcc (patch) | |
tree | 4b5b06ccf3329c94da14791e971cc33d14a5e4fe | |
parent | dac7037801605a87d904b8f2a7c8fdab9640035e (diff) | |
download | Qt-0a333e3e4f3ceb43ddad74e7a62605072ca1efcc.zip Qt-0a333e3e4f3ceb43ddad74e7a62605072ca1efcc.tar.gz Qt-0a333e3e4f3ceb43ddad74e7a62605072ca1efcc.tar.bz2 |
QSslSocket::systemCaCertificates(): fix for WinCE
on WinCE the function is called "CertOpenStore", and not
"CertOpenSystemStoreW".
Patch-by: Ismail Donmez
Task-number: QTBUG-11905
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 14 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_p.h | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 54a580d..cad8ca7 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -515,9 +515,15 @@ void QSslSocketPrivate::ensureInitialized() #elif defined(Q_OS_WIN) HINSTANCE hLib = LoadLibraryW(L"Crypt32"); if (hLib) { +#if defined(Q_OS_WINCE) + ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, L"CertOpenStore"); + ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, L"CertFindCertificateInStore"); + ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, L"CertCloseStore"); +#else ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW"); ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore"); ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore"); +#endif if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore) qWarning("could not resolve symbols in crypt32 library"); // should never happen } else { @@ -601,7 +607,15 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates() #elif defined(Q_OS_WIN) if (ptrCertOpenSystemStoreW && ptrCertFindCertificateInStore && ptrCertCloseStore) { HCERTSTORE hSystemStore; +#if defined(Q_OS_WINCE) + hSystemStore = ptrCertOpenSystemStoreW(CERT_STORE_PROV_SYSTEM_W, + 0, + 0, + CERT_STORE_NO_CRYPT_RELEASE_FLAG|CERT_SYSTEM_STORE_CURRENT_USER, + L"ROOT"); +#else hSystemStore = ptrCertOpenSystemStoreW(0, L"ROOT"); +#endif if(hSystemStore) { PCCERT_CONTEXT pc = NULL; while(1) { diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 09775bc..72b3ef7 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -77,7 +77,11 @@ QT_BEGIN_NAMESPACE #ifndef HCRYPTPROV_LEGACY #define HCRYPTPROV_LEGACY HCRYPTPROV #endif +#if defined(Q_OS_WINCE) + typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(LPCSTR, DWORD, HCRYPTPROV_LEGACY, DWORD, const void*); +#else typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(HCRYPTPROV_LEGACY, LPCWSTR); +#endif typedef PCCERT_CONTEXT (WINAPI *PtrCertFindCertificateInStore)(HCERTSTORE, DWORD, DWORD, DWORD, const void*, PCCERT_CONTEXT); typedef BOOL (WINAPI *PtrCertCloseStore)(HCERTSTORE, DWORD); #endif |