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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/test.h"
29 #define MY_LAST_ERROR ((DWORD)-1)
30 #define EXPECT_BAD_PATH__NOT_FOUND \
31 ok( (ERROR_PATH_NOT_FOUND == GetLastError()) || \
32 (ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) || \
33 (ERROR_FILE_NOT_FOUND == GetLastError()) || \
34 (ERROR_BAD_PATHNAME == GetLastError()) || \
35 (ERROR_SUCCESS == GetLastError()), \
36 "Last error wrong! ERROR_RESOURCE_DATA_NOT_FOUND/ERROR_BAD_PATHNAME (98)/" \
37 "ERROR_PATH_NOT_FOUND (NT4)/ERROR_FILE_NOT_FOUND (2k3) " \
38 "ERROR_SUCCESS (2k) expected, got %u\n", GetLastError());
39 #define EXPECT_INVALID__NOT_FOUND \
40 ok( (ERROR_PATH_NOT_FOUND == GetLastError()) || \
41 (ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) || \
42 (ERROR_FILE_NOT_FOUND == GetLastError()) || \
43 (ERROR_INVALID_PARAMETER == GetLastError()) || \
44 (ERROR_SUCCESS == GetLastError()), \
45 "Last error wrong! ERROR_RESOURCE_DATA_NOT_FOUND/ERROR_INVALID_PARAMETER (98)/" \
46 "ERROR_PATH_NOT_FOUND (NT4)/ERROR_FILE_NOT_FOUND (2k3) " \
47 "ERROR_SUCCESS (2k) expected, got %u\n", GetLastError());
49 static void create_file(const CHAR *name)
54 file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
55 ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
56 WriteFile(file, name, strlen(name), &written, NULL);
57 WriteFile(file, "\n", strlen("\n"), &written, NULL);
61 static void test_info_size(void)
63 char mypath[MAX_PATH] = "";
65 SetLastError(MY_LAST_ERROR);
66 retval = GetFileVersionInfoSizeA( NULL, NULL);
68 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x\n",
70 EXPECT_INVALID__NOT_FOUND;
73 SetLastError(MY_LAST_ERROR);
74 retval = GetFileVersionInfoSizeA( NULL, &hdl);
76 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x\n",
78 EXPECT_INVALID__NOT_FOUND;
80 "Handle wrong! 0L expected, got 0x%08x\n", hdl);
82 SetLastError(MY_LAST_ERROR);
83 retval = GetFileVersionInfoSizeA( "", NULL);
85 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x\n",
87 EXPECT_BAD_PATH__NOT_FOUND;
90 SetLastError(MY_LAST_ERROR);
91 retval = GetFileVersionInfoSizeA( "", &hdl);
93 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x\n",
95 EXPECT_BAD_PATH__NOT_FOUND;
97 "Handle wrong! 0L expected, got 0x%08x\n", hdl);
99 SetLastError(MY_LAST_ERROR);
100 retval = GetFileVersionInfoSizeA( "kernel32.dll", NULL);
102 "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
104 ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
105 "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
106 MY_LAST_ERROR, GetLastError());
109 SetLastError(MY_LAST_ERROR);
110 retval = GetFileVersionInfoSizeA( "kernel32.dll", &hdl);
112 "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
114 ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
115 "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
116 MY_LAST_ERROR, GetLastError());
118 "Handle wrong! 0L expected, got 0x%08x\n", hdl);
120 SetLastError(MY_LAST_ERROR);
121 retval = GetFileVersionInfoSizeA( "notexist.dll", NULL);
123 "GetFileVersionInfoSizeA result wrong! 0L expected, got 0x%08x\n",
125 ok( (ERROR_FILE_NOT_FOUND == GetLastError()) ||
126 (ERROR_RESOURCE_DATA_NOT_FOUND == GetLastError()) ||
127 (MY_LAST_ERROR == GetLastError()) ||
128 (ERROR_SUCCESS == GetLastError()), /* win2k */
129 "Last error wrong! ERROR_FILE_NOT_FOUND/ERROR_RESOURCE_DATA_NOT_FOUND "
130 "(XP)/0x%08x (NT4) expected, got %u\n", MY_LAST_ERROR, GetLastError());
132 /* test a currently loaded executable */
133 if(GetModuleFileNameA(NULL, mypath, MAX_PATH)) {
135 SetLastError(MY_LAST_ERROR);
136 retval = GetFileVersionInfoSizeA( mypath, &hdl);
138 "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
140 ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
141 "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
142 MY_LAST_ERROR, GetLastError());
144 "Handle wrong! 0L expected, got 0x%08x\n", hdl);
147 trace("skipping GetModuleFileNameA(NULL,..) failed\n");
149 /* test a not loaded executable */
150 if(GetSystemDirectoryA(mypath, MAX_PATH)) {
151 lstrcatA(mypath, "\\regsvr32.exe");
153 if(INVALID_FILE_ATTRIBUTES == GetFileAttributesA(mypath))
154 trace("GetFileAttributesA(%s) failed\n", mypath);
157 SetLastError(MY_LAST_ERROR);
158 retval = GetFileVersionInfoSizeA( mypath, &hdl);
160 "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
162 ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
163 "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
164 MY_LAST_ERROR, GetLastError());
166 "Handle wrong! 0L expected, got 0x%08x\n", hdl);
170 trace("skipping GetModuleFileNameA(NULL,..) failed\n");
172 create_file("test.txt");
174 /* no version info */
175 SetLastError(0xdeadbeef);
177 retval = GetFileVersionInfoSizeA("test.txt", &hdl);
178 ok(retval == 0, "Expected 0, got %d\n", retval);
179 ok(hdl == 0, "Expected 0, got %d\n", hdl);
180 ok(GetLastError() == ERROR_RESOURCE_DATA_NOT_FOUND ||
181 GetLastError() == ERROR_BAD_FORMAT || /* win9x */
182 GetLastError() == ERROR_SUCCESS, /* win2k */
183 "Expected ERROR_RESOURCE_DATA_NOT_FOUND, got %d\n", GetLastError());
185 DeleteFileA("test.txt");
188 static void VersionDwordLong2String(DWORDLONG Version, LPSTR lpszVerString)
192 a = (WORD)(Version >> 48);
193 b = (WORD)((Version >> 32) & 0xffff);
194 c = (WORD)((Version >> 16) & 0xffff);
195 d = (WORD)(Version & 0xffff);
197 sprintf(lpszVerString, "%d.%d.%d.%d", a, b, c, d);
202 static void test_info(void)
205 PVOID pVersionInfo = NULL;
207 VS_FIXEDFILEINFO *pFixedVersionInfo;
209 char VersionString[MAX_PATH];
210 static CHAR backslash[] = "\\";
211 DWORDLONG dwlVersion;
214 SetLastError(MY_LAST_ERROR);
215 retval = GetFileVersionInfoSizeA( "kernel32.dll", &hdl);
217 "GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08x\n",
219 ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
220 "Last error wrong! NO_ERROR/0x%08x (NT4) expected, got %u\n",
221 MY_LAST_ERROR, GetLastError());
223 "Handle wrong! 0L expected, got 0x%08x\n", hdl);
225 if ( retval == 0 || hdl != 0)
228 pVersionInfo = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, retval );
229 ok(pVersionInfo != 0, "HeapAlloc failed\n" );
230 if (pVersionInfo == 0)
235 /* this test crashes on WinNT4
237 boolret = GetFileVersionInfoA( "kernel32.dll", 0, retval, 0);
238 ok (!boolret, "GetFileVersionInfoA should have failed: GetLastError = %u\n", GetLastError());
239 ok ((GetLastError() == ERROR_INVALID_DATA) || (GetLastError() == ERROR_BAD_PATHNAME) ||
240 (GetLastError() == NO_ERROR),
241 "Last error wrong! ERROR_INVALID_DATA/ERROR_BAD_PATHNAME (ME)/"
242 "NO_ERROR (95) expected, got %u\n",
246 boolret = GetFileVersionInfoA( "kernel32.dll", 0, retval, pVersionInfo );
247 ok (boolret, "GetFileVersionInfoA failed: GetLastError = %u\n", GetLastError());
251 boolret = VerQueryValueA( pVersionInfo, backslash, (LPVOID *)&pFixedVersionInfo, &uiLength );
252 ok (boolret, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
256 dwlVersion = (((DWORDLONG)pFixedVersionInfo->dwFileVersionMS) << 32) +
257 pFixedVersionInfo->dwFileVersionLS;
259 VersionDwordLong2String(dwlVersion, VersionString);
261 trace("kernel32.dll version: %s\n", VersionString);
265 /* this test crashes on WinNT4
267 boolret = VerQueryValueA( pVersionInfo, backslash, (LPVOID *)&pFixedVersionInfo, 0);
268 ok (boolret, "VerQueryValue failed: GetLastError = %u\n", GetLastError());
272 HeapFree( GetProcessHeap(), 0, pVersionInfo);
275 static void test_32bit_win(void)
278 DWORD hdlW, retvalW = 0;
280 PVOID pVersionInfoA = NULL;
281 PVOID pVersionInfoW = NULL;
284 UINT uiLengthA, uiLengthW;
285 char mypathA[MAX_PATH];
286 WCHAR mypathW[MAX_PATH];
288 WCHAR rootW[] = { '\\', 0 };
289 char varfileinfoA[] = "\\VarFileInfo\\Translation";
290 WCHAR varfileinfoW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o',
291 '\\','T','r','a','n','s','l','a','t','i','o','n', 0 };
292 char WineVarFileInfoA[] = { 0x09, 0x04, 0xE4, 0x04 };
293 char FileDescriptionA[] = "\\StringFileInfo\\040904E4\\FileDescription";
294 WCHAR FileDescriptionW[] = { '\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o',
295 '\\','0','4','0','9','0','4','E','4',
296 '\\','F','i','l','e','D','e','s','c','r','i','p','t','i','o','n', 0 };
297 char WineFileDescriptionA[] = "FileDescription";
298 WCHAR WineFileDescriptionW[] = { 'F','i','l','e','D','e','s','c','r','i','p','t','i','o','n', 0 };
299 BOOL is_unicode_enabled = TRUE;
301 /* A copy from dlls/version/info.c */
308 #if 0 /* variable length structure */
312 VS_VERSION_INFO_STRUCT32 Children[];
314 } VS_VERSION_INFO_STRUCT32;
316 /* If we call GetFileVersionInfoA on a system that supports Unicode, NT/W2K/XP/W2K3 (by default) and Wine,
317 * the versioninfo will contain Unicode strings.
318 * Part of the test is to call both the A and W versions, which should have the same Version Information
319 * for some requests, on systems that support both calls.
322 /* First get the versioninfo via the W versions */
323 SetLastError(0xdeadbeef);
324 GetModuleFileNameW(NULL, mypathW, MAX_PATH);
325 if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
327 trace("GetModuleFileNameW not existing on this platform, skipping comparison between A- and W-calls\n");
328 is_unicode_enabled = FALSE;
331 if (is_unicode_enabled)
333 retvalW = GetFileVersionInfoSizeW( mypathW, &hdlW);
334 pVersionInfoW = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, retvalW );
335 retW = GetFileVersionInfoW( mypathW, 0, retvalW, pVersionInfoW );
338 GetModuleFileNameA(NULL, mypathA, MAX_PATH);
339 retvalA = GetFileVersionInfoSizeA( mypathA, &hdlA);
340 pVersionInfoA = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, retvalA );
341 retA = GetFileVersionInfoA( mypathA, 0, retvalA, pVersionInfoA );
343 if (is_unicode_enabled)
345 ok( retvalA == retvalW, "The size of the struct should be the same for both A/W calls, it is (%d) vs. (%d)\n",
347 ok( !memcmp(pVersionInfoA, pVersionInfoW, retvalA), "Both structs should be the same, they aren't\n");
350 /* The structs on Windows are bigger than just the struct for the basic information. The total struct
351 * contains also an empty part, which is used for converted strings. The converted strings are a result
352 * of calling VerQueryValueA on a 32bit resource and calling VerQueryValueW on a 16bit resource.
353 * The first WORD of the structure (wLength) shows the size of the base struct. The total struct size depends
354 * on the Windows version:
356 * 16bits resource (numbers are from a sample app):
358 * Windows Version Retrieved with A/W wLength StructSize
359 * ====================================================================================
360 * Win98 A 0x01B4 (436) 436
361 * NT4 A/W 0x01B4 (436) 2048 ???
362 * W2K/XP/W2K3 A/W 0x01B4 (436) 1536 which is (436 - sizeof(VS_FIXEDFILEINFO)) * 4
364 * 32bits resource (numbers are from this test executable version_crosstest.exe):
365 * Windows Version Retrieved with A/W wLength StructSize
366 * =============================================================
367 * Win98 A 0x01E0 (480) 848 (structure data doesn't seem correct)
368 * NT4 A/W 0x0350 (848) 1272 (848 * 1.5)
369 * W2K/XP/W2K3 A/W 0x0350 (848) 1700 which is (848 * 2) + 4
371 * Wine will follow the implementation (eventually) of W2K/XP/W2K3
374 /* Now some tests for the above (only if we are unicode enabled) */
376 if (is_unicode_enabled)
378 VS_VERSION_INFO_STRUCT32 *vvis = (VS_VERSION_INFO_STRUCT32 *)pVersionInfoW;
379 ok ( retvalW == ((vvis->wLength * 2) + 4) || retvalW == (vvis->wLength * 1.5),
380 "Structure is not of the correct size\n");
383 /* Although the 32bit resource structures contain Unicode strings, VerQueryValueA will always return normal strings,
384 * VerQueryValueW will always return Unicode ones. (That means everything returned for StringFileInfo requests).
387 /* Get the VS_FIXEDFILEINFO information, this must be the same for both A- and W-Calls */
389 retA = VerQueryValueA( pVersionInfoA, rootA, (LPVOID *)&pBufA, &uiLengthA );
390 ok (retA, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
391 ok ( uiLengthA == sizeof(VS_FIXEDFILEINFO), "Size (%d) doesn't match the size of the VS_FIXEDFILEINFO struct\n", uiLengthA);
393 if (is_unicode_enabled)
395 retW = VerQueryValueW( pVersionInfoW, rootW, (LPVOID *)&pBufW, &uiLengthW );
396 ok (retW, "VerQueryValueW failed: GetLastError = %u\n", GetLastError());
397 ok ( uiLengthA == sizeof(VS_FIXEDFILEINFO), "Size (%d) doesn't match the size of the VS_FIXEDFILEINFO struct\n", uiLengthA);
399 ok( uiLengthA == uiLengthW, "The size of VS_FIXEDFILEINFO should be the same for both A/W calls, it is (%d) vs. (%d)\n",
400 uiLengthA, uiLengthW);
401 ok( !memcmp(pBufA, pBufW, uiLengthA), "Both values should be the same, they aren't\n");
404 /* Get some VarFileInfo information, this must be the same for both A- and W-Calls */
406 retA = VerQueryValueA( pVersionInfoA, varfileinfoA, (LPVOID *)&pBufA, &uiLengthA );
407 ok (retA, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
408 ok( !memcmp(pBufA, WineVarFileInfoA, uiLengthA), "The VarFileInfo should have matched 0904e404 (non case sensitive)\n");
410 if (is_unicode_enabled)
412 retW = VerQueryValueW( pVersionInfoW, varfileinfoW, (LPVOID *)&pBufW, &uiLengthW );
413 ok (retW, "VerQueryValueW failed: GetLastError = %u\n", GetLastError());
414 ok( uiLengthA == uiLengthW, "The size of the VarFileInfo information should be the same for both A/W calls, it is (%d) vs. (%d)\n",
415 uiLengthA, uiLengthW);
416 ok( !memcmp(pBufA, pBufW, uiLengthA), "Both values should be the same, they aren't\n");
419 /* Get some StringFileInfo information, this will be ANSI for A-Calls and Unicode for W-Calls */
421 retA = VerQueryValueA( pVersionInfoA, FileDescriptionA, (LPVOID *)&pBufA, &uiLengthA );
422 ok (retA, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
423 ok( !lstrcmpA(WineFileDescriptionA, pBufA), "expected '%s' got '%s'\n",
424 WineFileDescriptionA, pBufA);
426 /* Test a second time */
427 retA = VerQueryValueA( pVersionInfoA, FileDescriptionA, (LPVOID *)&pBufA, &uiLengthA );
428 ok (retA, "VerQueryValueA failed: GetLastError = %u\n", GetLastError());
429 ok( !lstrcmpA(WineFileDescriptionA, pBufA), "expected '%s' got '%s'\n",
430 WineFileDescriptionA, pBufA);
432 if (is_unicode_enabled)
434 retW = VerQueryValueW( pVersionInfoW, FileDescriptionW, (LPVOID *)&pBufW, &uiLengthW );
435 ok (retW, "VerQueryValueW failed: GetLastError = %u\n", GetLastError());
436 ok( !lstrcmpW(WineFileDescriptionW, pBufW), "FileDescription should have been '%s'\n", WineFileDescriptionA);
439 HeapFree( GetProcessHeap(), 0, pVersionInfoA);
440 if (is_unicode_enabled)
441 HeapFree( GetProcessHeap(), 0, pVersionInfoW);
444 static void test_VerQueryValue(void)
446 static const char * const value_name[] = {
447 "Product", "CompanyName", "FileDescription", "Internal",
448 "ProductVersion", "InternalName", "File", "LegalCopyright",
449 "FileVersion", "Legal", "OriginalFilename", "ProductName",
450 "Company", "Original" };
452 UINT len, ret, translation, i;
455 ret = GetModuleFileName(NULL, buf, sizeof(buf));
458 SetLastError(0xdeadbeef);
459 len = GetFileVersionInfoSize(buf, NULL);
460 ok(len, "GetFileVersionInfoSize(%s) error %u\n", buf, GetLastError());
462 ver = HeapAlloc(GetProcessHeap(), 0, len);
465 SetLastError(0xdeadbeef);
466 ret = GetFileVersionInfo(buf, 0, len, ver);
467 ok(ret, "GetFileVersionInfo error %u\n", GetLastError());
469 p = (char *)0xdeadbeef;
471 SetLastError(0xdeadbeef);
472 ret = VerQueryValue(ver, "\\VarFileInfo\\Translation", (LPVOID*)&p, &len);
473 ok(ret, "VerQueryValue error %u\n", GetLastError());
474 ok(len == 4, "VerQueryValue returned %u, expected 4\n", len);
476 translation = *(UINT *)p;
477 translation = MAKELONG(HIWORD(translation), LOWORD(translation));
479 p = (char *)0xdeadbeef;
481 SetLastError(0xdeadbeef);
482 ret = VerQueryValue(ver, "String", (LPVOID*)&p, &len);
483 ok(!ret, "VerQueryValue should fail\n");
484 ok(GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND ||
485 GetLastError() == 0xdeadbeef /* Win9x, NT4, W2K */,
486 "VerQueryValue returned %u\n", GetLastError());
487 ok(p == (char *)0xdeadbeef, "expected 0xdeadbeef got %p\n", p);
489 len == 0xbeef, /* win9x */
490 "expected 0 got %x\n", len);
492 p = (char *)0xdeadbeef;
494 SetLastError(0xdeadbeef);
495 ret = VerQueryValue(ver, "StringFileInfo", (LPVOID*)&p, &len);
496 ok(ret, "VerQueryValue error %u\n", GetLastError());
497 todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len);
498 ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n");
500 p = (char *)0xdeadbeef;
502 SetLastError(0xdeadbeef);
503 ret = VerQueryValue(ver, "\\StringFileInfo", (LPVOID*)&p, &len);
504 ok(ret, "VerQueryValue error %u\n", GetLastError());
505 todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len);
506 ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n");
508 p = (char *)0xdeadbeef;
510 SetLastError(0xdeadbeef);
511 ret = VerQueryValue(ver, "\\\\StringFileInfo", (LPVOID*)&p, &len);
512 ok(ret, "VerQueryValue error %u\n", GetLastError());
513 todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len);
514 ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n");
516 p = (char *)0xdeadbeef;
518 SetLastError(0xdeadbeef);
519 ret = VerQueryValue(ver, "\\StringFileInfo\\\\", (LPVOID*)&p, &len);
520 ok(ret, "VerQueryValue error %u\n", GetLastError());
521 todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len);
522 ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n");
524 sprintf(buf, "\\StringFileInfo\\%08x", translation);
525 p = (char *)0xdeadbeef;
527 SetLastError(0xdeadbeef);
528 ret = VerQueryValue(ver, buf, (LPVOID*)&p, &len);
529 ok(ret, "VerQueryValue error %u\n", GetLastError());
530 todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len);
531 ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n");
533 for (i = 0; i < sizeof(value_name)/sizeof(value_name[0]); i++)
535 sprintf(buf, "\\StringFileInfo\\%08x\\%s", translation, value_name[i]);
536 p = (char *)0xdeadbeef;
538 SetLastError(0xdeadbeef);
539 ret = VerQueryValue(ver, buf, (LPVOID*)&p, &len);
540 ok(ret, "VerQueryValue(%s) error %u\n", buf, GetLastError());
541 ok(len == strlen(value_name[i]) + 1, "VerQueryValue returned %u\n", len);
542 ok(!strcmp(value_name[i], p), "expected \"%s\", got \"%s\"\n",
545 /* test partial value names */
548 p = (char *)0xdeadbeef;
550 SetLastError(0xdeadbeef);
551 ret = VerQueryValue(ver, buf, (LPVOID*)&p, &len);
552 ok(!ret, "VerQueryValue(%s) succeeded\n", buf);
553 ok(GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND ||
554 GetLastError() == 0xdeadbeef /* Win9x, NT4, W2K */,
555 "VerQueryValue returned %u\n", GetLastError());
556 ok(p == (char *)0xdeadbeef, "expected 0xdeadbeef got %p\n", p);
558 len == 0xbeef, /* win9x */
559 "expected 0 or 0xbeef, got %x\n", len);
562 HeapFree(GetProcessHeap(), 0, ver);
570 test_VerQueryValue();