From c3c7332caf2a396e304853a0a5170ac70227a402 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Fri, 19 May 2023 13:22:36 +0300 Subject: [PATCH] Update diagnostics (#1192) IB-7697 Signed-off-by: Raul Metsma --- client/Diagnostics.cpp | 22 +++++++++++----------- client/Diagnostics_win.cpp | 23 ++++++++++++----------- cmake | 2 +- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/client/Diagnostics.cpp b/client/Diagnostics.cpp index 2a5a025aa..39579c066 100644 --- a/client/Diagnostics.cpp +++ b/client/Diagnostics.cpp @@ -29,27 +29,27 @@ void Diagnostics::generalInfo(QTextStream &s) { - s << "" << tr("Arguments:") << " " << qApp->arguments().join(' ') << "
" + s << "" << tr("Arguments:") << " " << Application::arguments().join(' ') << "
" << "" << tr("Library paths:") << " " << QCoreApplication::libraryPaths().join(';') << "
" << "" << "URLs:" << "" #ifdef CONFIG_URL << "
CONFIG_URL: " << CONFIG_URL #endif - << "
SID-PROXY-URL: " << qApp->confValue(QLatin1String("SID-PROXY-URL")).toString(QStringLiteral(SMARTID_URL)) - << "
SIDV2-PROXY-URL: " << qApp->confValue(QLatin1String("SIDV2-PROXY-URL")).toString(QStringLiteral(SMARTID_URL)) - << "
SID-SK-URL: " << qApp->confValue(QLatin1String("SID-SK-URL")).toString(QStringLiteral(SMARTID_URL)) - << "
SIDV2-SK-URL: " << qApp->confValue(QLatin1String("SIDV2-SK-URL")).toString(QStringLiteral(SMARTID_URL)) + << "
SID-PROXY-URL: " << Application::confValue(QLatin1String("SID-PROXY-URL")).toString(QStringLiteral(SMARTID_URL)) + << "
SIDV2-PROXY-URL: " << Application::confValue(QLatin1String("SIDV2-PROXY-URL")).toString(QStringLiteral(SMARTID_URL)) + << "
SID-SK-URL: " << Application::confValue(QLatin1String("SID-SK-URL")).toString(QStringLiteral(SMARTID_URL)) + << "
SIDV2-SK-URL: " << Application::confValue(QLatin1String("SIDV2-SK-URL")).toString(QStringLiteral(SMARTID_URL)) << "
MID-PROXY-URL: " << Settings::MID_PROXY_URL << "
MID-SK-URL: " << Settings::MID_SK_URL << "
RPUUID: " << (Settings::MID_UUID_CUSTOM ? tr("is set manually") : tr("is set by default")) - << "
TSL_URL: " << qApp->confValue(Application::TSLUrl).toString() - << "
TSA_URL: " << qApp->confValue(Application::TSAUrl).toString() - << "
SIVA_URL: " << qApp->confValue(Application::SiVaUrl).toString() + << "
TSL_URL: " << Application::confValue(Application::TSLUrl).toString() + << "
TSA_URL: " << Application::confValue(Application::TSAUrl).toString() + << "
SIVA_URL: " << Application::confValue(Application::SiVaUrl).toString() << "

" << tr("TSL signing certs") << ":"; - for(const QSslCertificate &cert: qApp->confValue(Application::TSLCerts).value>()) + for(const QSslCertificate &cert: Application::confValue(Application::TSLCerts).value>()) s << "
" << cert.subjectInfo("CN").value(0); s << "

" << tr("TSL cache") << ":"; - QString cache = qApp->confValue(Application::TSLCache).toString(); + QString cache = Application::confValue(Application::TSLCache).toString(); const QStringList tsllist = QDir(cache).entryList({QStringLiteral("*.xml")}); for(const QString &file: tsllist) { @@ -61,7 +61,7 @@ void Diagnostics::generalInfo(QTextStream &s) #ifdef CONFIG_URL s << "" << tr("Central Configuration") << ":"; - QJsonObject metainf = qApp->confValue(QLatin1String("META-INF")).toObject(); + QJsonObject metainf = Application::confValue(QLatin1String("META-INF")).toObject(); for(QJsonObject::const_iterator i = metainf.constBegin(), end = metainf.constEnd(); i != end; ++i) { if(i.value().type() == QJsonValue::Double) diff --git a/client/Diagnostics_win.cpp b/client/Diagnostics_win.cpp index 1f7c9b8b1..f5ea20157 100644 --- a/client/Diagnostics_win.cpp +++ b/client/Diagnostics_win.cpp @@ -32,7 +32,7 @@ static QString getUserRights() { - HANDLE hToken = nullptr; + HANDLE hToken {}; if ( !OpenThreadToken( GetCurrentThread(), TOKEN_QUERY, TRUE, &hToken ) ) { if ( GetLastError() != ERROR_NO_TOKEN ) @@ -41,7 +41,7 @@ static QString getUserRights() return Diagnostics::tr( "Unknown - error %1" ).arg( GetLastError() ); } - DWORD dwLength = 0; + DWORD dwLength {}; if(!GetTokenInformation(hToken, TokenGroups, nullptr, dwLength, &dwLength)) { if( GetLastError() != ERROR_INSUFFICIENT_BUFFER ) @@ -55,7 +55,7 @@ static QString getUserRights() QString rights = Diagnostics::tr( "User" ); SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY; - PSID AdministratorsGroup = nullptr; + PSID AdministratorsGroup {}; if( AllocateAndInitializeSid( &NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup ) ) { @@ -96,7 +96,7 @@ QStringList Diagnostics::packages(const QStringList &names, bool withName) if(!type.contains(QStringLiteral("Update"), Qt::CaseInsensitive) && !name.contains(QStringLiteral("Update"), Qt::CaseInsensitive) && name.contains(QRegularExpression(names.join('|').prepend('^'), QRegularExpression::CaseInsensitiveOption))) - packages << packageName(name, version, withName); + packages.append(packageName(name, version, withName)); s.endGroup(); } } @@ -112,7 +112,7 @@ void Diagnostics::run() s << "" << tr("Locale:") << " "; QLocale::Language language = QLocale::system().language(); QString locale = (language == QLocale::C ? "English/United States" : QLocale::languageToString( language ) ); - CPINFOEX CPInfoEx; + CPINFOEX CPInfoEx {}; if( GetCPInfoEx( GetConsoleCP(), 0, &CPInfoEx ) != 0 ) locale.append(" / ").append(QString::fromWCharArray(CPInfoEx.CodePageName)); s << locale << "
"; @@ -152,19 +152,20 @@ void Diagnostics::run() "digidoc", "digidocpp", "qdigidoc4.exe", "qdigidocclient.exe", "qesteidutil.exe", "id-updater.exe", "qdigidoc_tera_gui.exe", "esteidcm", "esteidcm64", "EstIDMinidriver", "EstIDMinidriver64", "onepin-opensc-pkcs11", "EsteidShellExtension", "esteid-plugin-ie", "esteid-plugin-ie64", "chrome-token-signing.exe", "web-eid.exe", - "zlib1", "libeay32", "ssleay32", "libcrypto-1_1", "libssl-1_1", "libcrypto-1_1-x64", "libssl-1_1-x64", "xerces-c_3_1", "xerces-c_3_2", "xsec_1_7", "xsec_2_0", "libxml2", + "libcrypto-3", "libssl-3", "libcrypto-3-x64", "libssl-3-x64", "libcrypto-1_1", "libssl-1_1", "libcrypto-1_1-x64", "libssl-1_1-x64", + "zlib1", "xerces-c_3_1", "xerces-c_3_2", "xalan-c_1_12", "xalanmessages_1_12", "xsec_1_7", "xsec_2_0", "libxml2", "advapi32", "crypt32", "winscard"}; for(const QString &lib: dlls) { - DWORD infoHandle = 0; + DWORD infoHandle {}; DWORD sz = GetFileVersionInfoSize(LPCWSTR(lib.utf16()), &infoHandle); if( !sz ) continue; QByteArray data(int(sz * 2), 0); if( !GetFileVersionInfoW( LPCWSTR(lib.utf16()), 0, sz, data.data() ) ) continue; - VS_FIXEDFILEINFO *info = nullptr; - UINT len = 0; + VS_FIXEDFILEINFO *info {}; + UINT len {}; if( !VerQueryValueW( data.constData(), L"\\", (LPVOID*)&info, &len ) ) continue; s << QStringLiteral("%1 (%2.%3.%4.%5)").arg(lib) @@ -189,14 +190,14 @@ void Diagnostics::run() { if( SC_HANDLE s = OpenService( h, L"atrfiltr", SERVICE_QUERY_STATUS ) ) { - SERVICE_STATUS status; + SERVICE_STATUS status {}; QueryServiceStatus( s, &status ); atrfiltr = (status.dwCurrentState == SERVICE_RUNNING) ? Running : Stopped; CloseServiceHandle( s ); } if( SC_HANDLE s = OpenService( h, L"CertPropSvc", SERVICE_QUERY_STATUS )) { - SERVICE_STATUS status; + SERVICE_STATUS status {}; QueryServiceStatus( s, &status ); certprop = (status.dwCurrentState == SERVICE_RUNNING) ? Running : Stopped; CloseServiceHandle( s ); diff --git a/cmake b/cmake index 7b34cc036..01ec22ddc 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 7b34cc036c350e2ac13e4f3f529361003e36394a +Subproject commit 01ec22ddceaf93824737bed3158bd4a560c4af9d