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

string attribute (RPC)

· 52CE 我爱测

The \ string\ attribute and Remote Procedure Call (RPC).

The [ string] attribute indicates that the parameter is a pointer to an array of type char, byte, or w_char. As with a conformant array, the size of a [string] parameter is determined at run time. Unlike a conformant array, the developer does not have to provide the length associated with the array—the [string] attribute tells the stub to determine the array size by calling strlen. A [string] attribute cannot be used at the same time as the [ length_is] or [ last_is] attributes.

The [in, string] attribute combination directs the stub to pass the string from client to server only. The amount of memory allocated on the server is the same as the transmitted string size plus one.

The [ out, string] attributes direct the stub to pass the string from server to client only. The call-by-value design of the C language insists that all [out] parameters must be pointers.

The [out] parameter must be a pointer and, by default, all pointer parameters are reference pointers. The reference pointer does not change during the call—it points to the same memory as before the call. For string pointers, the additional constraint of the reference pointer means the client must allocate sufficient valid memory before making the remote procedure call. The stubs transmit the string that the [out, string] attributes indicate into the memory already allocated on the client side.

The following topics describe the remote procedure parameter prototypes for strings:

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)

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

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