[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 807
  • Last Modified:

Deleting LockPermissions problem, need help (Network lockpermission problem)

I am having a problem with deleting rows from the LockPermissions table.

We are setting fullrights to EveryOne on one of our folders.
The user can select where the folder shoudl be.
If the user selects a network path then there is an error message.

I have tried to implement the following workaround:
Delete all rows from LockPermissions

<--- Code start --->
function DeleteRightsIfOnNetwork(hMSI)
NUMBER result;
HWND hDB, hViewlist, hResult,hRec;

if result!=0 then

// Is network drive
hDB = MsiGetActiveDatabase(hMSI);
//hResult=MsiDatabaseOpenView(hDB,"SELECT * FROM `LockPermissions` WHERE `User`='EveryOne'",hViewlist);
hResult=MsiDatabaseOpenView(hDB,"SELECT * FROM `LockPermissions`",hViewlist);
if hResult==ERROR_SUCCESS then
hResult=MsiViewExecute(hViewlist, NULL);
if hResult!=ERROR_SUCCESS then
MessageBox ("Error executing!!", INFORMATION);

while (MsiViewFetch(hViewlist, hRec) == ERROR_SUCCESS)
hResult = MsiViewModify(hViewlist, MSIMODIFY_VALIDATE_DELETE, hRec);
if (hResult!=ERROR_SUCCESS) then
MessageBox ("Error verifying!!", INFORMATION);

hResult = MsiViewModify(hViewlist, MSIMODIFY_DELETE, hRec);
if (hResult!=ERROR_SUCCESS) then
MessageBox ("Error deleting!!", INFORMATION);

MessageBox ( "Bad Syntax!!", INFORMATION);
<--- Code end--->

And there are no errors when executing this.

The error is now replaced with a new error message:

"An error occurred while applying security settings.
Windows\ is not a valid user or group. This could be a problem with the package,
or a proble connecting to a domain controller on the network."

I feel like I am close to a solution, does anyone have any input to offer?
  • 4
  • 3
1 Solution
Vadim RappCommented:
what does the log say? what action fails?
LlandrAuthor Commented:
It is CreateFolders that fails.
I have amde an extract from the log file, unfortunately some parts are localized to Swedish.
But I dont think it is the important things that are in Swedish,

<--- MSI log exctract --->
MSI (s) (F0:8C) [15:45:40:000]: Doing action: CreateFolders
Åtgärden startade 15:45:40: CreateFolders.
MSI (s) (F0:8C) [15:45:40:000]: Note: 1: 2205 2:  3: SidCache
MSI (s) (F0:8C) [15:45:40:000]: Using well known SID for System
MSI (s) (F0:8C) [15:45:40:000]: Finished allocating new user SID
MSI (s) (F0:8C) [15:45:55:031]: Note: 1: 1609 2: Windows\ 3: 1789
MSI (s) (F0:8C) [15:45:59:781]:
MSI (s) (F0:8C) [15:45:59:781]: Note: 1: 3
Åtgärden avslutades 15:45:59: CreateFolders. Returvärdet 2.
MSI (s) (F0:8C) [15:45:59:781]: Machine policy value 'DisableRollback' is 0
MSI (s) (F0:8C) [15:45:59:781]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (F0:8C) [15:45:59:812]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (F0:8C) [15:45:59:828]: No System Restore sequence number for this installation.
MSI (s) (F0:8C) [15:45:59:828]: Unlocking Server
Åtgärden avslutades 15:45:59: INSTALL. Returvärdet 2.
MSI (s) (F0:8C) [15:45:59:828]: MainEngineThread is returning 1602
MSI (s) (F0:78) [15:45:59:937]: Destroying RemoteAPI object.
MSI (s) (F0:34) [15:45:59:937]: Custom Action Manager thread ending.
MSI (c) (54:60) [15:45:59:937]: Back from server. Return value: 1602
MSI (c) (54:60) [15:45:59:937]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1
MSI (c) (54:60) [15:45:59:937]: PROPERTY CHANGE: Deleting SECONDSEQUENCE property. Its current value is '1'.
Åtgärden avslutades 15:45:59: ExecuteAction. Returvärdet 2.
Vadim RappCommented:
Wouldn't it be easier to set permissions by custom action, running conditionally depending on result of PathIsNetworkPath.
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

LlandrAuthor Commented:
vadimrapp1:Wouldn't it be easier to set permissions by custom action, running conditionally depending on result of PathIsNetworkPath.

Yes that would also work, how do I do that?
Vadim RappCommented:
I'm not very familiar with Installshield, plus whether your project is installscript of msi... anyways, you can shell CACLS.exe, or, since you are already using shell functions, I'm sure you will find the one that sets security of files and directories, I'm not very familiar with that either, but http://home.hot.rr.com/graye/Articles/SetPermissions.htm or http://www.helpedia.com/programming/apisecrets/SetFileSecurity-function752.html  seems like what you need.

LlandrAuthor Commented:
CACLS solves the problem but doesnt answer the original question.
I will award the points.
Vadim RappCommented:
If the original question was why the initial solution did not work - I'd say, hacking the package in the midst of working with it most likely has unpredictable consequences. You can never reliably assume what was already read and what was not, so it's possible that the table you edited was already read, then you changed it, then it was re-read... quite a mess that Installer did not expect.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now