cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change Lockpermissions table with Custom Action

Is it possible to change or add items in the LockPermissions table through a custom action?
I've seen a lot of vbs scripts that can change table values of MSI's. But those vbs scripts are not in a Custom Action of the MSI itself.

I like to make a custom action that will read some property settings with the session.property command. And then it will re-use these values in the LockPermissions table.

Can someone help me out with this one?
(3) Replies
Hi There,

You can dynamically insert records into MSI tables via custom action if you like:

http://kb.flexerasoftware.com/doc/DocumentRepository/Installation/InstallShield/InstallShield%2012%20Professional/01_Public/Product%20Info/msiaccess.pdf

However, based on your description, it'd be much easier to just place property references in this table, since the Domain and User columns are formatted:

Domain: [%USERDOMAIN]
User: [USERNAME]
I've created the following script so far...
This script runs without an error and Runs in the UI Interface (immediate), but when I check the Folder, no permissions are set.
Do I overlooked something in my script?
I want to create a MSI template that can be used by co workers, so that they only need to add a property. The rest of the actions will be
applied by the msi CA.

[CODE]'Count GGA_GROUP from property Table
domain = session.property("DOMAIN")

cnt = 1
chk = 0

while chk <> 1
GGA_GRP = "GGA_GROUP_" & cnt
val = session.property (GGA_GRP)
if val = "" then
chk = 1
end if
if val <> "" then
cnt = cnt + 1
end if
wend
cnt = cnt - 1


'Set [INSTALLDIR] lockpermission with GGA_GROUP

Set dbSession = Session.database
Set View = dbSession.OpenView("Select * From LockPermissions")
View.Execute
set Record = View.Fetch
View.Modify 6, Record
View.Close

cnt2 = 0
while cnt2 <> cnt
if cnt2 = 0 then
cnt2 = 1
GGA_GRP = "GGA_GROUP_" & cnt2
val = session.property (GGA_GRP)
GRP_PERM = "GGA_GROUP_PERM_" & cnt2
perm = session.property (GRP_PERM)
if perm = "" then
perm = "537002153"
end if
if perm = "re" then
perm = "537002153"
end if
if perm = "full" then
perm = "1880031743"
end if
addlockperm()
else
cnt2 = cnt2 + 1
GGA_GRP = "GGA_GROUP_" & cnt2
val = session.property (GGA_GRP)
GRP_PERM = "GGA_GROUP_PERM_" & cnt2
perm = session.property (GRP_PERM)
if perm = "" then
perm = "537002153"
end if
if perm = "re" then
perm = "537002153"
end if
if perm = "full" then
perm = "1880031743"
end if
addlockperm()
end if
wend

Function addlockperm()

Set InstSession = Session.Installer
Set View = dbSession.OpenView("Select * From LockPermissions")
View.Execute
Set newRecord = InstSession.CreateRecord(5)
newRecord.StringData(1) = "INSTALLDIR"
newRecord.StringData(2) = "CreateFolder"
newRecord.StringData(3) = domain
newRecord.StringData(4) = val
'newRecord.IntegerData(5) = int(perm)
newRecord.StringData(5) = perm
View.Modify 7, newRecord
View.Execute
view.Close

End Function[/CODE]
Table changes are temporary; I am not 100%, but I think the state of the database resets when you hit the Execute sequence.

I would try moving the custom action to the Execute sequence, and see where that gets you. If that has problems still, I might author a second script to dump the LockPermissions table and see if your records are getting inserted.