how to uninstall and hide windows update?
That is my function to hide updates from Windows Update:
void UpdateManager::HideUpdate(String updateNumber /* typedef std::wstring String; */)
{
HRESULT hr = CoInitialize(NULL);
IUpdateSession* iUpdate;
IUpdateSearcher* searcher;
ISearchResult* results;
BSTR criteria = SysAllocString(L"IsInstalled=0 and Type='Software'");
hr = CoCreateInstance(CLSID_UpdateSession, NULL, CLSCTX_INPROC_SERVER, IID_IUpdateSession, (LPVOID*)&iUpdate);
hr = iUpdate->CreateUpdateSearcher(&searcher);
hr = searcher->Search(criteria, &results);
SysFreeString(criteria);
switch (hr)
{
case S_OK:
break;
case WU_E_LEGACYSERVER:
return;
case WU_E_INVALID_CRITERIA:
return;
}
IUpdateCollection *updateList;
IUpdate *updateItem;
LONG updateSize;
BSTR updateName;
DATE retdate;
results->get_Updates(&updateList);
updateList->get_Count(&updateSize);
for (LONG i = 0; i < updateSize; i++)
{
updateList->get_Item(i, &updateItem);
updateItem->get_Title(&updateName);
updateItem->get_LastDeploymentChangeTime(&retdate);
COleDateTime odt;
odt.m_dt = retdate;
if (updateName == updateNumber)
{
updateItem->put_IsHidden(TRUE);
}
}
::CoUninitialize();
}
not working =( Updates do not hide from Windows Update I looked at MSDN, but could not do anything. Help to implement a normal code.
Aucun commentaire:
Enregistrer un commentaire