The MQSetQueueSecurity function sets the access control security for the queue.
HRESULT APIENTRY MQSetQueueSecurity(
LPCWSTR lpwcsFormatName,
SECURITY_INFORMATION *SecurityInformation,
PSECURITY_DESCRIPTOR *pSecurityDescriptor
);
If access is denied, contact someone who has rights to modify the security descriptor.
Following are the default values for the security descriptor.
Default Value | Meaning |
---|---|
Owner | The process user. |
Group | The process group. |
DACL | Full control for the process user. All processes of other users can get queue properties, get queue security, and send messages to the queue. |
SACL | None. |
The format name of the queue (specified by lpwcsFormatName) must be a public or private format name. MSMQ must be able to access Active Directory (for public queues) or the local computer (for private queues) to get the queue's security descriptor.
If the format name of the queue is unknown, see Format Name to find ways to obtain a new format name.
The following access rights and privileges are required to change the queue's security descriptor.
Access right/privilege | Required to |
---|---|
MQSEC_TAKE_QUEUE _OWNERSHIP |
Change the owner of the queue. This access right is equivalent to WRITE_OWNER as defined by the Win32 header files. |
SE_TAKE_OWNERSHIP _NAME |
Change the owner of the queue. This privilege can be used instead of having the MQSEC_TAKE_QUEUE_OWNERSHIP access on the queue. If a user has this privilege on the server, the user can change the owner of any public queue in the enterprise. If the user has this privilege on the local computer, the user can change the owner of any private queue. |
MQSEC_CHANGE_QUEUE _PERMISSIONS |
Change the queue's discretionary access control list (DACL) if the process is not the owner of the queue. This access right is equivalent to WRITE_DAC as defined by the Win32 header files. |
SE_SECURITY_NAME | Change the queue's system ACL (SACL); this privilege must be enabled for the calling process on Active Directory for public queues and on the local computer for private queues. |
MQGetQueueSecurity cannot retrieve the security descriptor of a journal, dead letter, connector, or foreign queue.
A public queue's access security cannot be set if there is no connection to Active Directory. This restriction applies to dependent client computers, independent client computers that are working offline, and MSMQ routing servers (FRS). (For information on offline operations, see MSMQ Offline Support.)
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mq.h.
Import Library: Use mqrt.lib.
Unicode: Defined only as Unicode.