Winmo bustage fix from bug 545080 r=dougt

This commit is contained in:
Brad Lassey 2010-02-20 00:53:38 -05:00
parent 1f5e3f44d1
commit 611943fd65
2 changed files with 17 additions and 4 deletions

View file

@ -86,11 +86,17 @@ GetFileVersion(LPCWSTR szFile, verBlock *vbVersion)
ClearVersion(vbVersion);
if (FileExists(szFile)) {
bRv = TRUE;
dwLen = GetFileVersionInfoSizeW(szFile, &dwHandle);
#ifdef WINCE
// WinCe takes a non const file path string, while desktop take a const
LPWSTR lpFilepath = const_cast<LPWSTR>(szFile);
#else
LPCWSTR lpFilepath = szFile;
#endif
dwLen = GetFileVersionInfoSizeW(lpFilepath, &dwHandle);
lpData = (LPVOID)malloc(dwLen);
uLen = 0;
if (lpData && GetFileVersionInfoW(szFile, dwHandle, dwLen, lpData) != 0) {
if (lpData && GetFileVersionInfoW(lpFilepath, dwHandle, dwLen, lpData) != 0) {
if (VerQueryValueW(lpData, L"\\", &lpBuffer, &uLen) != 0) {
lpBuffer2 = (VS_FIXEDFILEINFO *)lpBuffer;

View file

@ -274,14 +274,21 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
if (NS_FAILED(rv = mPlugin->GetLeafName(fileName)))
return rv;
versionsize = ::GetFileVersionInfoSizeW(fullPath.get(), &zerome);
#ifdef WINCE
// WinCe takes a non const file path string, while desktop take a const
LPWSTR lpFilepath = const_cast<LPWSTR>(fullPath.get());
#else
LPCWSTR lpFilepath = fullPath.get();
#endif
versionsize = ::GetFileVersionInfoSizeW(lpFilepath, &zerome);
if (versionsize > 0)
verbuf = (WCHAR*)PR_Malloc(versionsize);
if (!verbuf)
return NS_ERROR_OUT_OF_MEMORY;
if (::GetFileVersionInfoW(fullPath.get(), NULL, versionsize, verbuf))
if (::GetFileVersionInfoW(lpFilepath, NULL, versionsize, verbuf))
{
info.fName = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\ProductName");
info.fDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileDescription");