Go Back   PackageDeploy Application Packaging Forums > Package Development > Application Packaging > Platformsdk MSI

Reply
 
LinkBack Thread Tools Display Modes
Old 07-01-2010, 04:01 PM   #1 (permalink)
David Brooks
Guest
 
Posts: n/a
Default Re:Instance Transforms and MsiOpenProduct

Hi kishmu...

I been searching around for a solution to a very similar problem and this
thread is the closest I have come to finding one. I know this is an old
issue to you, but do you think you could help point me in the right
direction?

I am not sure I completely understand your final comment: "I ended up
copying the cached msi to temp folder, changing its product
code to that of the instance transform, and then calling
MsiOpenDatabase and MsiOpenPackage. That works."

MsiOpenPackage will open the cached database with the transform already
applied, right? I have that working, and I see why you do an
MsiOpenDatabase on the copy (so you have to handles to diff to generate a
new transform), but where do you change the value? When I try to apply a
change to the database opened in MsiOpenPackage I get a failure on the view.
The database opened with MsiOpenDatabase, of course, doesn't show me any of
the changes in the transform (even after calling MsiDatabaseApplyTransform.

So I am stuck. I would greatly appreciated it if you could help me out (and
if you are even monitoring this tread any more).

Thanks,

Dave

url:http://www.ureader.com/msg/16531736.aspx
  Reply With Quote
Old 07-12-2010, 07:01 PM   #2 (permalink)
Adrian Accinelli
Guest
 
Posts: n/a
Default Re: Re:Instance Transforms and MsiOpenProduct

"David Brooks" <db@iy.com> wrote in message
news:1699faad14814a658e9766fadc49b7f3@newspe.com.. .
> Hi kishmu...
> I been searching around for a solution to a very similar problem and this
> thread is the closest I have come to finding one. I know this is an old
> issue to you, but do you think you could help point me in the right
> direction?
> I am not sure I completely understand your final comment: "I ended up
> copying the cached msi to temp folder, changing its product
> code to that of the instance transform, and then calling
> MsiOpenDatabase and MsiOpenPackage. That works."
> MsiOpenPackage will open the cached database with the transform already
> applied, right? I have that working, and I see why you do an
> MsiOpenDatabase on the copy (so you have to handles to diff to generate a
> new transform), but where do you change the value? When I try to apply a
> change to the database opened in MsiOpenPackage I get a failure on the
> view. The database opened with MsiOpenDatabase, of course, doesn't show
> me any of the changes in the transform (even after calling
> MsiDatabaseApplyTransform.
> So I am stuck. I would greatly appreciated it if you could help me out
> (and if you are even monitoring this tread any more).
> Thanks,
> Dave
> url:http://www.ureader.com/msg/16531736.aspx


To work with the Database's data you need to have a MSIHANDLE to the
Database itself. MsiOpenPackage/Ex and MsiOpenProduct give you an
Installation MSIHANDLE rather than a Database MSIHANDLE. That's why you
have the call MsiGetActiveDatabase from say a custom action because you are
given an Install handle in the MSIHANDLE provided to you. In addition the
active install database is read-only except for temporary rows/tables so
that's probably why you views are failing since you are likely trying to
modify them -- check the error are you getting to be sure.

To make a transform with all latest patches in place in the original
database I would:
1. Locate Cached MSI (or original msi) and copy it to temp -- call it
MSI_orig
2. Update MSI_a with instance ProductCode and close it. Then open with
MsiOpenPackage as hProduct.
3. Get the active Database from this Product Handle -- call it MSI_a. At
this point you should have read-only copy of patched/transformed MSI for the
product you want.
4. Create new empty database using MSIDBOPEN_CREATEDIRECT is fine -- call it
MSI_b
5. Enumerate contents of `_Tables` table from MSI_a, then
Export each table found to IDT file and import into MSI_b (using
MsiDatabaseExport/MsiDatabaseImport)
Export/Import _SummaryInformation table
6. Commit and close Handles

The up-to-date MSI_b file should now be available for copying/modification
and suitable for creating a transform.

Sincerely,
Adrian Accinelli


  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:09 AM.


vBulletin, Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
2007 - 2012 PackageDeploy.com