James Hawkins : msi: Return ERROR_INVALID_PARAMETER if a string pointer is non-NULL and the size pointer is NULL .
Alexandre Julliard
julliard at winehq.org
Tue Feb 5 06:34:01 CST 2008
Module: wine
Branch: master
Commit: 03335de8d0961e9880f07a179b0496cf0e6f363a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=03335de8d0961e9880f07a179b0496cf0e6f363a
Author: James Hawkins <truiken at gmail.com>
Date: Mon Feb 4 11:34:59 2008 -0600
msi: Return ERROR_INVALID_PARAMETER if a string pointer is non-NULL and the size pointer is NULL.
---
dlls/msi/msi.c | 8 ++++++++
dlls/msi/tests/msi.c | 14 ++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index f4ee66c..774c53f 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -1519,6 +1519,10 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL;
UINT ret = ERROR_OUTOFMEMORY;
+ if ((lpVersionBuf && !pcchVersionBuf) ||
+ (lpLangBuf && !pcchLangBuf))
+ return ERROR_INVALID_PARAMETER;
+
if( szFilePath )
{
szwFilePath = strdupAtoW( szFilePath );
@@ -1579,6 +1583,10 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
lpVersionBuf, pcchVersionBuf?*pcchVersionBuf:0,
lpLangBuf, pcchLangBuf?*pcchLangBuf:0);
+ if ((lpVersionBuf && !pcchVersionBuf) ||
+ (lpLangBuf && !pcchLangBuf))
+ return ERROR_INVALID_PARAMETER;
+
dwVerLen = GetFileVersionInfoSizeW(szFilePath, NULL);
if( !dwVerLen )
{
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index 79652a1..3bd6181 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -1877,17 +1877,14 @@ static void test_MsiGetFileVersion(void)
lstrcpyA(version, "version");
lstrcpyA(lang, "lang");
r = MsiGetFileVersionA("nonexistent", version, NULL, lang, &langsz);
+ ok(r == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
ok(!lstrcmpA(version, "version"),
"Expected version to be unchanged, got %s\n", version);
ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
ok(!lstrcmpA(lang, "lang"),
"Expected lang to be unchanged, got %s\n", lang);
ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
- todo_wine
- {
- ok(r == ERROR_INVALID_PARAMETER,
- "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
- }
/* nonexistent szFilePath, valid lpLangBuf, NULL pcchLangBuf */
versz = MAX_PATH;
@@ -1895,17 +1892,14 @@ static void test_MsiGetFileVersion(void)
lstrcpyA(version, "version");
lstrcpyA(lang, "lang");
r = MsiGetFileVersionA("nonexistent", version, &versz, lang, NULL);
+ ok(r == ERROR_INVALID_PARAMETER,
+ "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
ok(!lstrcmpA(version, "version"),
"Expected version to be unchanged, got %s\n", version);
ok(versz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, versz);
ok(!lstrcmpA(lang, "lang"),
"Expected lang to be unchanged, got %s\n", lang);
ok(langsz == MAX_PATH, "Expected %d, got %d\n", MAX_PATH, langsz);
- todo_wine
- {
- ok(r == ERROR_INVALID_PARAMETER,
- "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
- }
/* nonexistent szFilePath, valid lpVersionBuf, pcchVersionBuf is zero */
versz = 0;
More information about the wine-cvs
mailing list