LarryDalooza Posted December 9, 2007 Share Posted December 9, 2007 perhaps a search of regloadhive will find setprivilege will get you a hint... AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted December 9, 2007 Author Share Posted December 9, 2007 Using all those constants from Winnt.h (included with my Dev-C++ install), they all produced the same errors as before: 87 when passing in $DACL_SECURITY_INFORMATION, 1314 when passing in a pointer to a dword (which is wrong, but actually produces "more correct" results). Very confusing... Link to comment Share on other sites More sharing options...
Valik Posted December 9, 2007 Share Posted December 9, 2007 Has it occurred to you that the INVALID_PARAMETER error is the right error and that it's your SECURITY_DESCRIPTOR structure that's invalid? It makes sense to me that when you set the flag telling it to set DACL_SECURITY_INFORMATION it tries to but the structure is wrong or being passed wrong or something. But when you pass in a memory address, other bit flags are set and so the function does unknown actions (dangerous!) and produces a different error? Given that you had mistakes in the DllCall()'s you're asking for help with, what makes you think the other DllCall()'s are any more correct? Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted December 9, 2007 Author Share Posted December 9, 2007 Very true, so I went back over all my other code, and so far, nothing with anything above where I set the path is wrong. However, I did find that my trickery with $apath was producing blank results *WHACKSELF*. Fixed that, made sure with debug consolewrites, and now, no matter what I pass in to RegSetKeySecurity, I get error 87. As far as my SECURITY_DESCRIPTOR structure being valid, I'm having to hope on that one. According to MSDN, it can be different, so they say to initialize it using the function to do it. I couldn't figure out how to do that in AutoIt (doesn't AutoIt require knowing the structure's format ahead of time?), so I just copied the structure from the header files in my include folder from gcc. I also added the call to IsValidSecurityDescriptor to double check and see, and it doesn't return 0, which according to MSDN means error, so I can only assume it might be correct. If anyone has a clue on how to create/initialize a security descriptor without knowing the structure before hand in AutoIt, I would gladly change to using that. Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted December 9, 2007 Author Share Posted December 9, 2007 (edited) perhaps a search of regloadhive will find setprivilege will get you a hint...It did, and it told me to find your SetPrivilege post, which you deleted...Edit: Ah, the power of Google's cached pages... Edited December 9, 2007 by SkinnyWhiteGuy Link to comment Share on other sites More sharing options...
Valik Posted December 9, 2007 Share Posted December 9, 2007 According to the example, you allocate a buffer of size SECURITY_DESCRIPTOR_MIN_LENGTH. You then initialize that buffer using InitializeSecurityDescriptor(). After that, you use the Getters/Setters on the buffer which take care of setting the fields. Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted December 10, 2007 Author Share Posted December 10, 2007 Tried using Larry's method (both from his old post modified to newer code, and just by trying to emulate everything his code was doing using code from the newly imported Au3Lib stuff), nothing seemed to work. I'm at least consistent now, the only error I get now no matter what I pass into RegSetKeySecurity is 87. Gonna look into redoing my Security Descriptor init code at the top, and see if that does anything. Link to comment Share on other sites More sharing options...
SkinnyWhiteGuy Posted December 18, 2007 Author Share Posted December 18, 2007 I have gotten it working, using the method that Valik pointed out to me. I'm still testing it in VMWare to make sure it's ok, and when I'm happy with it, and can clean it up a bit, I'll see if I can roll some kind of UDF for, if nothing else, adding rights to users/groups available. Thanks for taking the time to help me, all of you. Link to comment Share on other sites More sharing options...
sanhen Posted December 21, 2008 Share Posted December 21, 2008 Hello. I would like to ask the right code is it? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now