CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    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?
    Last edited by ahmd; September 1st, 2010 at 02:16 AM.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    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.
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Installer/uninstaller issue

    Quote Originally Posted by VictorN View Post
    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?

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    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.
    Victor Nijegorodov

  5. #5
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Installer/uninstaller issue

    Quote Originally Posted by VictorN View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured