Hello,  I hope the following makes sence to someone!

We have a piece of software which was done before I started with the company
and now I have taken over the installation side of things.

I am reading a registry value in a property called DATABASEPATH.  This works
fine except the original programmer set the entire path including the
filename which i don't want, i only want the directory path (so at the
moment we have for example: 'C:\My Folder\MyFile.txt' and what i NEED is
'C:\My Folder\')

I have no idea how to tackle this and I have been playing around with
CustomActions but I really dont know what I'm doing.  I have some sample
code from the MS Website which I modified and looks like this...

UINT __stdcall DirectoryFormatter(MSIHANDLE hInstall)
{
        TCHAR* szValueBuf = NULL;
        DWORD cchValueBuf = 0;
        UINT uiStat = MsiGetProperty(hInstall, TEXT("DATABASEPATH"), TEXT(""),
&cchValueBuf);
        MsiSetProperty(hInstall, TEXT("DATABASEPATH"), TEXT("C:\\"));   // set 
the
property

        if (ERROR_MORE_DATA == uiStat)
        {
                ++cchValueBuf;
                
                szValueBuf = new TCHAR[cchValueBuf];
                if (szValueBuf)
                {
                        uiStat = MsiGetProperty(hInstall, TEXT("DATABASEPATH"), 
szValueBuf,
&cchValueBuf);
                        MsiSetProperty(hInstall, TEXT("DATABASEPATH"), 
TEXT("C:\\"));   // set the
property
                }
        }

        if (ERROR_SUCCESS != uiStat)
        {
                if (szValueBuf != NULL)
                {
                        delete [] szValueBuf;
                }

                return ERROR_INSTALL_FAILURE;
        }

        delete [] szValueBuf;

        return ERROR_SUCCESS;
}

Obviously a function will replace 'C:\\' with the stripped down path (could
probably figure that out).

My problem is getting this to run and change the DATABASEPATH property.  The
user is not going to get a choice at to where to install this because it
will be installed into the directory that it finds.  Am I over complicating
things?  If there is an easier way I would love to hear it because I'm
pulling my hair out now!

I am NOT a C++ Programmer so I have no idea what that code is doing!!  Any
help will be greatly appreciated.

Thanks in advance
-- 
View this message in context: 
http://www.nabble.com/Custom-Action-C%2B%2B-DLL-tf1955356.html#a5362968
Sent from the wix-users forum at Nabble.com.



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to