And make sure the phView is actually pointing at a view handle. Usually, you'd have MSIHANDLE hView; ... > If (MsiDatabaseOpenView(database, "SELECT 'Data' FROM 'Binary' WHERE > 'Name'= 'Hasp'", &hView) != ERROR_SUCCESS) ...
Dave On 11/22/2012 9:19 AM, Peter Shirtcliffe wrote: > Adjust that to > > PMSIHANDLE database = MsiGetActiveDatabase(hInstall); > if (database == 0) > ; //handle the error somehow and exit > > If (MsiDatabaseOpenView(database, "SELECT 'Data' FROM 'Binary' WHERE > 'Name'= 'Hasp'", phView) != ERROR_SUCCESS) > ; // handle the error somehow and exit > > > If you're more interested in getting it done quickly then you can use > ExtractBinary from the wix wcautil/dutil libraries. Its mentioned in these > links > Source > http://wix.cvs.sourceforge.net/viewvc/wix/wix/src/ca/wixca/dll/shellexecca.cp > p?hideattic=1&revision=1.4&view=markup&pathrev=MAIN > Example > http://blogs.msdn.com/b/icumove/archive/2009/06/23/custom-action-using-wix-re > ading-from-the-binary-table.aspx > > > -----Original Message----- > From: Natalie Carr [mailto:natalie.c...@measuresoft.com] > Sent: 22 November 2012 17:03 > To: 'General discussion for Windows Installer XML toolset.' > Subject: Re: [WiX-users] Extract Binary file from MSI C++ > > Peter, > I know now what you mean: > extern "C" UINT __stdcall InstallDrivers(MSIHANDLE hInstall) { > MsiGetActiveDatabase(hInstall); > MsiDatabaseOpenView(hInstall, "SELECT 'Data' FROM 'Binary' WHERE 'Name' > = 'Hasp'", phView); > MsiRecordReadStream(*phView, 1, szBuffer, &cbBuf); > CreateFile(szBuffer, GENERIC_WRITE,FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, > FILE_ATTRIBUTE_NORMAL, NULL); } > > Debugging throws up no errors it just ends the setup prematurely. > Kind Regards, > > Natalie Carr > > > -----Original Message----- > From: Peter Shirtcliffe [mailto:pshirtcli...@sdl.com] > Sent: Thursday, November 22, 2012 4:54 PM > To: General discussion for Windows Installer XML toolset. > Subject: Re: [WiX-users] Extract Binary file from MSI C++ > > The argument to MsiDatabaseOpenView should be a handle to a database. That > would be there return value of MsiGetActiveDatabase. MsiGetActiveDatabase > takes and argument of an installation session which is what the custom action > is passed on entry. You've passed and uninitialized database handle to both > calls. > > -----Original Message----- > From: Natalie Carr [mailto:natalie.c...@measuresoft.com] > Sent: 22 November 2012 16:35 > To: wix-users@lists.sourceforge.net > Subject: [WiX-users] Extract Binary file from MSI C++ > > Hi I am trying to run a custom action to extract a binary file from my WIX > installer, so far I have got this but I know it is not complete but I am not > sure where I am going wrong. I am using a C++ Custom Action and the file is > an exe. Any help would greatly be appreciated. > > > > > > MsiGetActiveDatabase(hDatabase); > > MsiDatabaseOpenView(hDatabase, "SELECT 'Data' FROM 'Binary' WHERE 'Name' > = 'Hasp'", phView); > > MsiRecordReadStream(*phView, 1, szBuffer, &cbBuf); > > CreateFile(szBuffer, GENERIC_WRITE,FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, > FILE_ATTRIBUTE_NORMAL, NULL); > ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users