Implement RtlWideStringLength() routine
ci/woodpecker/push/build Pipeline was successful Details

This commit is contained in:
Rafal Kupiec 2022-09-26 16:53:58 +02:00
parent 58847c2fea
commit c7f53e193a
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 48 additions and 1 deletions

View File

@ -73,6 +73,11 @@ RtlWideStringCompare(IN CONST PWCHAR String1,
IN CONST PWCHAR String2,
IN CONST ULONG Length);
XTCDECL
SIZE_T
RtlWideStringLength(IN CONST PWCHAR String,
IN SIZE_T MaxLength);
XTCDECL
PWCHAR
RtlWideStringTokenize(IN PWCHAR String,

View File

@ -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.
*