Jump to content

Working with MSI Shortcuts


Recommended Posts

When you install a product like MS Office, the installer creates what I'll call "MSI Shortcuts". If you go to the properties of these shortcuts, the Target field is disabled and references only the program's name Product name (like "Microsoft Office 2003 Professional") rather than the actual EXE.

The FileGetShortcut doesn't return the information as it does with a regular shortcut. What I'm trying to do is to read the MSI Shortcut and check to see if a shortcuts is still valid.

I realize FileGetShortcut does return some kind of information, but does anyone know how to get ALL the pertanent informaion like what the actual target is for this kind of shortcut?

Thanks.

Link to comment
Share on other sites

found this tidbit of code so far ... nothing that gets right to the EXE path...

$a = DLLCall("msi.dll","int","MsiGetShortcutTarget","str","C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft Office Excel 2003.lnk", _
        "str","","str","","str","")

MsgBox(4096,"",$a[0] & @LF & _
                $a[1] & @LF & _
                $a[2] & @LF & _
                $a[3] & @LF & _
                $a[4])

Lar.

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Link to comment
Share on other sites

Maybe you figure out how to apply this... You need to determine if it is an "Advertised" ... perhaps on failure of regular check... you use this.

$a = FileGetShortcut("C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft Office Excel 2003.lnk")

MsgBox(4096,"",$a[0] & @LF & _
                $a[1] & @LF & _
                $a[2] & @LF & _
                $a[3] & @LF & _
                $a[4] & @LF & _
                $a[5] & @LF & _
                $a[6])

$a = DLLCall("msi.dll","int","MsiGetShortcutTarget","str","C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office\Microsoft Office Excel 2003.lnk", _
        "str","","str","","str","")

MsgBox(4096,"",$a[0] & @LF & _
                $a[1] & @LF & _
                $a[2] & @LF & _
                $a[3] & @LF & _
                $a[4])

$b = DLLCall("msi.dll","int","MsiGetComponentPath","str",$a[2],"str",$a[4],"str","","dword*",1024)

MsgBox(4096,"",$b[0] & @LF & _
                $b[1] & @LF & _
                $b[2] & @LF & _
                $b[3] & @LF & _
                $b[4])

MsiGetComponentPath()

http://msdn2.microsoft.com/en-us/library/a...112(VS.85).aspx

MsiGetShortcutTarget()

http://msdn2.microsoft.com/en-us/library/a...299(VS.85).aspx

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...