Added dinput tests.
[wine.git] / dlls / dinput / tests / keyboard.c
blobf88254b5135d21f8e09cc255d5a1b688245898bc
1 /*
2 * Copyright (c) 2005 Robert Reif
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.
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.
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
19 #define STRICT
20 #define DIRECTINPUT_VERSION 0x0700
22 #define NONAMELESSSTRUCT
23 #define NONAMELESSUNION
24 #include <windows.h>
26 #include <math.h>
27 #include <stdio.h>
28 #include <stdlib.h>
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"
37 const char * get_file_version(const char * file_name)
39 static char version[32];
40 DWORD size;
41 DWORD handle;
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");
61 HeapFree(GetProcessHeap(), 0, data);
62 } else
63 sprintf(version, "failed");
64 } else
65 sprintf(version, "not available");
67 return version;
70 static void keyboard_tests()
74 START_TEST(keyboard)
76 CoInitialize(NULL);
78 trace("DLL Version: %s\n", get_file_version("dinput.dll"));
80 keyboard_tests();
82 CoUninitialize();