Hi,
I am trying to update the value of a property, thru code.
I have a code (VB Script) that can update the Property table in any MSI file.
Now, when i wrote the same code in C++ it does not work
The code flow is:
1. MsiOpenDatabase [open msiDB in MSIDBOPEN_DIRECT mode]
2. MsiDatabaseOpenView [query is "SELECT * FROM `Property` WHERE `Property` = 'MYPROP'"]
3. MsiViewExecute
4. MsiViewFetch
5. MsiRecordSetString [MsiRecordSetString ( record_handle, 2/*field to set*/, "new_value" );]
6. MsiViewModify [MSIMODIFY_UPDATE mode]
7. MsiCloseHandle [for Record & View]
8. MsiDatabaseCommit [for msiDB]
9. MsiCloseHandle [for msiDB]
Can you tell what's going wrong ?
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.
updating a property, thru code.
Started by
antyagi
, Nov 29 2005 13:33
9 replies to this topic
Posted 01 December 2005 - 07:05
You should start by checking the return codes of your functions. This should tell you exactly what is causing the problem. You can then post that up here and we can work from there.
Posted 06 December 2005 - 10:01
Sorry for my delayed response.
I have already checked the return codes. Every function returns ERROR_SUCCESS, i.e. no error.
Additionally, can you point to some example available somewhere online?
I have already checked the return codes. Every function returns ERROR_SUCCESS, i.e. no error.
Additionally, can you point to some example available somewhere online?
ankur tyagi
Posted 08 December 2005 - 19:39
When are you trying to change your property?
If the setup is not running (which seems the case but it's not explicit in your ask), then you have forgotten to close the view, so call "MsiViewClose" after "MsiViewModify". If the view is not closed, then your change will not be taken into account (it's 6 months since i last worked on msi, but anyway i'm nearly sure of it).
If your setup is running, you cannot make permanent changes, it will only be during the time the setup is running. And by the way, use the function "MsiSetProperty" instead of your request, it's more simple.
If the setup is not running (which seems the case but it's not explicit in your ask), then you have forgotten to close the view, so call "MsiViewClose" after "MsiViewModify". If the view is not closed, then your change will not be taken into account (it's 6 months since i last worked on msi, but anyway i'm nearly sure of it).
If your setup is running, you cannot make permanent changes, it will only be during the time the setup is running. And by the way, use the function "MsiSetProperty" instead of your request, it's more simple.
Posted 08 December 2005 - 19:44
And if you don't want to waste time with the "closehandle", use PMISHANDLEs instead of MSIHANDLE, they release themselves when out of scope.
Posted 06 January 2006 - 17:43
I'm interested in this thread, Have you fixed the problem yet antyagi?
Posted 25 January 2006 - 21:33
I'd like to do the same thing Antygi is doing but with installshield .ism files. Is there a way to update the version without opening the file up adn changing it by hand, say with a com or other api function like those available for MSI?
Posted 30 January 2006 - 00:41
You can use the same approach as listed above to change the version number, but you will have to edit the msi file, and not the ism.
Another idea is to look at using the Install Shield automation interface if you are using install sheild.
Another idea is to look at using the Install Shield automation interface if you are using install sheild.
Posted 30 January 2006 - 10:33
I haven't had time to read this closely, but maybe this helps:
http://www.installsh...ls-for-ipwi.asp
http://www.installsh...ls-for-ipwi.asp
Regards
-Stein Åsmul
-Stein Åsmul
Posted 30 January 2006 - 13:07
No Glytzhkof! you got it wrong. The likn refered by you does not solve the prob. I think you shold go thru the thread.
The refered article tell how to Get & Set properties in single session.
And thread talks about how to Set property in one session & Get in another session.
The refered article tell how to Get & Set properties in single session.
And thread talks about how to Set property in one session & Get in another session.
ankur tyagi