Type
Psoftitem = ^tsoftitem;
Tsoftitem = Packed record
softname:string;
softver:string;
path:string;
End
Procedure Readlocalsoftbymsi (alist:tlist);
Var
Index:integer;
Buf:array [0..38] of char;
Propbuf:pchar;
Hr:uint;
Len:dword;
P:psoftitem;
Begin
If not assigned (alist) then exit;
For Index: = alist.count-1 downto 0 Do
Begin
P: = Alist.items[index];
If assigned (p) then DisPose (p);
End
Alist.clear;
Index: = 0;
HR: = Msienumproducts (Index, Buf);
While hr = ERROR_SUCCESS todo
Begin
New (P);
len: = 0;
msigetproductinfo (Buf, Installproperty_installedproductname, Nil, @len);
Inc (Len);
Propbuf: = AllocMem (len);
Try
msigetproductinfo (Buf, Installproperty_ Installedproductname, Propbuf, @len);
p^. Softname: = Propbuf;
finally
Freemem (propbuf);
end;
Len: = 0;
Msigetproductinfo (Buf, installproperty_installlocation, Nil, @len);
INC (Len);
Propbuf: = AllocMem (len);
Try
Msigetproductinfo (Buf, Installproperty_installlocation, Propbuf, @len);
p^. Path: = Propbuf;
Finally
Freemem (PROPBUF);
End
Len: = 0;
Msigetproductinfo (Buf, installproperty_versionstring, Nil, @len);
INC (Len);
Propbuf: = AllocMem (len);
Try
Msigetproductinfo (Buf, installproperty_versionstring, Propbuf,