Commit 3d678afc authored by Alexandre Julliard's avatar Alexandre Julliard

Dynamically load version.dll in MMDRV_GetDescription32.

parent 8c7f7e4d
...@@ -123,17 +123,28 @@ static BOOL MMDRV_GetDescription32(const char* fname, char* buf, int buflen) ...@@ -123,17 +123,28 @@ static BOOL MMDRV_GetDescription32(const char* fname, char* buf, int buflen)
DWORD dw; DWORD dw;
BOOL ret = FALSE; BOOL ret = FALSE;
UINT u; UINT u;
FARPROC pGetFileVersionInfoSizeA;
FARPROC pGetFileVersionInfoA;
FARPROC pVerQueryValueA;
HMODULE hmodule = 0;
#define E(_x) do {TRACE _x;goto theEnd;} while(0) #define E(_x) do {TRACE _x;goto theEnd;} while(0)
if (OpenFile(fname, &ofs, OF_EXIST)==HFILE_ERROR) E(("Can't find file %s\n", fname)); if (OpenFile(fname, &ofs, OF_EXIST)==HFILE_ERROR) E(("Can't find file %s\n", fname));
/* should load version.dll */ if (!(hmodule = LoadLibraryA( "version.dll" ))) goto theEnd;
if (!(dw = GetFileVersionInfoSizeA(ofs.szPathName, &h))) E(("Can't get FVIS\n")); if (!(pGetFileVersionInfoSizeA = GetProcAddress( hmodule, "GetFileVersionInfoSizeA" )))
goto theEnd;
if (!(pGetFileVersionInfoA = GetProcAddress( hmodule, "GetFileVersionInfoA" )))
goto theEnd;
if (!(pVerQueryValueA = GetProcAddress( hmodule, "pVerQueryValueA" )))
goto theEnd;
if (!(dw = pGetFileVersionInfoSizeA(ofs.szPathName, &h))) E(("Can't get FVIS\n"));
if (!(ptr = HeapAlloc(GetProcessHeap(), 0, dw))) E(("OOM\n")); if (!(ptr = HeapAlloc(GetProcessHeap(), 0, dw))) E(("OOM\n"));
if (!GetFileVersionInfoA(ofs.szPathName, h, dw, ptr)) E(("Can't get FVI\n")); if (!pGetFileVersionInfoA(ofs.szPathName, h, dw, ptr)) E(("Can't get FVI\n"));
#define A(_x) if (VerQueryValueA(ptr, "\\StringFileInfo\\040904B0\\" #_x, &val, &u)) \ #define A(_x) if (pVerQueryValueA(ptr, "\\StringFileInfo\\040904B0\\" #_x, &val, &u)) \
TRACE(#_x " => %s\n", (LPSTR)val); else TRACE(#_x " @\n") TRACE(#_x " => %s\n", (LPSTR)val); else TRACE(#_x " @\n")
A(CompanyName); A(CompanyName);
...@@ -150,13 +161,14 @@ static BOOL MMDRV_GetDescription32(const char* fname, char* buf, int buflen) ...@@ -150,13 +161,14 @@ static BOOL MMDRV_GetDescription32(const char* fname, char* buf, int buflen)
A(SpecialBuild); A(SpecialBuild);
#undef A #undef A
if (!VerQueryValueA(ptr, "\\StringFileInfo\\040904B0\\ProductName", &val, &u)) E(("Can't get product name\n")); if (!pVerQueryValueA(ptr, "\\StringFileInfo\\040904B0\\ProductName", &val, &u)) E(("Can't get product name\n"));
lstrcpynA(buf, val, buflen); lstrcpynA(buf, val, buflen);
#undef E #undef E
ret = TRUE; ret = TRUE;
theEnd: theEnd:
HeapFree(GetProcessHeap(), 0, ptr); HeapFree(GetProcessHeap(), 0, ptr);
if (hmodule) FreeLibrary( hmodule );
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment