3.10.6.1 Update QueueFormatName
This event MUST be generated with no arguments.
Return Values
rStatus: A status code that can be one of the following:
The status code MQ_OK (0x00000000).
An error HRESULT.
Checking Pathname and QueueFormatName
If refQueue.Pathname is NULL and QueueFormatName is NULL, then return an error HRESULT, and take no further action.
If QueueFormatName is not NULL, then return MQ_OK, and take no further action.
Parsing and Expanding Path Name
Define the iPathname variable as a string and set it to refQueue.Pathname.
Parse iPathname based on [MS-MQMQ] section 2.1.1 and define the following variables:
Define the iIsSubqueue variable as a string and set it to TRUE if the path name includes the Subqueue part, otherwise set it to FALSE.
Define the iQueueName variable as a string and set it to the QueueName part of the path name.
Define the iComputer variable as a string and set it to the Computer part of the path name.
Define the iSubqueue variable as a string and set it to the Subqueue part of the path name.
If iPathname cannot be parsed correctly then return an error HRESULT and take no further action.
Define the iExpandedPathName variable as a string and set it to iPathname.
If iComputer is empty then return an error HRESULT and take no further action.
If iComputer is "." then take the following steps:
Set iComputer to the NETBIOS computer name of the current computer.
Replace the Computer part of the path name in the iExpandedPathName variable with iComputer.
Limiting Public Queue Name Length
If iPathname is a path for a public queue and the number of slashes ("/") in iQueueName plus the length of iQueueName is greater than 63, then return an error HRESULT and take no further action.
Removing the Subqueue part from Path name
If iIsSubqueue is TRUE, then remove the semicolon before the Subqueue part of the path name along with the Subqueue part itself from iExpandedPathName.
Getting Queue Format
Define iQueueFormat as an empty QUEUE_FORMAT structure ([MS-MQMP] section 2.2.3.5).
If iPathName is a path name to a private queue, take the following steps:
Define iObjectFormat as an empty OBJECT_FORMAT ([MS-MQMP] section 2.2.3.5).
Set iObjectFormat.pQueueFormat to point to iQueueFormat.
Define the iRpcBindHandle variable as an RPC binding handle.
Create an RPC binding handle as specified in [C706] section 2, "Introduction to the RPC API" to connect to the computer specified by iComputer.
If the server failed to create the RPC binding handle then return an error HRESULT, and take no further action.
Set iRpcBindHandle to the created RPC binding handle.
Call R_QMObjectPathToObjectFormat (Opnum 12) (as specified in [MS-MQMP] section 3.1.4.10) with the following parameters:
hBind: Set to iRpcBindHandle.
lpwcsPathName: Set to iExpandedPathName.
pObjectFormat: Set to the address of iObjectFormat.
If it failed, then return an error HRESULT and take no further action.
If iPathName is a path name to a public queue, take the following steps:
Generate a Read Directory ([MS-MQDSSM] section 3.1.6.3) event with the following arguments:
iDirectoryObjectType: Queue (as specified in [MS-MQDSSM] section 3.1.6.4.2).
iFilter: an array of type attribute-filter expression with the following expressions:
"Pathname" EQUALS iExpandedPathName.
iAttributeList: an array of the following directory attributes:
The Identifier attribute.
If rStatus is not DirectoryOperationResult.Success then return an error HRESULT, and take no further action.
Set iObjectFormat.m_qpt to QUEUE_FORMAT_TYPE_PUBLIC and set iObjectFormat. m_gPublicID to the Queue.Identifier attribute value.
If iIsSubQueue is TRUE, then take the following steps:
Define iDirectName as a string and set it to "OS:" + iExpandedPathName.
Set iObjectFormat.m_qpt to QUEUE_FORMAT_TYPE_DIRECT.
Set iObjectFormat.m_pDirectID to iDirectName.
Getting Queue Format Name
Define the iQueueFormatName variable as a string.
If iQueueFormat.m_qpt is QUEUE_FORMAT_TYPE_PRIVATE then set iQueueFormatName to "PRIVATE=Lineage\Uniquifier" where Lineage is replaced by iQueueFormat.m_oPrivateID.Lineage in the "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" format and Uniquifier is replaced by iQueueFormat. m_oPrivateID.Uniquifier in the "xxxxxxxx" format.
If iQueueFormat.m_qpt is QUEUE_FORMAT_TYPE_DIRECT then set iQueueFormatName to "DIRECT=DirectID" where DirectID is replaced by iQueueFormat.m_gDirectID.
If iQueueFormat.m_qpt is QUEUE_FORMAT_TYPE_PUBLIC then set iQueueFormatName to "PUBLIC=PublicID" where PublicID is replaced by iQueueFormat.m_gPublicID in "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" format.
If iIsSubQueue is TRUE then append ";" + iIsSubQueue to iQueueFormatName.
Update QueueFormatName to iQueueFormatName.
Return MQ_OK.