mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
cabinet: correctly implement DllGetVersion
use kernelbase helper function to retreive version information of the dll. Also remove todo_wine mark from test
This commit is contained in:
parent
690ef8d9a9
commit
1196fb5a5b
4 changed files with 104 additions and 18 deletions
|
@ -1,6 +1,6 @@
|
|||
MODULE = cabinet.dll
|
||||
IMPORTLIB = cabinet
|
||||
IMPORTS = $(ZLIB_PE_LIBS)
|
||||
IMPORTS = $(ZLIB_PE_LIBS) kernelbase
|
||||
EXTRAINCL = $(ZLIB_PE_CFLAGS)
|
||||
|
||||
C_SRCS = \
|
||||
|
|
|
@ -26,3 +26,25 @@
|
|||
#define WINE_PRODUCTVERSION_STR "5.0"
|
||||
|
||||
#include "wine/wine_common_ver.rc"
|
||||
|
||||
100 VERSIONINFO
|
||||
FILEVERSION WINE_FILEVERSION
|
||||
PRODUCTVERSION WINE_PRODUCTVERSION
|
||||
FILEOS VOS_NT
|
||||
FILETYPE VFT_DLL
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "1200"
|
||||
{
|
||||
VALUE "FileDescription", WINE_FILEDESCRIPTION_STR
|
||||
VALUE "FileVersion", WINE_FILEVERSION
|
||||
VALUE "FileVersionStr", WINE_FILEVERSION_STR
|
||||
VALUE "InternalName", WINE_FILENAME
|
||||
VALUE "LegalCopyright", WINE_LEGALCOPYRIGHT
|
||||
VALUE "OriginalFilename", WINE_FILENAME_STR
|
||||
VALUE "ProductName", WINE_PRODUCTNAME_STR
|
||||
VALUE "ProductVersion", WINE_PRODUCTVERSION_STR
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,30 +40,97 @@ WINE_DEFAULT_DEBUG_CHANNEL(cabinet);
|
|||
/***********************************************************************
|
||||
* DllGetVersion (CABINET.2)
|
||||
*
|
||||
* Retrieves version information of the 'CABINET.DLL'
|
||||
* Retrieves version information of the 'CABINET.DLL' using the
|
||||
* CABINETDLLVERSIONINFO structure
|
||||
*
|
||||
* PARAMS
|
||||
* pdvi [O] pointer to version information structure.
|
||||
* cabVerInfo [O] pointer to CABINETDLLVERSIONINFO structure.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: S_OK
|
||||
* Failure: E_INVALIDARG
|
||||
* This function has no return value
|
||||
*
|
||||
* NOTES
|
||||
* Supposedly returns version from IE6SP1RP1
|
||||
* Success: cabVerInfo points to mutet CABINETDLLVERSIONINFO structure
|
||||
* Failure: cabVerInfo points to unmutet CABINETDLLVERSIONINFO structure
|
||||
* Use GetLastError() to find out more about why the function failed
|
||||
*
|
||||
*/
|
||||
HRESULT WINAPI cabinet_dll_get_version (DLLVERSIONINFO *pdvi)
|
||||
|
||||
VOID WINAPI cabinet_dll_get_version (PCABINETDLLVERSIONINFO cabVerInfo)
|
||||
{
|
||||
WARN("hmmm... not right version number \"5.1.1106.1\"?\n");
|
||||
|
||||
if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) return E_INVALIDARG;
|
||||
LPCSTR filename;
|
||||
LPCSTR subBlock;
|
||||
DWORD lenVersionInfo;
|
||||
VOID *data;
|
||||
VOID *buffer;
|
||||
UINT lenRoot;
|
||||
DWORD *handleVerInfo;
|
||||
VS_FIXEDFILEINFO *versionInfo;
|
||||
|
||||
pdvi->dwMajorVersion = 5;
|
||||
pdvi->dwMinorVersion = 1;
|
||||
pdvi->dwBuildNumber = 1106;
|
||||
pdvi->dwPlatformID = 1;
|
||||
filename = "Cabinet.dll";
|
||||
subBlock = "\\";
|
||||
lenRoot = 0;
|
||||
|
||||
return S_OK;
|
||||
if (cabVerInfo == NULL){
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
TRACE("Bad Parameter: Error = %ld.\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
handleVerInfo = malloc(sizeof(DWORD));
|
||||
if (handleVerInfo == NULL){
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
TRACE("Cannot create handleVerInfo: Out of memory: Error = %ld.\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
lenVersionInfo = GetFileVersionInfoSizeA(filename, handleVerInfo);
|
||||
if (lenVersionInfo == 0){
|
||||
TRACE("Cannot set lenVersionInfo: Couldn't parse File Version Info Size: Error = %ld.\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
data=HeapAlloc(GetProcessHeap(), 0, lenVersionInfo);
|
||||
if (data == NULL) {
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
TRACE("Cannot create data: Out of memory: Error = %ld.\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (GetFileVersionInfoA(filename, 0, lenVersionInfo, data) == 0){
|
||||
TRACE("Cannot get FileVersionInfo: Couldn't parse File Version Info Ressource: Error = %ld.\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
if (VerQueryValueA(data, subBlock, &buffer, &lenRoot) == 0){
|
||||
TRACE("Cannot query version info: Couldn't parse File Version Info Value: Error = %ld.\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lenRoot != 0)
|
||||
{
|
||||
versionInfo = (VS_FIXEDFILEINFO *)buffer;
|
||||
if (versionInfo->dwSignature == 0xfeef04bd)
|
||||
{
|
||||
cabVerInfo->cbStruct = sizeof(CABINETDLLVERSIONINFO);
|
||||
cabVerInfo->dwFileVersionMS = versionInfo->dwFileVersionMS;
|
||||
cabVerInfo->dwFileVersionLS = versionInfo->dwFileVersionLS;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Cannot verify struct: Version information has wrong signature: Error = %ld.\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Cannot access struct: The length of the buffer holding version information is 0: Error = %ld.\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* FDI callback functions */
|
||||
|
|
|
@ -52,10 +52,7 @@ static void test_dllget(HMODULE libHandle)
|
|||
revisV = (int)( FileVersionLS >> 0 ) & 0xffff;
|
||||
|
||||
snprintf(version, sizeVerInfo, "%d.%d.%d.%d\n",majorV,minorV,buildV,revisV);;
|
||||
todo_wine {
|
||||
/* FIXME - Currently DllGetVersion isn't implemented correctly */
|
||||
ok(strcmp(version,"0.0.0.0\n") != 0, "Cabinet struct doesn't contain correct version: Error = %ld.\n", GetLastError());
|
||||
}
|
||||
ok(strcmp(version,"0.0.0.0\n") != 0, "Cabinet struct doesn't contain correct version: Error = %ld.\n", GetLastError());
|
||||
}
|
||||
|
||||
START_TEST(version)
|
||||
|
|
Loading…
Reference in a new issue