Test GetFileVersionInfoSizeA with executables.

This commit is contained in:
Stefan Leichter 2005-05-31 09:33:59 +00:00 committed by Alexandre Julliard
parent 1c196c5923
commit e7425a5b7c
4 changed files with 72 additions and 0 deletions

View File

@ -1,3 +1,4 @@
Makefile
info.ok
testlist.c
version.res

View File

@ -8,6 +8,8 @@ IMPORTS = version
CTESTS = \
info.c
RC_SRCS = version.rc
@MAKE_TEST_RULES@
### Dependencies:

View File

@ -45,6 +45,7 @@
static void test_info_size(void)
{ DWORD hdl, retval;
char mypath[MAX_PATH] = "";
SetLastError(MY_LAST_ERROR);
retval = GetFileVersionInfoSizeA( NULL, NULL);
@ -111,6 +112,46 @@ static void test_info_size(void)
(MY_LAST_ERROR == GetLastError()),
"Last error wrong! ERROR_FILE_NOT_FOUND/ERROR_RESOURCE_DATA_NOT_FOUND "
"(XP)/0x%08lx (NT4) expected, got 0x%08lx\n", MY_LAST_ERROR, GetLastError());
/* test a currently loaded executable */
if(GetModuleFileNameA(NULL, mypath, MAX_PATH)) {
hdl = 0x55555555;
SetLastError(MY_LAST_ERROR);
retval = GetFileVersionInfoSizeA( mypath, &hdl);
ok( retval,
"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08lx\n",
retval);
ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
"Last error wrong! NO_ERROR/0x%08lx (NT4) expected, got 0x%08lx\n",
MY_LAST_ERROR, GetLastError());
ok( hdl == 0L,
"Handle wrong! 0L expected, got 0x%08lx\n", hdl);
}
else
trace("skipping GetModuleFileNameA(NULL,..) failed\n");
/* test a not loaded executable */
if(GetSystemDirectoryA(mypath, MAX_PATH)) {
lstrcatA(mypath, "\\regsvr32.exe");
if(INVALID_FILE_ATTRIBUTES == GetFileAttributesA(mypath))
trace("GetFileAttributesA(%s) failed\n", mypath);
else {
hdl = 0x55555555;
SetLastError(MY_LAST_ERROR);
retval = GetFileVersionInfoSizeA( mypath, &hdl);
ok( retval,
"GetFileVersionInfoSizeA result wrong! <> 0L expected, got 0x%08lx\n",
retval);
ok((NO_ERROR == GetLastError()) || (MY_LAST_ERROR == GetLastError()),
"Last error wrong! NO_ERROR/0x%08lx (NT4) expected, got 0x%08lx\n",
MY_LAST_ERROR, GetLastError());
ok( hdl == 0L,
"Handle wrong! 0L expected, got 0x%08lx\n", hdl);
}
}
else
trace("skipping GetModuleFileNameA(NULL,..) failed\n");
}
static void VersionDwordLong2String(DWORDLONG Version, LPSTR lpszVerString)

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2005 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define WINE_FILEDESCRIPTION_STR "Wine version test"
#define WINE_FILENAME_STR "version_test.exe"
#define WINE_FILETYPE VFT_APP
#define WINE_FILEVERSION 1,0,0,0
#define WINE_FILEVERSION_STR "1.0.0.0"
#define WINE_PRODUCTVERSION 1,0,0,0
#define WINE_PRODUCTVERSION_STR "1.0.0.0"
#define WINE_PRODUCTNAME_STR "Wine version test"
#include "wine/wine_common_ver.rc"