Does anyone have a CA that will stream a bitmap into the Binary table?
I'd rather do it that way so it's self-documenting.
ORCA and Power Editor are too manual; easy to forget to tell my replacement that I did it.
thanks, Rob
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Need CA to stream bmp into binary table
Started by
rflum
, Feb 27 2002 23:40
9 replies to this topic
Posted 27 February 2002 - 23:52
Nobody does.
A CA would need a temporary record (because the source database tables are read-only) MsiRecordSetStream can not use temporary records.
Posted 28 February 2002 - 00:08
I could probably throw together a VBScript file that would do this for you. Is that what you are looking for? You wouldn't want to do this as part of a Custom Action during an install.
(Edited by Scott Williams at 6:08 pm on Feb. 27, 2002)
Posted 04 March 2002 - 23:19
Quote (Scott Williams @ Feb. 27 2002,18:08) |
I could probably throw together a VBScript file that would do this for you. Is that what you are looking for? You wouldn't want to do this as part of a Custom Action during an install.<p>(Edited by Scott Williams at 68 pm on Feb. 27, 2002) |
"I could probably throw together a VBScript file that would do this for you. Is that what you are looking for? You wouldn't want to do this as part of a Custom Action during an install.<p>(Edited by Scott Williams at 68 pm on Feb. 27, 2002)"
Hi, Scott,
Yes, I do want to do this as part of an install, or as part of an install authoring session that would leave a record behind.
By "record" I mean something that a second developer could see when they opened the project in ISWI, like the display in Setup Design. That would be my preference, and doing it at runtime would be my second choice, because at least it would be in the code where, again, a developer could see it.
Why wouldn't I want to do this at runtime?
thanks, Rob
Robert Flum
FlumR@genrad.com
FlumR@genrad.com
Posted 07 March 2002 - 22:38
First, I cannot comment at all on ISWI, I have chosen to skip the middle man and work directly with .MSI files.
Second, the Binary table is only used for files that are used during your install. Bitmaps for your Dialogs, Custom Action DLL's, VBScript files, etc. When you are installing, you do not want to be putting something INTO this table, not that you could as during an install I do not believe you can make persistant changes to the .MSI database anyhow.
Now, I may just not be understanding you properly, maybe by runtime you mean when you are building the .MSI file. This would fall into the realm of me not knowing about ISWI.
Anyhow, here is a quick sample VBScript Funtion that will add and/or update an entry in the Binary Table.
------
Things inside of the {} would be hardcoded values. You could easily modify this to accept/prompt for arguments if you know any VBScript at all.
Is this what you wanted to do?
Second, the Binary table is only used for files that are used during your install. Bitmaps for your Dialogs, Custom Action DLL's, VBScript files, etc. When you are installing, you do not want to be putting something INTO this table, not that you could as during an install I do not believe you can make persistant changes to the .MSI database anyhow.
Now, I may just not be understanding you properly, maybe by runtime you mean when you are building the .MSI file. This would fall into the realm of me not knowing about ISWI.
Anyhow, here is a quick sample VBScript Funtion that will add and/or update an entry in the Binary Table.
------
Code Sample |
Option Explicit Const msiOpenDatabaseModeReadOnly = 0 Const msiOpenDatabaseModeTransact = 1 Const msiOpenDatabaseModeCreate = 3 Const msiViewModifyInsert = 1 Const msiViewModifyUpdate = 2 Const msiViewModifyAssign = 3 Const msiViewModifyReplace = 4 Const msiViewModifyDelete = 6 dim oTarget, oView dim x, oRec, oInstaller Set oInstaller = Wscript.CreateObject("WindowsInstaller.Installer") Set oTarget = oInstaller.OpenDatabase("{Full path to your .MSI file}", msiOpenDatabaseModeTransact) Set oView = oTarget.OpenView("SELECT `Name`, `Data` FROM `Binary` WHERE `Name` = '{Your Binary Table Key}'") oView.Execute Set oRec = oView.Fetch if IsObject(oRec) then oRec.SetStream 2, "{Full path to the file you want to insert}" oView.Modify msiViewModifyUpdate, oRec end if Set oRec = Nothing oView.Close Set oView = Nothing oTarget.Commit set oTarget = Nothing set oInstaller = Nothing MsgBox "Done" ------- |
Things inside of the {} would be hardcoded values. You could easily modify this to accept/prompt for arguments if you know any VBScript at all.
Is this what you wanted to do?
Posted 08 March 2002 - 20:16
Hi, Scott,
I wanted to add a (well, six) bitmaps just after the setup starts that I can then use in a splash screen. I figured if I did it first thing, then I'd be okay.
But the real problem is the one mentioned by Ian at the beginning of this thread:
Posted on Feb. 27 2002,17:52
-----------------------------------------------------------
Nobody does.
A CA would need a temporary record (because the source database tables are read-only) MsiRecordSetStream can not use temporary records.
-----------------------------------------------------------
I wanted to hear what you had to say to see if you knew a way around this.
I don't know VBScript, but I see what you are doing and I could do the same thing in IS script if it were possible at runtime (during an install) I wasn't familiar with the record functions, but you've given me enough to get me through it.
I really appreciate your effort in writing the VB scrap, even though it doesn't look like I can use it to do what I want.
Thank You, Rob (and Thank you, too, Ian)
I wanted to add a (well, six) bitmaps just after the setup starts that I can then use in a splash screen. I figured if I did it first thing, then I'd be okay.
But the real problem is the one mentioned by Ian at the beginning of this thread:
Posted on Feb. 27 2002,17:52
-----------------------------------------------------------
Nobody does.
A CA would need a temporary record (because the source database tables are read-only) MsiRecordSetStream can not use temporary records.
-----------------------------------------------------------
I wanted to hear what you had to say to see if you knew a way around this.
I don't know VBScript, but I see what you are doing and I could do the same thing in IS script if it were possible at runtime (during an install) I wasn't familiar with the record functions, but you've given me enough to get me through it.
I really appreciate your effort in writing the VB scrap, even though it doesn't look like I can use it to do what I want.
Thank You, Rob (and Thank you, too, Ian)
Robert Flum
FlumR@genrad.com
FlumR@genrad.com
Posted 09 March 2002 - 07:36
Well, the question I keep getting to here is, why do you want to add these to the binary table at the beginning of the setup? Why can you you store these six bitmaps into the binary table when you create your install and then they are already there?
One of the things the binary table is for is to store bitmaps that are used in the Windows Installer Dialogs, I guess I just don't understand why you have to do this at the time you are actually installing the files.
One of the things the binary table is for is to store bitmaps that are used in the Windows Installer Dialogs, I guess I just don't understand why you have to do this at the time you are actually installing the files.
Posted 22 March 2002 - 19:19
Hi, Scott,
I wanted to do it during the setup just because it would leave a "trail" in the code - something for another developer to see.
Putting an entry in the Binary table isn't very visible.
It looks like in this particular case, that no one else will be maintaining this code, but if I were to be hit by a truck tomorrow, another engineer might have a hard time figuring out where those bitmaps were coming from, or how to add another one. The StreamFileFromBinary() function takes a location parameter, but it's not obvious how the bmp being referenced will get to the SUPPORTDIR.
I guess I'll just put in a lot of comments.
Thanks very much for all your efforts! Rob
I wanted to do it during the setup just because it would leave a "trail" in the code - something for another developer to see.
Putting an entry in the Binary table isn't very visible.
It looks like in this particular case, that no one else will be maintaining this code, but if I were to be hit by a truck tomorrow, another engineer might have a hard time figuring out where those bitmaps were coming from, or how to add another one. The StreamFileFromBinary() function takes a location parameter, but it's not obvious how the bmp being referenced will get to the SUPPORTDIR.
I guess I'll just put in a lot of comments.
Thanks very much for all your efforts! Rob
Robert Flum
FlumR@genrad.com
FlumR@genrad.com
Posted 22 March 2002 - 19:24
I sent an email to Ian and got a reply which I'll post here so others can read it:
"Hi, Ian,
I don't understand your reply, because I don't know the Windows Installer terminology well enough. What are the source database tables? Are those the binary and directory tables or something else?
Rob"
Ian wrote:
I am sorry "source database tables" is not proper terminology. I used the word source to mean the database currently being run. Windows installer does not allow this to be edited. However changes can be made to the run time image of the database (which is not persistant). It is possible to add and modify tables dynamically by using the TEMPORARY qualifier of the SQL string. This means you can dynamically change most of the records at runtime. You could add entries to the Directory table if you wished.
The problem with adding images to the binary table is the stream data type which holds the binary data. Unfortunately this is not allowed to be Temporary. So it is not possible to insert the data while the database is active. You could of course modify the database with a custom setup.exe which is run before msi opens the database. This has the problem of read only media to overcome.
I hope this clarifies my earlier terse statement.
--------------
Ian Blake
http://www.avantisworld.com
"Hi, Ian,
I don't understand your reply, because I don't know the Windows Installer terminology well enough. What are the source database tables? Are those the binary and directory tables or something else?
Rob"
Ian wrote:
I am sorry "source database tables" is not proper terminology. I used the word source to mean the database currently being run. Windows installer does not allow this to be edited. However changes can be made to the run time image of the database (which is not persistant). It is possible to add and modify tables dynamically by using the TEMPORARY qualifier of the SQL string. This means you can dynamically change most of the records at runtime. You could add entries to the Directory table if you wished.
The problem with adding images to the binary table is the stream data type which holds the binary data. Unfortunately this is not allowed to be Temporary. So it is not possible to insert the data while the database is active. You could of course modify the database with a custom setup.exe which is run before msi opens the database. This has the problem of read only media to overcome.
I hope this clarifies my earlier terse statement.
--------------
Ian Blake
http://www.avantisworld.com
Robert Flum
FlumR@genrad.com
FlumR@genrad.com