Added dinput tests.
[wine] / dlls / dinput / tests / keyboard.c
1 /*
2  * Copyright (c) 2005 Robert Reif
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #define STRICT
20 #define DIRECTINPUT_VERSION 0x0700
21
22 #define NONAMELESSSTRUCT
23 #define NONAMELESSUNION
24 #include <windows.h>
25
26 #include <math.h>
27 #include <stdio.h>
28 #include <stdlib.h>
29
30 #include "wine/test.h"
31 #include "windef.h"
32 #include "wingdi.h"
33 #include "dinput.h"
34 #include "dxerr8.h"
35 #include "dinput_test.h"
36
37 const char * get_file_version(const char * file_name)
38 {
39     static char version[32];
40     DWORD size;
41     DWORD handle;
42
43     size = GetFileVersionInfoSizeA(file_name, &handle);
44     if (size) {
45         char * data = HeapAlloc(GetProcessHeap(), 0, size);
46         if (data) {
47             if (GetFileVersionInfoA(file_name, handle, size, data)) {
48                 VS_FIXEDFILEINFO *pFixedVersionInfo;
49                 UINT len;
50                 if (VerQueryValueA(data, "\\", (LPVOID *)&pFixedVersionInfo, &len)) {
51                     sprintf(version, "%ld.%ld.%ld.%ld",
52                             pFixedVersionInfo->dwFileVersionMS >> 16,
53                             pFixedVersionInfo->dwFileVersionMS & 0xffff,
54                             pFixedVersionInfo->dwFileVersionLS >> 16,
55                             pFixedVersionInfo->dwFileVersionLS & 0xffff);
56                 } else
57                     sprintf(version, "not available");
58             } else
59                 sprintf(version, "failed");
60
61             HeapFree(GetProcessHeap(), 0, data);
62         } else
63             sprintf(version, "failed");
64     } else
65         sprintf(version, "not available");
66
67     return version;
68 }
69
70 static void keyboard_tests()
71 {
72 }
73
74 START_TEST(keyboard)
75 {
76     CoInitialize(NULL);
77
78     trace("DLL Version: %s\n", get_file_version("dinput.dll"));
79
80     keyboard_tests();
81
82     CoUninitialize();
83 }