|
Introduction
I was in need of reading data from an .msi file and after reading a nice article in the form of a pdf file, I made a simple console application that takse 2 command line arguments (first is full path to .msi file second one is the table name). I prefered doing a console application because it will be useful to all even having MFC or windows knowledge.
Background
Last week I installed InstallShield for Windows Installer 1.5 on my system and some how I learned how to create an .msi setup file. I was in need of it as we planned to port the tool on which I'm working to the newer version of InstallShield. I searched for help but finally helped myself to learn how to create msi files with InstallShield. I wouldn't say I mastered InstallShield but I can say I know little bit of InstallShield.
Actually the tool for which I have been working on needs the details of .msi files to create MOF files, so I was trying to read the .msi database (.msi is a setup file implemented as a database by Microsoft and it is run by Windows Installer, a service which runs in Windows 2000 and Windows XP).
Using the Code
First location I refered is MSDN. It says what are the functions we have to manipulate a .msi database. But as my attempt to work myself with the MSDN help to read .msi databse didn't work. So I searched on net. and I got nic pdf file regarding this pdf file http://www.wise.com/filelib/MSIwhitepaper.pdf. Please read the article for a full description on "how to". I used the code help from this article only. The flow goes like this. First we have to start with MsiOpenDatabase(..) which gives a MSIHANDLE after successful opening of the msi database. Then I called MsiDatabaseOpenView(hDatabase,szSelect,&hView) where hDatabase is the handle got from MsiOpenDatabase(). szSelect is a normal SQL query, then hView is the MSIHANDLE returned by this function on success. This function when called creates a view with the given query. To get the actual records we have to call MsiViewExecute(), which gives the perfectness to the view(means practically this function executes the query and stores the result in the view) Then remaining part of the code is parsing the data and printing on the screen. I once again repeat the pdf I read is the source for my application. I thank "Gary Chirhart" for writing such a nice article on Installer. my application takes 2 command line arguments( other than application name)
- msi file path: rememeber to give the path with "\\" separation like D:\\Share\\VMTNet.msi
- A table name existing in .msi database. There are so many tables but I prefer to give "File" as 2nd parameter.This table contains all the details embedded files in the .msi database.
For better understanding of the database structure one can use "ORCA" tool.
Points of Interest
The interesting thing I learned is actually we don't need any third party tools like Installshield or wise Installer to create .msi setup files. Everything can be done by us The only thing the third party vendors are doing is making things simple so that we can concentrate on development of our software so that we need not worry much about creating installers to our software.
| You must Sign In to use this message board. |
|
| | Msgs 1 to 18 of 18 (Total in Forum: 18) (Refresh) | FirstPrevNext |
|
|
 |
|
|
 |
|
|
Hello,
Ik like the tool. But I cant seem to get it working. This is the lin eI use: msiconsole.exe test d:\\msiconsole\\debug\\test.msi file test is the application name (aka productname) Then the pathe to the msi, and finally the tablename I want to see, "file"
But I keep getting the messga: run the application with argumnets h)> |
|
|
 |
