In the 2k system operation registry, found that some of the health must have permission problems;
Look at you big stickers, unfortunately not a suitable result;
Some people say: You can improve the user's rights, but in fact it seems to be not very useful;
After a hard, hard, hard struggle; Finally found some good dynamic on MSDN;
I don't want to be alone, (eh, I don't like someone, good things hide where they forget)
Sort out some useful things for some people: Hey, the code is as follows:
Serious suggestion: Everyone put the good things into the bar!!!!!!
Welcome Letter Discussion: lanren_me@etang.com
Start reconfiguring permissions to use the registry------------------------------------------------
LPTSTR Lpobjectname;
Se_object_type ObjectType; #include <aclapi.h>
Pacl Olddacl,newdacl;
Psecurity_descriptor SD;
Explicit_access EA;
Lpobjectname = "Machine\\system\\controlset001\\enum\\root";
ObjectType =se_registry_key;
To establish an empty ACL;
if (setentriesinacl (0, NULL, NULL, &OLDDACL)!=error_success)
Return
if (setentriesinacl (0, NULL, NULL, &NEWDACL)!=error_success)
Return
Get the existing ACL list to Olddacl
if (GetNamedSecurityInfo (Lpobjectname, ObjectType,
Dacl_security_information,
NULL, NULL,
&olddacl,
NULL, &SD)!= error_success)
Application->messagebox ("The specified key does not exist!") "," hint ", MB_OK);
Set user name ' Everyone ' has all rights to the specified key to the structure EA
ZeroMemory (&ea, sizeof (explicit_access));
Buildexplicitaccesswithname (&ea,
"Everyone",//Name of Trustee
Generic_all,//type of Access
Set_access,//ACCESS mode
Sub_containers_and_objects_inherit); Let the self-health inherit his authority; Inheritance mode
Merge the permissions list for the structure EA and Olddacl to the new Newdacl
if (SetEntriesInAcl (1, &ea, NULL, &newdacl)!= error_success)
Goto Cleanup;
Writes the new ACL to the specified key
SetNamedSecurityInfo (Lpobjectname, ObjectType,
Dacl_security_information,
NULL, NULL,
Newdacl,
NULL);
Start Operation Registry//////////////////////////////////////////////////////////
//...................................................
////////////////////////////////////////////////////////////////////////////
The right to restore the registry;
Buildexplicitaccesswithname (&ea,
"Everyone",//Name of Trustee
Generic_read,//type of Access
Set_access,//ACCESS mode
No_inheritance); Let the self-health inherit his authority; Inheritance mode
if (SetEntriesInAcl (1, &ea, NULL, &olddacl)!= error_success)
Goto Cleanup;
Writes the old ACL to the specified key
SetNamedSecurityInfo (Lpobjectname, ObjectType,
Dacl_security_information,
NULL, NULL,
Olddacl,
NULL);
Release pointer
Cleanup:
if (SD!= NULL)
LocalFree ((hlocal) SD);
if (Newdacl!= NULL)
LocalFree ((hlocal) newdacl);
if (Olddacl!= NULL)
LocalFree ((hlocal) olddacl);