Solved

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

Posted on 2004-03-23
3
317 Views
Last Modified: 2012-06-27
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.
0
Comment
Question by:adgarcia13
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 10668622
As I wrote in http://www.experts-exchange.com:8080/Programming/Programming_Platforms/Win_Prog/Q_20929696.html - you need to MQOpenQueue with the dwAccess parameter set to MQ_PEEK_ACCESS | MQ_ADMIN_ACCESS or MQ_RECEIVE_ACCESS | MQ_ADMIN_ACCESS along with local admin privileges.
0
 

Author Comment

by:adgarcia13
ID: 10671098

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
0
 
LVL 86

Expert Comment

by:jkr
ID: 10678996
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...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now