Prev Previous Post   Next Post Next
Old 12th March 2008, 12:38   #1
Daniel James
Junior Member
 
Join Date: Feb 2008
Location: Near London, UK
Posts: 40
Odd AccessControl error

I'm using the AccessControl plugin to set the rights on a data directory set up by my installer. The directory is freshly-created and known to exist, so the user running install will be its "CREATOR OWNER" and should have authority to set the access.

However, I'm occasionally -- not always, but I haven't spotted a trend -- getting error "22" returned. Looking at the source for the plugin I see that errors are usually textual, and that "22" doesn't seem to be one of them!

Here's the code snippet:
code:

; create the data directory
ClearErrors
CreateDirectory "$MBDir"

${If} ${Errors}
Abort "Can't create MessageBase directory $MBDir"
${EndIf}

; Set access permissions on $MBDir -- read write accessible by all users
; We have to use "(S-1-1-0)" instead of "World" or "(WD)" for Win2k
ClearErrors
AccessControl::GrantOnFile "$MBDir" "(S-1-1-0)" "GenericRead + GenericWrite + DeleteChild"
pop $0

${If} $0 != ""
MessageBox MB_OK "Error $0 granting access to $MBDir "
${EndIf}


The message I'm getting in the message box is typically something like "Error 22 granting access to E:\MyApp\Data ". The directory name is correct, and the directory has been created.

Can anyone tell me what this actually means? I take it I am calling the plugin correctly, and that GrantOnFile is meant to be usable on directories as well as normal files?

The Windows error code 22 is ERROR_BAD_COMMAND which is documented as meaning "The device does not recognize the command". I believe that's normally returned by IOCtl-type calls to devices, and not by access control APIs.

I'm testing this on XP64, BTW, but it's intended to be usable on all NT-class systems.

Cheers,
Daniel
Daniel James is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump