![]() |
Windows Update Agent Update-Titel
Hallo,
ich habe mir mal Windows Update Agent angesehen ( ![]()
Delphi-Quellcode:
Der Code zur Installation:
procedure GetListNotInstalledUpdates;
var updateSession : OleVariant; updateSearcher : OleVariant; updateSearchResult : OleVariant; updateEntry : OleVariant; UpdateCollection : OleVariant; oEnum : IEnumvariant; iValue : LongWord; begin updateSession:= CreateOleObject('Microsoft.Update.Session'); updateSearcher := updateSession.CreateUpdateSearcher; Writeln('Searching'); updateSearchResult:= updateSearcher.Search(Format('IsInstalled = 0 and Type=%s',[QuotedStr('Software')])); UpdateCollection := updateSearchResult.Updates; oEnum := IUnknown(UpdateCollection._NewEnum) as IEnumVariant; while oEnum.Next(1, updateEntry, iValue) = 0 do begin Writeln(updateEntry.Title); updateEntry:=Unassigned; end; Writeln('Done'); end;
Delphi-Quellcode:
Ich dachte mir, dass ich in der While Schleife der Procedur zur Update-Suche einfach die Funktion zur Update-Installation aufrufe:
function ISHotFixID_Installed(const HotFixID : string): Boolean;
var updateSession : OleVariant; updateSearcher : OleVariant; updateEntry : OleVariant; updateSearchResult : OleVariant; UpdateCollection : OleVariant; oEnum : IEnumvariant; iValue : LongWord; begin result:=False; updateSession:= CreateOleObject('Microsoft.Update.Session'); updateSearcher := updateSession.CreateUpdateSearcher; //this line improves the performance , the online porperty indicates whether the UpdateSearcher goes online to search for updates. so how we are looking for already installed updates we can set this value to false updateSearcher.online:=False; updateSearchResult:= updateSearcher.Search(Format('IsInstalled = 1 and Type=%s',[QuotedStr('Software')])); UpdateCollection := updateSearchResult.Updates; oEnum := IUnknown(UpdateCollection._NewEnum) as IEnumVariant; while oEnum.Next(1, updateEntry, iValue) = 0 do begin Result:=Pos(HotFixID,updateEntry.Title)>0; updateEntry:=Unassigned; if Result then break; end; end;
Delphi-Quellcode:
Nur enthält updateEntry.Title den Titel und nicht die richtige Bezeichnung und somit werden die Updates nicht installiert.
ISHotFixID_Installed(updateEntry.Title);
|
AW: Windows Update Agent Update-Titel
Ich benötige die Hot Fix ID. Diese wird beim Update-Namen in Klammern angegeben. Ich würde diese sonst aus dem Namen extrahieren, aber es gibt sicher eine einfachere Lösung. :wink:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:24 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz