Hey Pratapa, I am not sure I can help you "append data" to your custom action. However, here is what I do to read the data from the stream being passed to the deferred custom action.
HRESULT hr = S_OK; UINT er = ERROR_SUCCESS; BOOL isTurnedOn = FALSE; LPWSTR pwzAuthCabPath = NULL; HANDLE hFile = INVALID_HANDLE_VALUE; LPWSTR pwzCustomActionData = NULL; LPBYTE pbData = NULL; DWORD_PTR cbData = 0; DWORD cbWritten = 0; hr = WcaInitialize(hInstall, "ConfigureMU"); ExitOnFailure(hr, "failed to initialize ConfigureMU"); // get temporary path for extracted file StrAlloc(&pwzAuthCabPath, MAX_PATH); ExitOnFailure(hr, "Failed to allocate temporary path"); ::GetTempPathW(MAX_PATH, pwzAuthCabPath); hr = ::StringCchCatW(pwzAuthCabPath, MAX_PATH, L"muauth.cab"); ExitOnFailure(hr, "Failed to append filename."); hr = WcaGetProperty( L"CustomActionData", &pwzCustomActionData); ExitOnFailure(hr, "failed to get CustomActionData"); * //Get the stream for the custom action data. hr = WcaReadStreamFromCaData(&pwzCustomActionData, &pbData, &cbData); ExitOnFailure(hr, "failed to read file contents from custom action data");* Brian Rogers "Intelligence removes complexity." - Me http://icumove.spaces.live.com On Tue, Jan 27, 2009 at 11:22 PM, psanaga <pratap.san...@gmail.com> wrote: > > Thank you Brian. I figured out how to get the data from the binary table. > But > I'm still not able to find how to append data to the custom action data. > > Also, I'm getting return code 6(I'm guessing invalid handle) for > MsiGetProperty(). I don't recall any change to my code which would cause > this. Any idea in what all conditions I might get this error? > > Thanks! > > > > Brian Rogers wrote: > > > > Hey, > > > > This is some code that I used to do that. I think you can look into the > > shellexecca.cpp< > http://wix.cvs.sourceforge.net/viewvc/wix/wix/src/ca/wixca/dll/shellexecca.cpp?hideattic=1&revision=1.4&view=markup&pathrev=MAIN > > > > file. > > > > HRESULT hr = S_OK; > > UINT er = ERROR_SUCCESS; > > LPWSTR pwzStreamToString = NULL; > > BYTE* pbData = NULL; > > DWORD cbData = 0; > > > > hr = WcaInitialize(hInstall, "ScheduleMuConfig"); > > ExitOnFailure(hr, "failed to initialize ScheduleMuConfig"); > > > > //Extact the muauth.cab to a stream. > > hr = ExtractBinary(L"MuAuthCab", &pbData, &cbData); > > ExitOnFailure(hr, "failed to extract binary data"); > > > > //Write the stream to a string to be passed as CustomActionData > > hr = WcaWriteStreamToCaData(pbData, cbData, &pwzStreamToString); > > ExitOnFailure(hr, "failed to write the stream to a string"); > > > > hr = WcaDoDeferredAction(L"RollbackConfigMU", L"Rollback", 0); > > ExitOnFailure(hr, "Failed to schedule RollbackConfigMU"); > > > > hr = WcaDoDeferredAction(L"ConfigureMU", pwzStreamToString, > > COST_MU_CONFIG_TRANSACTION); > > ExitOnFailure(hr, "Failed to schedule ConfigureMU"); > > > > LExit: > > ReleaseStr(pwzStreamToString); > > ReleaseMem(pbData); > > if (FAILED(hr)) > > { > > er = ERROR_INSTALL_FAILURE; > > } > > return WcaFinalize(er); > > > > Brian Rogers > > "Intelligence removes complexity." - Me > > http://icumove.spaces.live.com > > > > > > On Mon, Jan 26, 2009 at 12:03 AM, Pratapa Reddy Sanaga < > > pratap.san...@gmail.com> wrote: > > > >> Hi, > >> > >> I'm placing a .pfx certificate in the binary table and wish to retrieve > >> it > >> in my deferred custom action dll. From what I read on the forum, I see > >> that > >> this can be achieved by reading the certificate using immediate custom > >> action, write it to custom action data(or to a temporary file, which I > >> don't > >> prefer) and then call the deferred custom action that can use this data. > >> Can > >> someone please help me with the following doubts: > >> > >> 1. What APIs should I be looking at, to write to custom action data in > an > >> immediate custom action? > >> 2. The certificate is purely binary data and all the APIs return > strings. > >> So, I'm afraid that I'd loose some data if there is a NULL in the binary > >> data. How can I handle this situation? > >> 3. I have a URI that should also be placed in the custom action data. > So, > >> how can I append the certificate's binary stream to the custom action > >> data(which contains the URI already)? > >> > >> Thanks, > >> Pratapa. > >> > ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users