网站首页  词典首页

请输入您要查询的函数:

 

术语 stringcbcatnex
释义 StringCbCatNEx
语法:
HRESULT StringCbCatNEx( LPTSTR pszDest,
size_t cbDest,
LPCTSTR pszSrc,
size_t cbMaxAppend,
LPTSTR *ppszDestEnd,
size_t *pcbRemaining,
DWORD dwFlags
);
StringCbCatNEx功能
StringCbCatNEx是一个strncat更换。大小,以字节为目标缓冲区提供的功能,以确保不会写入StringCbCatNEx过去这个缓冲区的末尾。 StringCbCatNEx增加了StringCbCatN功能通过返回一个指向目标字符串的结束以及闲置字节数在该字符串。旗也可以传递给函数的额外控制。
参数
pszDest
[中,out]指向一个缓冲区包含哪些pszSrc字符串连接在一起,并包含整个结果字符串。在pszSrc字符串添加到在pszDest字符串的结尾。
cbDest
[in]的目标缓冲区的大小,以字节为单位。此值必须考虑pszSrc加上pszDest加上终止空字符使用的字节长度。所允许的最大字节数为STRSAFE_MAX_CCH * sizeof(TCHAR)。
pszSrc
[in]指向一个缓冲区包含源字符串连接在一起的pszDest结束。此源字符串必须空终止。
cbMaxAppend
[in]的最大字节数要追加到pszDest。
ppszDestEnd
[内]的指针地址的pszDest结束。如果ppszDestEnd非空和任何数据将被追加到目标缓冲区,在该字符串的结束点,终止空字符。
pcbRemaining
[out]指向一个变量,表示未使用的字节pszDest,包括终止空字符使用的数量。如果pcbRemaining为NULL,则计数不保留或退回。
dwFlags
[in]一个或多个下列值。
STRSAFE_FILL_BEHIND_NULL
如果函数成功,在dwFlags(0)低字节是用来填补pszDest以下终止空字符初始化部分。
STRSAFE_IGNORE_NULLS
对待像(空字符串文字("")).空字符串指针
STRSAFE_FILL_ON_FAILURE
如果函数失败,在dwFlags(0)低字节是用来填充整个pszDest缓冲区,缓冲区空终止。在一个STRSAFE_E_INSUFFICIENT_BUFFER故障的情况下,任何预先存在或截断在目标字符串缓冲区被覆盖。
STRSAFE_NULL_ON_FAILURE
如果函数失败,pszDest设置为空字符串(文字("")).在一个STRSAFE_E_INSUFFICIENT_BUFFER故障的情况下,任何预先存在或截断在目标字符串缓冲区被覆盖。
STRSAFE_NO_TRUNCATION
如果函数失败,pszDest是不变。没有被添加到原始内容。
返回值
请注意,此函数返回,而不是strncat,它返回一个指针的hresult。我们强烈建议您使用的成功和失败宏来测试这个函数的返回值。
S_OKSource数据目前,弦串联没有截断,并由此产生的目标缓冲区是空终止。
STRSAFE_E_INVALID_PARAMETERThe在cbDest值大于STRSAFE_MAX_CCH * sizeof(TCHAR),一个无效的旗帜获得通过,或有之间的pszDest,cbDest大小的差异,以及材料的数量,以追加pszSrc。
STRSAFE_E_INSUFFICIENT_BUFFERThe复制操作失败,由于没有足够的缓冲空间。视乎dwFlags价值,目标缓冲区可能包含了预期的结果被截断,空终止的版本。截断的情况下是可以接受的,这未必是一个失败的情况出现。
备注
StringCbCatNEx提供了代码中的适当缓冲处理额外的处理。可怜的缓冲处理是牵连,许多安全问题涉及缓冲区溢出。 StringCbCatNEx总是空终止一个非零长度目标缓冲区。
StringCbCatNEx可以用在它的通用形式,或作为StringCbCatNExA特别(为ANSI字符串)或StringCbCatNExW(为Unicode字符串)。该表格使用取决于您的数据。
字符串数据String类型LiteralFunction
字符“字符串”StringCbCatNExA
TCHARTEXT(“字符串”)StringCbCatNEx
WCHARL“字符串”StringCbCatNExW
StringCbCatNEx及其ANSI和Unicode的变种替换这些功能:
strncat
StrNCat
行为是未定义如果字符串指向pszSrc和pszDest重叠。
无论pszSrc也不pszDest应该是NULL,除非STRSAFE_IGNORE_NULLS标志被指定,在这种情况下都可能为NULL。然而,由于一个错误没有足够的空间仍可能会返回空值,即使被忽略。
功能信息
Headerstrsafe.h
import librarystrsafe.lib
参见
StringCbCatN,StringCchCatNEx,StringCbCatEx
==英文原文==StringCbCatNEx Function
StringCbCatNEx is a replacement for strncat . The size, in bytes, of the destination buffer is provided to the function to ensure that StringCbCatNEx does not write past the end of this buffer. StringCbCatNEx adds to the functionality of StringCbCatN by returning a pointer to the end of the destination string as well as the number of bytes left unused in that string. Flags may also be passed to the function for additional control.
Syntax
HRESULT StringCbCatNEx( LPTSTR pszDest,
size_t cbDest,
LPCTSTR pszSrc,
size_t cbMaxAppend,
LPTSTR *ppszDestEnd,
size_t *pcbRemaining,
DWORD dwFlags
);
Parameters
pszDest
[in, out] Pointer to a buffer containing the string to which pszSrc is concatenated, and which contains the entire resultant string. The string at pszSrc is added to the end of the string at pszDest.
cbDest
[in] Size of the destination buffer, in bytes. This value must consider the length of pszSrc plus the length of pszDest plus the bytes used for the terminating null character. The maximum number of bytes allowed is STRSAFE_MAX_CCH * sizeof(TCHAR).
pszSrc
[in] Pointer to a buffer containing the source string that is concatenated to the end of pszDest. This source string must be null-terminated.
cbMaxAppend
[in] The maximum number of bytes to append to pszDest.
ppszDestEnd
[out] Address of a pointer to the end of pszDest. If ppszDestEnd is non-null and any data is appended to the destination buffer, this points to the terminating null character at the end of the string.
pcbRemaining
[out] Pointer to a variable that indicates the number of unused bytes in pszDest, including those used for the terminating null character. If pcbRemaining is NULL, the count is not kept or returned.
dwFlags
[in] One or more of the following values.
STRSAFE_FILL_BEHIND_NULL
If the function succeeds, the low byte of dwFlags (0) is used to fill the uninitialized portion of pszDest following the terminating null character.
STRSAFE_IGNORE_NULLS
Treat null string pointers like empty strings (TEXT("")).
STRSAFE_FILL_ON_FAILURE
If the function fails, the low byte of dwFlags (0) is used to fill the entire pszDest buffer, and the buffer is null-terminated. In the case of a STRSAFE_E_INSUFFICIENT_BUFFER failure, any pre-existing or truncated string in the destination buffer is overwritten.
STRSAFE_NULL_ON_FAILURE
If the function fails, pszDest is set to an empty string (TEXT("")). In the case of a STRSAFE_E_INSUFFICIENT_BUFFER failure, any pre-existing or truncated string in the destination buffer is overwritten.
STRSAFE_NO_TRUNCATION
If the function fails, pszDest is untouched. Nothing is added to the original contents.
Return Value
Note that this function returns an HRESULT as opposed to strncat, which returns a pointer. It is strongly recommended that you use the SUCCEEDED and FAILED macros to test the return value of this function.
S_OKSource data was present, the strings were concatenated without truncation, and the resultant destination buffer is null-terminated.
STRSAFE_E_INVALID_PARAMETERThe value in cbDest is larger than STRSAFE_MAX_CCH * sizeof(TCHAR), an invalid flag was passed, or there are discrepancies between the size of the pszDest, cbDest, and the amount of material to append in pszSrc.
STRSAFE_E_INSUFFICIENT_BUFFERThe copy operation failed due to insufficient buffer space. Depending on the value of dwFlags, the destination buffer may contain a truncated, null-terminated version of the intended result. In situations where truncation is acceptable, this may not necessarily be seen as a failure condition.
Remarks
StringCbCatNEx provides additional processing for proper buffer handling in your code. Poor buffer handling is implicated in many security issues that involve buffer overruns. StringCbCatNEx always null-terminates a non-zero-length destination buffer.
StringCbCatNEx can be used in its generic form, or specifically as StringCbCatNExA (for ANSI strings) or StringCbCatNExW (for Unicode strings). The form to use is determined by your data.
String Data TypeString LiteralFunction
char"string"StringCbCatNExA
TCHARTEXT("string")StringCbCatNEx
WCHARL"string"StringCbCatNExW
StringCbCatNEx and its ANSI and Unicode variants are replacements for these functions:
strncat
StrNCat
Behavior is undefined if the strings pointed to by pszSrc and pszDest overlap.
Neither pszSrc nor pszDest should be NULL unless the STRSAFE_IGNORE_NULLS flag is specified, in which case both may be NULL. However, an error due to insufficient space may still be returned even though null values are ignored.
Function Information
Headerstrsafe.h
Import librarystrsafe.lib
See Also
StringCbCatN , StringCchCatNEx , StringCbCatEx
==原始网址==http://msdn.microsoft.com/en-us/library/ms647498(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:20:22