Description
This function is used to determine the length of a string obtained from the registry using the KEY_VALUE_FULL_INFORMATION structure. The DataLength field of this structure specifies the number of BYTES of registry information to write the value identified by the name.
Since variable "pp" is PWCHAR type, it is necessary to divide RegSzLength into two.
BOOLEAN
|
NTAPI
|
PnpRegSzToString(IN PWCHAR RegSzData, |
IN ULONG RegSzLength, |
OUT PUSHORT StringLength OPTIONAL) |
{
|
PWCHAR p, pp; |
|
/* Find the end */ |
pp = RegSzData + (RegSzLength / 2);
|
for (p = RegSzData; p < pp; p++) if (!*p) break; |
|
/* Return it */ |
if (StringLength) *StringLength = (USHORT)(p - RegSzData) * sizeof(WCHAR); |
return TRUE; |
}
|
|