Skip to content

Fix typo: use dwMinorVersion instead of dwMajorVersion in Windows 8 version check#176

Open
keymaker-arch wants to merge 1 commit intoOpenVPN:masterfrom
keymaker-arch:fix/dwMinorVersion-typo
Open

Fix typo: use dwMinorVersion instead of dwMajorVersion in Windows 8 version check#176
keymaker-arch wants to merge 1 commit intoOpenVPN:masterfrom
keymaker-arch:fix/dwMinorVersion-typo

Conversation

@keymaker-arch
Copy link

Bug Description

In DriverEntry() (src/tapdrvr.c, line 236), the code intends to check whether the OS is Windows 8 / Server 2012 or later (version 6.2) to set GlobalData.RunningWindows8OrGreater. However, dwMajorVersion is assigned twice:

osInfo.dwMajorVersion = 6;
osInfo.dwMajorVersion = 2;  // BUG: should be dwMinorVersion

This leaves dwMinorVersion at its default value (0), so the check effectively compares against version 6.0 (Windows Vista / Server 2008) instead of 6.2.

Fix

Change the second assignment to osInfo.dwMinorVersion = 2:

osInfo.dwMajorVersion = 6;
osInfo.dwMinorVersion = 2;

Impact

Without this fix, RunningWindows8OrGreater is set to TRUE on Windows Vista and later, rather than specifically Windows 8 and later. This affects the MmGetSystemAddressForMdlSafe flag behavior described in the surrounding comments.

…version check

In DriverEntry, the code intended to check for Windows 8/Server 2012 (version
6.2) by setting dwMajorVersion=6 and dwMinorVersion=2. However, dwMajorVersion
was assigned twice, leaving dwMinorVersion uninitialized (zero). This caused the
version check to compare against 6.0 (Windows Vista/Server 2008) instead of 6.2.

Fix the second assignment to correctly use osInfo.dwMinorVersion = 2.
@cron2
Copy link
Contributor

cron2 commented Feb 26, 2026

From a first glance this looks like a real bug, thanks for the report.

I'm not sure this has any real consequences since we do not really support anything older than Win10 anymore... ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants