15,793,452 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Python questions
View PHP questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Anurag__ (Top 8 by date)
Anurag__
2-Jan-20 2:53am
View
https://social.technet.microsoft.com/Forums/en-US/208e8a4c-f2fa-43f1-842a-a2b4de8b8dd3/some-of-the-cumulative-amp-feature-updates-not-giving-download-url-windows-10?forum=winserverwsus
Anurag__
22-Nov-19 5:04am
View
This above code working fine till windows 8.1
but in some of the cumulative updates & feature updates, not getting download url in windows 10.
Anurag__
22-Nov-19 5:02am
View
I modified some code, now i am getting download url.
Modified code:-
res = update->get_BundledUpdates(&updatecol);
//res = updatecol->get_Count(&j);
res = updatecol->get_Item(0,&updateTmp);
res = update->get_KBArticleIDs(&updateKBIDs);
if (FAILED(res)) {
HandleError(L"Failed to get KB article ID list", res);
goto innerCleanup;
}
res = updateTmp->get_DownloadContents(&pDownUrl);
if(SUCCEEDED(res))
{
BSTR url;
res = pDownUrl->get_Count(&count);
res = pDownUrl->get_Item(0, &downloadContent);
if(FAILED(res))
{
HandleError(L"Failed to get url article ID count", res);
//goto innerCleanup;
}
else
{
res = downloadContent->get_DownloadUrl(&url);
if(FAILED(res))
{
//goto innerCleanup;
}
else
{
std::wcout << L"URL" << L':' << url <
Anurag__
22-Nov-19 0:37am
View
I got this code from following link
https://gist.github.com/apsun/b471c2e11dab94ad690d
where i added this code
res = update->get_DownloadContents(&pDownUrl);
if(SUCCEEDED(res))
{
BSTR url;
res = pDownUrl->get_Count(&count);
res = pDownUrl->get_Item(1, &downloadContent);
if(FAILED(res))
{
HandleError(L"Failed to get url article ID count", res);
//goto innerCleanup;
}
else
{
res = downloadContent->get_DownloadUrl(&url);
if(FAILED(res))
{
//goto innerCleanup;
}
else
{
std::wcout << L"URL" << url << L':' << std::endl;
SysFreeString(url);
}
}
In above section i am not getting download url.
Anurag__
22-Nov-19 0:15am
View
Hi richard,
I think there is a word limit is there, there fore not able to see complete code,
let me check some other method.
Anurag__
22-Nov-19 0:12am
View
Deleted
#include <sdkddkver.h>
#include <windows.h>
#include <comdef.h>
#include <wuapi.h>
#include <string>
#include <iostream>
void HandleError(LPCWSTR message, HRESULT result)
{
_com_error error(result);
LPCTSTR errorText = error.ErrorMessage();
std::wcerr << message << L": " << errorText << std::endl;
}
int main()
{
IUpdateSession *updateSession = NULL;
IUpdateSearcher *updateSearcher = NULL;
ISearchResult *searchResult = NULL;
IUpdateCollection *updates = NULL;
IUpdateDownloadContentCollection *pDownUrl = NULL;
IUpdateDownloadContent *downloadContent = NULL;
HRESULT res;
int ret = 1;
LONG count;
res = CoInitializeEx(NULL, 0);
if (FAILED(res)) {
HandleError(L"Failed to initialize COM", res);
return 1;
}
res = CoCreateInstance(CLSID_UpdateSession, NULL, CLSCTX_INPROC_SERVER, IID_IUpdateSession, (LPVOID *)&updateSession);
if (FAILED(res)) {
HandleError(L"Failed to create update session", res);
goto cleanup;
}
res = updateSession->CreateUpdateSearcher(&updateSearcher);
if (FAILED(res)) {
HandleError(L"Failed to create update searcher", res);
goto cleanup;
}
res = updateSearcher->put_IncludePotentiallySupersededUpdates(VARIANT_TRUE);
if (FAILED(res)) {
HandleError(L"Failed to set search options", res);
goto cleanup;
}
BSTR criteria = SysAllocString(L"IsInstalled=1 or IsHidden=1");
res = updateSearcher->Search(criteria, &searchResult);
SysFreeString(criteria);
if (FAILED(res)) {
HandleError(L"Failed to search for updates", res);
goto cleanup;
}
res = searchResult->get_Updates(&updates);
if (FAILED(res)) {
HandleError(L"Failed to retrieve update list from search result", res);
goto cleanup;
}
LONG updateCount;
res = updates->get_Count(&updateCount);
if (FAILED(res)) {
HandleError(L"Failed to get update count", res);
goto cleanup;
}
for (LONG i = 0L; i < updateCount; ++i)
{
IUpdate *update = NULL;
IStringCollection *updateKBIDs = NULL;
bool innerError = true;
res = updates->get_Item(i, &update);
if (FAILED(res)) {
HandleError(L"Failed to get update item", res);
goto innerCleanup;
}
res = update->get_KBArticleIDs(&updateKBIDs);
if (FAILED(res)) {
HandleError(L"Failed to get KB article ID list", res);
goto innerCleanup;
}
res = update->get_DownloadContents(&pDownUrl);
if(SUCCEEDED(res))
{
BSTR url;
res = pDownUrl->get_Count(&count);
res = pDownUrl->get_Item(1, &downloadContent);
if(FAILED(res))
{
HandleError(L"Failed to get url article ID count", res);
//goto innerCleanup;
}
else
{
res = downloadContent->get_DownloadUrl(&url);
if(FAILED(res))
{
//goto innerCleanup;
}
else
{
std::wcout << L"URL" << url << L':' << std::endl;
SysFreeString(url);
}
}
}
LONG kbIDCount;
res = updateKBIDs->get_Count(&kbIDCount);
if (FAILED(res)) {
HandleError(L"Failed to get KB article ID count", res);
goto innerCleanup;
}
for (LONG j = 0L; j < kbIDCount; ++j) {
BSTR kbID;
res = updateKBIDs->get_Item(j, &kbID);
if (FAILED(res)) {
HandleError(L"Failed to get KB article ID", res);
goto innerCleanup;
}
std::wcout << L"KB" << kbID << L':' << std::endl;
SysFreeString(kbID);
}
BSTR updateTitle;
Anurag__
21-Nov-19 9:12am
View
int main()
{
IUpdateSession *updateSession = NULL;
IUpdateSearcher *updateSearcher = NULL;
ISearchResult *searchResult = NULL;
IUpdateCollection *updates = NULL;
IUpdateDownloadContentCollection *pDownUrl = NULL;
IUpdateDownloadContent *downloadContent = NULL;
HRESULT res;
int ret = 1;
LONG count;
res = CoInitializeEx(NULL, 0);
if (FAILED(res)) {
HandleError(L"Failed to initialize COM", res);
return 1;
}
res = CoCreateInstance(CLSID_UpdateSession, NULL, CLSCTX_INPROC_SERVER, IID_IUpdateSession, (LPVOID *)&updateSession);
if (FAILED(res)) {
HandleError(L"Failed to create update session", res);
goto cleanup;
}
res = updateSession->CreateUpdateSearcher(&updateSearcher);
if (FAILED(res)) {
HandleError(L"Failed to create update searcher", res);
goto cleanup;
}
res = updateSearcher->put_IncludePotentiallySupersededUpdates(VARIANT_TRUE);
if (FAILED(res)) {
HandleError(L"Failed to set search options", res);
goto cleanup;
}
BSTR criteria = SysAllocString(L"IsInstalled=1 or IsHidden=1");
res = updateSearcher->Search(criteria, &searchResult);
SysFreeString(criteria);
if (FAILED(res)) {
HandleError(L"Failed to search for updates", res);
goto cleanup;
}
res = searchResult->get_Updates(&updates);
if (FAILED(res)) {
HandleError(L"Failed to retrieve update list from search result", res);
goto cleanup;
}
LONG updateCount;
res = updates->get_Count(&updateCount);
if (FAILED(res)) {
HandleError(L"Failed to get update count", res);
goto cleanup;
}
for (LONG i = 0L; i < updateCount; ++i)
{
IUpdate *update = NULL;
IStringCollection *updateKBIDs = NULL;
bool innerError = true;
res = updates->get_Item(i, &update);
if (FAILED(res)) {
HandleError(L"Failed to get update item", res);
goto innerCleanup;
}
res = update->get_KBArticleIDs(&updateKBIDs);
if (FAILED(res)) {
HandleError(L"Failed to get KB article ID list", res);
goto innerCleanup;
}
res = update->get_DownloadContents(&pDownUrl);
if(SUCCEEDED(res))
{
BSTR url;
res = pDownUrl->get_Count(&count);
res = pDownUrl->get_Item(1, &downloadContent);
if(FAILED(res))
{
HandleError(L"Failed to get url article ID count", res);
//goto innerCleanup;
}
else
{
res = downloadContent->get_DownloadUrl(&url);
if(FAILED(res))
{
//goto innerCleanup;
}
else
{
std::wcout << L"URL" << url << L':' << std::endl;
SysFreeString(url);
}
}
}
LONG kbIDCount;
res = updateKBIDs->get_Count(&kbIDCount);
if (FAILED(res)) {
HandleError(L"Failed to get KB article ID count", res);
goto innerCleanup;
}
for (LONG j = 0L; j < kbIDCount; ++j) {
BSTR kbID;
res = updateKBIDs->get_Item(j, &kbID);
if (FAILED(res)) {
HandleError(L"Failed to get KB article ID", res);
goto innerCleanup;
}
std::wcout << L"KB" << kbID << L':' << std::endl;
SysFreeString(kbID);
}
BSTR updateTitle;
res = update->get_Title(&updateTitle);
if (FAILED(res)) {
HandleError(L"Failed to get update title", res);
goto innerCleanup;
}
std::wcout << L" " << updateTitle << std::endl << std::endl;
SysFreeString(updateTitle);
innerError = false;
innerCleanup:
updateKBI
Anurag__
19-Nov-19 2:16am
View
Hi richard,
thanks for solution.
I am checking for the same.
Show More