Installer/uninstaller issue
I have a custom installer that places a program's shortcut on a desktop using the following code sequence:
Code:
SHGetSpecialFolderLocation(hWnd, CSIDL_DESKTOPDIRECTORY, &pidl);
SHGetPathFromIDList(pidl, path);
CString pPathLinkTo;
pPathLinkTo = path + LinkName;
//Use 'path' to create a shortcut
IShellLink* psl;
CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink,
reinterpret_cast<void**>(&psl));
psl->SetPath(pPathLinkTo);
IPersistFile* ppf;
psl->QueryInterface(IID_IPersistFile, reinterpret_cast<void**>(&ppf));
ppf->Save(pSaveLinkTo, TRUE);
ppf->Release();
psl->Release();
I should also say that the installer is running elevated.
Now, when the uninstaller runs (also elevated) it attempts to delete the shortcut created above using the following code:
Code:
SHGetSpecialFolderLocation(hWnd, CSIDL_DESKTOPDIRECTORY, &pidl);
SHGetPathFromIDList(pidl, path);
CString pPathLinkTo;
pPathLinkTo = path + LinkName;
DeleteFile(pPathLinkTo);
It succeeds and removes the link from the Admin account's desktop, but what it fails to do is to remove the same shortcut from [another] standard user's desktop on the same system. For some reason the installer creates a copy of the shortcut for the standard user as well.
How do I make uninstaller remove the shortcut from a standard user's desktop too?
Re: Installer/uninstaller issue
I guess you could avoid this problem if you placed the shortcuts in CSIDL_COMMON_DESKTOPDIRECTORY rather than CSIDL_DESKTOPDIRECTORY folder.
Re: Installer/uninstaller issue
Quote:
Originally Posted by
VictorN
I guess you could avoid this problem if you placed the shortcuts in CSIDL_COMMON_DESKTOPDIRECTORY rather than CSIDL_DESKTOPDIRECTORY folder.
Victor, unfortunately I cannot change that installer (it's an old version of the software that has to be removed before a new one is installed). So my question is, how do I remove all those shortcuts now?
Re: Installer/uninstaller issue
Then you can be in trouble!
Try to search for the shortcuts in all subdirectories of C:\Documents and Settings and permanently delete them.
Re: Installer/uninstaller issue
Quote:
Originally Posted by
VictorN
Then you can be in trouble!
Try to search for the shortcuts in all subdirectories of C:\Documents and Settings and permanently delete them.
Yeah, that's what I thought. Thanks.