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