|
|
I was looking for a few samples for MsiOpenDatabase, found your small article.
It gave a useful link on Wise Solutions site,
Thanks.
P.S.: don't take too personal all the stuff on here. Keep writing
Yevgeny
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Last time I've read some data from a MSI table I've done it with about 10 lines of VBScript and it took 15 minutes to write and debug. Granted, it took another 30 minutes to find the relevant part of SDK doc.
Not everything is worth to write about, IMHO, even if you are "just a student".
MK
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I really Don't understand? Why I am getting all negative comments. You say you did that within some 1 hour, It took me one day for writing that in vc++, nothing more than that. Le me tell you my dear friend try doing the same thing in vc++. In that case you can refer to my article it will be helpful Writing script is always has been very easy. please never compare script with vc++.
cheers harinath
Harinath Reddy HOneywell Technology Solutions Lab, Bangalore, India-560076 harinath@vandemataram.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello, Could you do me a favour and tell me how to get data from MSI file by VBScript? I want a start. Thank you very much.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
You remind me of a Visual Basic "programmer" who can drag and drop buttons on a form and add event handlers by double-clicking the button. This is not programming, and what you "learned" about "MSI" (as you call it) could not be further from the truth. You really should research more about the technology you're dealing with before embarking on a project and especially trying to explain it to others.
First, as someone that beta-tested both the pre-release Windows Installer and Wise for Windows Installer, I can promise you that Windows Installer is not "a service on Windows 2000 and Windows XP". It is an application (msiexec.exe) available for all 32-bit Windows OS's. The service that runs on Windows NT-based OS's is used for remote installations primarily.
Second, you talked about learning "InstallShield". InstallShield is nothing more than a development environment for writing Windows Installer setups, just like Wise or even file-based installations where you write everything from scratch. It's just like I can write .NET or Win32 executables using Visual Studio .NET or 6.0, or I can use GViM or Notepad and the Platform SDK or .NET Framework SDK. In fact, InstallShield - only in the latest version - finally allows the developer to access ALL tables of the MSI file (before compiling). Wise has allowed it since the beginning, which one could argue facilitates developers who really understand Windows Installer and can manipulate MSI files.
So, before claiming that you learned quite a bit, be sure to get you P's and Q's straight about the technology you're using.
Reminiscent of my younger years... 10 LOAD "SCISSORS" 20 RUN
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks for your feed back. Thanks a lot for reminding me that I am in the begining stage. for your information, I am just a fresher, doing my Post graduation, and as a part of my project I am working in vc++ for the last 2 months. So I think It may not be big blunder if i have some mistakes in my article. Well, I really wonder for your statement "Windows Installer is not a service on Windows 200 and windows xp". As I know it is a service. all the services are nothing but some kind of .exe file only but with a minor changes. a exe which is running as a service will be able to respond to SCManager requests like start stop etc. FYI the service "windows installer" runs only msiexec.exe from C:\WINDOWS\System32\msiexec.exe with /v option. regarding the msiexec.exe you were talking about, in order to support .msi files msiexec.exe exists for even NT and other windows versions also, where windows installer is not a service.
I think I am not wrong in what i am saying, I know How to create services and work with them through c++ programs also. so You can believe me in this regard. Actually you were telling about TABLES etc, what i told in my article. installshield has power editor. I hope you know ORCA tool. Regarding my knowledge about installshield etc. I said "little bit" only not "quite a bit", I am not responsible for your own assumptions.
I just wanted to share my program results with other programmers so that it may be useful.
thanks n regards harinath
Harinath Reddy Bangalore, India-560076
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
No, you are the one that's wrong. You've been working on this for less than two months while I've been donig this since '97 or '98, before the general "public" even got wind of Windows Installer. Yes, msiexec.exe does run as a service but only to keep the libraries loaded for better performance and for remote installations. Read the Microsoft Platform SDK docs. the .msi extension is even associated with msiexec.exe - check your registry. Besides, Windows Services are not supported on 9x/ME machines. I've consulted for many small and large companies, including ActiveState that makes ActivePerl, ActivePython, Perl.NET, and many other projects. You're the one that's wrong.
And yes, I'm very familiar with ORCA. I've written Installer databases from scratch (no development environment like Wise or InstallShield) using it and the text -> table importer. I was using the Windows Installer SDK before you probably even heard of it or saw it used. I've been doing this for a long time and know very much what I'm doing and what I'm talking about.
Also, check the name on the editor of your article - it's me! No, correct or "proper" articles aren't the only ones posted at CodeProject - believe me, as an editor I know. We post articles that at least have a scrap of truth. While your concept and many statements about Windows Installer are incorrect, you're utility still does what you profess, so I edited and posted it.
Reminiscent of my younger years... 10 LOAD "SCISSORS" 20 RUN
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Extremely Sorry. I don't have any more argument.Now I learned the facts about this topic. Well, I will try to read and do more work in this topic. I feel You are encouraging me, thanks for the comments. I am sorry again if I hurt you.I didn't know that you are the editor.
cheers mahanare
Harinath Reddy Bangalore, India-560076 harinath@vandemataram.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
"No knowledge" does not mean you need to say sorry even you are wrong..... but this atricle is nothing but 2-month-experience-MSDN-Doc-searcher can write However, you may like to take a look this Open Project.... MSI doesn't have any magic excpet M$'s stuff... http://msi2xml.sourceforge.net/[^]
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thank You, But still I feel I am not wrong in my article.
thanks for giving me nice link, certainly it i will go through that.
cheers harinath
Harinath Reddy HOneywell Technology Solutions Lab, Bangalore, India-560076 harinath@vandemataram.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
"as an editor I know" WOW
Let me add another thing to the list of what you should know as an editor:
- People should be encouraged to write for CodeProject. If YOU posted the article and still have some comments then: - Either express them in a constructive way or - Post the comments directly to the author.
Your intentions should be positive. We don't need all this show-offs here.
Yevgeny
|
| Sign In·View Thread·PermaLink | 5.00/5 (2 votes) |
|
|
|
 |
|
|
Sir, I have one doubt about ORCA. Actually i have one MSI file, whih has to be updated with the new files (to be installed). So I used ORCA editor to do this and i modified some table values(like, file,component, feature components...) and able to change it succesflly.
Now, i cant repeat this process of editing MSI file for each and everytime when i change the files to be installed.
So is there any way to automate this process (instead of manually editing tables using ORCA) ????
Please help me in this issue and reply ur msgs to balaji.1manarmy@gmail.com
Thanks in advance...
balaji.J
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
HI there, I hae no knowledgeof msi files myself, but however , my computer does not recognise any msi files right now and you seem to know what your talking about. here is the error box of what it says is missing or cannot be found, Could you please help me either find this file and tell me how to get it re-installed on my computor. I run windows 2000, heres the error file thaats says its missing
c:\docume~1\admini~1.mad\local~1\temp\_isb4\internet cleanup.msi
you can e-mail me at maddog1122@hotmail.com with any information, I would greatly aprreciate it and would greatly learn and improve my own computor skills if you could explain this to me in english. thank you for listening to me very much Tom stratemyer, Sr.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
General News Question Answer Joke Rant Admin
|
|
|
|