Implement RtlWideStringLength() routine

这个提交包含在:
2022-09-26 16:53:58 +02:00
父节点 58847c2fea
当前提交 c7f53e193a
共有 2 个文件被更改,包括 48 次插入1 次删除

查看文件

@@ -19,7 +19,7 @@
* Wide string to be compared.
*
* @param Length
* Maximum number of characters to compare.
* Maximum number of characters to compare. If no limit set, it compares whole strings.
*
* @return Integral value indicating the relationship between the wide strings.
*
@@ -61,6 +61,48 @@ RtlWideStringCompare(IN CONST PWCHAR String1,
return 0;
}
/**
* Calculates the length of a given wide string.
*
* @param String
* Pointer to the null-terminated wide string to be examined.
*
* @param MaxLength
* Maximum number of wide characters to examine. If no limit set, it examines whole string.
*
* @return The length of the null-terminated wide string.
*
* @since: XT 1.0
*/
XTCDECL
SIZE_T
RtlWideStringLength(IN CONST PWCHAR String,
IN SIZE_T MaxLength)
{
SIZE_T Length;
/* Check if NULL pointer passed */
if(String == NULL)
{
return 0;
}
/* Iterate through the wide string */
for(Length = 0; ; Length++)
{
/* Check if NULL found or max length limit reached */
if((Length != 0 && Length == MaxLength) || !String[Length])
{
/* Finish examination */
break;
}
}
/* Return wide string length */
return Length;
}
/**
* Finds the next token in a null-terminated wide string.
*