Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista
The MQPathNameToFormatName function returns a format name based on the path name provided.
HRESULT APIENTRY MQPathNameToFormatName( LPCWSTR lpwcsPathName, LPWSTR lpwcsFormatName, LPDWORD lpdwCount );
[in] UNC or DNS path name of the queue. Either private or public Message Queuing path names are valid.
[out] Pointer to a buffer to receive the format name for the queue.
[in, out] On input, specifies the length of the lpwcsFormatName buffer (in Unicode characters). When Message Queuing is in domain mode, public queues require at least 44 Unicode characters; private queues require at least 54. When Message Queuing is in workgroup mode, the number of Unicode characters required by a direct format name for a private queue depends on the queue name.
On output, indicates the length of the returned format name string, including the null-terminating character. If the output value is greater than the initial input value, the supplied buffer is not large enough to contain the complete format name string and MQ_ERROR_FORMATNAME_BUFFER_TOO_SMALL is returned. In this case, only a portion of the format name is returned, but the output value can be used to allocate a sufficiently large buffer for a repeated function call.
The buffer pointed to by lpwcsFormatName is too small to contain the format name string.
The lpwcsPathName parameter contains an illegal Message Queuing path name string.
A connection with the directory service cannot be established. Verify permissions for accessing the directory service.
(Public queues only) The queue is not registered in the directory service.
The Message Queuing service is not available.
Apart from generic Message Queuing error codes, this function may return ADSI and LDAP error codes. For example, LDAP_BUSY (0x8007200E) is returned when the directory service server is busy.
Private (local only) and public Message Queuing path names can be specified.
Typically, this function is used when the only available information is the queue's Message Queuing path name and you need the format name for calls to MQOpenQueue, MQGetQueueProperties, MQSetQueueProperties, MQGetQueueSecurity, or MQSetQueueSecurity.
Message Queuing uses information stored in the directory service to generate a public format name from the path name of a local or remote public queue. The format name of a public queue cannot be retrieved if there is no connection to the directory service.
This function can be called by a computer that is a member of a domain or a workgroup to obtain the format name of a local private queue, but cannot be called by a domain computer operating offline to obtain the format name of a public queue. When the computer is operating in domain mode, the function returns the private format name for a local private queue, and when the computer is operating in workgroup mode, the function returns its direct format name. For information on offline operations, see Message Queuing Offline Support.
The following code examples are included in Using Message Queuing.
|For an example of||See|
|Generating a format name from a queue path name||C/C++ Code Example: Opening a Queue|
Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Mq.h.
Library: Use Mqrt.lib.