Use MSI to read out the list of installed software for this computer

Source: Internet
Author: User

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,

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.