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"
35 #include "wine/unicode.h"
36 #include "wine/debug.h"
37 #include "ntdll_misc.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(ver);
43 WIN20, /* Windows 2.0 */
44 WIN30, /* Windows 3.0 */
45 WIN31, /* Windows 3.1 */
46 WIN95, /* Windows 95 */
47 WIN98, /* Windows 98 */
48 WINME, /* Windows Me */
49 NT351, /* Windows NT 3.51 */
50 NT40, /* Windows NT 4.0 */
51 NT2K, /* Windows 2000 */
52 WINXP, /* Windows XP */
53 WIN2K3, /* Windows 2003 */
57 /* FIXME: compare values below with original and fix.
58 * An *excellent* win9x version page (ALL versions !)
59 * can be found at members.aol.com/axcel216/ver.htm */
60 static const RTL_OSVERSIONINFOEXW VersionData[NB_WINDOWS_VERSIONS] =
62 /* WIN20 FIXME: verify values */
64 sizeof(RTL_OSVERSIONINFOEXW), 2, 0, 0, VER_PLATFORM_WIN32s,
65 {'W','i','n','3','2','s',' ','1','.','3',0},
68 /* WIN30 FIXME: verify values */
70 sizeof(RTL_OSVERSIONINFOEXW), 3, 0, 0, VER_PLATFORM_WIN32s,
71 {'W','i','n','3','2','s',' ','1','.','3',0},
76 sizeof(RTL_OSVERSIONINFOEXW), 3, 10, 0, VER_PLATFORM_WIN32s,
77 {'W','i','n','3','2','s',' ','1','.','3',0},
82 /* Win95: 4, 0, 0x40003B6, ""
83 * Win95sp1: 4, 0, 0x40003B6, " A " (according to doc)
84 * Win95osr2: 4, 0, 0x4000457, " B " (according to doc)
85 * Win95osr2.1: 4, 3, 0x40304BC, " B " (according to doc)
86 * Win95osr2.5: 4, 3, 0x40304BE, " C " (according to doc)
87 * Win95a/b can be discerned via regkey SubVersionNumber
89 * http://support.microsoft.com/support/kb/articles/q158/2/38.asp
91 sizeof(RTL_OSVERSIONINFOEXW), 4, 0, 0x40003B6, VER_PLATFORM_WIN32_WINDOWS,
95 /* WIN98 (second edition) */
97 /* Win98: 4, 10, 0x40A07CE, " " 4.10.1998
98 * Win98SE: 4, 10, 0x40A08AE, " A " 4.10.2222
100 sizeof(RTL_OSVERSIONINFOEXW), 4, 10, 0x40A08AE, VER_PLATFORM_WIN32_WINDOWS,
106 sizeof(RTL_OSVERSIONINFOEXW), 4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS,
112 sizeof(RTL_OSVERSIONINFOEXW), 3, 51, 0x421, VER_PLATFORM_WIN32_NT,
113 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
118 sizeof(RTL_OSVERSIONINFOEXW), 4, 0, 0x565, VER_PLATFORM_WIN32_NT,
119 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','6','a',0},
120 6, 0, 0, VER_NT_WORKSTATION, 0
124 sizeof(RTL_OSVERSIONINFOEXW), 5, 0, 0x893, VER_PLATFORM_WIN32_NT,
125 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','4',0},
126 4, 0, 0, VER_NT_WORKSTATION, 30 /* FIXME: Great, a reserved field with a value! */
130 sizeof(RTL_OSVERSIONINFOEXW), 5, 1, 0xA28, VER_PLATFORM_WIN32_NT,
131 {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','2',0},
132 2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 30 /* FIXME: Great, a reserved field with a value! */
136 sizeof(RTL_OSVERSIONINFOEXW), 5, 2, 0xECE, VER_PLATFORM_WIN32_NT,
138 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
142 static const char * const WinVersionNames[NB_WINDOWS_VERSIONS] =
143 { /* no spaces in here ! */
152 "win2000,win2k,nt2k,nt2000", /* NT2K */
154 "win2003,win2k3" /* WIN2K3 */
157 /* names to print out in debug traces */
158 static const char * const debug_names[NB_WINDOWS_VERSIONS] =
160 "Windows 2.0", /* WIN20 */
161 "Windows 3.0", /* WIN30 */
162 "Windows 3.1", /* WIN31 */
163 "Windows 95", /* WIN95 */
164 "Windows 98", /* WIN98 */
165 "Windows Me", /* WINME */
166 "Windows NT 3.51", /* NT351 */
167 "Windows NT 4.0", /* NT40 */
168 "Windows 2000", /* NT2K */
169 "Windows XP", /* WINXP */
170 "Windows Server 2003"/* WIN2K3 */
173 /* if one of the following dlls is importing ntdll the windows
174 version autodetection switches wine to unicode (nt 3.51 or 4.0) */
175 static const WCHAR special_dlls[][16] =
177 {'c','o','m','d','l','g','3','2','.','d','l','l',0},
178 {'c','o','m','c','t','l','3','2','.','d','l','l',0},
179 {'s','h','e','l','l','3','2','.','d','l','l',0},
180 {'o','l','e','3','2','.','d','l','l',0},
181 {'r','p','c','r','t','4','.','d','l','l',0}
184 /* the current version has not been autodetected but forced via cmdline */
185 static BOOL versionForced = FALSE;
186 static WINDOWS_VERSION forcedWinVersion; /* init value irrelevant */
188 /**********************************************************************
191 * Parse the contents of the Version key.
193 static BOOL parse_win_version( HKEY hkey )
195 static const WCHAR WindowsW[] = {'W','i','n','d','o','w','s',0};
197 UNICODE_STRING valueW;
198 char tmp[64], buffer[50];
199 KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)tmp;
203 RtlInitUnicodeString( &valueW, WindowsW );
204 if (NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp), &count ))
207 RtlUnicodeToMultiByteN( buffer, sizeof(buffer)-1, &len, (WCHAR *)info->Data, info->DataLength );
210 for (i = 0; i < NB_WINDOWS_VERSIONS; i++)
212 const char *p, *pCurr = WinVersionNames[i];
213 /* iterate through all winver aliases separated by comma */
215 p = strchr(pCurr, ',');
216 len = p ? p - pCurr : strlen(pCurr);
217 if ( (!strncmp( pCurr, buffer, len )) && (buffer[len] == 0) )
219 forcedWinVersion = i;
220 versionForced = TRUE;
221 TRACE( "got win version %s\n", WinVersionNames[forcedWinVersion] );
228 MESSAGE("Invalid Windows version value '%s' specified in config file.\n", buffer );
229 MESSAGE("Valid versions are:" );
230 for (i = 0; i < NB_WINDOWS_VERSIONS; i++)
232 /* only list the first, "official" alias in case of aliases */
233 const char *pCurr = WinVersionNames[i];
234 const char *p = strchr(pCurr, ',');
235 len = (p) ? p - pCurr : strlen(pCurr);
237 MESSAGE(" '%.*s'%c", (int)len, pCurr, (i == NB_WINDOWS_VERSIONS - 1) ? '\n' : ',' );
243 /**********************************************************************
246 void VERSION_Init( const WCHAR *appname )
248 OBJECT_ATTRIBUTES attr;
249 UNICODE_STRING nameW;
250 HKEY hkey, config_key;
251 static const WCHAR configW[] = {'M','a','c','h','i','n','e','\\',
252 'S','o','f','t','w','a','r','e','\\',
253 'W','i','n','e','\\',
254 'W','i','n','e','\\',
255 'C','o','n','f','i','g',0};
256 static const WCHAR appdefaultsW[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0};
257 static const WCHAR versionW[] = {'\\','V','e','r','s','i','o','n',0};
259 attr.Length = sizeof(attr);
260 attr.RootDirectory = 0;
261 attr.ObjectName = &nameW;
263 attr.SecurityDescriptor = NULL;
264 attr.SecurityQualityOfService = NULL;
265 RtlInitUnicodeString( &nameW, configW );
267 if (NtOpenKey( &config_key, KEY_ALL_ACCESS, &attr )) return;
268 attr.RootDirectory = config_key;
270 /* open AppDefaults\\appname\\Version key */
271 if (appname && *appname)
274 WCHAR appversion[MAX_PATH+20];
275 BOOL got_win_ver = FALSE;
277 if ((p = strrchrW( appname, '/' ))) appname = p + 1;
278 if ((p = strrchrW( appname, '\\' ))) appname = p + 1;
280 strcpyW( appversion, appdefaultsW );
281 strcatW( appversion, appname );
282 strcatW( appversion, versionW );
283 TRACE( "getting version from %s\n", debugstr_w(appversion) );
284 RtlInitUnicodeString( &nameW, appversion );
286 if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
288 got_win_ver = parse_win_version( hkey );
291 if (got_win_ver) goto done;
294 TRACE( "getting default version\n" );
295 RtlInitUnicodeString( &nameW, versionW + 1 );
296 if (!NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ))
298 parse_win_version( hkey );
303 NtClose( config_key );
307 /**********************************************************************
308 * VERSION_GetSystemDLLVersion
310 * This function tries to figure out if a given (native) dll comes from
311 * win95/98 or winnt. Since all values in the OptionalHeader are not a
312 * usable hint, we test if a dll imports the ntdll.
313 * This is at least working for all system dlls like comctl32, comdlg32 and
315 * If you have a better idea to figure this out...
317 static DWORD VERSION_GetSystemDLLVersion( HMODULE hmod )
320 IMAGE_IMPORT_DESCRIPTOR *pe_imp;
322 if ((pe_imp = RtlImageDirectoryEntryToData( hmod, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, &size )))
324 for ( ; pe_imp->Name; pe_imp++)
326 char * name = (char *)hmod + (unsigned int)pe_imp->Name;
329 if (!strncasecmp(name, "ntdll", 5))
331 switch(RtlImageNtHeader(hmod)->OptionalHeader.MajorOperatingSystemVersion) {
333 MESSAGE("WARNING: very old native DLL (NT 3.x) used, might cause instability.\n");
336 case 5: switch (RtlImageNtHeader(hmod)->OptionalHeader.MinorOperatingSystemVersion){
338 case 1: return WINXP;
339 case 2: return WIN2K3;
342 FIXME("Unknown DLL OS version, please report !!\n");
352 /**********************************************************************
353 * VERSION_GetLinkedDllVersion
355 * Some version data (not reliable!):
356 * linker/OS/image/subsys
358 * x.xx/1.00/0.00/3.10 Win32s (any version ?)
359 * 2.39/1.00/0.00/3.10 Win32s freecell.exe (any version)
360 * 2.50/1.00/4.00/4.00 Win32s 1.30 winhlp32.exe
361 * 2.60/3.51/3.51/3.51 NT351SP5 system dlls
362 * 2.60/3.51/3.51/4.00 NT351SP5 comctl32 dll
363 * 2.xx/1.00/0.00/4.00 Win95 system files
364 * x.xx/4.00/0.00/4.00 Win95 most applications
365 * 3.10/4.00/0.00/4.00 Win98 notepad
366 * x.xx/5.00/5.00/4.00 Win98 system dlls (e.g. comctl32.dll)
367 * x.xx/4.00/4.00/4.00 NT 4 most apps
368 * 5.12/5.00/5.00/4.00 NT4+IE5 comctl32.dll
369 * 5.12/5.00/5.00/4.00 Win98 calc
370 * x.xx/5.00/5.00/4.00 win95/win98/NT4 IE5 files
372 static DWORD VERSION_GetLinkedDllVersion(void)
374 WINDOWS_VERSION WinVersion = NB_WINDOWS_VERSIONS;
375 PIMAGE_OPTIONAL_HEADER ophd;
376 IMAGE_NT_HEADERS *nt;
378 PLIST_ENTRY mark, entry;
382 /* First check the native dlls provided. These have to be
383 from one windows version */
385 mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList;
386 for (entry = mark->Flink; entry != mark; entry = entry->Flink)
388 mod = CONTAINING_RECORD(entry, LDR_MODULE, InLoadOrderModuleList);
389 if (mod->Flags & LDR_WINE_INTERNAL) continue;
390 nt = RtlImageNtHeader(mod->BaseAddress);
391 ophd = &nt->OptionalHeader;
392 name = strrchrW( mod->FullDllName.Buffer, '\\' );
394 else name = mod->FullDllName.Buffer;
396 TRACE("%s: %02x.%02x/%02x.%02x/%02x.%02x/%02x.%02x\n",
397 debugstr_w(name), ophd->MajorLinkerVersion, ophd->MinorLinkerVersion,
398 ophd->MajorOperatingSystemVersion, ophd->MinorOperatingSystemVersion,
399 ophd->MajorImageVersion, ophd->MinorImageVersion,
400 ophd->MajorSubsystemVersion, ophd->MinorSubsystemVersion);
402 for (i = 0; i < sizeof(special_dlls)/sizeof(special_dlls[0]); i++)
404 /* test if it is a special dll */
405 if (!strcmpiW(name, special_dlls[i]))
407 DWORD DllVersion = VERSION_GetSystemDLLVersion(mod->BaseAddress);
408 if (WinVersion == NB_WINDOWS_VERSIONS) WinVersion = DllVersion;
409 else if (WinVersion != DllVersion)
411 ERR("You mixed system DLLs from different windows versions! Expect a crash! (%s: expected version %s, but is %s)\n",
413 debugstr_w(VersionData[WinVersion].szCSDVersion),
414 debugstr_w(VersionData[DllVersion].szCSDVersion));
415 return WIN20; /* this may let the exe exit */
422 if(WinVersion != NB_WINDOWS_VERSIONS) return WinVersion;
424 /* we are using no external system dlls, look at the exe */
425 nt = RtlImageNtHeader(NtCurrentTeb()->Peb->ImageBaseAddress);
426 ophd = &nt->OptionalHeader;
428 TRACE("%02x.%02x/%02x.%02x/%02x.%02x/%02x.%02x\n",
429 ophd->MajorLinkerVersion, ophd->MinorLinkerVersion,
430 ophd->MajorOperatingSystemVersion, ophd->MinorOperatingSystemVersion,
431 ophd->MajorImageVersion, ophd->MinorImageVersion,
432 ophd->MajorSubsystemVersion, ophd->MinorSubsystemVersion);
434 /* special nt 3.51 */
435 if (3 == ophd->MajorOperatingSystemVersion && 51 == ophd->MinorOperatingSystemVersion)
440 /* the MajorSubsystemVersion is the only usable sign */
441 if (ophd->MajorSubsystemVersion < 4)
443 if ( ophd->MajorOperatingSystemVersion == 1
444 && ophd->MinorOperatingSystemVersion == 0)
446 return WIN31; /* win32s */
449 if (ophd->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
450 return NT351; /* FIXME: NT 3.1, not tested */
455 switch (ophd->MajorOperatingSystemVersion)
458 switch (ophd->MinorOperatingSystemVersion)
460 case 0 : return NT2K;
461 case 1 : return WINXP;
462 case 2 : return WIN2K3;
466 switch(ophd->MinorOperatingSystemVersion)
468 case 90 : return WINME;
469 case 10 : return WIN98;
471 switch(ophd->MajorImageVersion)
473 case 4 : return NT40;
474 case 0 : return WIN95;
480 if(ophd->MinorOperatingSystemVersion == 0)
484 FIXME("Unknown EXE OS version %d.%d, please report !!\n",
485 ophd->MajorOperatingSystemVersion, ophd->MinorOperatingSystemVersion );
489 /**********************************************************************
493 * Don't call this function too early during the Wine init,
494 * as pdb->exe_modref (required by VERSION_GetImageVersion()) might still
495 * be NULL in such cases, which causes the winver to ALWAYS be detected
497 * And as we cache the winver once it has been determined, this is bad.
498 * This can happen much easier than you might think, as this function
499 * is called by EVERY GetVersion*() API !
502 static const RTL_OSVERSIONINFOEXW *VERSION_GetVersion(void)
504 static WORD winver = 0xffff;
507 return &VersionData[forcedWinVersion]; /* user has overridden any sensible checks */
509 if (winver == 0xffff) /* to be determined */
511 WINDOWS_VERSION retver = VERSION_GetLinkedDllVersion();
513 /* cache determined value, but do not store in case of WIN31 */
514 if (retver != WIN31) winver = retver;
515 return &VersionData[retver];
517 return &VersionData[winver];
521 /***********************************************************************
522 * RtlGetVersion (NTDLL.@)
524 NTSTATUS WINAPI RtlGetVersion( RTL_OSVERSIONINFOEXW *info )
526 const RTL_OSVERSIONINFOEXW * const current = VERSION_GetVersion();
528 info->dwMajorVersion = current->dwMajorVersion;
529 info->dwMinorVersion = current->dwMinorVersion;
530 info->dwBuildNumber = current->dwBuildNumber;
531 info->dwPlatformId = current->dwPlatformId;
532 strcpyW( info->szCSDVersion, current->szCSDVersion );
533 if(info->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW))
535 info->wServicePackMajor = current->wServicePackMajor;
536 info->wServicePackMinor = current->wServicePackMinor;
537 info->wSuiteMask = current->wSuiteMask;
538 info->wProductType = current->wProductType;
540 TRACE("<-- %s (%s)\n", debug_names[current - VersionData], debugstr_w(current->szCSDVersion) );
541 return STATUS_SUCCESS;
545 /******************************************************************************
546 * RtlGetNtVersionNumbers (NTDLL.@)
548 * Get the version numbers of the run time library.
551 * major [O] Destination for the Major version
552 * minor [O] Destination for the Minor version
553 * build [O] Destination for the Build version
559 * Introduced in Windows XP (NT5.1)
561 void WINAPI RtlGetNtVersionNumbers( LPDWORD major, LPDWORD minor, LPDWORD build )
563 const RTL_OSVERSIONINFOEXW * const current = VERSION_GetVersion();
565 if (major) *major = current->dwMajorVersion;
566 if (minor) *minor = current->dwMinorVersion;
567 /* FIXME: Does anybody know the real formula? */
568 if (build) *build = (0xF0000000 | current->dwBuildNumber);
572 /******************************************************************************
573 * VerifyVersionInfoW (KERNEL32.@)
575 NTSTATUS WINAPI RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW *info,
576 DWORD dwTypeMask, DWORDLONG dwlConditionMask )
578 RTL_OSVERSIONINFOEXW ver;
581 FIXME("(%p,%lu,%llx): Not all cases correctly implemented yet\n",
582 info, dwTypeMask, dwlConditionMask);
585 - Check the following special case on Windows (various versions):
586 o lp->wSuiteMask == 0 and ver.wSuiteMask != 0 and VER_AND/VER_OR
587 o lp->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW)
588 - MSDN talks about some tests being impossible. Check what really happens.
591 ver.dwOSVersionInfoSize = sizeof(ver);
592 if ((status = RtlGetVersion( &ver )) != STATUS_SUCCESS) return status;
594 if(!(dwTypeMask && dwlConditionMask)) return STATUS_INVALID_PARAMETER;
596 if(dwTypeMask & VER_PRODUCT_TYPE)
597 switch(dwlConditionMask >> 7*3 & 0x07) {
599 if(ver.wProductType != info->wProductType) return STATUS_REVISION_MISMATCH;
602 if(ver.wProductType <= info->wProductType) return STATUS_REVISION_MISMATCH;
604 case VER_GREATER_EQUAL:
605 if(ver.wProductType < info->wProductType) return STATUS_REVISION_MISMATCH;
608 if(ver.wProductType >= info->wProductType) return STATUS_REVISION_MISMATCH;
611 if(ver.wProductType > info->wProductType) return STATUS_REVISION_MISMATCH;
614 return STATUS_INVALID_PARAMETER;
616 if(dwTypeMask & VER_SUITENAME)
617 switch(dwlConditionMask >> 6*3 & 0x07)
620 if((info->wSuiteMask & ver.wSuiteMask) != info->wSuiteMask)
621 return STATUS_REVISION_MISMATCH;
624 if(!(info->wSuiteMask & ver.wSuiteMask) && info->wSuiteMask)
625 return STATUS_REVISION_MISMATCH;
628 return STATUS_INVALID_PARAMETER;
630 if(dwTypeMask & VER_PLATFORMID)
631 switch(dwlConditionMask >> 3*3 & 0x07)
634 if(ver.dwPlatformId != info->dwPlatformId) return STATUS_REVISION_MISMATCH;
637 if(ver.dwPlatformId <= info->dwPlatformId) return STATUS_REVISION_MISMATCH;
639 case VER_GREATER_EQUAL:
640 if(ver.dwPlatformId < info->dwPlatformId) return STATUS_REVISION_MISMATCH;
643 if(ver.dwPlatformId >= info->dwPlatformId) return STATUS_REVISION_MISMATCH;
646 if(ver.dwPlatformId > info->dwPlatformId) return STATUS_REVISION_MISMATCH;
649 return STATUS_INVALID_PARAMETER;
651 if(dwTypeMask & VER_BUILDNUMBER)
652 switch(dwlConditionMask >> 2*3 & 0x07)
655 if(ver.dwBuildNumber != info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
658 if(ver.dwBuildNumber <= info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
660 case VER_GREATER_EQUAL:
661 if(ver.dwBuildNumber < info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
664 if(ver.dwBuildNumber >= info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
667 if(ver.dwBuildNumber > info->dwBuildNumber) return STATUS_REVISION_MISMATCH;
670 return STATUS_INVALID_PARAMETER;
672 if(dwTypeMask & VER_MAJORVERSION)
673 switch(dwlConditionMask >> 1*3 & 0x07)
676 if(ver.dwMajorVersion != info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
679 if(ver.dwMajorVersion <= info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
681 case VER_GREATER_EQUAL:
682 if(ver.dwMajorVersion < info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
685 if(ver.dwMajorVersion >= info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
688 if(ver.dwMajorVersion > info->dwMajorVersion) return STATUS_REVISION_MISMATCH;
691 return STATUS_INVALID_PARAMETER;
693 if(dwTypeMask & VER_MINORVERSION)
694 switch(dwlConditionMask >> 0*3 & 0x07)
697 if(ver.dwMinorVersion != info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
700 if(ver.dwMinorVersion <= info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
702 case VER_GREATER_EQUAL:
703 if(ver.dwMinorVersion < info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
706 if(ver.dwMinorVersion >= info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
709 if(ver.dwMinorVersion > info->dwMinorVersion) return STATUS_REVISION_MISMATCH;
712 return STATUS_INVALID_PARAMETER;
714 if(dwTypeMask & VER_SERVICEPACKMAJOR)
715 switch(dwlConditionMask >> 5*3 & 0x07)
718 if(ver.wServicePackMajor != info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
721 if(ver.wServicePackMajor <= info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
723 case VER_GREATER_EQUAL:
724 if(ver.wServicePackMajor < info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
727 if(ver.wServicePackMajor >= info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
730 if(ver.wServicePackMajor > info->wServicePackMajor) return STATUS_REVISION_MISMATCH;
733 return STATUS_INVALID_PARAMETER;
735 if(dwTypeMask & VER_SERVICEPACKMINOR)
736 switch(dwlConditionMask >> 4*3 & 0x07)
739 if(ver.wServicePackMinor != info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
742 if(ver.wServicePackMinor <= info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
744 case VER_GREATER_EQUAL:
745 if(ver.wServicePackMinor < info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
748 if(ver.wServicePackMinor >= info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
751 if(ver.wServicePackMinor > info->wServicePackMinor) return STATUS_REVISION_MISMATCH;
754 return STATUS_INVALID_PARAMETER;
757 return STATUS_SUCCESS;