Archive: AccessControl bugfix


AccessControl bugfix
Hi,

I worked on a bugfix of the AccessControl Dll. I would be interested to update the release in the archive at nis.ssourceforge.net !

Extended and bug fixed by Andreas Rock (andreas.rock@bigfoot.com)"
=======================================================

1. Bug fixes

1.1 Error handling

If an error occures a message box will be displayed.
The error message is then given back on the stack.
I've changed it in that way, that you must always pop the error
status from the stack and no message box on erros is displayed.

The message contains the error code in first 4 characters:
e.g. 1001::Trustee is missing

Usage new: e.g. for grant file

# Give ownership for file C:\test.txt to Waterloo\Mathias
AccessControl::SetFileOwner \
"C:\test.txt" "Waterloo\Mathias"
pop $0
StrCmp $0 "" aclok
MessageBox MB_OK "Acl error=$0"
aclok:

Usage old:
# Give ownership for file C:\test.txt to Waterloo\Mathias
AccessControl::SetFileOwner \
"C:\test.txt" "Waterloo\Mathias"



1.2 Function ParseSid: line 243 ShowError("uh..");

Must be uncommented. Error is shown by calling function!


2.0 Error messages, empty if no error occured

Error messages:

1001:Trustee is missing
1002:Permission flags are missing
1003:Bug: Unsupported change mode:
1004:Filesystem path missing
1005:Invalid filesystem path missing
1006:Root key name missing
1007:Bad root key name (..)
1008:Registry key name missing


2001:Bad trustee ..
2002:Bad permission flags ..
2003:Cannot read access control list. GetNamedSecurityInfo error code:..
2004:Cannot build new access control list. SetEntriesAcl error code:..
2005:Cannot apply new ownership. SetNamedSecurityInfo error code:..

3. Known bugs

The original project file for VisualStudio 1.0 only works with the release version.
The debug part can't produce a dll.
I've prepared a working project file for VisualStudio1.1 (see AccessControlStudioNet2003.zip).


Regards,Rocky


Please test it, give others some time to test it, and e-mail it to me when you think it's ready for uploading.


The attached zip is missing AccessControl.c. I believe there is a bug in the call to GetNamedSecurityInfo. The last parameter is NULL, and according to Microsoft documentation, it cannot be NULL. I'd like to fix this problem, as I believe it may be the cause of a problem for some of my customers (this call fails).

I have the source to the original AccessControl plugin, but not to this new version. I'd like to use the new version so I can include error messages in the details window, which I save to a log file after install completes.

Can someone post or send me the source to this new version?

Thanks!
Joe A.


AccessControl.c
Hi!

I am sorry that this file is missing. Attached you will find my complete source set.

Please reply your changes!


Missing attachment
Hi!

Sorry I was not logged properly. So I lost the attachement.
Attached you will find my complete source set.


GetNamedSecurityInfo
Hi Joe,


Could you solve your problem with "GetNamedSecurityInfo"?

It would be nice get the last version of it.
Then we could make it available in the archive.


Publishing new AccessControl plugin
Dear Kichik,

As I saw in thread http://forums.winamp.com/showthread....90#post1573690 the problem was only a user problem, no function problem.

I would like to publish my extension now. I have tested it well and it's working since may 2004.

The problem is, that I have added an error flag, wich must be popped from the stack. The old scripts must be changed therefore.

Should I prepare a new release with a new name like AccessControlX and publish it on the archive ?


Thanks for the source Rocky, but I wouldn't post it the the archive just yet! Here's why...

Besides my problem using "Users" for a Windows group name on non-English Windows (it must be translated, or better yet, use the SID), there are at least 2 coding errors in AccessControl.

1. The last parameter of GetNamedSecurityInfo() is a NULL. According to Microsoft documentation, it must be a pointer to a pointer, and then LocalFree'ed when done.

2. It uses GetLastError() for GetNamedSecurityInfo (and other) functions, but those are documented to return the error code on the function call, and does not mention GetLastError() as usable (though it appears to work, should be fixed).

So I will make these fixes in the next few days and post the source on this thread. I'm still trying to get our maintenance release of ComputerTime onto our site at www.softwaretime.com. Thanks.

Joe A.


superrock2, you can use the script's error flag in the latest NSIS version (extra->exec_flags.exec_error). If you use it instead of the stack, it could be compatible with the old version.

BTW, what happened to your old user? Send me a PM if you want it back.