logo

Previous Thread:   Executing an VS.NET Deployment Package in Script

10/19/2005 10:21:04 AM    Changing the Setup.vdproj to make an edit control password type
Is it possible to edit the Setup.vdproj file directly so that when it is  
  
executed during the build an Edit Control field is set with the 0x200000  
  
(password) attribute.  
  
The reason I ask is that our build master is the one who pushs the MSI files  
  
out to our SA's.  He does not have the time after the MSI has been built from  
  
Code pulled from the source repository to run Orca and change the attribute  
  
of this one field.  
  
Barring changing the Setup.vdproj file to accomplish this is there a way to  
  
edit the MSI via WSH as a post build event and accomplish the same end as  
  
editing the file with Orca.  
  
--  
  
Thank you,  
  
John

10/20/2005 10:18:49 AM    RE: Changing the Setup.vdproj to make an edit control password type
Hi John,  
  
Manually edit the Setup.vdproj file could not work for your requirement,  
  
and we don't recommend to edit that setup project file directly neither.  
  
yes, you can use a VBScript to modify the target msi package just as the  
  
using the ORCA. The Windows Installer service provides the corresponding  
  
automation interfaces to manupilate the installation package, the Database  
  
object could be used to access an installer database, and execute an SQL  
  
query to review or update an existing table, please refer to the following  
  
MSDN doc and the sample scripts in the platform SDK's sample  
  
directory(...\Microsoft Platform SDK\Samples\SysMgmt\Msi\Scripts):  
  
Database Object  
  
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/d  
  
atabase_object.asp  
  
Thanks!  
  
Best regards,  
  
Gary Chang  
  
Microsoft Community Support  
  
--------------------  
  
Get Secure! ¡§C www.microsoft.com/security  
  
Register to Access MSDN Managed Newsgroups!  
  
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp  
  
&SD=msdn  
  
This posting is provided "AS IS" with no warranties, and confers no rights.

10/25/2005 9:45:09 AM    RE: Changing the Setup.vdproj to make an edit control password type
Hi John,  
  
How are the things going?  
  
I have worked out a sample code for your convenience:  
  
The target SQL statement would be:  
  
UPDATE Control SET Control.Attributes = '2097159' WHERE Control.Dialog_ =  
  
'CustomTextA' AND Control.Control = 'Edit1'  
  
'the 2097159 = 2097152(0x00200000) + 7  
  
You can use the following script to update the target msi package:  
  
(Note: The below approaches assume the sample scripts in the same directory  
  
as the target msi package, if not, please use the fullname of the msi  
  
package. By the way, be careful of the character "`" and "'", do not mix up  
  
then in the script and command line)  
  
Option Explicit  
  
Const msiOpenDatabaseModeTransact     = 1  
  
' Connect to Windows Installer object  
  
On Error Resume Next  
  
Dim installer : Set installer = Nothing  
  
Set installer = Wscript.CreateObject("WindowsInstaller.Installer")  
  
Dim openMode  : openMode = msiOpenDatabaseModeTransact  
  
Dim database : Set database = installer.OpenDatabase("Test.msi", openMode)  
  
Dim view  : Set view = database.OpenView("UPDATE Control SET  
  
Control.Attributes = '2097159' WHERE Control.Dialog_ = 'CustomTextA' AND  
  
Control.Control = 'Edit1'")  
  
view.Execute  
  
database.Commit  
  
Set view = Nothing  
  
Set database = Nothing  
  
Or via the script-driven database command-line queries that provided in the  
  
Windows Installer SDK as the utility WiRunSQL.vbs:  
  
CScript WiRunSQL.vbs Test.msi "UPDATE `Control` SET `Control`.`Attributes`  
  
= '2097159' WHERE `Control`.`Dialog_` = 'CustomTextA' AND  
  
`Control`.`Control` = 'Edit1'"  
  
Please refer to the following MSDN doc:  
  
Examples of Database Queries Using SQL and Script  
  
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/e  
  
xamples_of_database_queries_using_sql_and_script.asp  
  
Good Luck!  
  
Best regards,  
  
Gary Chang  
  
Microsoft Community Support  
  
--------------------  
  
Get Secure! ¡§C www.microsoft.com/security  
  
Register to Access MSDN Managed Newsgroups!  
  
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp  
  
&SD=msdn  
  
This posting is provided "AS IS" with no warranties, and confers no rights.