I figured out that how to do below thing using shortcut table: create a shortcut under $(env.SYSTEMDRIVE)\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start menu\Programs\Startup
Thanks for reminder. Cheers Lian -----Original Message----- From: Lian Jiang Sent: Thursday, August 20, 2009 12:33 PM To: 'General discussion for Windows Installer XML toolset.' Subject: RE: [WiX-users] IPersistFile::Save return 0x8007007b in custom action. Thanks Blair. I am trying to create a shortcut under $(env.SYSTEMDRIVE)\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start menu\Programs\Startup, but I did not find any Folder property to do this declaratively. That's why I create my own custom action. I once made below scenario work: Step 1. Create a native exe to create shortcut; Step 2. In my installer, the custom action call this exe after files are installed. I want to remove this native exe by migrating this function to a C# custom action. It looks like I have to roll back to the native exe solution. Thanks Lian -----Original Message----- From: Blair [mailto:os...@live.com] Sent: Thursday, August 20, 2009 12:03 PM To: 'General discussion for Windows Installer XML toolset.' Subject: Re: [WiX-users] IPersistFile::Save return 0x8007007b in custom action. That error code is "The filename, directory name, or volume label syntax is incorrect." Not sure which of the two paths it doesn't like. -----Original Message----- From: Blair [mailto:os...@live.com] Sent: Thursday, August 20, 2009 11:49 AM To: 'General discussion for Windows Installer XML toolset.' Subject: Re: [WiX-users] IPersistFile::Save return 0x8007007b in custom action. Not sure, but why aren't you using MSI's Shortcut table instead of rolling your own? -----Original Message----- From: Lian Jiang [mailto:lji...@microsoft.com] Sent: Thursday, August 20, 2009 10:40 AM To: General discussion for Windows Installer XML toolset. Subject: [WiX-users] IPersistFile::Save return 0x8007007b in custom action. Hi, I have a custom action which creates a link (shortcut). The calling process between layers is: a) The function of creating link is implemented in a C++ DLL. It uses IPersistFile::Save to save the link. b) The function is wrapped in C# code using P/invoke. c) My C# custom action calls this wrapped function to create the link. Right now the log always reports IPersistFile::Save always return 0x8007007b (-2147024773) which means the path is not correct. I have already succeeded to create a link using the same C++ dll and a managed standalone exe (using p/invoke too). Also I have tested that the parameter passing has no problem. For example, I passed in "c:\np.lnk" then I can see the C++ function can return the same string which is printed in msi log. I don't think it is permission issue because (a) I always run the msi in an admin command window, (b) I tried "impersonate='no'", (c) the link is created just under "c:\" instead of any privileged locations . Based on my test, I suspect that IPersistFile::Save may not be used in an installer like a standalone managed exe. What I am doing wrong with below code? hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (LPVOID*)&psl); psl->SetPath(lpszTargetPath); // lpszTargetPath is "c:\windows\system32\notepad.exe" hr = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf); hr = ppf->Save(lpszShortcutPath, TRUE); // return 0x8007007b. lpszShortcutPath is "c:\np.lnk" Appreciate any insight. Thanks Lian ---------------------------------------------------------------------------- -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ---------------------------------------------------------------------------- -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users