Hi Natalie, I have the following function for extracting a release note out of my MSI's binary table. Hopefully this is of some use to you. Once you've got the file out, I expect executing it should be fairly simple, but let me know if you're having issues with it.
void CMsiFile::ExtractOneReleaseNote(MSIHANDLE hMsi, const CString& sTableId, const CString& sFileName) { CString sQuery; sQuery.Format(L"SELECT Data FROM `Binary` WHERE `Name` = '%s'", sTableId.GetString()); PMSIHANDLE hView; UINT res = ::MsiDatabaseOpenView(hMsi, sQuery.GetString(), &hView); if (ERROR_SUCCESS == res) { res = ::MsiViewExecute(hView, 0); if (ERROR_SUCCESS == res) { PMSIHANDLE hRecord; res = ::MsiViewFetch(hView, &hRecord); if (ERROR_SUCCESS == res) { DWORD dwSizeNeeded = 0; ::MsiRecordReadStream(hRecord, 1, 0, &dwSizeNeeded); if (dwSizeNeeded > 0) { std::vector<char> contents(dwSizeNeeded); res = ::MsiRecordReadStream(hRecord, 1, &contents[0], &dwSizeNeeded); if (ERROR_SUCCESS == res) { HANDLE hFile = ::CreateFile(sFileName.GetString(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (INVALID_HANDLE_VALUE != hFile) { DWORD dwWritten; const BOOL bWritten = ::WriteFile(hFile, &contents[0], contents.size(), &dwWritten, NULL); ::CloseHandle(hFile); if (!bWritten) { ::DeleteFile(sFileName.GetString()); } } } } } } } } Rob On 17/12/2012 15:34, Natalie Carr wrote: > Hi does anyone have a full example of extracting a file from the binary > table and executing it in C++? I cannot seem get it working at all. > > > > Kind Regards, > > > > Natalie Carr > > > > ------------------------------------------------------------------------------ > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d > ------------------------------------------------------------------------------ Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only - learn more at: http://p.sf.net/sfu/learnmore_122512 _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users