Community Forums
Page 1 of 2 12 LastLast
Results 1 to 5 of 7

Thread: Basic MSI Project - Custom Action - unable to get installed path

  1. #1
    Join Date
    Jan 2017
    Location
    Hyderabad
    Posts
    3

    Angry Basic MSI Project - Custom Action - unable to get installed path

    Hi,

    I am using InstallShiled 2014 Pro.
    I have created Basic MSI Project.
    Added CustomAction in Basic MSI Project. ( Call a function in a Windows Installer dynamic-link library )

    PFA: Screenshot for more info
    https://i.imgsafe.org/1b4b0f3066.png

    Added the new property in property manager.

    Name - CustomActionData
    Value - [INSTALLDIR]bin

    When I executed setup.exe then "Install" custom action has thrown.
    I am unable to get installed path.

    shared custom action dll source code.
    Code:
    UINT __stdcall Install( MSIHANDLE hInstall )
    {
       TCHAR customData[MAX_FILE_PATH * 3];
    
       DWORD len = sizeof( customData ) / sizeof( TCHAR );
       
       UINT gp = ::MsiGetProperty( hInstall,
                                   _T("CustomActionData"), 
                                   customData, 
                                   &len);
       ::MessageBox(NULL, customData, "Install", MB_OK);
       if (gp != ERROR_SUCCESS)
       {
          return ERROR_INSTALL_FAILURE;
    	  ::OutputDebugString("gp != ERROR_SUCCESS");
       }
    
    return ERROR_SUCCESS;
    }


    I got "[INSTALLDIR]bin" instead of "installed path" value in the message.box.

  2. #2
    chad.petersen Guest
    It's been a long time since I used C++ for a Custom Action. I always use C# these days. But see if this information helps

    https://social.msdn.microsoft.com/Fo...=winformssetup

    The passing of [TARGETDIR] into CustomActionData seems to have been the trick in this case.

    I hope that helps.

    Chad

  3. #3
    Join Date
    Oct 2001
    Location
    Itasca, IL
    Posts
    2,387
    To pass a value as CustomActionData, you need to set a property that matches the name of the custom action. In your case, set the value of the property named CustomActions to [INSTALLDIR]bin.
    Last edited by hidenori; 01-24-2017 at 10:28 PM.
    Hidenori Yamanishi - Senior Software Engineer - Flexera Software: InstallShield Team

  4. #4
    Join Date
    Jan 2017
    Location
    Hyderabad
    Posts
    3

    i am unable to get installed path while installing

    Hi chad.petersen

    Thanks for reply

    Please addressed my following steps.

    1.
    I have added a custom action in merge module.
    PFA: screenshot has more info.
    https://i.imgsafe.org/afb61dba52.png

    2.
    I have added Property in Property Manager in merge module.
    PFA Screenshot for more info.
    https://i.imgsafe.org/afd2ad7396.png

    3.
    I have added merge module in basic MSI Project.

    4.
    I have added the custom action from merge module in basic MSI project.
    PFA: screenshot for more info.
    https://i.imgsafe.org/afdda9c8e0.png


    I have shared sample source code of dll
    Code:
    UINT __stdcall Install( MSIHANDLE hInstall )
    {
       TCHAR customData[MAX_FILE_PATH * 3];
    
       DWORD len = sizeof( customData ) / sizeof( TCHAR );
       
       UINT gp = ::MsiGetProperty( hInstall,
                                   _T("CustomActionsForInstall"), 
                                   customData, 
                                   &len);
       ::MessageBox(NULL, customData, "Install", MB_OK);
       if (gp != ERROR_SUCCESS)
       {
          return ERROR_INSTALL_FAILURE;
    	  ::OutputDebugString("gp != ERROR_SUCCESS");
       }
    
    return ERROR_SUCCESS;
    }


    I have set CustomActionName = PropertyName in merge module.

    Please verify my install sequences of custom action.


    I have set all property as per your instruction but it is not working now.

    Regards,
    Vijay Kumbhani
    Regards,
    Vijay Kumbhani

  5. #5
    Join Date
    Oct 2001
    Location
    Itasca, IL
    Posts
    2,387
    The value of the property that matches the name of your custom action is available in the CustomActionData property within the deferred, commit, or rollback custom action. You need to get the value of the the CustomActionData property as your original code did:

    Code:
    UINT __stdcall Install( MSIHANDLE hInstall )
    {
       TCHAR customData[MAX_FILE_PATH * 3];
    
       DWORD len = sizeof( customData ) / sizeof( TCHAR );
       
       UINT gp = ::MsiGetProperty( hInstall,
                                   _T("CustomActionData"), 
                                   customData, 
                                   &len);
       ::MessageBox(NULL, customData, "Install", MB_OK);
       if (gp != ERROR_SUCCESS)
       {
          return ERROR_INSTALL_FAILURE;
    	  ::OutputDebugString("gp != ERROR_SUCCESS");
       }
    
    return ERROR_SUCCESS;
    }
    Hidenori Yamanishi - Senior Software Engineer - Flexera Software: InstallShield Team

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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