Menu

#1386 bad default working folder for WixShellExec

v3.0
closed
2012-09-15
2008-10-28
No

Doing this:

    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch App" />
    <Property Id="WixShellExecTarget" Value="MyApp" />
    <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />

provides a checkbox after the install which launches the app. However unlike a traditional shortcut, the app is launched with the working folder set to c:\windows\system32.

This is because in src\ca\wixca\dll\shellexecca.cpp, the code is:

HINSTANCE hinst = ::ShellExecuteW(NULL, NULL, wzTarget, NULL, NULL, SW_SHOWDEFAULT);

The last NULL sets the working folder to the current working folder.

Discussion

  • Bob Arnson

    Bob Arnson - 2008-10-30

    Problem is, there's no better default than none. I've considered looking at the given target to see if there's valid path info, but that won't do anything for your sample.

     
  • Jason Sandlin

    Jason Sandlin - 2008-10-31

    About the only thing I think is to try to mirror Start | Run behavior with something like this to pull the path from the target.

    WCHAR* szPath = NULL;
    WCHAR szFolder[MAX_PATH];
    WCHAR* szFilePart = NULL;
    int nResult = ::GetFullPathName( wzTarget, MAX_PATH, szFolder, &szFilePart );
    if( nResult != 0 && szFilePart != NULL )
    {
        *szFilePart = 0;
        szPath = szFolder;
    }
    HINSTANCE hinst = ::ShellExecuteW(NULL, NULL, wzTarget, NULL, szPath, SW_SHOWDEFAULT);
    
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 21 days (the time period specified by
    the administrator of this Tracker).

     
MongoDB Logo MongoDB