2 * Windows and DOS version functions
4 * Copyright 1997 Marcus Meissner
5 * Copyright 1998 Patrik Stridvall
6 * Copyright 1998, 2003 Andreas Mohr
7 * Copyright 1997, 2003 Alexandre Julliard
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #define WIN32_NO_STATUS
31 #include "wine/debug.h"
32 #include "ntdll_misc.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(ver
);
39 WIN20
, /* Windows 2.0 */
40 WIN30
, /* Windows 3.0 */
41 WIN31
, /* Windows 3.1 */
42 WIN95
, /* Windows 95 */
43 WIN98
, /* Windows 98 */
44 WINME
, /* Windows Me */
45 NT351
, /* Windows NT 3.51 */
46 NT40
, /* Windows NT 4.0 */
47 NT2K
, /* Windows 2000 */
48 WINXP
, /* Windows XP */
49 WINXP64
, /* Windows XP 64-bit */
50 WIN2K3
, /* Windows 2003 */
51 WINVISTA
,/* Windows Vista */
52 WIN2K8
, /* Windows 2008 */
53 WIN2K8R2
,/* Windows 2008 R2 */
56 WIN81
, /* Windows 8.1 */
57 WIN10
, /* Windows 10 */
61 /* FIXME: compare values below with original and fix.
62 * An *excellent* win9x version page (ALL versions !)
63 * can be found at www.mdgx.com/ver.htm */
64 static const RTL_OSVERSIONINFOEXW VersionData
[NB_WINDOWS_VERSIONS
] =
66 /* WIN20 FIXME: verify values */
68 sizeof(RTL_OSVERSIONINFOEXW
), 2, 0, 0, VER_PLATFORM_WIN32s
,
69 L
"Win32s 1.3", 0, 0, 0, 0, 0
71 /* WIN30 FIXME: verify values */
73 sizeof(RTL_OSVERSIONINFOEXW
), 3, 0, 0, VER_PLATFORM_WIN32s
,
74 L
"Win32s 1.3", 0, 0, 0, 0, 0
78 sizeof(RTL_OSVERSIONINFOEXW
), 3, 10, 0, VER_PLATFORM_WIN32s
,
79 L
"Win32s 1.3", 0, 0, 0, 0, 0
83 /* Win95: 4, 0, 0x40003B6, ""
84 * Win95sp1: 4, 0, 0x40003B6, " A " (according to doc)
85 * Win95osr2: 4, 0, 0x4000457, " B " (according to doc)
86 * Win95osr2.1: 4, 3, 0x40304BC, " B " (according to doc)
87 * Win95osr2.5: 4, 3, 0x40304BE, " C " (according to doc)
88 * Win95a/b can be discerned via regkey SubVersionNumber
90 sizeof(RTL_OSVERSIONINFOEXW
), 4, 0, 0x40003B6, VER_PLATFORM_WIN32_WINDOWS
,
93 /* WIN98 (second edition) */
95 /* Win98: 4, 10, 0x40A07CE, " " 4.10.1998
96 * Win98SE: 4, 10, 0x40A08AE, " A " 4.10.2222
98 sizeof(RTL_OSVERSIONINFOEXW
), 4, 10, 0x40A08AE, VER_PLATFORM_WIN32_WINDOWS
,
103 sizeof(RTL_OSVERSIONINFOEXW
), 4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS
,
108 sizeof(RTL_OSVERSIONINFOEXW
), 3, 51, 0x421, VER_PLATFORM_WIN32_NT
,
109 L
"Service Pack 5", 5, 0, 0, VER_NT_WORKSTATION
, 0
113 sizeof(RTL_OSVERSIONINFOEXW
), 4, 0, 0x565, VER_PLATFORM_WIN32_NT
,
114 L
"Service Pack 6a", 6, 0, 0, VER_NT_WORKSTATION
, 0
118 sizeof(RTL_OSVERSIONINFOEXW
), 5, 0, 0x893, VER_PLATFORM_WIN32_NT
,
119 L
"Service Pack 4", 4, 0, 0, VER_NT_WORKSTATION
,
120 30 /* FIXME: Great, a reserved field with a value! */
124 sizeof(RTL_OSVERSIONINFOEXW
), 5, 1, 0xA28, VER_PLATFORM_WIN32_NT
,
125 L
"Service Pack 3", 3, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
,
126 30 /* FIXME: Great, a reserved field with a value! */
130 sizeof(RTL_OSVERSIONINFOEXW
), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT
,
131 L
"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
, 0
135 sizeof(RTL_OSVERSIONINFOEXW
), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT
,
136 L
"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_SERVER
, 0
140 sizeof(RTL_OSVERSIONINFOEXW
), 6, 0, 0x1772, VER_PLATFORM_WIN32_NT
,
141 L
"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
, 0
145 sizeof(RTL_OSVERSIONINFOEXW
), 6, 0, 0x1772, VER_PLATFORM_WIN32_NT
,
146 L
"Service Pack 2", 2, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_SERVER
, 0
150 sizeof(RTL_OSVERSIONINFOEXW
), 6, 1, 0x1DB1, VER_PLATFORM_WIN32_NT
,
151 L
"Service Pack 1", 1, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
, 0
155 sizeof(RTL_OSVERSIONINFOEXW
), 6, 1, 0x1DB1, VER_PLATFORM_WIN32_NT
,
156 L
"Service Pack 1", 1, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_SERVER
, 0
160 sizeof(RTL_OSVERSIONINFOEXW
), 6, 2, 0x23F0, VER_PLATFORM_WIN32_NT
,
161 L
"", 0, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
, 0
165 sizeof(RTL_OSVERSIONINFOEXW
), 6, 3, 0x2580, VER_PLATFORM_WIN32_NT
,
166 L
"", 0, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
, 0
170 sizeof(RTL_OSVERSIONINFOEXW
), 10, 0, 0x4563, VER_PLATFORM_WIN32_NT
,
171 L
"", 0, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
, 0
176 static const struct { WCHAR name
[12]; WINDOWS_VERSION ver
; } version_names
[] =
186 { L
"win2000", NT2K
},
191 { L
"winxp64", WINXP64
},
192 { L
"win2003", WIN2K3
},
193 { L
"win2k3", WIN2K3
},
194 { L
"vista", WINVISTA
},
195 { L
"winvista", WINVISTA
},
196 { L
"win2008", WIN2K8
},
197 { L
"win2k8", WIN2K8
},
198 { L
"win2008r2", WIN2K8R2
},
199 { L
"win2k8r2", WIN2K8R2
},
207 /* initialized to null so that we crash if we try to retrieve the version too early at startup */
208 static const RTL_OSVERSIONINFOEXW
*current_version
;
211 /**********************************************************************
212 * get_nt_registry_version
214 * Fetch the version information from the NT-style registry keys.
216 static BOOL
get_nt_registry_version( RTL_OSVERSIONINFOEXW
*version
)
218 OBJECT_ATTRIBUTES attr
;
219 UNICODE_STRING nameW
, valueW
;
224 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)tmp
;
226 attr
.Length
= sizeof(attr
);
227 attr
.RootDirectory
= 0;
228 attr
.ObjectName
= &nameW
;
230 attr
.SecurityDescriptor
= NULL
;
231 attr
.SecurityQualityOfService
= NULL
;
232 RtlInitUnicodeString( &nameW
, L
"Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion" );
234 if (NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
)) return FALSE
;
236 memset( version
, 0, sizeof(*version
) );
238 RtlInitUnicodeString( &valueW
, L
"CurrentVersion" );
239 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
241 WCHAR
*p
, *str
= (WCHAR
*)info
->Data
;
242 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
243 p
= wcschr( str
, '.' );
247 version
->dwMinorVersion
= wcstoul( p
, NULL
, 10 );
249 version
->dwMajorVersion
= wcstoul( str
, NULL
, 10 );
252 if (version
->dwMajorVersion
) /* we got the main version, now fetch the other fields */
255 version
->dwPlatformId
= VER_PLATFORM_WIN32_NT
;
257 /* get build number */
259 RtlInitUnicodeString( &valueW
, L
"CurrentBuildNumber" );
260 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
262 WCHAR
*str
= (WCHAR
*)info
->Data
;
263 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
264 version
->dwBuildNumber
= wcstoul( str
, NULL
, 10 );
267 /* get version description */
269 RtlInitUnicodeString( &valueW
, L
"CSDVersion" );
270 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
272 DWORD len
= min( info
->DataLength
, sizeof(version
->szCSDVersion
) - sizeof(WCHAR
) );
273 memcpy( version
->szCSDVersion
, info
->Data
, len
);
274 version
->szCSDVersion
[len
/ sizeof(WCHAR
)] = 0;
277 /* get service pack version */
279 RtlInitUnicodeString( &nameW
, L
"Machine\\System\\CurrentControlSet\\Control\\Windows" );
280 if (!NtOpenKey( &hkey2
, KEY_ALL_ACCESS
, &attr
))
282 RtlInitUnicodeString( &valueW
, L
"CSDVersion" );
283 if (!NtQueryValueKey( hkey2
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
), &count
))
285 if (info
->DataLength
>= sizeof(DWORD
))
287 DWORD dw
= *(DWORD
*)info
->Data
;
288 version
->wServicePackMajor
= LOWORD(dw
) >> 8;
289 version
->wServicePackMinor
= LOWORD(dw
) & 0xff;
295 /* get product type */
297 RtlInitUnicodeString( &nameW
, L
"Machine\\System\\CurrentControlSet\\Control\\ProductOptions" );
298 if (!NtOpenKey( &hkey2
, KEY_ALL_ACCESS
, &attr
))
300 RtlInitUnicodeString( &valueW
, L
"ProductType" );
301 if (!NtQueryValueKey( hkey2
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
303 WCHAR
*str
= (WCHAR
*)info
->Data
;
304 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
305 if (!wcsicmp( str
, L
"WinNT" )) version
->wProductType
= VER_NT_WORKSTATION
;
306 else if (!wcsicmp( str
, L
"LanmanNT" )) version
->wProductType
= VER_NT_DOMAIN_CONTROLLER
;
307 else if (!wcsicmp( str
, L
"ServerNT" )) version
->wProductType
= VER_NT_SERVER
;
312 /* FIXME: get wSuiteMask */
320 /**********************************************************************
321 * get_win9x_registry_version
323 * Fetch the version information from the Win9x-style registry keys.
325 static BOOL
get_win9x_registry_version( RTL_OSVERSIONINFOEXW
*version
)
327 OBJECT_ATTRIBUTES attr
;
328 UNICODE_STRING nameW
, valueW
;
333 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)tmp
;
335 attr
.Length
= sizeof(attr
);
336 attr
.RootDirectory
= 0;
337 attr
.ObjectName
= &nameW
;
339 attr
.SecurityDescriptor
= NULL
;
340 attr
.SecurityQualityOfService
= NULL
;
341 RtlInitUnicodeString( &nameW
, L
"Machine\\Software\\Microsoft\\Windows\\CurrentVersion" );
343 if (NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
)) return FALSE
;
345 memset( version
, 0, sizeof(*version
) );
347 RtlInitUnicodeString( &valueW
, L
"VersionNumber" );
348 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
350 WCHAR
*p
, *str
= (WCHAR
*)info
->Data
;
351 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
352 p
= wcschr( str
, '.' );
354 version
->dwMajorVersion
= wcstoul( str
, NULL
, 10 );
358 p
= wcschr( str
, '.' );
362 version
->dwBuildNumber
= wcstoul( p
, NULL
, 10 );
364 version
->dwMinorVersion
= wcstoul( str
, NULL
, 10 );
366 /* build number contains version too on Win9x */
367 version
->dwBuildNumber
|= MAKEWORD( version
->dwMinorVersion
, version
->dwMajorVersion
) << 16;
370 if (version
->dwMajorVersion
) /* we got the main version, now fetch the other fields */
373 version
->dwPlatformId
= VER_PLATFORM_WIN32_WINDOWS
;
375 RtlInitUnicodeString( &valueW
, L
"SubVersionNumber" );
376 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
378 DWORD len
= min( info
->DataLength
, sizeof(version
->szCSDVersion
) - sizeof(WCHAR
) );
379 memcpy( version
->szCSDVersion
, info
->Data
, len
);
380 version
->szCSDVersion
[len
/ sizeof(WCHAR
)] = 0;
389 /**********************************************************************
392 * Parse the contents of the Version key.
394 static BOOL
parse_win_version( HANDLE hkey
)
396 UNICODE_STRING valueW
;
397 WCHAR
*name
, tmp
[64];
398 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)tmp
;
401 RtlInitUnicodeString( &valueW
, L
"Version" );
402 if (NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
) - sizeof(WCHAR
), &count
))
405 name
= (WCHAR
*)info
->Data
;
406 name
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
408 for (i
= 0; i
< ARRAY_SIZE(version_names
); i
++)
410 if (wcscmp( version_names
[i
].name
, name
)) continue;
411 current_version
= &VersionData
[version_names
[i
].ver
];
412 TRACE( "got win version %s\n", debugstr_w(version_names
[i
].name
) );
416 ERR( "Invalid Windows version value %s specified in config file.\n", debugstr_w(name
) );
421 /**********************************************************************
424 void version_init(void)
426 OBJECT_ATTRIBUTES attr
;
427 UNICODE_STRING nameW
;
428 HANDLE root
, hkey
, config_key
;
429 BOOL got_win_ver
= FALSE
;
430 const WCHAR
*p
, *appname
= NtCurrentTeb()->Peb
->ProcessParameters
->ImagePathName
.Buffer
;
431 WCHAR appversion
[MAX_PATH
+20];
433 current_version
= &VersionData
[WIN7
];
435 RtlOpenCurrentUser( KEY_ALL_ACCESS
, &root
);
436 attr
.Length
= sizeof(attr
);
437 attr
.RootDirectory
= root
;
438 attr
.ObjectName
= &nameW
;
440 attr
.SecurityDescriptor
= NULL
;
441 attr
.SecurityQualityOfService
= NULL
;
442 RtlInitUnicodeString( &nameW
, L
"Software\\Wine" );
444 /* @@ Wine registry key: HKCU\Software\Wine */
445 if (NtOpenKey( &config_key
, KEY_ALL_ACCESS
, &attr
)) config_key
= 0;
447 if (!config_key
) goto done
;
449 /* open AppDefaults\\appname key */
451 if ((p
= wcsrchr( appname
, '/' ))) appname
= p
+ 1;
452 if ((p
= wcsrchr( appname
, '\\' ))) appname
= p
+ 1;
454 wcscpy( appversion
, L
"AppDefaults\\" );
455 wcscat( appversion
, appname
);
456 RtlInitUnicodeString( &nameW
, appversion
);
457 attr
.RootDirectory
= config_key
;
459 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe */
460 if (!NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
))
462 TRACE( "getting version from %s\n", debugstr_w(appversion
) );
463 got_win_ver
= parse_win_version( hkey
);
469 TRACE( "getting default version\n" );
470 got_win_ver
= parse_win_version( config_key
);
472 NtClose( config_key
);
477 static RTL_OSVERSIONINFOEXW registry_version
;
479 TRACE( "getting registry version\n" );
480 if (get_nt_registry_version( ®istry_version
) ||
481 get_win9x_registry_version( ®istry_version
))
482 current_version
= ®istry_version
;
486 NtCurrentTeb()->Peb
->OSMajorVersion
= current_version
->dwMajorVersion
;
487 NtCurrentTeb()->Peb
->OSMinorVersion
= current_version
->dwMinorVersion
;
488 NtCurrentTeb()->Peb
->OSBuildNumber
= current_version
->dwBuildNumber
;
489 NtCurrentTeb()->Peb
->OSPlatformId
= current_version
->dwPlatformId
;
491 TRACE( "got %d.%d platform %d build %x name %s service pack %d.%d product %d\n",
492 current_version
->dwMajorVersion
, current_version
->dwMinorVersion
,
493 current_version
->dwPlatformId
, current_version
->dwBuildNumber
,
494 debugstr_w(current_version
->szCSDVersion
),
495 current_version
->wServicePackMajor
, current_version
->wServicePackMinor
,
496 current_version
->wProductType
);
499 /***********************************************************************
500 * RtlGetProductInfo (NTDLL.@)
502 * Gives info about the current Windows product type, in a format compatible
503 * with the given Windows version
505 * Returns TRUE if the input is valid, FALSE otherwise
507 BOOLEAN WINAPI
RtlGetProductInfo(DWORD dwOSMajorVersion
, DWORD dwOSMinorVersion
, DWORD dwSpMajorVersion
,
508 DWORD dwSpMinorVersion
, PDWORD pdwReturnedProductType
)
510 TRACE("(%d, %d, %d, %d, %p)\n", dwOSMajorVersion
, dwOSMinorVersion
,
511 dwSpMajorVersion
, dwSpMinorVersion
, pdwReturnedProductType
);
513 if (!pdwReturnedProductType
)
516 if (dwOSMajorVersion
< 6)
518 *pdwReturnedProductType
= PRODUCT_UNDEFINED
;
522 if (current_version
->wProductType
== VER_NT_WORKSTATION
)
523 *pdwReturnedProductType
= PRODUCT_ULTIMATE_N
;
525 *pdwReturnedProductType
= PRODUCT_STANDARD_SERVER
;
530 /***********************************************************************
531 * RtlGetVersion (NTDLL.@)
533 NTSTATUS WINAPI
RtlGetVersion( RTL_OSVERSIONINFOEXW
*info
)
535 info
->dwMajorVersion
= current_version
->dwMajorVersion
;
536 info
->dwMinorVersion
= current_version
->dwMinorVersion
;
537 info
->dwBuildNumber
= current_version
->dwBuildNumber
;
538 info
->dwPlatformId
= current_version
->dwPlatformId
;
539 wcscpy( info
->szCSDVersion
, current_version
->szCSDVersion
);
540 if(info
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
))
542 info
->wServicePackMajor
= current_version
->wServicePackMajor
;
543 info
->wServicePackMinor
= current_version
->wServicePackMinor
;
544 info
->wSuiteMask
= current_version
->wSuiteMask
;
545 info
->wProductType
= current_version
->wProductType
;
547 return STATUS_SUCCESS
;
551 /******************************************************************************
552 * RtlGetNtVersionNumbers (NTDLL.@)
554 * Get the version numbers of the run time library.
557 * major [O] Destination for the Major version
558 * minor [O] Destination for the Minor version
559 * build [O] Destination for the Build version
565 * Introduced in Windows XP (NT5.1)
567 void WINAPI
RtlGetNtVersionNumbers( LPDWORD major
, LPDWORD minor
, LPDWORD build
)
569 if (major
) *major
= current_version
->dwMajorVersion
;
570 if (minor
) *minor
= current_version
->dwMinorVersion
;
571 /* FIXME: Does anybody know the real formula? */
572 if (build
) *build
= (0xF0000000 | current_version
->dwBuildNumber
);
576 /******************************************************************************
577 * RtlGetNtProductType (NTDLL.@)
579 BOOLEAN WINAPI
RtlGetNtProductType( LPDWORD type
)
581 if (type
) *type
= current_version
->wProductType
;
585 static inline UCHAR
version_update_condition(UCHAR
*last_condition
, UCHAR condition
)
587 switch (*last_condition
)
590 *last_condition
= condition
;
593 if (condition
>= VER_EQUAL
&& condition
<= VER_LESS_EQUAL
)
595 *last_condition
= condition
;
600 case VER_GREATER_EQUAL
:
601 if (condition
>= VER_EQUAL
&& condition
<= VER_GREATER_EQUAL
)
606 if (condition
== VER_EQUAL
|| (condition
>= VER_LESS
&& condition
<= VER_LESS_EQUAL
))
610 if (!condition
) *last_condition
|= 0x10;
611 return *last_condition
& 0xf;
614 static inline NTSTATUS
version_compare_values(ULONG left
, ULONG right
, UCHAR condition
)
618 if (left
!= right
) return STATUS_REVISION_MISMATCH
;
621 if (left
<= right
) return STATUS_REVISION_MISMATCH
;
623 case VER_GREATER_EQUAL
:
624 if (left
< right
) return STATUS_REVISION_MISMATCH
;
627 if (left
>= right
) return STATUS_REVISION_MISMATCH
;
630 if (left
> right
) return STATUS_REVISION_MISMATCH
;
633 return STATUS_REVISION_MISMATCH
;
635 return STATUS_SUCCESS
;
638 /******************************************************************************
639 * RtlVerifyVersionInfo (NTDLL.@)
641 NTSTATUS WINAPI
RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW
*info
,
642 DWORD dwTypeMask
, DWORDLONG dwlConditionMask
)
644 RTL_OSVERSIONINFOEXW ver
;
647 TRACE("(%p,0x%x,0x%s)\n", info
, dwTypeMask
, wine_dbgstr_longlong(dwlConditionMask
));
649 ver
.dwOSVersionInfoSize
= sizeof(ver
);
650 if ((status
= RtlGetVersion( &ver
)) != STATUS_SUCCESS
) return status
;
652 if(!(dwTypeMask
&& dwlConditionMask
)) return STATUS_INVALID_PARAMETER
;
654 if(dwTypeMask
& VER_PRODUCT_TYPE
)
656 status
= version_compare_values(ver
.wProductType
, info
->wProductType
, dwlConditionMask
>> 7*3 & 0x07);
657 if (status
!= STATUS_SUCCESS
)
660 if(dwTypeMask
& VER_SUITENAME
)
661 switch(dwlConditionMask
>> 6*3 & 0x07)
664 if((info
->wSuiteMask
& ver
.wSuiteMask
) != info
->wSuiteMask
)
665 return STATUS_REVISION_MISMATCH
;
668 if(!(info
->wSuiteMask
& ver
.wSuiteMask
) && info
->wSuiteMask
)
669 return STATUS_REVISION_MISMATCH
;
672 return STATUS_INVALID_PARAMETER
;
674 if(dwTypeMask
& VER_PLATFORMID
)
676 status
= version_compare_values(ver
.dwPlatformId
, info
->dwPlatformId
, dwlConditionMask
>> 3*3 & 0x07);
677 if (status
!= STATUS_SUCCESS
)
680 if(dwTypeMask
& VER_BUILDNUMBER
)
682 status
= version_compare_values(ver
.dwBuildNumber
, info
->dwBuildNumber
, dwlConditionMask
>> 2*3 & 0x07);
683 if (status
!= STATUS_SUCCESS
)
687 if(dwTypeMask
& (VER_MAJORVERSION
|VER_MINORVERSION
|VER_SERVICEPACKMAJOR
|VER_SERVICEPACKMINOR
))
689 unsigned char condition
, last_condition
= 0;
690 BOOLEAN do_next_check
= TRUE
;
692 if(dwTypeMask
& VER_MAJORVERSION
)
694 condition
= version_update_condition(&last_condition
, dwlConditionMask
>> 1*3 & 0x07);
695 status
= version_compare_values(ver
.dwMajorVersion
, info
->dwMajorVersion
, condition
);
696 do_next_check
= (ver
.dwMajorVersion
== info
->dwMajorVersion
) &&
697 ((condition
>= VER_EQUAL
) && (condition
<= VER_LESS_EQUAL
));
699 if((dwTypeMask
& VER_MINORVERSION
) && do_next_check
)
701 condition
= version_update_condition(&last_condition
, dwlConditionMask
>> 0*3 & 0x07);
702 status
= version_compare_values(ver
.dwMinorVersion
, info
->dwMinorVersion
, condition
);
703 do_next_check
= (ver
.dwMinorVersion
== info
->dwMinorVersion
) &&
704 ((condition
>= VER_EQUAL
) && (condition
<= VER_LESS_EQUAL
));
706 if((dwTypeMask
& VER_SERVICEPACKMAJOR
) && do_next_check
)
708 condition
= version_update_condition(&last_condition
, dwlConditionMask
>> 5*3 & 0x07);
709 status
= version_compare_values(ver
.wServicePackMajor
, info
->wServicePackMajor
, condition
);
710 do_next_check
= (ver
.wServicePackMajor
== info
->wServicePackMajor
) &&
711 ((condition
>= VER_EQUAL
) && (condition
<= VER_LESS_EQUAL
));
713 if((dwTypeMask
& VER_SERVICEPACKMINOR
) && do_next_check
)
715 condition
= version_update_condition(&last_condition
, dwlConditionMask
>> 4*3 & 0x07);
716 status
= version_compare_values(ver
.wServicePackMinor
, info
->wServicePackMinor
, condition
);
719 if (status
!= STATUS_SUCCESS
)
723 return STATUS_SUCCESS
;