msi: Return the string length even if the string is NULL.
This commit is contained in:
parent
40841946f5
commit
dc8f714ade
|
@ -1611,7 +1611,8 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
|
|||
ret = GetLastError();
|
||||
goto end;
|
||||
}
|
||||
if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )
|
||||
|
||||
if (pcchVersionBuf)
|
||||
{
|
||||
if( VerQueryValueW(lpVer, szVersionResource, (LPVOID*)&ffi, &puLen) &&
|
||||
(puLen > 0) )
|
||||
|
@ -1619,24 +1620,24 @@ UINT WINAPI MsiGetFileVersionW(LPCWSTR szFilePath, LPWSTR lpVersionBuf,
|
|||
wsprintfW(tmp, szVersionFormat,
|
||||
HIWORD(ffi->dwFileVersionMS), LOWORD(ffi->dwFileVersionMS),
|
||||
HIWORD(ffi->dwFileVersionLS), LOWORD(ffi->dwFileVersionLS));
|
||||
lstrcpynW(lpVersionBuf, tmp, *pcchVersionBuf);
|
||||
*pcchVersionBuf = lstrlenW(lpVersionBuf);
|
||||
if (lpVersionBuf) lstrcpynW(lpVersionBuf, tmp, *pcchVersionBuf);
|
||||
*pcchVersionBuf = lstrlenW(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
*lpVersionBuf = 0;
|
||||
if (lpVersionBuf) *lpVersionBuf = 0;
|
||||
*pcchVersionBuf = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( lpLangBuf && pcchLangBuf && *pcchLangBuf )
|
||||
if (pcchLangBuf)
|
||||
{
|
||||
DWORD lang = GetUserDefaultLangID();
|
||||
|
||||
FIXME("Retrieve language from file\n");
|
||||
wsprintfW(tmp, szLangFormat, lang);
|
||||
lstrcpynW(lpLangBuf, tmp, *pcchLangBuf);
|
||||
*pcchLangBuf = lstrlenW(lpLangBuf);
|
||||
if (lpLangBuf) lstrcpynW(lpLangBuf, tmp, *pcchLangBuf);
|
||||
*pcchLangBuf = lstrlenW(tmp);
|
||||
}
|
||||
|
||||
end:
|
||||
|
|
|
@ -2012,19 +2012,13 @@ static void test_MsiGetFileVersion(void)
|
|||
versz = MAX_PATH;
|
||||
r = MsiGetFileVersionA(path, NULL, &versz, NULL, NULL);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
todo_wine
|
||||
{
|
||||
ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
|
||||
}
|
||||
|
||||
/* get pcchLangBuf */
|
||||
langsz = MAX_PATH;
|
||||
r = MsiGetFileVersionA(path, NULL, NULL, NULL, &langsz);
|
||||
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
|
||||
todo_wine
|
||||
{
|
||||
ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
|
||||
}
|
||||
|
||||
/* pcchVersionBuf not big enough */
|
||||
versz = 5;
|
||||
|
@ -2032,10 +2026,10 @@ static void test_MsiGetFileVersion(void)
|
|||
r = MsiGetFileVersionA(path, version, &versz, NULL, NULL);
|
||||
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);
|
||||
ok(versz == verchecksz, "Expected %d, got %d\n", verchecksz, versz);
|
||||
}
|
||||
|
||||
/* pcchLangBuf not big enough */
|
||||
|
@ -2044,10 +2038,10 @@ static void test_MsiGetFileVersion(void)
|
|||
r = MsiGetFileVersionA(path, NULL, NULL, lang, &langsz);
|
||||
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);
|
||||
ok(langsz == langchecksz, "Expected %d, got %d\n", langchecksz, langsz);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, vercheck);
|
||||
|
|
Loading…
Reference in New Issue