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
21 #include "wine/test.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)
44 SetLastError(MY_LAST_ERROR);
45 retval = GetFileVersionInfoSizeA( NULL, NULL);
47 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
49 EXPECT_INVALID__NOT_FOUND;
52 SetLastError(MY_LAST_ERROR);
53 retval = GetFileVersionInfoSizeA( NULL, &hdl);
55 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
57 EXPECT_INVALID__NOT_FOUND;
59 "Handle wrong! 0L expected, got 0x%08lx\n", hdl);
61 SetLastError(MY_LAST_ERROR);
62 retval = GetFileVersionInfoSizeA( "", NULL);
64 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
66 EXPECT_BAD_PATH__NOT_FOUND;
69 SetLastError(MY_LAST_ERROR);
70 retval = GetFileVersionInfoSizeA( "", &hdl);
72 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
74 EXPECT_BAD_PATH__NOT_FOUND;
76 "Handle wrong! 0L expected, got 0x%08lx\n", hdl);
78 SetLastError(MY_LAST_ERROR);
79 retval = GetFileVersionInfoSizeA( "kernel32.dll", NULL);
81 "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08lx\n",
83 ok( NO_ERROR == GetLastError(),
84 "Last error wrong! NO_ERROR expected, got 0x%08lx\n",
88 SetLastError(MY_LAST_ERROR);
89 retval = GetFileVersionInfoSizeA( "kernel32.dll", &hdl);
91 "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08lx\n",
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());
97 "Handle wrong! 0L expected, got 0x%08lx\n", hdl);
99 SetLastError(MY_LAST_ERROR);
100 retval = GetFileVersionInfoSizeA( "notexist.dll", NULL);
102 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08lx\n",
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());