title: Set default permissions when creating a new Message Queue (MSMQ) in C#
body: <p>I am trying to programmatically create several <code>Message Queues</code> on a Windows 2003x64/2008R2 Server.
  When a Queue is created, Windows automatically applies default permissions to the Queue.</p>
  
  <p>For MSMQ 4, the following users are added by default</p>
  
  <ul>
  <li>Everyone</li>
  <li>Creator of the queue</li>
  <li>ANONYMOUS LOGIN</li>
  </ul>
  
  <p>When I set the permissions for a queue using <code>MessageQueue.SetPermissions()</code>, the specified <code>AccessControlList</code> is only appended to the default security permissions.</p>
  
  <p>Is there any way the default permissions can be removed or overwritten?
  In  <a href="http://blogs.msdn.com/b/johnbreakwell/archive/2009/08/03/default-msmq-queue-permissions-have-changed-in-msmq-4-0.aspx" rel="noreferrer" title="Default MSMQ queue permissions have changed in MSMQ 4.0">this MSDN Article</a> at the bottom, it states that </p>
  
  <blockquote>
    <p>You can't, though, customise the defaults as they are hard-coded.</p>
  </blockquote>
  
  <p>I know that the settings of a queue are persisted in a file, located in <code>C:\Windows\System32\msmq\storage\lqs</code>. In this file there's a Security property that represents the permissions for the queue. Might editing this key be an option? Doing this, however, seems kind of odd to me.</p>
  
  <p>I'm looking for a proper way to specify my own <code>AccessControlList</code> that overwrites the default security permissions of a queue. Either when it's being created, or afterwards.</p>
  
  <p>Any help is appreciated,</p>
  
  <p>Thanks.</p>