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); Kind Regards, Natalie Carr ----------------------------------------------------------------------------- - 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 SDL PLC confidential, all rights reserved. If you are not the intended recipient of this mail SDL requests and requires that you delete it without acting upon or copying any of its contents, and we further request that you advise us. SDL PLC is a public limited company registered in England and Wales. Registered number: 02675207. Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, UK. ------------------------------------------------------------------------------ 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