Проверка исправлений Windows, уже установленных обновлений и обновлений безопасности, как показывает Adobe в «Программах и функциях» панели управления, является наиболее важной функцией для проверки безопасности.
Есть способ убедиться, сколько исправлений уже установлено в Windows-системе на C++.
После запуска в Visual Studio 2017, сборки и F5 вы получите результат в окне консоли:
Код:
#include "pch.h" #include < iostream > #include < windows.h > #include < stdio.h > #define MAX_KEY_LENGTH 255 #define MAX_VALUE_NAME 16383 // QueryKey - Enumerates the subkeys of key and its associated values // hKey - Key whose subkeys and values are to be enumerated. void QueryKey(HKEY hKey) { WCHAR achKey[MAX_KEY_LENGTH]; // buffer for subkey name DWORD cbName; // size of name string WCHAR achClass[MAX_PATH] = TEXT(""); // buffer for class name DWORD cchClassName = MAX_PATH; // size of class string DWORD cSubKeys = 0; // number of subkeys DWORD cbMaxSubKey; // longest subkey size DWORD cchMaxClass; // longest class string DWORD cValues; // number of values for key DWORD cchMaxValue; // longest value name DWORD cbMaxValueData; // longest value data DWORD cbSecurityDescriptor; // size of security descriptor FILETIME ftLastWriteTime; // last write time DWORD i, retCode; WCHAR achValue[MAX_VALUE_NAME]; DWORD cchValue = MAX_VALUE_NAME; // Get the class name and the value count. retCode = RegQueryInfoKey( hKey, // key handle achClass, // buffer for class name & cchClassName, // size of class string NULL, // reserved & cSubKeys, // number of subkeys & cbMaxSubKey, // longest subkey size & cchMaxClass, // longest class string & cValues, // number of values for this key & cchMaxValue, // longest value name & cbMaxValueData, // longest value data & cbSecurityDescriptor, // security descriptor & ftLastWriteTime); // last write time wprintf(L "RegQueryInfoKey() returns %u\n", retCode); // Enumerate the subkeys, until RegEnumKeyEx() fails if (cSubKeys) { wprintf(L "\nNumber of subkeys: %d\n", cSubKeys); for (i = 0; i < cSubKeys; i++) { cbName = MAX_KEY_LENGTH; retCode = RegEnumKeyEx(hKey, i, achKey, & cbName, NULL, NULL, NULL, & ftLastWriteTime); if (retCode == ERROR_SUCCESS) { wprintf(L "(%d) %s\n", i + 1, achKey); } } } else wprintf(L "No subkeys to be enumerated!\n"); // Enumerate the key values if (cValues) { wprintf(L "\nNumber of values: %d\n", cValues); for (i = 0, retCode = ERROR_SUCCESS; i < cValues; i++) { cchValue = MAX_VALUE_NAME; achValue[0] = '\0'; retCode = RegEnumValue(hKey, i, achValue, & cchValue, NULL, NULL, NULL, NULL); if (retCode == ERROR_SUCCESS) { wprintf(L "(%d) %s\n", i + 1, achValue); } } } else wprintf(L "No values to be enumerated!\n"); } int wmain(int argc, WCHAR * argv[]) { HKEY hTestKey; // Change the key and subkey accordingly... // In this case: HKEY_USERS\\S-1-5-18\\... if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\Packages" /*L"S-1-5-18"*/ , 0, KEY_READ | KEY_WOW64_64KEY, & hTestKey) == ERROR_SUCCESS) // if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\WPA", 0, KEY_READ, &hTestKey) == ERROR_SUCCESS) { wprintf(L "RegOpenKeyEx() is OK! HotFix Lists ...\n"); QueryKey(hTestKey); } else wprintf(L "RegOpenKeyEx() failed!\n"); if (RegCloseKey(hTestKey) == ERROR_SUCCESS) wprintf(L "hTestKey key was closed successfully!\n"); else wprintf(L "Fail to close hTestKey key!\n"); return 0; }
ВЫПОЛНЕНО!
Оставленное сообщение, если какая-либо информация нуждается в обновлении или вопрос приветствуется.