Link to home
Start Free TrialLog in
Avatar of adgarcia13
adgarcia13Flag for United States of America

asked on

MSMQ - Access rights problem on call to MQReceiveMessageByLookupId...

Greetings,

    I am making the following call:

 // Peek at message with the given lookup identifier.
  hr = MQReceiveMessageByLookupId(
                                  hQueue,                // Handle of queue
                                  ullLookupId,           // Lookup identifier
                                  MQ_LOOKUP_PEEK_CURRENT // Access mode
                                  &msgProps,             // Message property structure
                                  NULL,                  // No OVERLAPPED structure
                                  NULL,                  // No callback function
                                  MQ_NO_TRANSACTION      // Not in a transaction
                                  );

 And receiving the following error:

 "The access rights of the queue for performing the action specified in dwLookupAction are not allowed for the user that opened the queue."

 The queue itself is a private queue accessed locally, and the security on it is setup such that full control is allowed by everyone and yet I still get this error... has anyone run into this problem? and if so how did they correct it? any help is appreciated. Btw, there are in fact 10 messages currently in the queue.

adgarcia13

PS: I have cross-posted this question in the Windows Programming topic area.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of adgarcia13

ASKER


It looks like in fact I was not setting the dwAccess parameter to MQ_RECEIVE_ACCESS, Thanks. On a different note, what is the best approach for reading a message from Que1, writing it to Que2, and subsequently deleting the original message from Que1 once the write to Que2 is successful?

adgarcia13
Well, as you cannot explicitly delete messages from a queue, you'd MQ_ACTION_PEEK_CURRENT on the msg you want to place in the other queue, 'MQSendMessage()' that one and the use MQ_ACTION_RECEIVE to remove the msg from the 1st queue...