Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Orca corrupts msi file

704 views
Skip to first unread message

Rob Gravereaux

unread,
May 16, 2003, 9:08:47 AM5/16/03
to
I'm trying to change a property table value from an msi produced by visual
studio .net.

I opened an msi file created from visual studio .net in Orca from the feb.
2003 psdk (v. 2.0.3790.0), changed nothing, then saved it to a new file.

The resulting MSI install fails with error 2356 (Couldn't locate cabinet in
stream). The original msi file installs OK. The modified msi file is about
300K smaller than the original.

Anyone know what this is, why I'm receiving this error, and what I can do to
correct it?

Thanks.


--
______________________________
Rob Gravereaux
Principle Software Developer
Glen Road Systems, Inc.
http://www.grsinc.com


Michael Sanford [MVP]

unread,
May 16, 2003, 12:36:56 PM5/16/03
to
Orca does not copy the embedded storages over when you do a "Save As...". The
only way to handle this is to copy the file first then edit your copy.

--
R. Michael Sanford
Windows Installer MVP
+++++++++++++++++++++++++++++++++++++++++++++++++++++
ActiveInstall Professional is now available!!!
- Visit http://www.activeinstall.com and download a trial today!!!
- Ask nicely and I'll even give you a special discount code! ;-)
+++++++++++++++++++++++++++++++++++++++++++++++++++++
"Rob Gravereaux" <Rob_Gra...@grsinc.com> wrote in message
news:#VRH4u6G...@tk2msftngp13.phx.gbl...

Derek (MS)

unread,
May 16, 2003, 6:34:50 PM5/16/03
to
Rob,

For windows installer (msi) questions you will probably get more help in the Windows Installer newsgroup
(microsoft.public.platformsdk.msi)

--
Cheers,
Derek [MS-SDK]

-Please do not send email directly to this alias. This alias is for newsgroup purposes only

-This posting is provided "AS IS" with no warranties, and confers no rights.
"Rob Gravereaux" <Rob_Gra...@grsinc.com> wrote in message news:eU#F4EKGD...@TK2MSFTNGP12.phx.gbl...

Rob Gravereaux

unread,
May 19, 2003, 8:12:17 AM5/19/03
to
If that's true then is it possible to apply a transform and save the
resulting msi without losing the embedded storages? When I apply a transform
the only option available is 'Save Transform As...'

Thanks.

"Michael Sanford [MVP]" <msan...@activeinstall.com> wrote in message
news:#IqRpk8G...@TK2MSFTNGP11.phx.gbl...

Michael (michka) Kaplan [MS]

unread,
May 19, 2003, 9:22:23 AM5/19/03
to
Why not use the method Michael suggested? Copy the file and then edit the
copy.


--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Rob Gravereaux" <Rob_Gra...@grsinc.com> wrote in message
news:OzyOQ9f...@TK2MSFTNGP12.phx.gbl...

Rob Gravereaux

unread,
May 19, 2003, 10:08:43 AM5/19/03
to
Michaels method works, but I'd rather use a transform if possible. It would
save me (potentially) from a lot of repetitive and error-prone manual
editing. I'll be making the modifications with Orca every time I rebuild the
msi which won't be too much fun.

"Michael (michka) Kaplan [MS]" <mic...@online.microsoft.com> wrote in
message news:eahCamgH...@tk2msftngp13.phx.gbl...

Michael (michka) Kaplan [MS]

unread,
May 19, 2003, 11:31:45 AM5/19/03
to
Actually, all of those operations can be automated; nothing has to be
manual. Its one API to copy a file, a just a few APIs to edit the MSI.


--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Rob Gravereaux" <Rob_Gra...@grsinc.com> wrote in message

news:%23P%23wT%23gHD...@TK2MSFTNGP10.phx.gbl...

Rob Gravereaux

unread,
May 19, 2003, 1:08:44 PM5/19/03
to
I guess I'll assume that it's not possible to apply a transform and save

without losing the embedded storages?

Do you have any sample code for the API solution?

Thanks.

"Michael (michka) Kaplan [MS]" <mic...@online.microsoft.com> wrote in

message news:eR89kuhH...@TK2MSFTNGP11.phx.gbl...

Michael (michka) Kaplan [MS]

unread,
May 19, 2003, 3:39:52 PM5/19/03
to
I do not know if it is possible -- I am a user of Windows Installer, versus
being a member on the team. Someone else may be able to answer your question
of whether a transform would be possible.

But from my pre-Microsoft, solution-oriented days I was pointing to the
easiest solution I could see. I was focused on helping you find *an* answer,
rather than trying to giv you the specific answer for which you were
looking. :-)

For APIs, its hard to answer without knowing what programming language you
are using here. You have not specified what actions you are taking. In your
example you opened the file, changed nothing, and saved it -- obviously this
issue is solved in the suggestions posted. Beyond that, you would have to be
more specific about language and types of changes you are making to receive
sample code or assistance with code.


--
MichKa [MS]

This posting is provided "AS IS" with
no warranties, and confers no rights.

"Rob Gravereaux" <Rob_Gra...@grsinc.com> wrote in message

news:%23ws35ii...@TK2MSFTNGP12.phx.gbl...

Rob Gravereaux

