I am getting the error "Exception from HRESULT: 0x80240007" when I am trying to fetch the installed Windows updates. My code worked well in Windows 7, but it's not working in Windows XP. I am getting the error in the line var history = updateSearcher.QueryHistory(0, count);
This is my code snippet:
var updateSession = new UpdateSession();
var updateSearcher = updateSession.CreateUpdateSearcher();
var count = updateSearcher.GetTotalHistoryCount();
var history = updateSearcher.QueryHistory(0, count);
What changes do I need to make in the code?