[DSOUND] print dsound.dll version in tests

Robert Reif reif at earthlink.net
Sat Mar 5 02:31:32 CST 2005


Print dsound.dll version from file versioninfo resource.
-------------- next part --------------
Index: dlls/dsound/tests/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/Makefile.in,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile.in
--- dlls/dsound/tests/Makefile.in	30 Jul 2004 18:42:51 -0000	1.10
+++ dlls/dsound/tests/Makefile.in	5 Mar 2005 08:28:02 -0000
@@ -3,8 +3,8 @@ TOPOBJDIR = ../../..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 TESTDLL   = dsound.dll
-IMPORTS   = dsound ole32 user32 kernel32
-EXTRALIBS = -ldxguid -luuid -ldxerr8
+IMPORTS   = dsound ole32 user32 kernel32 version
+EXTRALIBS = -ldxguid -luuid -ldxerr8 -lversion
 
 CTESTS = \
 	capture.c \
Index: dlls/dsound/tests/capture.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/capture.c,v
retrieving revision 1.19
diff -u -p -r1.19 capture.c
--- dlls/dsound/tests/capture.c	24 Feb 2005 17:02:42 -0000	1.19
+++ dlls/dsound/tests/capture.c	5 Mar 2005 08:28:03 -0000
@@ -541,6 +541,9 @@ START_TEST(capture)
         trace("dsound.dll not found\n");
         return;
     }
+
+    trace("DLL Version: %s\n", get_file_version("dsound.dll"));
+
     pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound,"DirectSoundCaptureCreate");
     pDirectSoundCaptureEnumerateA=(void*)GetProcAddress(hDsound,"DirectSoundCaptureEnumerateA");
     if (!pDirectSoundCaptureCreate || !pDirectSoundCaptureEnumerateA)
Index: dlls/dsound/tests/ds3d.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/ds3d.c,v
retrieving revision 1.22
diff -u -p -r1.22 ds3d.c
--- dlls/dsound/tests/ds3d.c	25 Feb 2005 19:17:11 -0000	1.22
+++ dlls/dsound/tests/ds3d.c	5 Mar 2005 08:28:04 -0000
@@ -1232,6 +1232,8 @@ START_TEST(ds3d)
 {
     CoInitialize(NULL);
 
+    trace("DLL Version: %s\n", get_file_version("dsound.dll"));
+
     ds3d_tests();
 
     CoUninitialize();
Index: dlls/dsound/tests/ds3d8.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/ds3d8.c,v
retrieving revision 1.16
diff -u -p -r1.16 ds3d8.c
--- dlls/dsound/tests/ds3d8.c	23 Feb 2005 12:43:38 -0000	1.16
+++ dlls/dsound/tests/ds3d8.c	5 Mar 2005 08:28:05 -0000
@@ -1133,6 +1133,8 @@ START_TEST(ds3d8)
         return;
     }
 
+    trace("DLL Version: %s\n", get_file_version("dsound.dll"));
+
     pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8");
     if (!pDirectSoundCreate8) {
         trace("ds3d8 test skipped\n");
Index: dlls/dsound/tests/dsound.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/dsound.c,v
retrieving revision 1.49
diff -u -p -r1.49 dsound.c
--- dlls/dsound/tests/dsound.c	25 Feb 2005 19:17:11 -0000	1.49
+++ dlls/dsound/tests/dsound.c	5 Mar 2005 08:28:05 -0000
@@ -925,6 +928,8 @@ static void dsound_tests()
 START_TEST(dsound)
 {
     CoInitialize(NULL);
+
+    trace("DLL Version: %s\n", get_file_version("dsound.dll"));
 
     IDirectSound_tests();
     dsound_tests();
Index: dlls/dsound/tests/dsound8.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/dsound8.c,v
retrieving revision 1.17
diff -u -p -r1.17 dsound8.c
--- dlls/dsound/tests/dsound8.c	23 Feb 2005 12:43:38 -0000	1.17
+++ dlls/dsound/tests/dsound8.c	5 Mar 2005 08:28:06 -0000
@@ -28,6 +28,7 @@
 #define NONAMELESSSTRUCT
 #define NONAMELESSUNION
 #include <windows.h>
+#include <stdio.h>
 
 #include "wine/test.h"
 #include "dsound.h"
@@ -785,6 +786,39 @@ static void dsound8_tests()
     ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
 }
 
+const char * get_file_version(const char * file_name)
+{
+    static char version[32];
+    DWORD size;
+    DWORD handle;
+
+    size = GetFileVersionInfoSizeA("dsound.dll", &handle);
+    if (size) {
+        char * data = HeapAlloc(GetProcessHeap(), 0, size);
+        if (data) {
+            if (GetFileVersionInfoA("dsound.dll", handle, size, data)) {
+                VS_FIXEDFILEINFO *pFixedVersionInfo;
+                UINT len;
+                if (VerQueryValueA(data, "\\", (LPLPVOID)&pFixedVersionInfo, &len)) {
+                    sprintf(version, "%ld.%ld.%ld.%ld",
+                            pFixedVersionInfo->dwFileVersionMS >> 16,
+                            pFixedVersionInfo->dwFileVersionMS & 0xffff,
+                            pFixedVersionInfo->dwFileVersionLS >> 16,
+                            pFixedVersionInfo->dwFileVersionLS & 0xffff);
+                } else
+                    sprintf(version, "not available");
+            } else
+                sprintf(version, "failed");
+
+            HeapFree(GetProcessHeap(), 0, data);
+        } else
+            sprintf(version, "failed");
+    } else
+        sprintf(version, "not available");
+
+    return version;
+}
+
 START_TEST(dsound8)
 {
     HMODULE hDsound;
@@ -796,6 +830,8 @@ START_TEST(dsound8)
         trace("dsound.dll not found\n");
         return;
     }
+
+    trace("DLL Version: %s\n", get_file_version("dsound.dll"));
 
     pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8");
     if (!pDirectSoundCreate8) {
Index: dlls/dsound/tests/dsound_test.h
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/dsound_test.h,v
retrieving revision 1.8
diff -u -p -r1.8 dsound_test.h
--- dlls/dsound/tests/dsound_test.h	25 Feb 2005 19:17:11 -0000	1.8
+++ dlls/dsound/tests/dsound_test.h	5 Mar 2005 08:28:06 -0000
@@ -61,3 +61,4 @@ extern void test_buffer8(LPDIRECTSOUND8,
                          LPDIRECTSOUND3DLISTENER,BOOL,BOOL);
 extern const char * getDSBCAPS(DWORD xmask);
 extern int align(int length, int align);
+extern const char * get_file_version(const char * file_name);
Index: dlls/dsound/tests/propset.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/propset.c,v
retrieving revision 1.15
diff -u -p -r1.15 propset.c
--- dlls/dsound/tests/propset.c	23 Feb 2005 12:43:38 -0000	1.15
+++ dlls/dsound/tests/propset.c	5 Mar 2005 08:28:07 -0000
@@ -435,7 +435,9 @@ START_TEST(propset)
         trace("dsound.dll not found\n");
         return;
     }
-                                                                                
+
+    trace("DLL Version: %s\n", get_file_version("dsound.dll"));
+
     pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8");
     pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound,"DirectSoundCaptureCreate");
     pDirectSoundCaptureCreate8=(void*)GetProcAddress(hDsound,"DirectSoundCaptureCreate8");


More information about the wine-patches mailing list