Fixed GetFileVersionInfoSizeA tests on NT4 platform.
[wine/multimedia.git] / dlls / version / tests / info.c
blob9a2a6d375e281272e40b084c159cf32732010f01
1 /*
2 * Copyright (C) 2004 Stefan Leichter
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 #include <stdarg.h>
21 #include "wine/test.h"
22 #include "windef.h"
23 #include "winbase.h"
24 #include "winerror.h"
25 #include "winver.h"
27 #define MY_LAST_ERROR -1L
28 #define EXPECT_BAD_PATH__NOT_FOUND \
29 ok( (ERROR_PATH_NOT_FOUND == GetLastError()) || \
30 (ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) || \
31 (ERROR_BAD_PATHNAME == GetLastError()), \
32 "Last error wrong! ERROR_RESOURCE_DATA_NOT_FOUND/ERROR_BAD_PATHNAME (98)/" \
33 "ERROR_PATH_NOT_FOUND (NT4) expected, got 0x%08lx\n", GetLastError());
34 #define EXPECT_INVALID__NOT_FOUND \
35 ok( (ERROR_PATH_NOT_FOUND == GetLastError()) || \
36 (ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) || \
37 (ERROR_INVALID_PARAMETER == GetLastError()), \
38 "Last error wrong! ERROR_RESOURCE_DATA_NOT_FOUND/ERROR_INVALID_PARAMETER (98)/" \
39 "ERROR_PATH_NOT_FOUND (NT4) expected, got 0x%08lx\n", GetLastError());
41 static void test_info_size(void)
42 { DWORD hdl, retval;
44 SetLastError(MY_LAST_ERROR);
45 retval = GetFileVersionInfoSizeA( NULL, NULL);
46 ok( !retval,
47 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
48 retval);
49 EXPECT_INVALID__NOT_FOUND;
51 hdl = 0x55555555;
52 SetLastError(MY_LAST_ERROR);
53 retval = GetFileVersionInfoSizeA( NULL, &hdl);
54 ok( !retval,
55 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
56 retval);
57 EXPECT_INVALID__NOT_FOUND;
58 ok( hdl == 0L,
59 "Handle wrong! 0L expected, got 0x%08lx\n", hdl);
61 SetLastError(MY_LAST_ERROR);
62 retval = GetFileVersionInfoSizeA( "", NULL);
63 ok( !retval,
64 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
65 retval);
66 EXPECT_BAD_PATH__NOT_FOUND;
68 hdl = 0x55555555;
69 SetLastError(MY_LAST_ERROR);
70 retval = GetFileVersionInfoSizeA( "", &hdl);
71 ok( !retval,
72 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
73 retval);
74 EXPECT_BAD_PATH__NOT_FOUND;
75 ok( hdl == 0L,
76 "Handle wrong! 0L expected, got 0x%08lx\n", hdl);
78 SetLastError(MY_LAST_ERROR);
79 retval = GetFileVersionInfoSizeA( "kernel32.dll", NULL);
80 ok( retval,
81 "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08lx\n",
82 retval);
83 ok( NO_ERROR == GetLastError(),
84 "Last error wrong! NO_ERROR expected, got 0x%08lx\n",
85 GetLastError());
87 hdl = 0x55555555;
88 SetLastError(MY_LAST_ERROR);
89 retval = GetFileVersionInfoSizeA( "kernel32.dll", &hdl);
90 ok( retval,
91 "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08lx\n",
92 retval);
93 ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
94 "Last error wrong! NO_ERROR/0x%08lx (NT4) expected, got 0x%08lx\n",
95 MY_LAST_ERROR, GetLastError());
96 ok( hdl == 0L,
97 "Handle wrong! 0L expected, got 0x%08lx\n", hdl);
99 SetLastError(MY_LAST_ERROR);
100 retval = GetFileVersionInfoSizeA( "notexist.dll", NULL);
101 ok( !retval,
102 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
103 retval);
104 ok( (ERROR_FILE_NOT_FOUND == GetLastError()) ||
105 (ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) ||
106 (MY_LAST_ERROR == GetLastError()),
107 "Last error wrong! ERROR_FILE_NOT_FOUND/ERROR_RESOURCE_DATA_NOT_FOUND "
108 "(XP)/0x%08lx (NT4) expected, got 0x%08lx\n", MY_LAST_ERROR, GetLastError());
111 START_TEST(info)
113 test_info_size();