mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 09:50:52 +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
1 changed files with 4 additions and 3 deletions
|
@ -1010,6 +1010,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
|
||||||
BOOL ret, isText;
|
BOOL ret, isText;
|
||||||
INT len;
|
INT len;
|
||||||
LPWSTR lpSubBlockW;
|
LPWSTR lpSubBlockW;
|
||||||
|
UINT value_len;
|
||||||
|
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, NULL, 0);
|
len = MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, NULL, 0);
|
||||||
lpSubBlockW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
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);
|
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);
|
HeapFree(GetProcessHeap(), 0, lpSubBlockW);
|
||||||
|
|
||||||
|
@ -1030,8 +1032,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
|
||||||
*/
|
*/
|
||||||
LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
|
LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4;
|
||||||
DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
|
DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock;
|
||||||
|
len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, value_len,
|
||||||
len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, -1,
|
|
||||||
lpBufferA + pos, info->wLength - pos, NULL, NULL);
|
lpBufferA + pos, info->wLength - pos, NULL, NULL);
|
||||||
*lplpBuffer = lpBufferA + pos;
|
*lplpBuffer = lpBufferA + pos;
|
||||||
if (puLen) *puLen = len;
|
if (puLen) *puLen = len;
|
||||||
|
|
Loading…
Reference in a new issue