James Hawkins : msi: ExpandEnvironmentStringsW returns the required size in characters, so multiply the required size by sizeof(WCHAR) when allocating the buffer.
Alexandre Julliard
julliard at winehq.org
Thu Dec 3 10:29:52 CST 2009
Module: wine
Branch: master
Commit: 6b8b82ef13d10bbdc790e72ce1d01e1bd94169d0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6b8b82ef13d10bbdc790e72ce1d01e1bd94169d0
Author: James Hawkins <truiken at gmail.com>
Date: Wed Dec 2 17:28:48 2009 -0800
msi: ExpandEnvironmentStringsW returns the required size in characters, so multiply the required size by sizeof(WCHAR) when allocating the buffer.
---
dlls/msi/automation.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c
index b443257..3b6dd2d 100644
--- a/dlls/msi/automation.c
+++ b/dlls/msi/automation.c
@@ -1498,7 +1498,7 @@ static void variant_from_registry_value(VARIANT *pVarResult, DWORD dwType, LPBYT
case REG_EXPAND_SZ:
if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize)))
ERR("ExpandEnvironmentStrings returned error %d\n", GetLastError());
- else if (!(szNewString = msi_alloc(dwNewSize)))
+ else if (!(szNewString = msi_alloc(dwNewSize * sizeof(WCHAR))))
ERR("Out of memory\n");
else if (!(dwNewSize = ExpandEnvironmentStringsW(szString, szNewString, dwNewSize)))
ERR("ExpandEnvironmentStrings returned error %d\n", GetLastError());
More information about the wine-cvs
mailing list