[wix-users] calling 3rd part library calls using custom action in c++

Hoover, Jacob Jacob.Hoover at greenheck.com
Tue Mar 5 07:34:54 PST 2019

A)  What is CreateNewFIle, and is it able to handle the // 's?
B)  You need something inside a fragment that you reference in your main authoring to "pull it in".
C) Have you looked at your MSI post compile in Orca?  My guess is the CA isn't included nor scheduled due to B.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Hanumanthaiah, ShashikalaX via wix-users
Sent: Tuesday, March 5, 2019 2:09 AM
To: wix-users at lists.wixtoolset.org
Cc: Hanumanthaiah, ShashikalaX <shashikalax.hanumanthaiah at intel.com>
Subject: [wix-users] calling 3rd part library calls using custom action in c++


    I have created a DLL which just creates a file. Iam trying call this Createnewfile API through custom action in wix cpp.
    My compilation went fine but when I run the msi , The file is not getting created after the installation. Iam attaching the snippet for reference.
   Could you please guide me where Iam going wrong .

#include "Testdll.h"

UINT __stdcall Createfile(
       MSIHANDLE hInstall
       HRESULT hr = S_OK;

       hr = WcaInitialize(hInstall, "Createfile");
       ExitOnFailure(hr, "Failed to initialize");

       //const char* filepath="C://shashi.txt";
       //const char * Mode = "W";
       //wsprintfA(filepath, "%S",L"Name");
       //wsprintfA(Mode, "%S", L"Name");
       //LPWSTR filepath;
       //LPWSTR Mode;

//hr = WcaGetProperty(L"Name", &filepath); //hr = WcaGetProperty(L"Mode", &Mode);
       WcaLog(LOGMSG_STANDARD, "Initialized.");
       Createnewfile("C://shashi.txt", "w");

       // TODO: Add your custom action code here.

       return WcaFinalize(er);


<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="Testapp" Language="1033" Version="" Manufacturer="Intel" UpgradeCode="37b2e1fe-dc59-41d8-9ee8-c5601dc4e1d9">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallFinalize"/>
    <Media Id="1" Cabinet="Product.cab" EmbedCab="yes" />

    <Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLLOCATION" Name="Testapp" >
          <Component Id="ProductComponent" Guid="19bf71c2-30e3-4e57-8dec-11889b81bab3">
            <File Id="Testapp" Name="Testapp.exe" Source="..\Testapp\Debug\Testapp.exe" KeyPath="yes" />

    <Binary Id='CustomCreateBinary' SourceFile='..\Testappcustomaction\bin\Debug\Testappcustomaction.dll'/>
    <CustomAction Id='CustomCreate' BinaryKey='CustomCreateBinary' DllEntry='Createfile' Execute='immediate'   Return='check'/>

    <Custom Action="CustomCreate" After="InstallFiles"></Custom>
    <Custom Action="CustomCreate" After="InstallFiles"></Custom>

Thanks and Regards,

WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.

More information about the wix-users mailing list