Featured post
c# dllimport of MsiGetShortcutTarget(msi.dll) failed with error 1603 under Windows 7 -
i want resolve advertised msi shortcut in c# described here: how parse "special" .lnk files, aka. msi shortcuts aka. windows installer advertised shortcuts using c#
[dllimport("msi.dll", charset = charset.auto)] private static extern uint32 msigetshortcuttarget( string szshortcuttarget, [out] stringbuilder szproductcode, [out] stringbuilder szfeatureid, [out] stringbuilder szcomponentcode); public static string parseshortcut(string file) { stringbuilder product = new stringbuilder(maxguidlength + 1); stringbuilder feature = new stringbuilder(maxfeaturelength + 1); stringbuilder component = new stringbuilder(maxguidlength + 1); uint32 res = msigetshortcuttarget(file, product, feature, component); ... }
i use vs 2010 , tried different settings "platform target" and/or "target framework". msigetshortcuttarget returns 1603 (a fatal error occurred during installation) under windows 7.
i tried same c++ , can resolve shortcut , fine. tested msi.dll, copied windows xp , dll can resolve shortcut c# code. have no idea why c# code won't work msi.dll under windows 7.
i testet msigetcomponentpath known product guid , component guid resolve target path in c# dll, returns 1603 msigetshortcuttarget , works perfectly. msigetcomponentpath fails under windows 7 , don't know why went wrong.
this seems related way com initialized.
if add [stathread]
main
method, works fine (well, if use stringbuilder
instead of char[]
arguments :-), return value of 1603 when using mta.
- Get link
- X
- Other Apps
Comments
Post a Comment