mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 20:33:38 +00:00
version: Use the string value length when converting strings.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
efe0a09fb5
commit
bec279d8c1
|
@ -1010,6 +1010,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
|
|||
BOOL ret, isText;
|
||||
INT len;
|
||||
LPWSTR lpSubBlockW;
|
||||
UINT value_len;
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, NULL, 0);
|
||||
lpSubBlockW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
|
@ -1019,7 +1020,8 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
|
|||
|
||||
MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, lpSubBlockW, len);
|
||||
|
||||
ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, puLen, &isText);
|
||||
ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, &value_len, &isText);
|
||||
if (puLen) *puLen = value_len;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpSubBlockW);
|
||||
|
||||
|
@ -1030,8 +1032,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
|
|||
*/
|
||||
LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
|
||||
DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
|
||||
|
||||
len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, -1,
|
||||
len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, value_len,
|
||||
lpBufferA + pos, info->wLength - pos, NULL, NULL);
|
||||
*lplpBuffer = lpBufferA + pos;
|
||||
if (puLen) *puLen = len;
|
||||
|
|
Loading…
Reference in a new issue