diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index de9dc4fc2c6..643f9cceb7d 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -1621,6 +1621,10 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS), HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS)); if (lpVersionBuf) lstrcpynW(lpVersionBuf, tmp, *pcchVersionBuf); + + if (lstrlenW(tmp) >= *pcchVersionBuf) + ret = ERROR_MORE_DATA; + *pcchVersionBuf = lstrlenW(tmp); } else @@ -1637,6 +1641,10 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf, FIXME("Retrieve language from file\n"); wsprintfW(tmp, szLangFormat, lang); if (lpLangBuf) lstrcpynW(lpLangBuf, tmp, *pcchLangBuf); + + if (lstrlenW(tmp) >= *pcchLangBuf) + ret = ERROR_MORE_DATA; + *pcchLangBuf = lstrlenW(tmp); } diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index dfe91db123d..520f0e77582 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -2024,25 +2024,19 @@ static void test_MsiGetFileVersion(void) versz = 5; lstrcpyA(version, "version"); r = MsiGetFileVersionA(path, version, &versz, NULL, NULL); + ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!strncmp(version, vercheck, 4), "Expected first 4 characters of %s, got %s\n", vercheck, version); ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz); - todo_wine - { - ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); - } /* pcchLangBuf not big enough */ langsz = 3; lstrcpyA(lang, "lang"); r = MsiGetFileVersionA(path, NULL, NULL, lang, &langsz); + ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); ok(!strncmp(lang, langcheck, 2), "Expected first character of %s, got %s\n", langcheck, lang); ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz); - todo_wine - { - ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); - } HeapFree(GetProcessHeap(), 0, vercheck); HeapFree(GetProcessHeap(), 0, langcheck);