The QueryServiceObjectSecurity function retrieves a copy of the security descriptor associated with a service object.
BOOL QueryServiceObjectSecurity(
SC_HANDLE hService, |
// handle of service |
SECURITY_INFORMATION dwSecurityInformation, |
// type of security information requested |
PSECURITY_DESCRIPTOR lpSecurityDescriptor, |
// address of security descriptor |
DWORD cbBufSize, |
// size of security descriptor buffer |
LPDWORD pcbBytesNeeded |
// address of variable for bytes needed |
); |
Value |
Meaning |
OWNER_SECURITY_INFORMATION |
Requests the object’s owner security identifier (SID). |
GROUP_SECURITY_INFORMATION |
Requests the object’s primary group SID. |
DACL_SECURITY_INFORMATION |
Requests the object’s discretionary access control list (ACL). |
SACL_SECURITY_INFORMATION |
Requests the object’s system ACL. The calling process must have the SE_SECURITY_NAME privilege. For more information about privileges, see Privileges. |
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The following error codes may be set by the service control manager. Other error codes may be set by the registry functions that are called by the service control manager.
Value |
Meaning |
ERROR_ACCESS_DENIED |
The specified handle was not opened with READ_CONTROL access, or the calling process is not the owner of the object. |
ERROR_INVALID_HANDLE |
The specified handle is invalid. |
ERROR_INSUFFICIENT_BUFFER |
There is more security descriptor information than would fit into the lpSecurityDescriptor buffer. The number of bytes required to get all the information is returned in the pcbBytesNeeded parameter. Nothing is written to the lpSecurityDescriptor buffer. |
ERROR_INVALID_PARAMETER |
The specified security information is invalid. |
The initial security descriptor of a service object is created by the service control manager, based on the security descriptor specified by the service control program that called the CreateService function to create the service. You can change the security descriptor by calling the SetServiceObjectSecurity function.
To read the owner, group, or DACL from the service object’s security descriptor, the calling process must have been granted READ_CONTROL access when the handle was opened. To get READ_CONTROL access, the caller must be the owner of the object or the object's DACL must grant the access.
To read the SACL from the security descriptor, the calling process must have been granted ACCESS_SYSTEM_SECURITY access when the handle was opened. The proper way to get this access is to enable the SE_SECURITY_NAME privilege in the caller's current token, open the handle for ACCESS_SYSTEM_SECURITY access, and then disable the privilege.
CreateService, OpenService, SECURITY_DESCRIPTOR, SetServiceObjectSecurity
file: /Techref/os/win/api/win32/func/src/f69_10.htm, 7KB, , updated: 2000/4/7 11:19, local time: 2024/11/24 08:10,
3.149.23.123:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/techref/os/win/api/win32/func/src/f69_10.htm"> QueryServiceObjectSecurity</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.