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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "wine/port.h"
33 #include "wine/unicode.h"
34 #include "wine/debug.h"
35 #include "ntdll_misc.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(ver
);
41 WIN20
, /* Windows 2.0 */
42 WIN30
, /* Windows 3.0 */
43 WIN31
, /* Windows 3.1 */
44 WIN95
, /* Windows 95 */
45 WIN98
, /* Windows 98 */
46 WINME
, /* Windows Me */
47 NT351
, /* Windows NT 3.51 */
48 NT40
, /* Windows NT 4.0 */
49 NT2K
, /* Windows 2000 */
50 WINXP
, /* Windows XP */
51 WIN2K3
, /* Windows 2003 */
55 /* FIXME: compare values below with original and fix.
56 * An *excellent* win9x version page (ALL versions !)
57 * can be found at members.aol.com/axcel216/ver.htm */
58 static const RTL_OSVERSIONINFOEXW VersionData
[NB_WINDOWS_VERSIONS
] =
60 /* WIN20 FIXME: verify values */
62 sizeof(RTL_OSVERSIONINFOEXW
), 2, 0, 0, VER_PLATFORM_WIN32s
,
63 {'W','i','n','3','2','s',' ','1','.','3',0},
66 /* WIN30 FIXME: verify values */
68 sizeof(RTL_OSVERSIONINFOEXW
), 3, 0, 0, VER_PLATFORM_WIN32s
,
69 {'W','i','n','3','2','s',' ','1','.','3',0},
74 sizeof(RTL_OSVERSIONINFOEXW
), 3, 10, 0, VER_PLATFORM_WIN32s
,
75 {'W','i','n','3','2','s',' ','1','.','3',0},
80 /* Win95: 4, 0, 0x40003B6, ""
81 * Win95sp1: 4, 0, 0x40003B6, " A " (according to doc)
82 * Win95osr2: 4, 0, 0x4000457, " B " (according to doc)
83 * Win95osr2.1: 4, 3, 0x40304BC, " B " (according to doc)
84 * Win95osr2.5: 4, 3, 0x40304BE, " C " (according to doc)
85 * Win95a/b can be discerned via regkey SubVersionNumber
87 * http://support.microsoft.com/support/kb/articles/q158/2/38.asp
89 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
,
104 sizeof(RTL_OSVERSIONINFOEXW
), 4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS
,
110 sizeof(RTL_OSVERSIONINFOEXW
), 3, 51, 0x421, VER_PLATFORM_WIN32_NT
,
111 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
116 sizeof(RTL_OSVERSIONINFOEXW
), 4, 0, 0x565, VER_PLATFORM_WIN32_NT
,
117 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','6','a',0},
118 6, 0, 0, VER_NT_WORKSTATION
, 0
122 sizeof(RTL_OSVERSIONINFOEXW
), 5, 0, 0x893, VER_PLATFORM_WIN32_NT
,
123 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','4',0},
124 4, 0, 0, VER_NT_WORKSTATION
, 30 /* FIXME: Great, a reserved field with a value! */
128 sizeof(RTL_OSVERSIONINFOEXW
), 5, 1, 0xA28, VER_PLATFORM_WIN32_NT
,
129 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
130 2, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_WORKSTATION
, 30 /* FIXME: Great, a reserved field with a value! */
134 sizeof(RTL_OSVERSIONINFOEXW
), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT
,
135 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','1',0},
136 1, 0, VER_SUITE_SINGLEUSERTS
, VER_NT_SERVER
, 0
140 static const char * const WinVersionNames
[NB_WINDOWS_VERSIONS
] =
141 { /* no spaces in here ! */
150 "win2000,win2k,nt2k,nt2000", /* NT2K */
152 "win2003,win2k3" /* WIN2K3 */
156 /* initialized to null so that we crash if we try to retrieve the version too early at startup */
157 static const RTL_OSVERSIONINFOEXW
*current_version
;
160 /**********************************************************************
161 * get_nt_registry_version
163 * Fetch the version information from the NT-style registry keys.
165 static BOOL
get_nt_registry_version( RTL_OSVERSIONINFOEXW
*version
)
167 static const WCHAR version_keyW
[] = {'M','a','c','h','i','n','e','\\',
168 'S','o','f','t','w','a','r','e','\\',
169 'M','i','c','r','o','s','o','f','t','\\',
170 'W','i','n','d','o','w','s',' ','N','T','\\',
171 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
172 static const WCHAR service_pack_keyW
[] = {'M','a','c','h','i','n','e','\\',
173 'S','y','s','t','e','m','\\',
174 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
175 'C','o','n','t','r','o','l','\\',
176 'W','i','n','d','o','w','s',0};
177 static const WCHAR product_keyW
[] = {'M','a','c','h','i','n','e','\\',
178 'S','y','s','t','e','m','\\',
179 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
180 'C','o','n','t','r','o','l','\\',
181 'P','r','o','d','u','c','t','O','p','t','i','o','n','s',0};
182 static const WCHAR CurrentBuildNumberW
[] = {'C','u','r','r','e','n','t','B','u','i','l','d','N','u','m','b','e','r',0};
183 static const WCHAR CSDVersionW
[] = {'C','S','D','V','e','r','s','i','o','n',0};
184 static const WCHAR CurrentVersionW
[] = {'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
185 static const WCHAR ProductTypeW
[] = {'P','r','o','d','u','c','t','T','y','p','e',0};
186 static const WCHAR WinNTW
[] = {'W','i','n','N','T',0};
187 static const WCHAR ServerNTW
[] = {'S','e','r','v','e','r','N','T',0};
188 static const WCHAR LanmanNTW
[] = {'L','a','n','m','a','n','N','T',0};
190 OBJECT_ATTRIBUTES attr
;
191 UNICODE_STRING nameW
, valueW
;
196 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)tmp
;
198 attr
.Length
= sizeof(attr
);
199 attr
.RootDirectory
= 0;
200 attr
.ObjectName
= &nameW
;
202 attr
.SecurityDescriptor
= NULL
;
203 attr
.SecurityQualityOfService
= NULL
;
204 RtlInitUnicodeString( &nameW
, version_keyW
);
206 if (NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
)) return FALSE
;
208 memset( version
, 0, sizeof(*version
) );
210 RtlInitUnicodeString( &valueW
, CurrentVersionW
);
211 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
213 WCHAR
*p
, *str
= (WCHAR
*)info
->Data
;
214 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
215 p
= strchrW( str
, '.' );
219 version
->dwMinorVersion
= atoiW( p
);
221 version
->dwMajorVersion
= atoiW( str
);
224 if (version
->dwMajorVersion
) /* we got the main version, now fetch the other fields */
227 version
->dwPlatformId
= VER_PLATFORM_WIN32_NT
;
229 /* get build number */
231 RtlInitUnicodeString( &valueW
, CurrentBuildNumberW
);
232 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
234 WCHAR
*str
= (WCHAR
*)info
->Data
;
235 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
236 version
->dwBuildNumber
= atoiW( str
);
239 /* get version description */
241 RtlInitUnicodeString( &valueW
, CSDVersionW
);
242 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
244 DWORD len
= min( info
->DataLength
, sizeof(version
->szCSDVersion
) - sizeof(WCHAR
) );
245 memcpy( version
->szCSDVersion
, info
->Data
, len
);
246 version
->szCSDVersion
[len
/ sizeof(WCHAR
)] = 0;
249 /* get service pack version */
251 RtlInitUnicodeString( &nameW
, service_pack_keyW
);
252 if (!NtOpenKey( &hkey2
, KEY_ALL_ACCESS
, &attr
))
254 RtlInitUnicodeString( &valueW
, CSDVersionW
);
255 if (!NtQueryValueKey( hkey2
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
), &count
))
257 if (info
->DataLength
>= sizeof(DWORD
))
259 DWORD dw
= *(DWORD
*)info
->Data
;
260 version
->wServicePackMajor
= LOWORD(dw
) >> 8;
261 version
->wServicePackMinor
= LOWORD(dw
) & 0xff;
267 /* get product type */
269 RtlInitUnicodeString( &nameW
, product_keyW
);
270 if (!NtOpenKey( &hkey2
, KEY_ALL_ACCESS
, &attr
))
272 RtlInitUnicodeString( &valueW
, ProductTypeW
);
273 if (!NtQueryValueKey( hkey2
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
275 WCHAR
*str
= (WCHAR
*)info
->Data
;
276 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
277 if (!strcmpiW( str
, WinNTW
)) version
->wProductType
= VER_NT_WORKSTATION
;
278 else if (!strcmpiW( str
, LanmanNTW
)) version
->wProductType
= VER_NT_DOMAIN_CONTROLLER
;
279 else if (!strcmpiW( str
, ServerNTW
)) version
->wProductType
= VER_NT_SERVER
;
284 /* FIXME: get wSuiteMask */
292 /**********************************************************************
293 * get_win9x_registry_version
295 * Fetch the version information from the Win9x-style registry keys.
297 static BOOL
get_win9x_registry_version( RTL_OSVERSIONINFOEXW
*version
)
299 static const WCHAR version_keyW
[] = {'M','a','c','h','i','n','e','\\',
300 'S','o','f','t','w','a','r','e','\\',
301 'M','i','c','r','o','s','o','f','t','\\',
302 'W','i','n','d','o','w','s','\\',
303 'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
304 static const WCHAR VersionNumberW
[] = {'V','e','r','s','i','o','n','N','u','m','b','e','r',0};
305 static const WCHAR SubVersionNumberW
[] = {'S','u','b','V','e','r','s','i','o','n','N','u','m','b','e','r',0};
307 OBJECT_ATTRIBUTES attr
;
308 UNICODE_STRING nameW
, valueW
;
313 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)tmp
;
315 attr
.Length
= sizeof(attr
);
316 attr
.RootDirectory
= 0;
317 attr
.ObjectName
= &nameW
;
319 attr
.SecurityDescriptor
= NULL
;
320 attr
.SecurityQualityOfService
= NULL
;
321 RtlInitUnicodeString( &nameW
, version_keyW
);
323 if (NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
)) return FALSE
;
325 memset( version
, 0, sizeof(*version
) );
327 RtlInitUnicodeString( &valueW
, VersionNumberW
);
328 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
330 WCHAR
*p
, *str
= (WCHAR
*)info
->Data
;
331 str
[info
->DataLength
/ sizeof(WCHAR
)] = 0;
332 p
= strchrW( str
, '.' );
334 version
->dwMajorVersion
= atoiW( str
);
338 p
= strchrW( str
, '.' );
342 version
->dwBuildNumber
= atoiW( p
);
344 version
->dwMinorVersion
= atoiW( str
);
346 /* build number contains version too on Win9x */
347 version
->dwBuildNumber
|= MAKEWORD( version
->dwMinorVersion
, version
->dwMajorVersion
) << 16;
350 if (version
->dwMajorVersion
) /* we got the main version, now fetch the other fields */
353 version
->dwPlatformId
= VER_PLATFORM_WIN32_WINDOWS
;
355 RtlInitUnicodeString( &valueW
, SubVersionNumberW
);
356 if (!NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
)-1, &count
))
358 DWORD len
= min( info
->DataLength
, sizeof(version
->szCSDVersion
) - sizeof(WCHAR
) );
359 memcpy( version
->szCSDVersion
, info
->Data
, len
);
360 version
->szCSDVersion
[len
/ sizeof(WCHAR
)] = 0;
369 /**********************************************************************
372 * Parse the contents of the Version key.
374 static BOOL
parse_win_version( HANDLE hkey
)
376 static const WCHAR VersionW
[] = {'V','e','r','s','i','o','n',0};
378 UNICODE_STRING valueW
;
379 char tmp
[64], buffer
[50];
380 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)tmp
;
384 RtlInitUnicodeString( &valueW
, VersionW
);
385 if (NtQueryValueKey( hkey
, &valueW
, KeyValuePartialInformation
, tmp
, sizeof(tmp
), &count
))
388 RtlUnicodeToMultiByteN( buffer
, sizeof(buffer
)-1, &len
, (WCHAR
*)info
->Data
, info
->DataLength
);
391 for (i
= 0; i
< NB_WINDOWS_VERSIONS
; i
++)
393 const char *p
, *pCurr
= WinVersionNames
[i
];
394 /* iterate through all winver aliases separated by comma */
396 p
= strchr(pCurr
, ',');
397 len
= p
? p
- pCurr
: strlen(pCurr
);
398 if ( (!strncmp( pCurr
, buffer
, len
)) && (buffer
[len
] == 0) )
400 current_version
= &VersionData
[i
];
401 TRACE( "got win version %s\n", WinVersionNames
[i
] );
408 MESSAGE("Invalid Windows version value '%s' specified in config file.\n", buffer
);
409 MESSAGE("Valid versions are:" );
410 for (i
= 0; i
< NB_WINDOWS_VERSIONS
; i
++)
412 /* only list the first, "official" alias in case of aliases */
413 const char *pCurr
= WinVersionNames
[i
];
414 const char *p
= strchr(pCurr
, ',');
415 len
= (p
) ? p
- pCurr
: strlen(pCurr
);
417 MESSAGE(" '%.*s'%c", (int)len
, pCurr
, (i
== NB_WINDOWS_VERSIONS
- 1) ? '\n' : ',' );
423 /**********************************************************************
426 void version_init( const WCHAR
*appname
)
428 static const WCHAR configW
[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e',0};
429 static const WCHAR appdefaultsW
[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0};
431 OBJECT_ATTRIBUTES attr
;
432 UNICODE_STRING nameW
;
433 HANDLE root
, hkey
, config_key
;
434 BOOL got_win_ver
= FALSE
;
436 current_version
= &VersionData
[NT2K
]; /* default if nothing else is specified */
438 RtlOpenCurrentUser( KEY_ALL_ACCESS
, &root
);
439 attr
.Length
= sizeof(attr
);
440 attr
.RootDirectory
= root
;
441 attr
.ObjectName
= &nameW
;
443 attr
.SecurityDescriptor
= NULL
;
444 attr
.SecurityQualityOfService
= NULL
;
445 RtlInitUnicodeString( &nameW
, configW
);
447 /* @@ Wine registry key: HKCU\Software\Wine */
448 if (NtOpenKey( &config_key
, KEY_ALL_ACCESS
, &attr
)) config_key
= 0;
450 if (!config_key
) goto done
;
452 /* open AppDefaults\\appname key */
453 if (appname
&& *appname
)
456 WCHAR appversion
[MAX_PATH
+20];
458 if ((p
= strrchrW( appname
, '/' ))) appname
= p
+ 1;
459 if ((p
= strrchrW( appname
, '\\' ))) appname
= p
+ 1;
461 strcpyW( appversion
, appdefaultsW
);
462 strcatW( appversion
, appname
);
463 RtlInitUnicodeString( &nameW
, appversion
);
464 attr
.RootDirectory
= config_key
;
466 /* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe */
467 if (!NtOpenKey( &hkey
, KEY_ALL_ACCESS
, &attr
))
469 TRACE( "getting version from %s\n", debugstr_w(appversion
) );
470 got_win_ver
= parse_win_version( hkey
);
477 TRACE( "getting default version\n" );
478 got_win_ver
= parse_win_version( config_key
);
480 NtClose( config_key
);
485 static RTL_OSVERSIONINFOEXW registry_version
;
487 TRACE( "getting registry version\n" );
488 if (get_nt_registry_version( ®istry_version
) ||
489 get_win9x_registry_version( ®istry_version
))
490 current_version
= ®istry_version
;
494 NtCurrentTeb()->Peb
->OSMajorVersion
= current_version
->dwMajorVersion
;
495 NtCurrentTeb()->Peb
->OSMinorVersion
= current_version
->dwMinorVersion
;
496 NtCurrentTeb()->Peb
->OSBuildNumber
= current_version
->dwBuildNumber
;
497 NtCurrentTeb()->Peb
->OSPlatformId
= current_version
->dwPlatformId
;
499 TRACE( "got %ld.%ld plaform %ld build %lx name %s service pack %d.%d product %d\n",
500 current_version
->dwMajorVersion
, current_version
->dwMinorVersion
,
501 current_version
->dwPlatformId
, current_version
->dwBuildNumber
,
502 debugstr_w(current_version
->szCSDVersion
),
503 current_version
->wServicePackMajor
, current_version
->wServicePackMinor
,
504 current_version
->wProductType
);
508 /***********************************************************************
509 * RtlGetVersion (NTDLL.@)
511 NTSTATUS WINAPI
RtlGetVersion( RTL_OSVERSIONINFOEXW
*info
)
513 info
->dwMajorVersion
= current_version
->dwMajorVersion
;
514 info
->dwMinorVersion
= current_version
->dwMinorVersion
;
515 info
->dwBuildNumber
= current_version
->dwBuildNumber
;
516 info
->dwPlatformId
= current_version
->dwPlatformId
;
517 strcpyW( info
->szCSDVersion
, current_version
->szCSDVersion
);
518 if(info
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
))
520 info
->wServicePackMajor
= current_version
->wServicePackMajor
;
521 info
->wServicePackMinor
= current_version
->wServicePackMinor
;
522 info
->wSuiteMask
= current_version
->wSuiteMask
;
523 info
->wProductType
= current_version
->wProductType
;
525 return STATUS_SUCCESS
;
529 /******************************************************************************
530 * RtlGetNtVersionNumbers (NTDLL.@)
532 * Get the version numbers of the run time library.
535 * major [O] Destination for the Major version
536 * minor [O] Destination for the Minor version
537 * build [O] Destination for the Build version
543 * Introduced in Windows XP (NT5.1)
545 void WINAPI
RtlGetNtVersionNumbers( LPDWORD major
, LPDWORD minor
, LPDWORD build
)
547 if (major
) *major
= current_version
->dwMajorVersion
;
548 if (minor
) *minor
= current_version
->dwMinorVersion
;
549 /* FIXME: Does anybody know the real formula? */
550 if (build
) *build
= (0xF0000000 | current_version
->dwBuildNumber
);
554 /******************************************************************************
555 * RtlGetNtProductType (NTDLL.@)
557 BOOLEAN WINAPI
RtlGetNtProductType( LPDWORD type
)
559 if (type
) *type
= current_version
->wProductType
;
564 /******************************************************************************
565 * RtlVerifyVersionInfo (NTDLL.@)
567 NTSTATUS WINAPI
RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW
*info
,
568 DWORD dwTypeMask
, DWORDLONG dwlConditionMask
)
570 RTL_OSVERSIONINFOEXW ver
;
573 FIXME("(%p,%lu,%llx): Not all cases correctly implemented yet\n",
574 info
, dwTypeMask
, dwlConditionMask
);
577 - Check the following special case on Windows (various versions):
578 o lp->wSuiteMask == 0 and ver.wSuiteMask != 0 and VER_AND/VER_OR
579 o lp->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW)
580 - MSDN talks about some tests being impossible. Check what really happens.
583 ver
.dwOSVersionInfoSize
= sizeof(ver
);
584 if ((status
= RtlGetVersion( &ver
)) != STATUS_SUCCESS
) return status
;
586 if(!(dwTypeMask
&& dwlConditionMask
)) return STATUS_INVALID_PARAMETER
;
588 if(dwTypeMask
& VER_PRODUCT_TYPE
)
589 switch(dwlConditionMask
>> 7*3 & 0x07) {
591 if(ver
.wProductType
!= info
->wProductType
) return STATUS_REVISION_MISMATCH
;
594 if(ver
.wProductType
<= info
->wProductType
) return STATUS_REVISION_MISMATCH
;
596 case VER_GREATER_EQUAL
:
597 if(ver
.wProductType
< info
->wProductType
) return STATUS_REVISION_MISMATCH
;
600 if(ver
.wProductType
>= info
->wProductType
) return STATUS_REVISION_MISMATCH
;
603 if(ver
.wProductType
> info
->wProductType
) return STATUS_REVISION_MISMATCH
;
606 return STATUS_INVALID_PARAMETER
;
608 if(dwTypeMask
& VER_SUITENAME
)
609 switch(dwlConditionMask
>> 6*3 & 0x07)
612 if((info
->wSuiteMask
& ver
.wSuiteMask
) != info
->wSuiteMask
)
613 return STATUS_REVISION_MISMATCH
;
616 if(!(info
->wSuiteMask
& ver
.wSuiteMask
) && info
->wSuiteMask
)
617 return STATUS_REVISION_MISMATCH
;
620 return STATUS_INVALID_PARAMETER
;
622 if(dwTypeMask
& VER_PLATFORMID
)
623 switch(dwlConditionMask
>> 3*3 & 0x07)
626 if(ver
.dwPlatformId
!= info
->dwPlatformId
) return STATUS_REVISION_MISMATCH
;
629 if(ver
.dwPlatformId
<= info
->dwPlatformId
) return STATUS_REVISION_MISMATCH
;
631 case VER_GREATER_EQUAL
:
632 if(ver
.dwPlatformId
< info
->dwPlatformId
) return STATUS_REVISION_MISMATCH
;
635 if(ver
.dwPlatformId
>= info
->dwPlatformId
) return STATUS_REVISION_MISMATCH
;
638 if(ver
.dwPlatformId
> info
->dwPlatformId
) return STATUS_REVISION_MISMATCH
;
641 return STATUS_INVALID_PARAMETER
;
643 if(dwTypeMask
& VER_BUILDNUMBER
)
644 switch(dwlConditionMask
>> 2*3 & 0x07)
647 if(ver
.dwBuildNumber
!= info
->dwBuildNumber
) return STATUS_REVISION_MISMATCH
;
650 if(ver
.dwBuildNumber
<= info
->dwBuildNumber
) return STATUS_REVISION_MISMATCH
;
652 case VER_GREATER_EQUAL
:
653 if(ver
.dwBuildNumber
< info
->dwBuildNumber
) return STATUS_REVISION_MISMATCH
;
656 if(ver
.dwBuildNumber
>= info
->dwBuildNumber
) return STATUS_REVISION_MISMATCH
;
659 if(ver
.dwBuildNumber
> info
->dwBuildNumber
) return STATUS_REVISION_MISMATCH
;
662 return STATUS_INVALID_PARAMETER
;
664 if(dwTypeMask
& VER_MAJORVERSION
)
665 switch(dwlConditionMask
>> 1*3 & 0x07)
668 if(ver
.dwMajorVersion
!= info
->dwMajorVersion
) return STATUS_REVISION_MISMATCH
;
671 if(ver
.dwMajorVersion
<= info
->dwMajorVersion
) return STATUS_REVISION_MISMATCH
;
673 case VER_GREATER_EQUAL
:
674 if(ver
.dwMajorVersion
< info
->dwMajorVersion
) return STATUS_REVISION_MISMATCH
;
677 if(ver
.dwMajorVersion
>= info
->dwMajorVersion
) return STATUS_REVISION_MISMATCH
;
680 if(ver
.dwMajorVersion
> info
->dwMajorVersion
) return STATUS_REVISION_MISMATCH
;
683 return STATUS_INVALID_PARAMETER
;
685 if(dwTypeMask
& VER_MINORVERSION
)
686 switch(dwlConditionMask
>> 0*3 & 0x07)
689 if(ver
.dwMinorVersion
!= info
->dwMinorVersion
) return STATUS_REVISION_MISMATCH
;
692 if(ver
.dwMinorVersion
<= info
->dwMinorVersion
) return STATUS_REVISION_MISMATCH
;
694 case VER_GREATER_EQUAL
:
695 if(ver
.dwMinorVersion
< info
->dwMinorVersion
) return STATUS_REVISION_MISMATCH
;
698 if(ver
.dwMinorVersion
>= info
->dwMinorVersion
) return STATUS_REVISION_MISMATCH
;
701 if(ver
.dwMinorVersion
> info
->dwMinorVersion
) return STATUS_REVISION_MISMATCH
;
704 return STATUS_INVALID_PARAMETER
;
706 if(dwTypeMask
& VER_SERVICEPACKMAJOR
)
707 switch(dwlConditionMask
>> 5*3 & 0x07)
710 if(ver
.wServicePackMajor
!= info
->wServicePackMajor
) return STATUS_REVISION_MISMATCH
;
713 if(ver
.wServicePackMajor
<= info
->wServicePackMajor
) return STATUS_REVISION_MISMATCH
;
715 case VER_GREATER_EQUAL
:
716 if(ver
.wServicePackMajor
< info
->wServicePackMajor
) return STATUS_REVISION_MISMATCH
;
719 if(ver
.wServicePackMajor
>= info
->wServicePackMajor
) return STATUS_REVISION_MISMATCH
;
722 if(ver
.wServicePackMajor
> info
->wServicePackMajor
) return STATUS_REVISION_MISMATCH
;
725 return STATUS_INVALID_PARAMETER
;
727 if(dwTypeMask
& VER_SERVICEPACKMINOR
)
728 switch(dwlConditionMask
>> 4*3 & 0x07)
731 if(ver
.wServicePackMinor
!= info
->wServicePackMinor
) return STATUS_REVISION_MISMATCH
;
734 if(ver
.wServicePackMinor
<= info
->wServicePackMinor
) return STATUS_REVISION_MISMATCH
;
736 case VER_GREATER_EQUAL
:
737 if(ver
.wServicePackMinor
< info
->wServicePackMinor
) return STATUS_REVISION_MISMATCH
;
740 if(ver
.wServicePackMinor
>= info
->wServicePackMinor
) return STATUS_REVISION_MISMATCH
;
743 if(ver
.wServicePackMinor
> info
->wServicePackMinor
) return STATUS_REVISION_MISMATCH
;
746 return STATUS_INVALID_PARAMETER
;
749 return STATUS_SUCCESS
;