Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
dde5e430
Commit
dde5e430
authored
8 years ago
by
Steve Holme
Browse files
Options
Downloads
Patches
Plain Diff
win32: Added verify windows version functionality
parent
6020ce5f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/system_win32.c
+130
-5
130 additions, 5 deletions
lib/system_win32.c
with
130 additions
and
5 deletions
lib/system_win32.c
+
130
−
5
View file @
dde5e430
...
...
@@ -81,12 +81,137 @@ bool Curl_verify_windows_version(const unsigned int majorVersion,
const
PlatformIdentifier
platform
,
const
VersionCondition
condition
)
{
(
void
)
majorVersion
;
(
void
)
minorVersion
;
(
void
)
platform
;
(
void
)
condition
;
bool
matched
=
FALSE
;
return
FALSE
;
#if !defined(_WIN32_WINNT) || !defined(_WIN32_WINNT_WIN2K) || \
(_WIN32_WINNT < _WIN32_WINNT_WIN2K)
OSVERSIONINFO
osver
;
memset
(
&
osver
,
0
,
sizeof
(
osver
));
osver
.
dwOSVersionInfoSize
=
sizeof
(
osver
);
/* Find out Windows version */
if
(
GetVersionEx
(
&
osver
))
{
/* Verify the Operating System version number */
switch
(
condition
)
{
case
VERSION_LESS_THAN
:
if
(
osver
.
dwMajorVersion
<
majorVersion
||
(
osver
.
dwMajorVersion
==
majorVersion
&&
osver
.
dwMinorVersion
<
minorVersion
))
matched
=
TRUE
;
break
;
case
VERSION_LESS_THAN_EQUAL
:
if
(
osver
.
dwMajorVersion
<=
majorVersion
&&
osver
.
dwMinorVersion
<=
minorVersion
)
matched
=
TRUE
;
break
;
case
VERSION_EQUAL
:
if
(
osver
.
dwMajorVersion
==
majorVersion
&&
osver
.
dwMinorVersion
==
minorVersion
)
matched
=
TRUE
;
break
;
case
VERSION_GREATER_THAN_EQUAL
:
if
(
osver
.
dwMajorVersion
>=
majorVersion
&&
osver
.
dwMinorVersion
>=
minorVersion
)
matched
=
TRUE
;
break
;
case
VERSION_GREATER_THAN
:
if
(
osver
.
dwMajorVersion
>
majorVersion
||
(
osver
.
dwMajorVersion
==
majorVersion
&&
osver
.
dwMinorVersion
>
minorVersion
))
matched
=
TRUE
;
break
;
}
/* Verify the platform identifier (if necessary) */
if
(
matched
&&
platform
!=
PLATFORM_DONT_CARE
)
{
switch
(
platform
)
{
case
PLATFORM_WINDOWS
:
if
(
osver
.
dwPlatformId
!=
VER_PLATFORM_WIN32_WINDOWS
)
matched
=
FALSE
;
break
;
case
PLATFORM_WINNT
:
if
(
osver
.
dwPlatformId
!=
VER_PLATFORM_WIN32_NT
)
matched
=
FALSE
;
}
}
}
#else
ULONGLONG
cm
=
0
;
OSVERSIONINFOEX
osver
;
BYTE
majorCondition
;
BYTE
minorCondition
;
BYTE
spMajorCondition
;
BYTE
spMinorCondition
;
switch
(
condition
)
{
case
VERSION_LESS_THAN
:
majorCondition
=
VER_LESS
;
minorCondition
=
VER_LESS
;
spMajorCondition
=
VER_LESS_EQUAL
;
spMinorCondition
=
VER_LESS_EQUAL
;
break
;
case
VERSION_LESS_THAN_EQUAL
:
majorCondition
=
VER_LESS_EQUAL
;
minorCondition
=
VER_LESS_EQUAL
;
spMajorCondition
=
VER_LESS_EQUAL
;
spMinorCondition
=
VER_LESS_EQUAL
;
break
;
case
VERSION_EQUAL
:
majorCondition
=
VER_EQUAL
;
minorCondition
=
VER_EQUAL
;
spMajorCondition
=
VER_GREATER_EQUAL
;
spMinorCondition
=
VER_GREATER_EQUAL
;
break
;
case
VERSION_GREATER_THAN_EQUAL
:
majorCondition
=
VER_GREATER_EQUAL
;
minorCondition
=
VER_GREATER_EQUAL
;
spMajorCondition
=
VER_GREATER_EQUAL
;
spMinorCondition
=
VER_GREATER_EQUAL
;
break
;
case
VERSION_GREATER_THAN
:
majorCondition
=
VER_GREATER
;
minorCondition
=
VER_GREATER
;
spMajorCondition
=
VER_GREATER_EQUAL
;
spMinorCondition
=
VER_GREATER_EQUAL
;
break
;
default:
return
FALSE
;
}
memset
(
&
osver
,
0
,
sizeof
(
osver
));
osver
.
dwOSVersionInfoSize
=
sizeof
(
osver
);
osver
.
dwMajorVersion
=
majorVersion
;
osver
.
dwMinorVersion
=
minorVersion
;
if
(
platform
==
PLATFORM_WINDOWS
)
osver
.
dwPlatformId
=
VER_PLATFORM_WIN32_WINDOWS
;
else
if
(
platform
==
PLATFORM_WINNT
)
osver
.
dwPlatformId
=
VER_PLATFORM_WIN32_NT
;
cm
=
VerSetConditionMask
(
cm
,
VER_MAJORVERSION
,
majorCondition
);
cm
=
VerSetConditionMask
(
cm
,
VER_MINORVERSION
,
minorCondition
);
cm
=
VerSetConditionMask
(
cm
,
VER_SERVICEPACKMAJOR
,
spMajorCondition
);
cm
=
VerSetConditionMask
(
cm
,
VER_SERVICEPACKMINOR
,
spMinorCondition
);
if
(
platform
!=
PLATFORM_DONT_CARE
)
cm
=
VerSetConditionMask
(
cm
,
VER_PLATFORMID
,
VER_EQUAL
);
if
(
VerifyVersionInfo
(
&
osver
,
(
VER_MAJORVERSION
|
VER_MINORVERSION
|
VER_SERVICEPACKMAJOR
|
VER_SERVICEPACKMINOR
),
cm
))
matched
=
TRUE
;
#endif
return
matched
;
}
#if defined(USE_WINDOWS_SSPI) || (!defined(CURL_DISABLE_TELNET) && \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment