ChangeSet ID: 21149 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/11/08 04:55:26
Modified files: programs/winemenubuilder: winemenubuilder.c
Log message: Mike McCormack mike@codeweavers.com Extract the executable name for msi advertised shortcuts.
Patch: http://cvs.winehq.org/patch.py?id=21149
Old revision New revision Changes Path 1.35 1.36 +29 -2 wine/programs/winemenubuilder/winemenubuilder.c
Index: wine/programs/winemenubuilder/winemenubuilder.c diff -u -p wine/programs/winemenubuilder/winemenubuilder.c:1.35 wine/programs/winemenubuilder/winemenubuilder.c:1.36 --- wine/programs/winemenubuilder/winemenubuilder.c:1.35 8 Nov 2005 10:55:26 -0000 +++ wine/programs/winemenubuilder/winemenubuilder.c 8 Nov 2005 10:55:26 -0000 @@ -52,6 +52,7 @@ #include <shlobj.h> #include <objidl.h> #include <shlguid.h> +#include <appmgmt.h>
#include "wine/unicode.h" #include "wine/debug.h" @@ -726,6 +727,33 @@ static BOOL GetLinkLocation( LPCWSTR lin return FALSE; }
+/* gets the target path directly or through MSI */ +static HRESULT get_path( IShellLinkW *sl, LPWSTR szPath, DWORD sz ) +{ + IShellLinkDataList *dl = NULL; + EXP_DARWIN_LINK *dar = NULL; + HRESULT hr; + + szPath[0] = 0; + hr = IShellLinkW_GetPath( sl, szPath, MAX_PATH, NULL, SLGP_RAWPATH ); + if (hr == S_OK && szPath[0]) + return hr; + + hr = IShellLinkW_QueryInterface( sl, &IID_IShellLinkDataList, (LPVOID*) &dl ); + if (FAILED(hr)) + return hr; + + hr = IShellLinkDataList_CopyDataBlock( dl, EXP_DARWIN_ID_SIG, (LPVOID*) &dar ); + if (SUCCEEDED(hr)) + { + CommandLineFromMsiDescriptor( dar->szwDarwinID, szPath, &sz ); + LocalFree( dar ); + } + + IShellLinkDataList_Release( dl ); + return hr; +} + static BOOL InvokeShellLinker( IShellLinkW *sl, LPCWSTR link, BOOL bAgain ) { char *link_name = NULL, *icon_name = NULL, *work_dir = NULL; @@ -760,8 +788,7 @@ static BOOL InvokeShellLinker( IShellLin IShellLinkW_GetDescription( sl, szDescription, INFOTIPSIZE ); WINE_TRACE("description: %s\n", wine_dbgstr_w(szDescription));
- szPath[0] = 0; - IShellLinkW_GetPath( sl, szPath, MAX_PATH, NULL, SLGP_RAWPATH ); + get_path( sl, szPath, MAX_PATH ); WINE_TRACE("path : %s\n", wine_dbgstr_w(szPath));
szArgs[0] = 0;