Talk:AccessControl plug-in: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
(→Usage Example: error codes on stack regarded) |
||
Line 21: | Line 21: | ||
== Usage Example == | == Usage Example == | ||
<highlight-nsis> | <highlight-nsis> | ||
AccessControl::GrantOnFile \ | AccessControl::GrantOnFile \ | ||
"$INSTDIR\database" "(BU)" "GenericRead + GenericExecute + GenericWrite + Delete" | "$INSTDIR\database" "(BU)" "GenericRead + GenericExecute + GenericWrite + Delete" | ||
</highlight-nsis> | </highlight-nsis> | ||
:You can't use it that way because your stack may be modified after that call. Because you don't know about causing an error (the error flag isn't set although an error occured) you have to check the stack: | |||
<highlight-nsis> | |||
Push $0 ; save | |||
Push "Marker" | |||
AccessControl::GrantOnFile \ | |||
"$INSTDIR\database" "(BU)" "GenericRead + GenericExecute + GenericWrite + Delete" | |||
Pop $0 ; get "Marker" or error msg | |||
StrCmp $0 "Marker" Continue | |||
MessageBox MB_OK|MB_ICONSTOP "Error setting access control for $INSTDIR\database: $0" | |||
Pop $0 ; pop "Marker" | |||
Continue: | |||
Pop $0 ; restore | |||
</highlight-nsis> | |||
:It would be much easier if the AccessControl-functions always push something on the stack, e.g. "success" if there wasn't an error. Otherwise the functions may set or clear the error flag. Thus you simply know if something should be on the stack or not. --[[User:212.51.7.22|212.51.7.22]] 22:52, 1 October 2007 (PDT) |
Revision as of 05:52, 2 October 2007
What about Vista support? Is it working on Vista?
--141.7.15.121 05:21, 26 June 2007 (PDT)
What about recursive rights?
--141.7.15.121 00:25, 30 July 2007 (PDT)
Vista support
I've tested AccessControl under Vista and it works great. Thx
Set the append/modify flag for ACLs
If you want to set the append/modify flag (in German: ändern) for files/directories, set the accesscontrol flag to:
"GenericRead + GenericExecute + GenericWrite + Delete"
Usage Example
AccessControl::GrantOnFile \ "$INSTDIR\database" "(BU)" "GenericRead + GenericExecute + GenericWrite + Delete"
- You can't use it that way because your stack may be modified after that call. Because you don't know about causing an error (the error flag isn't set although an error occured) you have to check the stack:
Push $0 ; save Push "Marker" AccessControl::GrantOnFile \ "$INSTDIR\database" "(BU)" "GenericRead + GenericExecute + GenericWrite + Delete" Pop $0 ; get "Marker" or error msg StrCmp $0 "Marker" Continue MessageBox MB_OK|MB_ICONSTOP "Error setting access control for $INSTDIR\database: $0" Pop $0 ; pop "Marker" Continue: Pop $0 ; restore
- It would be much easier if the AccessControl-functions always push something on the stack, e.g. "success" if there wasn't an error. Otherwise the functions may set or clear the error flag. Thus you simply know if something should be on the stack or not. --212.51.7.22 22:52, 1 October 2007 (PDT)