unread,
May 21, 2003, 8:15:06 AM5/21/03
to
Possible languages would be any of the visual studio .net or visual studio 6
languages - VB6, C++6, VB.Net, C#. If it's in another language I'm sure I'll
be able to decipher what APIs are used, and translate the code to a language
of my choice.

You mentioned 'one api to copy a file, just a few apis to edit the msi'. How
about an example to do that? A specific sequence of operations would be:
1) Copy the MSI.
2) Apply a transform to the MSI. Or just modify existing table values, if
easier.

The specific action I'm taking (from my original post) is to... 'change a


property table value from an msi produced by visual

studio .net.' I apologize if this not specific enough. I'd also like to
automate the process if possible.

So far, the one solution suggested is to copy the msi file and make changes
manually with Orca. That solution is not very appetizing to me. If you can
elaborate on your suggestion then perhaps I can make an informed decision on
which method works best for me.

"Michael (michka) Kaplan [MS]" <mic...@online.microsoft.com> wrote in

message news:uBc0a5jH...@TK2MSFTNGP12.phx.gbl...

Michael (michka) Kaplan [MS]

unread,
May 21, 2003, 9:35:47 AM5/21/03
to
"Rob Gravereaux" <Rob_Gra...@grsinc.com> wrote...

> Possible languages would be any of the visual studio .net or visual studio
6
> languages - VB6, C++6, VB.Net, C#. If it's in another language I'm sure
I'll
> be able to decipher what APIs are used, and translate the code to a
language
> of my choice.

I was asking for the language that you were using or wanted to use? Sigh...

Never mind, we'll talk in C#. :-)

> You mentioned 'one api to copy a file, just a few apis to edit the msi'.
How
> about an example to do that? A specific sequence of operations would be:
> 1) Copy the MSI.

Well, in C# its not even an API.... File.Copy() will do the trick (usage
samples in MSDN).

> 2) Apply a transform to the MSI. Or just modify existing table values, if
> easier.

Obviously modifying a simple value is less work.....

> The specific action I'm taking (from my original post) is to... 'change a
> property table value from an msi produced by visual
> studio .net.' I apologize if this not specific enough. I'd also like to
> automate the process if possible.

The APIs you would use are:

MsiOpenDatabase()
MsiSetProperty()
MsiDatabaseCommit()
MsiCloseHandle()

PInvokes given below.

> So far, the one solution suggested is to copy the msi file and make
changes
> manually with Orca. That solution is not very appetizing to me. If you can
> elaborate on your suggestion then perhaps I can make an informed decision
on
> which method works best for me.

This was not the way I read Michael Sanford's suggestion -- Orca was not
mentioned as part of the solution, neither was the word "manually". It was
only mentioned to say that you could not use Orca. Now, the Orca "solution"
you mention above will work, but requires manual intervention (as you
noted).

Instead take the elemental suggestion: "The only way to handle this is to
copy the file first then edit your copy." and insert the word
programatically before both tasks.... I saw a statement that could go either
way. :-)

Four pinvokes for the above APIs:

[DllImport("msi.dll")]
private static extern uint MsiOpenDatabase(
string szDatabasePath,
uint szPersist,
out IntPtr phDatabase);

[DllImport("msi.dll")]
private static extern uint MsiSetProperty(
IntPtr hInstall,
string szName,
string szValue);

[DllImport("msi.dll")]
private static extern uint MsiDatabaseCommit(IntPtr hDatabase);

[DllImport("msi.dll")]
private static extern uint MsiCloseHandle(IntPtr hAny);

To me, using these APIs seems a lot easier (I have created entire MSIs using
just a few of these APIs) -- open the db, call SetProprty, the commit and
close.

mgama

unread,
May 21, 2003, 1:22:12 PM5/21/03
to
I created a post build batch script that would modify the MSI that VS.NET
created. You can take a look at it here:

http://www.vzavenue.net/~mgama/
or
http://www.vzavenue.net/~mgama/PostBuild.bat.txt (notice I renamed the
extension to .txt for downloading/security reasons).

Basically you could call "copy" or "xcopy" to make a copy of the original
MSI, then use the WiRunSQL.vbs script to make changes to the MSI.
Unfortunately VS.NET doesn't allow you to add "Post-Build-Events" to setup
projects. If they had done that, then you could have VS.NET call the
automated script automatically after each compile. Maybe that would be a
good feature request, Michael? :)


"Rob Gravereaux" <Rob_Gra...@grsinc.com> wrote in message

news:euIkKI5H...@tk2msftngp13.phx.gbl...

Michael (michka) Kaplan [MS]

unread,
May 21, 2003, 3:28:27 PM5/21/03
to
"mgama" <mgam...@hotmail.com> wrote...

> Maybe that would be a good feature request, Michael? :)

I am not on that team, either, sorry. :-(

I work on globalization/internationalization features in Windows and the
.NET framework. As part of that job I write several managed tools, a lot of
managed and unmanaged code, and occasionally I write tools that build
MSIs/MSMs so that customers can redistribute what the tools produce.

mgama

unread,
May 21, 2003, 4:04:00 PM5/21/03
to
:) I didn't think so, but it was worth a shot. Maybe I will send a mail to
mswish, with that and several other feature requests.


"Michael (michka) Kaplan [MS]" <mic...@online.microsoft.com> wrote in

message news:OzS0V88H...@TK2MSFTNGP10.phx.gbl...

0 new messages