大网数据广告活动
网络与域名解析

Interpreting Binding Information

· 52CE 我爱测

Microsoft RPC enables your client and server programs access to and interpret the information in a binding handle.

Microsoft RPC enables your client and server programs access to and interpret the information in a binding handle. This does not mean that you can or should try to access the contents of a binding handle directly. Microsoft RPC provides functions that set and retrieve the information in binding handles.

To get the information in a binding handle, pass the handle to RpcBindingToStringBinding. It returns the binding information as a string. For every call to RpcBindingToStringBinding, you must have a corresponding call to the function RpcStringFree.

You can call the function RpcStringBindingParse to parse the string you obtain from RpcBindingToStringBinding. This function allocates strings to contain the information it parses. If you do not want it to parse a particular piece of binding information, pass a NULL as the value of that parameter. Be sure to call RpcStringFree for each of the strings it allocates.

The following code fragment illustrates how an application might call these functions.

RPC_STATUS status;
UCHAR *lpzStringBinding;
UCHAR *lpzProtocolSequence;
UCHAR *lpzNetworkAddress;
UCHAR *lpzEndpoint;
UCHAR *NetworkOptions;
 
// The variable hBindingHandle is a valid binding handle.
 
status = RpcBindingToStringBinding(hBindingHandle,&lpzStringBinding);
// Code to check the status goes here.
 
status = RpcStringBindingParse(
    lpzStringBinding,
    NULL,
    &lpzProtocolSequence;
    &lpzNetworkAddress;
    &lpzEndpoint;
    &NetworkOptions);
// Code to check the status goes here.
 
// Code to analyze and alter the binding information in the strings
// goes here.
 
status = RpcStringFree(&lpzStringBinding);
// Code to check the status goes here.
 
status = RpcStringFree(&lpzProtocolSequence);
// Code to check the status goes here.
 
status = RpcStringFree(&lpzNetworkAddress);
// Code to check the status goes here.
 
status = RpcStringFree(&NetworkOptions);
// Code to check the status goes here.

The preceding sample code calls the functions RpcBindingToStringBinding and RpcStringBindingParse to get and parse the information in a valid binding handle. Note that the value NULL was passed as the second parameter to RpcStringBindingParse. This causes that function to skip parsing the object UUID. Since it does not parse the UUID, RpcStringBindingParse will not allocate a string for it. This technique enables your application to only allocate memory for the information you are interested in parsing and analyzing.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。