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
25 #include "wine/port.h"
32 #define WIN32_NO_STATUS
34 #include "wine/unicode.h"
35 #include "wine/debug.h"
36 #include "ntdll_misc.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(ver
);
44 WIN20
, /* Windows 2.0 */
45 WIN30
, /* Windows 3.0 */
46 WIN31
, /* Windows 3.1 */
47 WIN95
, /* Windows 95 */
48 WIN98
, /* Windows 98 */
49 WINME
, /* Windows Me */
50 NT351
, /* Windows NT 3.51 */
51 NT40
, /* Windows NT 4.0 */
52 NT2K
, /* Windows 2000 */
54 WINXP
, /* Windows XP */
55 WIN2K3
, /* Windows 2003 */
56 WINVISTA
,/* Windows Vista */
57 WIN2K8
, /* Windows 2008 */
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
] =
67 /* WIN20 FIXME: verify values */
69 sizeof(RTL_OSVERSIONINFOEXW
), 2, 0, 0, VER_PLATFORM_WIN32s
,
70 {'W','i','n','3','2','s',' ','1','.','3',0},
73 /* WIN30 FIXME: verify values */
75 sizeof(RTL_OSVERSIONINFOEXW
), 3, 0, 0, VER_PLATFORM_WIN32s
,
76 {'W','i','n','3','2','s',' ','1','.','3',0},
81 sizeof(RTL_OSVERSIONINFOEXW
), 3, 10, 0, VER_PLATFORM_WIN32s
,
82 {'W','i','n','3','2','s',' ','1','.','3',0},
87 /* Win95: 4, 0, 0x40003B6, ""
88 * Win95sp1: 4, 0, 0x40003B6, " A " (according to doc)
89 * Win95osr2: 4, 0, 0x4000457, " B " (according to doc)
90 * Win95osr2.1: 4, 3, 0x40304BC, " B " (according to doc)
91 * Win95osr2.5: 4, 3, 0x40304BE, " C " (according to doc)
92 * Win95a/b can be discerned via regkey SubVersionNumber
94 sizeof(RTL_OSVERSIONINFOEXW
), 4, 0, 0x40003B6, VER_PLATFORM_WIN32_WINDOWS
,
98 /* WIN98 (second edition) */
100 /* Win98: 4, 10, 0x40A07CE, " " 4.10.1998
101 * Win98SE: 4, 10, 0x40A08AE, " A " 4.10.2222
103 sizeof(RTL_OSVERSIONINFOEXW
), 4, 10, 0x40A08AE, VER_PLATFORM_WIN32_WINDOWS
,
109 sizeof(RTL_OSVERSIONINFOEXW
), 4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS
,
115 sizeof(RTL_OSVERSIONINFOEXW
), 3, 51, 0x421, VER_PLATFORM_WIN32_NT
,
116 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
121 sizeof(RTL_OSVERSIONINFOEXW
), 4, 0, 0x565, VER_PLATFORM_WIN32_NT
,
122 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','6','a',0},
123 6, 0, 0, VER_NT_WORKSTATION
, 0
127 sizeof(RTL_OSVERSIONINFOEXW
), 5, 0, 0x893, VER_PLATFORM_WIN32_NT
,
128 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','4',0},
129 4, 0, 0, VER_NT_WORKSTATION
, 30 /* FIXME: Great, a reserved field with a value! */
134 sizeof(RTL_OSVERSIONINFOEXW
), 5, 1, 0xA28, VER_PLATFORM_WIN32_NT
,
135 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
136 2, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
, 30 /* FIXME: Great, a reserved field with a value! */
140 sizeof(RTL_OSVERSIONINFOEXW
), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT
,
141 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','1',0},
142 1, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_SERVER
, 0
146 sizeof(RTL_OSVERSIONINFOEXW
), 6, 0, 0x1770, VER_PLATFORM_WIN32_NT
,
148 0, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
, 0
152 sizeof(RTL_OSVERSIONINFOEXW
), 6, 0, 0x1771, VER_PLATFORM_WIN32_NT
,
153 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','1',0},
154 0, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_SERVER
, 0
158 static const char * const WinVersionNames
[NB_WINDOWS_VERSIONS
] =
159 { /* no spaces in here ! */
169 "win2000,win2k,nt2k,nt2000", /* NT2K */
172 "win2003,win2k3", /* WIN2K3 */
173 "vista,winvista", /* WINVISTA*/
174 "win2008,win2k8", /* WIN2K8 */
178 /* initialized to null so that we crash if we try to retrieve the version too early at startup */
179 static const RTL_OSVERSIONINFOEXW
*current_version
;
182 /**********************************************************************
183 * get_nt_registry_version
185 * Fetch the version information from the NT-style registry keys.
187 static BOOL
get_nt_registry_version( RTL_OSVERSIONINFOEXW
*version
)
189 static const WCHAR version_keyW
[] = {'M','a','c','h','i','n','e','\\',
190 'S','o','f','t','w','a','r','e','\\',
191 'M','i','c','r','o','s','o','f','t','\\',
192 'W','i','n','d','o','w','s',' ','N','T','\\',
193 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
194 static const WCHAR service_pack_keyW
[] = {'M','a','c','h','i','n','e','\\',
195 'S','y','s','t','e','m','\\',
196 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
197 'C','o','n','t','r','o','l','\\',
198 'W','i','n','d','o','w','s',0};
199 static const WCHAR product_keyW
[] = {'M','a','c','h','i','n','e','\\',
200 'S','y','s','t','e','m','\\',
201 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
202 'C','o','n','t','r','o','l','\\',
203 'P','r','o','d','u','c','t','O','p','t','i','o','n','s',0};
204 static const WCHAR CurrentBuildNumberW
[] = {'C','u','r','r','e','n','t','B','u','i','l','d','N','u','m','b','e','r',0};
205 static const WCHAR CSDVersionW
[] = {'C','S','D','V','e','r','s','i','o','n',0};
206 static const WCHAR CurrentVersionW
[] = {'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
207 static const WCHAR ProductTypeW
[] = {'P','r','o','d','u','c','t','T','y','p','e',0};
208 static const WCHAR WinNTW
[] = {'W','i','n','N','T',0};
209 static const WCHAR ServerNTW
[] = {'S','e','r','v','e','r','N','T',0};
210 static const WCHAR LanmanNTW
[] = {'L','a','n','m','a','n','N','T',0};
212 OBJECT_ATTRIBUTES attr
;
213 UNICODE_STRING nameW
, valueW
;
218 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)tmp
;
220 attr
.Length
= sizeof(attr
);
221 attr
.RootDirectory
= 0;
222 attr
.ObjectName
= &nameW
;
224 attr
.SecurityDescriptor
= NULL
;
225 attr
.SecurityQualityOfService
= NULL
;
226 RtlInitUnicodeString( &nameW
, version_keyW
);
228 if (NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
)) return FALSE
;
230 memset( version
, 0, sizeof(*version
) );
232 RtlInitUnicodeString( &valueW
, CurrentVersionW
);
233 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
235 WCHAR
*p
, *str
= (WCHAR
*)info
->Data
;
236 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
237 p
= strchrW( str
, '.' );
241 version
->dwMinorVersion
= atoiW( p
);
243 version
->dwMajorVersion
= atoiW( str
);
246 if (version
->dwMajorVersion
) /* we got the main version, now fetch the other fields */
249 version
->dwPlatformId
= VER_PLATFORM_WIN32_NT
;
251 /* get build number */
253 RtlInitUnicodeString( &valueW
, CurrentBuildNumberW
);
254 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
256 WCHAR
*str
= (WCHAR
*)info
->Data
;
257 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
258 version
->dwBuildNumber
= atoiW( str
);
261 /* get version description */
263 RtlInitUnicodeString( &valueW
, CSDVersionW
);
264 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
266 DWORD len
= min( info
->DataLength
, sizeof(version
->szCSDVersion
) - sizeof(WCHAR
) );
267 memcpy( version
->szCSDVersion
, info
->Data
, len
);
268 version
->szCSDVersion
[len
/ sizeof(WCHAR
)] = 0;
271 /* get service pack version */
273 RtlInitUnicodeString( &nameW
, service_pack_keyW
);
274 if (!NtOpenKey( &hkey2
, KEY_ALL_ACCESS
, &attr
))
276 RtlInitUnicodeString( &valueW
, CSDVersionW
);
277 if (!NtQueryValueKey( hkey2
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
), &count
))
279 if (info
->DataLength
>= sizeof(DWORD
))
281 DWORD dw
= *(DWORD
*)info
->Data
;
282 version
->wServicePackMajor
= LOWORD(dw
) >> 8;
283 version
->wServicePackMinor
= LOWORD(dw
) & 0xff;
289 /* get product type */
291 RtlInitUnicodeString( &nameW
, product_keyW
);
292 if (!NtOpenKey( &hkey2
, KEY_ALL_ACCESS
, &attr
))
294 RtlInitUnicodeString( &valueW
, ProductTypeW
);
295 if (!NtQueryValueKey( hkey2
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
297 WCHAR
*str
= (WCHAR
*)info
->Data
;
298 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
299 if (!strcmpiW( str
, WinNTW
)) version
->wProductType
= VER_NT_WORKSTATION
;
300 else if (!strcmpiW( str
, LanmanNTW
)) version
->wProductType
= VER_NT_DOMAIN_CONTROLLER
;
301 else if (!strcmpiW( str
, ServerNTW
)) version
->wProductType
= VER_NT_SERVER
;
306 /* FIXME: get wSuiteMask */
314 /**********************************************************************
315 * get_win9x_registry_version
317 * Fetch the version information from the Win9x-style registry keys.
319 static BOOL
get_win9x_registry_version( RTL_OSVERSIONINFOEXW
*version
)
321 static const WCHAR version_keyW
[] = {'M','a','c','h','i','n','e','\\',
322 'S','o','f','t','w','a','r','e','\\',
323 'M','i','c','r','o','s','o','f','t','\\',
324 'W','i','n','d','o','w','s','\\',
325 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
326 static const WCHAR VersionNumberW
[] = {'V','e','r','s','i','o','n','N','u','m','b','e','r',0};
327 static const WCHAR SubVersionNumberW
[] = {'S','u','b','V','e','r','s','i','o','n','N','u','m','b','e','r',0};
329 OBJECT_ATTRIBUTES attr
;
330 UNICODE_STRING nameW
, valueW
;
335 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)tmp
;
337 attr
.Length
= sizeof(attr
);
338 attr
.RootDirectory
= 0;
339 attr
.ObjectName
= &nameW
;
341 attr
.SecurityDescriptor
= NULL
;
342 attr
.SecurityQualityOfService
= NULL
;
343 RtlInitUnicodeString( &nameW
, version_keyW
);
345 if (NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
)) return FALSE
;
347 memset( version
, 0, sizeof(*version
) );
349 RtlInitUnicodeString( &valueW
, VersionNumberW
);
350 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
352 WCHAR
*p
, *str
= (WCHAR
*)info
->Data
;
353 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
354 p
= strchrW( str
, '.' );
356 version
->dwMajorVersion
= atoiW( str
);
360 p
= strchrW( str
, '.' );
364 version
->dwBuildNumber
= atoiW( p
);
366 version
->dwMinorVersion
= atoiW( str
);
368 /* build number contains version too on Win9x */
369 version
->dwBuildNumber
|= MAKEWORD( version
->dwMinorVersion
, version
->dwMajorVersion
) << 16;
372 if (version
->dwMajorVersion
) /* we got the main version, now fetch the other fields */
375 version
->dwPlatformId
= VER_PLATFORM_WIN32_WINDOWS
;
377 RtlInitUnicodeString( &valueW
, SubVersionNumberW
);
378 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
380 DWORD len
= min( info
->DataLength
, sizeof(version
->szCSDVersion
) - sizeof(WCHAR
) );
381 memcpy( version
->szCSDVersion
, info
->Data
, len
);
382 version
->szCSDVersion
[len
/ sizeof(WCHAR
)] = 0;
391 /**********************************************************************
394 * Parse the contents of the Version key.
396 static BOOL
parse_win_version( HANDLE hkey
)
398 static const WCHAR VersionW
[] = {'V','e','r','s','i','o','n',0};
400 UNICODE_STRING valueW
;
401 char tmp
[64], buffer
[50];
402 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)tmp
;
406 RtlInitUnicodeString( &valueW
, VersionW
);
407 if (NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
), &count
))
410 RtlUnicodeToMultiByteN( buffer
, sizeof(buffer
)-1, &len
, (WCHAR
*)info
->Data
, info
->DataLength
);
413 for (i
= 0; i
< NB_WINDOWS_VERSIONS
; i
++)
415 const char *p
, *pCurr
= WinVersionNames
[i
];
416 /* iterate through all winver aliases separated by comma */
418 p
= strchr(pCurr
, ',');
419 len
= p
? p
- pCurr
: strlen(pCurr
);
420 if ( (!strncmp( pCurr
, buffer
, len
)) && (buffer
[len
] == 0) )
422 current_version
= &VersionData
[i
];
423 TRACE( "got win version %s\n", WinVersionNames
[i
] );
430 MESSAGE("Invalid Windows version value '%s' specified in config file.\n", buffer
);
431 MESSAGE("Valid versions are:" );
432 for (i
= 0; i
< NB_WINDOWS_VERSIONS
; i
++)
434 /* only list the first, "official" alias in case of aliases */
435 const char *pCurr
= WinVersionNames
[i
];
436 const char *p
= strchr(pCurr
, ',');
437 len
= (p
) ? p
- pCurr
: strlen(pCurr
);
439 MESSAGE(" '%.*s'%c", (int)len
, pCurr
, (i
== NB_WINDOWS_VERSIONS
- 1) ? '\n' : ',' );
445 /**********************************************************************
448 void version_init( const WCHAR
*appname
)
450 static const WCHAR configW
[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
451 static const WCHAR appdefaultsW
[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0};
453 OBJECT_ATTRIBUTES attr
;
454 UNICODE_STRING nameW
;
455 HANDLE root
, hkey
, config_key
;
456 BOOL got_win_ver
= FALSE
;
458 current_version
= &VersionData
[WINXP
]; /* default if nothing else is specified */
460 RtlOpenCurrentUser( KEY_ALL_ACCESS
, &root
);
461 attr
.Length
= sizeof(attr
);
462 attr
.RootDirectory
= root
;
463 attr
.ObjectName
= &nameW
;
465 attr
.SecurityDescriptor
= NULL
;
466 attr
.SecurityQualityOfService
= NULL
;
467 RtlInitUnicodeString( &nameW
, configW
);
469 /* @@ Wine registry key: HKCU\Software\Wine */
470 if (NtOpenKey( &config_key
, KEY_ALL_ACCESS
, &attr
)) config_key
= 0;
472 if (!config_key
) goto done
;
474 /* open AppDefaults\\appname key */
475 if (appname
&& *appname
)
478 WCHAR appversion
[MAX_PATH
+20];
480 if ((p
= strrchrW( appname
, '/' ))) appname
= p
+ 1;
481 if ((p
= strrchrW( appname
, '\\' ))) appname
= p
+ 1;
483 strcpyW( appversion
, appdefaultsW
);
484 strcatW( appversion
, appname
);
485 RtlInitUnicodeString( &nameW
, appversion
);
486 attr
.RootDirectory
= config_key
;
488 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe */
489 if (!NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
))
491 TRACE( "getting version from %s\n", debugstr_w(appversion
) );
492 got_win_ver
= parse_win_version( hkey
);
499 TRACE( "getting default version\n" );
500 got_win_ver
= parse_win_version( config_key
);
502 NtClose( config_key
);
507 static RTL_OSVERSIONINFOEXW registry_version
;
509 TRACE( "getting registry version\n" );
510 if (get_nt_registry_version( ®istry_version
) ||
511 get_win9x_registry_version( ®istry_version
))
512 current_version
= ®istry_version
;
516 NtCurrentTeb()->Peb
->OSMajorVersion
= current_version
->dwMajorVersion
;
517 NtCurrentTeb()->Peb
->OSMinorVersion
= current_version
->dwMinorVersion
;
518 NtCurrentTeb()->Peb
->OSBuildNumber
= current_version
->dwBuildNumber
;
519 NtCurrentTeb()->Peb
->OSPlatformId
= current_version
->dwPlatformId
;
521 user_shared_data
->NtProductType
= current_version
->wProductType
;
522 user_shared_data
->ProductTypeIsValid
= TRUE
;
523 user_shared_data
->MajorNtVersion
= current_version
->dwMajorVersion
;
524 user_shared_data
->MinorNtVersion
= current_version
->dwMinorVersion
;
525 user_shared_data
->MinorNtVersion
= current_version
->dwMinorVersion
;
526 user_shared_data
->SuiteMask
= current_version
->wSuiteMask
;
528 TRACE( "got %d.%d plaform %d build %x name %s service pack %d.%d product %d\n",
529 current_version
->dwMajorVersion
, current_version
->dwMinorVersion
,
530 current_version
->dwPlatformId
, current_version
->dwBuildNumber
,
531 debugstr_w(current_version
->szCSDVersion
),
532 current_version
->wServicePackMajor
, current_version
->wServicePackMinor
,
533 current_version
->wProductType
);
537 /***********************************************************************
538 * RtlGetVersion (NTDLL.@)
540 NTSTATUS WINAPI
RtlGetVersion( RTL_OSVERSIONINFOEXW
*info
)
542 info
->dwMajorVersion
= current_version
->dwMajorVersion
;
543 info
->dwMinorVersion
= current_version
->dwMinorVersion
;
544 info
->dwBuildNumber
= current_version
->dwBuildNumber
;
545 info
->dwPlatformId
= current_version
->dwPlatformId
;
546 strcpyW( info
->szCSDVersion
, current_version
->szCSDVersion
);
547 if(info
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
))
549 info
->wServicePackMajor
= current_version
->wServicePackMajor
;
550 info
->wServicePackMinor
= current_version
->wServicePackMinor
;
551 info
->wSuiteMask
= current_version
->wSuiteMask
;
552 info
->wProductType
= current_version
->wProductType
;
554 return STATUS_SUCCESS
;
558 /******************************************************************************
559 * RtlGetNtVersionNumbers (NTDLL.@)
561 * Get the version numbers of the run time library.
564 * major [O] Destination for the Major version
565 * minor [O] Destination for the Minor version
566 * build [O] Destination for the Build version
572 * Introduced in Windows XP (NT5.1)
574 void WINAPI
RtlGetNtVersionNumbers( LPDWORD major
, LPDWORD minor
, LPDWORD build
)
576 if (major
) *major
= current_version
->dwMajorVersion
;
577 if (minor
) *minor
= current_version
->dwMinorVersion
;
578 /* FIXME: Does anybody know the real formula? */
579 if (build
) *build
= (0xF0000000 | current_version
->dwBuildNumber
);
583 /******************************************************************************
584 * RtlGetNtProductType (NTDLL.@)
586 BOOLEAN WINAPI
RtlGetNtProductType( LPDWORD type
)
588 if (type
) *type
= current_version
->wProductType
;
593 static inline NTSTATUS
version_compare_values(ULONG left
, ULONG right
, UCHAR condition
)
597 if (left
!= right
) return STATUS_REVISION_MISMATCH
;
600 if (left
<= right
) return STATUS_REVISION_MISMATCH
;
602 case VER_GREATER_EQUAL
:
603 if (left
< right
) return STATUS_REVISION_MISMATCH
;
606 if (left
>= right
) return STATUS_REVISION_MISMATCH
;
609 if (left
> right
) return STATUS_REVISION_MISMATCH
;
612 return STATUS_REVISION_MISMATCH
;
614 return STATUS_SUCCESS
;
617 /******************************************************************************
618 * RtlVerifyVersionInfo (NTDLL.@)
620 NTSTATUS WINAPI
RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW
*info
,
621 DWORD dwTypeMask
, DWORDLONG dwlConditionMask
)
623 RTL_OSVERSIONINFOEXW ver
;
626 TRACE("(%p,0x%x,0x%s)\n", info
, dwTypeMask
, wine_dbgstr_longlong(dwlConditionMask
));
628 ver
.dwOSVersionInfoSize
= sizeof(ver
);
629 if ((status
= RtlGetVersion( &ver
)) != STATUS_SUCCESS
) return status
;
631 if(!(dwTypeMask
&& dwlConditionMask
)) return STATUS_INVALID_PARAMETER
;
633 if(dwTypeMask
& VER_PRODUCT_TYPE
)
635 status
= version_compare_values(ver
.wProductType
, info
->wProductType
, dwlConditionMask
>> 7*3 & 0x07);
636 if (status
!= STATUS_SUCCESS
)
639 if(dwTypeMask
& VER_SUITENAME
)
640 switch(dwlConditionMask
>> 6*3 & 0x07)
643 if((info
->wSuiteMask
& ver
.wSuiteMask
) != info
->wSuiteMask
)
644 return STATUS_REVISION_MISMATCH
;
647 if(!(info
->wSuiteMask
& ver
.wSuiteMask
) && info
->wSuiteMask
)
648 return STATUS_REVISION_MISMATCH
;
651 return STATUS_INVALID_PARAMETER
;
653 if(dwTypeMask
& VER_PLATFORMID
)
655 status
= version_compare_values(ver
.dwPlatformId
, info
->dwPlatformId
, dwlConditionMask
>> 3*3 & 0x07);
656 if (status
!= STATUS_SUCCESS
)
659 if(dwTypeMask
& VER_BUILDNUMBER
)
661 status
= version_compare_values(ver
.dwBuildNumber
, info
->dwBuildNumber
, dwlConditionMask
>> 2*3 & 0x07);
662 if (status
!= STATUS_SUCCESS
)
666 if(dwTypeMask
& (VER_MAJORVERSION
|VER_MINORVERSION
|VER_SERVICEPACKMAJOR
|VER_SERVICEPACKMINOR
))
668 unsigned char condition
= 0;
669 BOOLEAN do_next_check
= TRUE
;
671 if(dwTypeMask
& VER_MAJORVERSION
)
672 condition
= dwlConditionMask
>> 1*3 & 0x07;
673 else if(dwTypeMask
& VER_MINORVERSION
)
674 condition
= dwlConditionMask
>> 0*3 & 0x07;
675 else if(dwTypeMask
& VER_SERVICEPACKMAJOR
)
676 condition
= dwlConditionMask
>> 5*3 & 0x07;
677 else if(dwTypeMask
& VER_SERVICEPACKMINOR
)
678 condition
= dwlConditionMask
>> 4*3 & 0x07;
680 if(dwTypeMask
& VER_MAJORVERSION
)
682 status
= version_compare_values(ver
.dwMajorVersion
, info
->dwMajorVersion
, condition
);
683 do_next_check
= (ver
.dwMajorVersion
== info
->dwMajorVersion
) &&
684 ((condition
!= VER_EQUAL
) || (status
== STATUS_SUCCESS
));
686 if((dwTypeMask
& VER_MINORVERSION
) && do_next_check
)
688 status
= version_compare_values(ver
.dwMinorVersion
, info
->dwMinorVersion
, condition
);
689 do_next_check
= (ver
.dwMinorVersion
== info
->dwMinorVersion
) &&
690 ((condition
!= VER_EQUAL
) || (status
== STATUS_SUCCESS
));
692 if((dwTypeMask
& VER_SERVICEPACKMAJOR
) && do_next_check
)
694 status
= version_compare_values(ver
.wServicePackMajor
, info
->wServicePackMajor
, condition
);
695 do_next_check
= (ver
.wServicePackMajor
== info
->wServicePackMajor
) &&
696 ((condition
!= VER_EQUAL
) || (status
== STATUS_SUCCESS
));
698 if((dwTypeMask
& VER_SERVICEPACKMINOR
) && do_next_check
)
700 status
= version_compare_values(ver
.wServicePackMinor
, info
->wServicePackMinor
, condition
);
703 if (status
!= STATUS_SUCCESS
)
707 return STATUS_SUCCESS
;