Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9b33b479
Commit
9b33b479
authored
Apr 27, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 27, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Fix test failures on certain versions of Windows.
parent
a7fc0c65
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
35 deletions
+57
-35
version.c
dlls/kernel32/tests/version.c
+57
-35
No files found.
dlls/kernel32/tests/version.c
View file @
9b33b479
...
...
@@ -101,9 +101,9 @@ static void test_GetVersionEx(void)
static
void
test_VerifyVersionInfo
(
void
)
{
OSVERSIONINFOEX
info
=
{
sizeof
(
info
)
}
;
OSVERSIONINFOEX
info
;
BOOL
ret
;
DWORD
servicepack
;
DWORD
servicepack
,
error
;
if
(
!
pVerifyVersionInfoA
||
!
pVerSetConditionMask
)
{
...
...
@@ -114,21 +114,24 @@ static void test_VerifyVersionInfo(void)
/* Before we start doing some tests we should check what the version of
* the ServicePack is. Tests on a box with no ServicePack will fail otherwise.
*/
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionExA
((
OSVERSIONINFO
*
)
&
info
);
servicepack
=
info
.
wServicePackMajor
;
memset
(
&
info
,
0
,
sizeof
(
info
));
info
.
dwOSVersionInfoSize
=
sizeof
(
info
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MAJORVERSION
|
VER_MINORVERSION
,
pVerSetConditionMask
(
0
,
VER_MAJORVERSION
,
VER_GREATER_EQUAL
));
ok
(
ret
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_BUILDNUMBER
|
VER_MAJORVERSION
|
VER_MINORVERSION
/* | VER_PLATFORMID | VER_SERVICEPACKMAJOR |
VER_SERVICEPACKMINOR | VER_SUITENAME | VER_PRODUCT_TYPE */
,
pVerSetConditionMask
(
0
,
VER_MAJORVERSION
,
VER_GREATER_EQUAL
));
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_OLD_WIN_VERSION
),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
GetLastError
());
error
=
GetLastError
();
ok
(
!
ret
,
"VerifyVersionInfoA succeeded
\n
"
);
ok
(
error
==
ERROR_OLD_WIN_VERSION
,
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
error
);
/* tests special handling of VER_SUITENAME */
...
...
@@ -163,22 +166,17 @@ static void test_VerifyVersionInfo(void)
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
),
VER_MAJORVERSION
,
VER_GREATER_EQUAL
));
if
(
servicepack
==
0
)
{
ok
(
!
ret
||
broken
(
ret
),
/* win2k3 */
"VerifyVersionInfoA should have failed
\n
"
);
ok
(
GetLastError
()
==
ERROR_OLD_WIN_VERSION
,
"Expected ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
GetLastError
());
}
else
ok
(
ret
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
wServicePackMinor
++
;
SetLastError
(
0xdeadbeef
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
));
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_OLD_WIN_VERSION
),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
GetLastError
());
error
=
GetLastError
();
ok
(
!
ret
,
"VerifyVersionInfoA succeeded
\n
"
);
ok
(
error
==
ERROR_OLD_WIN_VERSION
||
broken
(
error
==
ERROR_BAD_ARGUMENTS
)
/* some wink2 */
,
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
error
);
if
(
servicepack
==
0
)
{
...
...
@@ -186,83 +184,107 @@ static void test_VerifyVersionInfo(void)
}
else
{
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
wServicePackMajor
--
;
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER
));
ok
(
ret
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
ok
(
ret
||
broken
(
!
ret
)
/* some win2k */
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
wServicePackMajor
--
;
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
));
ok
(
ret
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
ok
(
ret
||
broken
(
!
ret
)
/* some win2k */
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
}
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
wServicePackMajor
++
;
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_LESS
));
ok
(
ret
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
ok
(
ret
||
broken
(
!
ret
)
/* some win2k */
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
wServicePackMajor
++
;
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_LESS_EQUAL
));
ok
(
ret
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
ok
(
ret
||
broken
(
!
ret
)
/* some win2k */
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
wServicePackMajor
--
;
SetLastError
(
0xdeadbeef
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_EQUAL
));
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_OLD_WIN_VERSION
),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
GetLastError
());
error
=
GetLastError
();
ok
(
!
ret
,
"VerifyVersionInfoA succeeded
\n
"
);
ok
(
error
==
ERROR_OLD_WIN_VERSION
||
broken
(
error
==
ERROR_BAD_ARGUMENTS
)
/* some win2k */
,
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
error
);
/* test the failure hierarchy for the four version fields */
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
wServicePackMajor
++
;
SetLastError
(
0xdeadbeef
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
));
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_OLD_WIN_VERSION
),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
GetLastError
());
error
=
GetLastError
();
ok
(
!
ret
,
"VerifyVersionInfoA succeeded
\n
"
);
ok
(
error
==
ERROR_OLD_WIN_VERSION
||
broken
(
error
==
ERROR_BAD_ARGUMENTS
)
/* some win2k */
,
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
error
);
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
dwMinorVersion
++
;
SetLastError
(
0xdeadbeef
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
));
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_OLD_WIN_VERSION
),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
GetLastError
());
error
=
GetLastError
();
ok
(
!
ret
,
"VerifyVersionInfoA succeeded
\n
"
);
ok
(
error
==
ERROR_OLD_WIN_VERSION
||
broken
(
error
==
ERROR_BAD_ARGUMENTS
)
/* some win2k */
,
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
error
);
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
dwMajorVersion
++
;
SetLastError
(
0xdeadbeef
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MAJORVERSION
|
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
));
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_OLD_WIN_VERSION
),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
GetLastError
());
error
=
GetLastError
();
ok
(
!
ret
,
"VerifyVersionInfoA succeeded
\n
"
);
ok
(
error
==
ERROR_OLD_WIN_VERSION
||
broken
(
error
==
ERROR_BAD_ARGUMENTS
)
/* some win2k */
,
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
error
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
));
ok
(
ret
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
ok
(
ret
||
broken
(
!
ret
)
/* some win2k */
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
dwBuildNumber
++
;
SetLastError
(
0xdeadbeef
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MAJORVERSION
|
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
));
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_OLD_WIN_VERSION
),
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
GetLastError
());
error
=
GetLastError
();
ok
(
!
ret
,
"VerifyVersionInfoA succeeded
\n
"
);
ok
(
error
==
ERROR_OLD_WIN_VERSION
||
broken
(
error
==
ERROR_BAD_ARGUMENTS
)
/* some win2k */
,
"VerifyVersionInfoA should have failed with ERROR_OLD_WIN_VERSION instead of %d
\n
"
,
error
);
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MINORVERSION
,
VER_GREATER_EQUAL
));
ok
(
ret
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
ok
(
ret
||
broken
(
!
ret
)
/* some win2k */
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
/* test bad dwOSVersionInfoSize */
info
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFOEX
);
GetVersionEx
((
OSVERSIONINFO
*
)
&
info
);
info
.
dwOSVersionInfoSize
=
0
;
ret
=
pVerifyVersionInfoA
(
&
info
,
VER_MAJORVERSION
|
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
,
pVerSetConditionMask
(
0
,
VER_MAJORVERSION
,
VER_GREATER_EQUAL
));
ok
(
ret
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
ok
(
ret
||
broken
(
!
ret
)
/* some win2k */
,
"VerifyVersionInfoA failed with error %d
\n
"
,
GetLastError
());
}
START_TEST
(
version
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment