Tidy up PhGetFileVersionInfoKey
@@ -1822,7 +1822,7 @@ PVOID PhGetFileVersionInfoValue(
_Success_(return)
BOOLEAN PhGetFileVersionInfoKey(
_In_ PVS_VERSION_INFO_STRUCT32 VersionInfo,
- _In_ ULONG KeyLength,
+ _In_ SIZE_T KeyLength,
_In_ PWSTR Key,
_Out_opt_ PVOID* Buffer
)
@@ -1837,7 +1837,7 @@ BOOLEAN PhGetFileVersionInfoKey(
valueOffset = VersionInfo->ValueLength * (VersionInfo->Type ? sizeof(WCHAR) : sizeof(BYTE));
child = PTR_ADD_OFFSET(value, ALIGN_UP(valueOffset, ULONG));
- while ((ULONG_PTR)child < (ULONG_PTR)VersionInfo + VersionInfo->Length)
+ while ((ULONG_PTR)child < (ULONG_PTR)PTR_ADD_OFFSET(VersionInfo, VersionInfo->Length))
{
if (_wcsnicmp(child->Key, Key, KeyLength) == 0 && child->Key[KeyLength] == UNICODE_NULL)
{
@@ -1870,14 +1870,14 @@ BOOLEAN PhGetFileVersionVarFileInfoValue(
if (PhGetFileVersionInfoKey(
VersionInfo,
- (ULONG)varfileBlockName.Length / sizeof(WCHAR),
+ varfileBlockName.Length / sizeof(WCHAR),
varfileBlockName.Buffer,
&varfileBlockInfo
))
{
if (PhGetFileVersionInfoKey(
varfileBlockInfo,
- (ULONG)KeyName->Length / sizeof(WCHAR),
+ KeyName->Length / sizeof(WCHAR),
KeyName->Buffer,
&varfileBlockValue
))
@@ -2002,7 +2002,7 @@ PPH_STRING PhGetFileVersionInfoString2(
if (!PhGetFileVersionInfoKey(
VersionInfo,
- (ULONG)blockInfoName.Length / sizeof(WCHAR),
+ blockInfoName.Length / sizeof(WCHAR),
blockInfoName.Buffer,
&blockStringInfo
))
@@ -2019,7 +2019,7 @@ PPH_STRING PhGetFileVersionInfoString2(
if (!PhGetFileVersionInfoKey(
blockStringInfo,
- (ULONG)returnLength / sizeof(WCHAR) - sizeof(ANSI_NULL), // ANSI_NULL required (dmex)
+ returnLength / sizeof(WCHAR) - sizeof(ANSI_NULL), // ANSI_NULL required (dmex)
langNameString,
&blockLangInfo
))
@@ -2029,7 +2029,7 @@ PPH_STRING PhGetFileVersionInfoString2(
if (!PhGetFileVersionInfoKey(
blockLangInfo,
- (ULONG)KeyName->Length / sizeof(WCHAR),
+ KeyName->Length / sizeof(WCHAR),
KeyName->Buffer,
&stringNameBlockInfo
))
@@ -2043,7 +2043,7 @@ PPH_STRING PhGetFileVersionInfoString2(
return NULL;
string = PhCreateStringEx(
- (PWCHAR)stringNameBlockValue,
+ stringNameBlockValue,
stringNameBlockInfo->ValueLength * sizeof(WCHAR)
);
PhTrimToNullTerminatorString(string); // length may include the null terminator.
