WILとWindows Update Agent APIでSystemInformationを作成・管理してWUA API関連のシステム情報(OEMハードウェアサポートリンク、リブート要求)を取得するサンプルコードです。
#include <iostream> #define STRICT #define NOMINMAX #include <Windows.h> #include <wuapi.h> #include <wil/com.h> #include <wil/resource.h> int main() { auto couninit = wil::CoInitializeEx_failfast(); auto systemInformation = wil::CoCreateInstanceFailFast<SystemInformation, ISystemInformation>(); wil::unique_bstr oemHardwareSupportLink; VARIANT_BOOL rebootRequired; FAIL_FAST_IF_FAILED(systemInformation->get_OemHardwareSupportLink(&oemHardwareSupportLink)); FAIL_FAST_IF_FAILED(systemInformation->get_RebootRequired(&rebootRequired)); std::wcout << L"OEM Hardware Support Link: " << oemHardwareSupportLink.get() << std::endl; std::wcout << L"Reboot Required: " << std::boolalpha << !!rebootRequired << std::endl; return 0; }
参考