共用方式為


PROPID_M_PROV_NAME_LEN

 

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

(Read-only.) The PROPID_M_PROV_NAME_LEN property specifies the length of the name of the cryptographic provider used for validating the digital signature attached to the message.

This property can be used when passing authenticated messages to a foreign queue or to Message Queuing from a foreign messaging system. For information on exchanging authenticated messages with foreign messaging systems, see Connector Services.

Property ID

PROPID_M_PROV_NAME_LEN

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

Property Value

On input: The size (in Unicode characters) of the buffer allocated by the receiving application.

On return: The length (in Unicode characters) of the cryptographic provider name, plus the end-of-string character, returned by PROPID_M_PROV_NAME.

Remarks

PROPID_M_PROV_NAME_LEN is only used by the receiving application. It is required whenever PROPID_M_PROV_NAME is specified in the MQMSGPROPS structure.

On input, the provider name buffer should be large enough to hold the complete provider name string including the end-of-string character.

To retrieve the name of the cryptographic provider from a message, set PROPID_M_PROV_NAME and PROPID_M_PROV_NAME_LEN in the MQMSGPROPS structure. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned values. When retrieving PROPID_M_PROV_NAME_LEN, you can set the type indicator to VT_UI4 or VT_NULL. If you set the type indicator to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.

When MQReceiveMessage succeeds, first test the returned value of PROPID_M_PROV_NAME_LEN to see if a provider name exists. A returned value of 0 indicates that provider name was not specified by the sending application. A non-0 return value indicates that a provider name was returned by PROPID_M_PROV_NAME.

If MQReceiveMessage or MQReceiveMessageByLookupId fails, returning an MQ_ERROR_PROV_NAME_BUFFER_TOO_SMALL error, use the returned value of PROPID_M_PROV_NAME_LEN to reallocate the provider name buffer and call the applicable function again.

Equivalent COM Property

This property is not needed when you are using COM components.

Example Code

The following code fragment shows how PROPID_M_PROV_NAME_LEN is specified in arrays that can be used to initialize an MQMSGPROPS structure when retrieving the name of the cryptographic provider.

ULONG ulProviderNameLength = 64;  
WCHAR * wszProviderNameBuffer = NULL;  
wszProviderNameBuffer = (WCHAR*)malloc(ulProviderNameLength*sizeof(WCHAR));  
if (wszProviderNameBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszProviderNameBuffer, 0, ulProviderNameLength*sizeof(WCHAR));  
aMsgPropId[i] = PROPID_M_PROV_NAME_LEN;           // Property ID  
aMsgPropVar[i].vt = VT_UI4;                       // Type indicator  
aMsgPropVar[i].ulVal = ulProviderNameLength;  
i++;  
  
aMsgPropId[i] = PROPID_M_PROV_NAME;               // Property ID  
aMsgPropVar[i].vt = VT_LPWSTR;                    // Type indicator  
aMsgPropVar[i].pwszVal = wszProviderNameBuffer;  
i++;  

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
PROPID_M_PROV_NAME