Hello,
Welcome to Microsoft Q&A!
According to the Doc: SetNamedSecurityInfoA function
If setting
SACL_SECURITY_INFORMATION
orSCOPE_SECURITY_INFORMATION
, the caller must have theSE_SECURITY_NAME
privilege enabled. If you are not setting the SACL, this parameter can be NULL.
According to your code, you set the SACL_SECURITY_INFORMATION
flag, but you set the pSacl
to NULL
. As far as I'm concerned, it is the reason for the error. When you use the SACL_SECURITY_INFORMATION
flag, you must have the SE_SECURITY_NAME
privilege enabled, the pSacl
should point to the SACL for the object.
Thank you.
Jeanine
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.