PSID pAdminSID = NULL;
PACL pACL = NULL;
PSECURITY_DESCRIPTOR pSD = NULL;
- EXPLICIT_ACCESS ea;
+ /*
+ * Initialize an EXPLICIT_ACCESS structure for an ACE.
+ * The ACE will allow the Administrators group full access to the key.
+ */
+ EXPLICIT_ACCESS ea = {
+ .grfAccessPermissions = FILE_ALL_ACCESS,
+ .grfAccessMode = SET_ACCESS,
+ .grfInheritance = NO_INHERITANCE,
+ .Trustee = {
+ .TrusteeForm = TRUSTEE_IS_SID,
+ .TrusteeType = TRUSTEE_IS_GROUP,
+ .ptstrName = (LPTSTR)pAdminSID,
+ },
+ };
SID_IDENTIFIER_AUTHORITY SIDAuthNT = {SECURITY_NT_AUTHORITY};
/* Create a SID for the BUILTIN\Administrators group. */
dbg("AllocateAndInitializeSid Error %lu\n", GetLastError());
return 0;
}
- /* Initialize an EXPLICIT_ACCESS structure for an ACE.
- The ACE will allow the Administrators group full access to the key.
- */
- ea.grfAccessPermissions = FILE_ALL_ACCESS;
- ea.grfAccessMode = SET_ACCESS;
- ea.grfInheritance = NO_INHERITANCE;
- ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
- ea.Trustee.TrusteeType = TRUSTEE_IS_GROUP;
- ea.Trustee.ptstrName = (LPTSTR) pAdminSID;
/* Create a new ACL that contains the new ACEs */
dwRes = SetEntriesInAcl(1, &ea, NULL, &pACL);