From: Tobias G��rgens tobi.goergens@gmail.com
--- dlls/cabinet/tests/Makefile.in | 3 +- dlls/cabinet/tests/version.c | 79 ++++++++++++++++++++++++++++++++++ include/shlwapi.h | 9 ++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 dlls/cabinet/tests/version.c
diff --git a/dlls/cabinet/tests/Makefile.in b/dlls/cabinet/tests/Makefile.in index f301617473d..fc9fff75c7b 100644 --- a/dlls/cabinet/tests/Makefile.in +++ b/dlls/cabinet/tests/Makefile.in @@ -3,4 +3,5 @@ IMPORTS = cabinet
C_SRCS = \ extract.c \ - fdi.c + fdi.c \ + version.c diff --git a/dlls/cabinet/tests/version.c b/dlls/cabinet/tests/version.c new file mode 100644 index 00000000000..60f5dc74efe --- /dev/null +++ b/dlls/cabinet/tests/version.c @@ -0,0 +1,79 @@ +#include <stdio.h> +#include <string.h> +#include <windows.h> +#include <winbase.h> +#include <wine/test.h> + + +#include "windef.h" +#define NO_SHLWAPI_REG +#include "shlwapi.h" +#undef NO_SHLWAPI_REG +#include "winbase.h" + + +typedef VOID (__stdcall *f_dllget)(PCABINETDLLVERSIONINFO); +typedef LPCSTR (__stdcall *f_getdll)(void); + + +static void test_dllget(HMODULE libHandle) +{ + PCABINETDLLVERSIONINFO verInfo; + char *version; + int sizeVerInfo; + DWORD FileVersionMS; + DWORD FileVersionLS; + int majorV; + int minorV; + int buildV; + int revisV; + + f_dllget DllGetVersion = (f_dllget)GetProcAddress(libHandle, "DllGetVersion"); + todo_wine { + /* FIXME - Currently DllGetVersion isn't implemented correctly */ + ok(libHandle != NULL, "Function DllGetVersion in DLL not found: Error = %ld.\n", GetLastError()); + + + verInfo = malloc(sizeof(CABINETDLLVERSIONINFO)); + ok(verInfo != NULL, "Couldn't allocate memory to run tests properly!\n"); + DllGetVersion(verInfo); + + FileVersionMS = verInfo->dwFileVersionMS; + FileVersionLS = verInfo->dwFileVersionLS; + + /*length of 4 DWORDs + buffer*/ + sizeVerInfo = 32; + + version = malloc(sizeVerInfo); + + + majorV = (int)( FileVersionMS >> 16 ) & 0xffff; + minorV = (int)( FileVersionMS >> 0 ) & 0xffff; + buildV = (int)( FileVersionLS >> 16 ) & 0xffff; + revisV = (int)( FileVersionLS >> 0 ) & 0xffff; + + snprintf(version, sizeVerInfo, "%d.%d.%d.%d\n",majorV,minorV,buildV,revisV);; + + ok(strcmp(version,"") != 0, "Cabinet struct doesn't contain correct version: Error = %ld.\n", GetLastError()); + } +} + + +static void test_getdll(HMODULE libHandle) +{ + f_getdll GetDllVersion = (f_getdll)GetProcAddress(libHandle, "GetDllVersion"); + todo_wine { + /* FIXME - Currently GetDllVersion isn't implemented */ + ok(libHandle != NULL, "Function GetDllVersion in DLL not found: Error = %ld.\n", GetLastError()); + ok(strcmp(GetDllVersion(),"") != 0, "GetDllVersion doesn't return correct version: Error = %ld.\n", GetLastError()); + } +} + +START_TEST(version) +{ + HMODULE libHandle; + libHandle = LoadLibraryA("Cabinet.dll"); + ok(libHandle != NULL, "Cabinet.dll not found: Error = %ld.\n", GetLastError()); + test_dllget(libHandle); + test_getdll(libHandle); +} diff --git a/include/shlwapi.h b/include/shlwapi.h index 6149c7081a3..028a6e7efba 100644 --- a/include/shlwapi.h +++ b/include/shlwapi.h @@ -1065,6 +1065,15 @@ typedef struct _DllVersionInfo { DWORD dwPlatformID; } DLLVERSIONINFO;
+/*version information used in cabinet.dll*/ +typedef struct _CABINETDLLVERSIONINFO { + DWORD cbStruct; + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwFileVersionMS; + DWORD dwFileVersionLS; +} CABINETDLLVERSIONINFO, *PCABINETDLLVERSIONINFO; + #define DLLVER_PLATFORM_WINDOWS 0x01 /* Win9x */ #define DLLVER_PLATFORM_NT 0x02 /* WinNT */