2 * Windows and DOS version functions
4 * Copyright 1997 Alexandre Julliard
5 * Copyright 1997 Marcus Meissner
6 * Copyright 1998 Patrik Stridvall
7 * Copyright 1998 Andreas Mohr
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
33 #include "wine/winbase16.h"
35 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(ver
);
42 WIN20
, /* Windows 2.0 */
43 WIN30
, /* Windows 3.0 */
44 WIN31
, /* Windows 3.1 */
45 WIN95
, /* Windows 95 */
46 WIN98
, /* Windows 98 */
47 WINME
, /* Windows Me */
48 NT351
, /* Windows NT 3.51 */
49 NT40
, /* Windows NT 4.0 */
50 NT2K
, /* Windows 2000 */
51 WINXP
, /* Windows XP */
59 OSVERSIONINFOEXA getVersionEx
;
62 /* FIXME: compare values below with original and fix.
63 * An *excellent* win9x version page (ALL versions !)
64 * can be found at members.aol.com/axcel216/ver.htm */
65 static VERSION_DATA VersionData
[NB_WINDOWS_VERSIONS
] =
67 /* WIN20 FIXME: verify values */
69 MAKELONG( 0x0002, 0x0303 ), /* assume DOS 3.3 */
70 MAKELONG( 0x0002, 0x8000 ),
72 sizeof(OSVERSIONINFOA
), 2, 0, 0,
73 VER_PLATFORM_WIN32s
, "Win32s 1.3",
77 /* WIN30 FIXME: verify values */
79 MAKELONG( 0x0003, 0x0500 ), /* assume DOS 5.00 */
80 MAKELONG( 0x0003, 0x8000 ),
82 sizeof(OSVERSIONINFOA
), 3, 0, 0,
83 VER_PLATFORM_WIN32s
, "Win32s 1.3",
89 MAKELONG( 0x0a03, 0x0616 ), /* DOS 6.22 */
90 MAKELONG( 0x0a03, 0x8000 ),
92 sizeof(OSVERSIONINFOA
), 3, 10, 0,
93 VER_PLATFORM_WIN32s
, "Win32s 1.3",
102 /* Win95: 4, 0, 0x40003B6, ""
103 * Win95sp1: 4, 0, 0x40003B6, " A " (according to doc)
104 * Win95osr2: 4, 0, 0x4000457, " B " (according to doc)
105 * Win95osr2.1: 4, 3, 0x40304BC, " B " (according to doc)
106 * Win95osr2.5: 4, 3, 0x40304BE, " C " (according to doc)
107 * Win95a/b can be discerned via regkey SubVersionNumber
109 * http://support.microsoft.com/support/kb/articles/q158/2/38.asp
111 sizeof(OSVERSIONINFOA
), 4, 0, 0x40003B6,
112 VER_PLATFORM_WIN32_WINDOWS
, "",
116 /* WIN98 (second edition) */
121 /* Win98: 4, 10, 0x40A07CE, " " 4.10.1998
122 * Win98SE: 4, 10, 0x40A08AE, " A " 4.10.2222
124 sizeof(OSVERSIONINFOA
), 4, 10, 0x40A08AE,
125 VER_PLATFORM_WIN32_WINDOWS
, " A ",
134 sizeof(OSVERSIONINFOA
), 4, 90, 0x45A0BB8,
135 VER_PLATFORM_WIN32_WINDOWS
, " ",
144 sizeof(OSVERSIONINFOA
), 3, 51, 0x421,
145 VER_PLATFORM_WIN32_NT
, "Service Pack 2",
154 sizeof(OSVERSIONINFOA
), 4, 0, 0x565,
155 VER_PLATFORM_WIN32_NT
, "Service Pack 6",
156 6, 0, 0, VER_NT_WORKSTATION
, 0
164 sizeof(OSVERSIONINFOA
), 5, 0, 0x893,
165 VER_PLATFORM_WIN32_NT
, "Service Pack 2",
166 2, 0, 0, VER_NT_WORKSTATION
, 30 /* FIXME: Great, a reserved field with a value! */
171 0x05005F03, /* Assuming DOS 5 like the other NT */
174 sizeof(OSVERSIONINFOA
), 5, 1, 0xA28,
175 VER_PLATFORM_WIN32_NT
, "",
176 0, 0, 0, VER_NT_WORKSTATION
, 0 /* FIXME: Verify last 5 values */
181 static const char *WinVersionNames
[NB_WINDOWS_VERSIONS
] =
182 { /* no spaces in here ! */
191 "win2000,win2k,nt2k,nt2000",
195 /* if one of the following dlls is importing ntdll the windows
196 version autodetection switches wine to unicode (nt 3.51 or 4.0) */
197 static char * special_dlls
[] =
207 /* the current version has not been autodetected but forced via cmdline */
208 static BOOL versionForced
= FALSE
;
209 static WINDOWS_VERSION forcedWinVersion
= WIN31
; /* init value irrelevant */
211 /**********************************************************************
212 * VERSION_ParseWinVersion
214 static void VERSION_ParseWinVersion( const char *arg
)
217 const char *pCurr
, *p
;
218 for (i
= 0; i
< NB_WINDOWS_VERSIONS
; i
++)
220 pCurr
= WinVersionNames
[i
];
221 /* iterate through all winver aliases separated by comma */
223 p
= strchr(pCurr
, ',');
224 len
= p
? (int)p
- (int)pCurr
: strlen(pCurr
);
225 if ( (!strncmp( pCurr
, arg
, len
)) && (arg
[len
] == '\0') )
227 forcedWinVersion
= (WINDOWS_VERSION
)i
;
228 versionForced
= TRUE
;
234 MESSAGE("Invalid Windows version value '%s' specified in config file.\n", arg
);
235 MESSAGE("Valid versions are:" );
236 for (i
= 0; i
< NB_WINDOWS_VERSIONS
; i
++)
238 /* only list the first, "official" alias in case of aliases */
239 pCurr
= WinVersionNames
[i
];
240 p
= strchr(pCurr
, ',');
241 len
= (p
) ? (int)p
- (int)pCurr
: strlen(pCurr
);
243 MESSAGE(" '%.*s'%c", len
, pCurr
,
244 (i
== NB_WINDOWS_VERSIONS
- 1) ? '\n' : ',' );
250 /**********************************************************************
251 * VERSION_ParseDosVersion
253 static void VERSION_ParseDosVersion( const char *arg
)
256 if (sscanf( arg
, "%d.%d", &hi
, &lo
) == 2)
258 VersionData
[WIN31
].getVersion16
=
259 MAKELONG(LOWORD(VersionData
[WIN31
].getVersion16
),
264 MESSAGE("Wrong format for DOS version in config file. Use \"x.xx\"\n");
270 /**********************************************************************
273 static void VERSION_Init(void)
277 BOOL got_win_ver
= FALSE
, got_dos_ver
= FALSE
;
278 char buffer
[MAX_PATH
+16], *appname
, *p
;
279 static BOOL init_done
;
281 if (init_done
) return;
282 if (!GetModuleFileNameA( 0, buffer
, MAX_PATH
))
284 WARN( "could not get module file name\n" );
289 if ((p
= strrchr( appname
, '/' ))) appname
= p
+ 1;
290 if ((p
= strrchr( appname
, '\\' ))) appname
= p
+ 1;
292 if (!RegOpenKeyA( HKEY_LOCAL_MACHINE
, "Software\\Wine\\Wine\\Config\\AppDefaults", &hkey
))
294 /* open AppDefaults\\appname\\Version key */
295 strcat( appname
, "\\Version" );
296 if (!RegOpenKeyA( hkey
, appname
, &appkey
))
298 count
= sizeof(buffer
);
299 if (!RegQueryValueExA( appkey
, "Windows", NULL
, &type
, buffer
, &count
))
301 VERSION_ParseWinVersion( buffer
);
302 TRACE( "got app win version %s\n", WinVersionNames
[forcedWinVersion
] );
305 count
= sizeof(buffer
);
306 if (!RegQueryValueExA( appkey
, "DOS", NULL
, &type
, buffer
, &count
))
308 VERSION_ParseDosVersion( buffer
);
309 TRACE( "got app dos version %lx\n", VersionData
[WIN31
].getVersion16
);
312 RegCloseKey( appkey
);
317 if (got_win_ver
&& got_dos_ver
) return;
319 if (!RegOpenKeyA( HKEY_LOCAL_MACHINE
, "Software\\Wine\\Wine\\Config\\Version", &hkey
))
323 count
= sizeof(buffer
);
324 if (!RegQueryValueExA( hkey
, "Windows", NULL
, &type
, buffer
, &count
))
326 VERSION_ParseWinVersion( buffer
);
327 TRACE( "got default win version %s\n", WinVersionNames
[forcedWinVersion
] );
332 count
= sizeof(buffer
);
333 if (!RegQueryValueExA( hkey
, "DOS", NULL
, &type
, buffer
, &count
))
335 VERSION_ParseDosVersion( buffer
);
336 TRACE( "got default dos version %lx\n", VersionData
[WIN31
].getVersion16
);
344 /**********************************************************************
345 * VERSION_GetSystemDLLVersion
347 * This function tries to figure out if a given (native) dll comes from
348 * win95/98 or winnt. Since all values in the OptionalHeader are not a
349 * usable hint, we test if a dll imports the ntdll.
350 * This is at least working for all system dlls like comctl32, comdlg32 and
352 * If you have a better idea to figure this out...
354 static DWORD
VERSION_GetSystemDLLVersion( HMODULE hmod
)
357 IMAGE_IMPORT_DESCRIPTOR
*pe_imp
;
359 if ((pe_imp
= RtlImageDirectoryEntryToData( hmod
, TRUE
, IMAGE_DIRECTORY_ENTRY_IMPORT
, &size
)))
361 for ( ; pe_imp
->Name
; pe_imp
++)
363 char * name
= (char *)hmod
+ (unsigned int)pe_imp
->Name
;
366 if (!strncasecmp(name
, "ntdll", 5))
368 switch(RtlImageNtHeader(hmod
)->OptionalHeader
.MajorOperatingSystemVersion
) {
370 MESSAGE("WARNING: very old native DLL (NT 3.x) used, might cause instability.\n");
374 case 6: return WINXP
;
376 FIXME("Unknown DLL OS version, please report !!\n");
384 /**********************************************************************
385 * VERSION_GetLinkedDllVersion
387 * Some version data (not reliable!):
388 * linker/OS/image/subsys
390 * x.xx/1.00/0.00/3.10 Win32s (any version ?)
391 * 2.39/1.00/0.00/3.10 Win32s freecell.exe (any version)
392 * 2.50/1.00/4.00/4.00 Win32s 1.30 winhlp32.exe
393 * 2.60/3.51/3.51/3.51 NT351SP5 system dlls
394 * 2.60/3.51/3.51/4.00 NT351SP5 comctl32 dll
395 * 2.xx/1.00/0.00/4.00 Win95 system files
396 * x.xx/4.00/0.00/4.00 Win95 most applications
397 * 3.10/4.00/0.00/4.00 Win98 notepad
398 * x.xx/5.00/5.00/4.00 Win98 system dlls (e.g. comctl32.dll)
399 * x.xx/4.00/4.00/4.00 NT 4 most apps
400 * 5.12/5.00/5.00/4.00 NT4+IE5 comctl32.dll
401 * 5.12/5.00/5.00/4.00 Win98 calc
402 * x.xx/5.00/5.00/4.00 win95/win98/NT4 IE5 files
404 DWORD
VERSION_GetLinkedDllVersion(void)
407 DWORD WinVersion
= NB_WINDOWS_VERSIONS
;
408 PIMAGE_OPTIONAL_HEADER ophd
;
409 IMAGE_NT_HEADERS
*nt
;
411 /* First check the native dlls provided. These have to be
412 from one windows version */
413 for ( wm
= MODULE_modref_list
; wm
; wm
=wm
->next
)
415 nt
= RtlImageNtHeader(wm
->module
);
416 ophd
= &nt
->OptionalHeader
;
418 TRACE("%s: %02x.%02x/%02x.%02x/%02x.%02x/%02x.%02x\n",
420 ophd
->MajorLinkerVersion
, ophd
->MinorLinkerVersion
,
421 ophd
->MajorOperatingSystemVersion
, ophd
->MinorOperatingSystemVersion
,
422 ophd
->MajorImageVersion
, ophd
->MinorImageVersion
,
423 ophd
->MajorSubsystemVersion
, ophd
->MinorSubsystemVersion
);
425 /* test if it is an external (native) dll */
426 if (!(wm
->flags
& WINE_MODREF_INTERNAL
))
429 for (i
= 0; special_dlls
[i
]; i
++)
431 /* test if it is a special dll */
432 if (!strncasecmp(wm
->modname
, special_dlls
[i
], strlen(special_dlls
[i
]) ))
434 DWORD DllVersion
= VERSION_GetSystemDLLVersion(wm
->module
);
435 if (WinVersion
== NB_WINDOWS_VERSIONS
)
436 WinVersion
= DllVersion
;
438 if (WinVersion
!= DllVersion
) {
439 ERR("You mixed system DLLs from different windows versions! Expect a crash! (%s: expected version '%s', but is '%s')\n",
441 VersionData
[WinVersion
].getVersionEx
.szCSDVersion
,
442 VersionData
[DllVersion
].getVersionEx
.szCSDVersion
);
443 return WIN20
; /* this may let the exe exiting */
452 if(WinVersion
!= NB_WINDOWS_VERSIONS
) return WinVersion
;
454 /* we are using no external system dlls, look at the exe */
455 nt
= RtlImageNtHeader(GetModuleHandleA(NULL
));
456 ophd
= &nt
->OptionalHeader
;
458 TRACE("%02x.%02x/%02x.%02x/%02x.%02x/%02x.%02x\n",
459 ophd
->MajorLinkerVersion
, ophd
->MinorLinkerVersion
,
460 ophd
->MajorOperatingSystemVersion
, ophd
->MinorOperatingSystemVersion
,
461 ophd
->MajorImageVersion
, ophd
->MinorImageVersion
,
462 ophd
->MajorSubsystemVersion
, ophd
->MinorSubsystemVersion
);
464 /* special nt 3.51 */
465 if (3 == ophd
->MajorOperatingSystemVersion
&& 51 == ophd
->MinorOperatingSystemVersion
)
470 /* the MajorSubsystemVersion is the only usable sign */
471 if (ophd
->MajorSubsystemVersion
< 4)
473 if ( ophd
->MajorOperatingSystemVersion
== 1
474 && ophd
->MinorOperatingSystemVersion
== 0)
476 return WIN31
; /* win32s */
479 if (ophd
->Subsystem
== IMAGE_SUBSYSTEM_WINDOWS_CUI
)
480 return NT351
; /* FIXME: NT 3.1, not tested */
488 /**********************************************************************
492 * Don't call this function too early during the Wine init,
493 * as pdb->exe_modref (required by VERSION_GetImageVersion()) might still
494 * be NULL in such cases, which causes the winver to ALWAYS be detected
496 * And as we cache the winver once it has been determined, this is bad.
497 * This can happen much easier than you might think, as this function
498 * is called by EVERY GetVersion*() API !
501 static WINDOWS_VERSION
VERSION_GetVersion(void)
503 static WORD winver
= 0xffff;
505 if (winver
== 0xffff) /* to be determined */
507 WINDOWS_VERSION retver
;
510 if (versionForced
) /* user has overridden any sensible checks */
511 winver
= forcedWinVersion
;
514 retver
= VERSION_GetLinkedDllVersion();
516 /* cache determined value, but do not store in case of WIN31 */
517 if (retver
!= WIN31
) winver
= retver
;
527 /***********************************************************************
528 * GetVersion (KERNEL.3)
530 LONG WINAPI
GetVersion16(void)
532 WINDOWS_VERSION ver
= VERSION_GetVersion();
533 return VersionData
[ver
].getVersion16
;
537 /***********************************************************************
538 * GetVersion (KERNEL32.@)
540 LONG WINAPI
GetVersion(void)
542 WINDOWS_VERSION ver
= VERSION_GetVersion();
543 return VersionData
[ver
].getVersion32
;
547 /***********************************************************************
548 * GetVersionEx (KERNEL.149)
550 BOOL16 WINAPI
GetVersionEx16(OSVERSIONINFO16
*v
)
552 WINDOWS_VERSION ver
= VERSION_GetVersion();
553 if (v
->dwOSVersionInfoSize
< sizeof(OSVERSIONINFO16
))
555 WARN("wrong OSVERSIONINFO size from app\n");
556 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
559 v
->dwMajorVersion
= VersionData
[ver
].getVersionEx
.dwMajorVersion
;
560 v
->dwMinorVersion
= VersionData
[ver
].getVersionEx
.dwMinorVersion
;
561 v
->dwBuildNumber
= VersionData
[ver
].getVersionEx
.dwBuildNumber
;
562 v
->dwPlatformId
= VersionData
[ver
].getVersionEx
.dwPlatformId
;
563 strcpy( v
->szCSDVersion
, VersionData
[ver
].getVersionEx
.szCSDVersion
);
568 /***********************************************************************
569 * GetVersionExA (KERNEL32.@)
571 BOOL WINAPI
GetVersionExA(OSVERSIONINFOA
*v
)
573 WINDOWS_VERSION ver
= VERSION_GetVersion();
574 LPOSVERSIONINFOEXA vex
;
576 if (v
->dwOSVersionInfoSize
!= sizeof(OSVERSIONINFOA
) &&
577 v
->dwOSVersionInfoSize
!= sizeof(OSVERSIONINFOEXA
))
579 WARN("wrong OSVERSIONINFO size from app (got: %ld, expected: %d or %d)\n",
580 v
->dwOSVersionInfoSize
, sizeof(OSVERSIONINFOA
),
581 sizeof(OSVERSIONINFOEXA
));
582 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
585 v
->dwMajorVersion
= VersionData
[ver
].getVersionEx
.dwMajorVersion
;
586 v
->dwMinorVersion
= VersionData
[ver
].getVersionEx
.dwMinorVersion
;
587 v
->dwBuildNumber
= VersionData
[ver
].getVersionEx
.dwBuildNumber
;
588 v
->dwPlatformId
= VersionData
[ver
].getVersionEx
.dwPlatformId
;
589 strcpy( v
->szCSDVersion
, VersionData
[ver
].getVersionEx
.szCSDVersion
);
590 if(v
->dwOSVersionInfoSize
== sizeof(OSVERSIONINFOEXA
)) {
591 vex
= (LPOSVERSIONINFOEXA
) v
;
592 vex
->wServicePackMajor
= VersionData
[ver
].getVersionEx
.wServicePackMajor
;
593 vex
->wServicePackMinor
= VersionData
[ver
].getVersionEx
.wServicePackMinor
;
594 vex
->wSuiteMask
= VersionData
[ver
].getVersionEx
.wSuiteMask
;
595 vex
->wProductType
= VersionData
[ver
].getVersionEx
.wProductType
;
601 /***********************************************************************
602 * GetVersionExW (KERNEL32.@)
604 BOOL WINAPI
GetVersionExW(OSVERSIONINFOW
*v
)
606 WINDOWS_VERSION ver
= VERSION_GetVersion();
607 LPOSVERSIONINFOEXW vex
;
609 if (v
->dwOSVersionInfoSize
!= sizeof(OSVERSIONINFOW
) &&
610 v
->dwOSVersionInfoSize
!= sizeof(OSVERSIONINFOEXW
))
612 WARN("wrong OSVERSIONINFO size from app (got: %ld, expected: %d or %d)\n",
613 v
->dwOSVersionInfoSize
, sizeof(OSVERSIONINFOW
),
614 sizeof(OSVERSIONINFOEXW
));
615 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
618 v
->dwMajorVersion
= VersionData
[ver
].getVersionEx
.dwMajorVersion
;
619 v
->dwMinorVersion
= VersionData
[ver
].getVersionEx
.dwMinorVersion
;
620 v
->dwBuildNumber
= VersionData
[ver
].getVersionEx
.dwBuildNumber
;
621 v
->dwPlatformId
= VersionData
[ver
].getVersionEx
.dwPlatformId
;
622 MultiByteToWideChar( CP_ACP
, 0, VersionData
[ver
].getVersionEx
.szCSDVersion
, -1,
623 v
->szCSDVersion
, sizeof(v
->szCSDVersion
)/sizeof(WCHAR
) );
624 if(v
->dwOSVersionInfoSize
== sizeof(OSVERSIONINFOEXW
)) {
625 vex
= (LPOSVERSIONINFOEXW
) v
;
626 vex
->wServicePackMajor
= VersionData
[ver
].getVersionEx
.wServicePackMajor
;
627 vex
->wServicePackMinor
= VersionData
[ver
].getVersionEx
.wServicePackMinor
;
628 vex
->wSuiteMask
= VersionData
[ver
].getVersionEx
.wSuiteMask
;
629 vex
->wProductType
= VersionData
[ver
].getVersionEx
.wProductType
;
635 /******************************************************************************
636 * VerifyVersionInfoA (KERNEL32.@)
638 BOOL WINAPI
VerifyVersionInfoA( LPOSVERSIONINFOEXA lpVersionInfo
, DWORD dwTypeMask
,
639 DWORDLONG dwlConditionMask
)
641 OSVERSIONINFOEXW verW
;
643 verW
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFOEXW
);
644 verW
.dwMajorVersion
= lpVersionInfo
->dwMajorVersion
;
645 verW
.dwMinorVersion
= lpVersionInfo
->dwMinorVersion
;
646 verW
.dwBuildNumber
= lpVersionInfo
->dwBuildNumber
;
647 verW
.dwPlatformId
= lpVersionInfo
->dwPlatformId
;
648 verW
.wServicePackMajor
= lpVersionInfo
->wServicePackMajor
;
649 verW
.wServicePackMinor
= lpVersionInfo
->wServicePackMinor
;
650 verW
.wSuiteMask
= lpVersionInfo
->wSuiteMask
;
651 verW
.wProductType
= lpVersionInfo
->wProductType
;
652 verW
.wReserved
= lpVersionInfo
->wReserved
;
654 return VerifyVersionInfoW(&verW
, dwTypeMask
, dwlConditionMask
);
658 /******************************************************************************
659 * VerifyVersionInfoW (KERNEL32.@)
661 BOOL WINAPI
VerifyVersionInfoW( LPOSVERSIONINFOEXW lpVersionInfo
, DWORD dwTypeMask
,
662 DWORDLONG dwlConditionMask
)
664 OSVERSIONINFOEXW ver
;
667 FIXME("(%p,%lu,%llx): Not all cases correctly implemented yet\n", lpVersionInfo
, dwTypeMask
, dwlConditionMask
);
669 - Check the following special case on Windows (various versions):
670 o lp->wSuiteMask == 0 and ver.wSuiteMask != 0 and VER_AND/VER_OR
671 o lp->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW)
672 - MSDN talks about some tests being impossible. Check what really happens.
675 ver
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFOEXW
);
676 if(!GetVersionExW((LPOSVERSIONINFOW
) &ver
))
681 if(!(dwTypeMask
&& dwlConditionMask
)) {
683 SetLastError(ERROR_BAD_ARGUMENTS
);
686 if(dwTypeMask
& VER_PRODUCT_TYPE
)
687 switch(dwlConditionMask
>> 7*3 & 0x07) {
689 if(ver
.wProductType
!= lpVersionInfo
->wProductType
)
693 if(ver
.wProductType
<= lpVersionInfo
->wProductType
)
696 case VER_GREATER_EQUAL
:
697 if(ver
.wProductType
< lpVersionInfo
->wProductType
)
701 if(ver
.wProductType
>= lpVersionInfo
->wProductType
)
705 if(ver
.wProductType
> lpVersionInfo
->wProductType
)
710 SetLastError(ERROR_BAD_ARGUMENTS
);
713 if(dwTypeMask
& VER_SUITENAME
&& res
)
714 switch(dwlConditionMask
>> 6*3 & 0x07) {
716 if((lpVersionInfo
->wSuiteMask
& ver
.wSuiteMask
) != lpVersionInfo
->wSuiteMask
)
720 if(!(lpVersionInfo
->wSuiteMask
& ver
.wSuiteMask
) && lpVersionInfo
->wSuiteMask
)
725 SetLastError(ERROR_BAD_ARGUMENTS
);
728 if(dwTypeMask
& VER_PLATFORMID
&& res
)
729 switch(dwlConditionMask
>> 3*3 & 0x07) {
731 if(ver
.dwPlatformId
!= lpVersionInfo
->dwPlatformId
)
735 if(ver
.dwPlatformId
<= lpVersionInfo
->dwPlatformId
)
738 case VER_GREATER_EQUAL
:
739 if(ver
.dwPlatformId
< lpVersionInfo
->dwPlatformId
)
743 if(ver
.dwPlatformId
>= lpVersionInfo
->dwPlatformId
)
747 if(ver
.dwPlatformId
> lpVersionInfo
->dwPlatformId
)
752 SetLastError(ERROR_BAD_ARGUMENTS
);
755 if(dwTypeMask
& VER_BUILDNUMBER
&& res
)
756 switch(dwlConditionMask
>> 2*3 & 0x07) {
758 if(ver
.dwBuildNumber
!= lpVersionInfo
->dwBuildNumber
)
762 if(ver
.dwBuildNumber
<= lpVersionInfo
->dwBuildNumber
)
765 case VER_GREATER_EQUAL
:
766 if(ver
.dwBuildNumber
< lpVersionInfo
->dwBuildNumber
)
770 if(ver
.dwBuildNumber
>= lpVersionInfo
->dwBuildNumber
)
774 if(ver
.dwBuildNumber
> lpVersionInfo
->dwBuildNumber
)
779 SetLastError(ERROR_BAD_ARGUMENTS
);
782 if(dwTypeMask
& VER_MAJORVERSION
&& res
)
783 switch(dwlConditionMask
>> 1*3 & 0x07) {
785 if(ver
.dwMajorVersion
!= lpVersionInfo
->dwMajorVersion
)
789 if(ver
.dwMajorVersion
<= lpVersionInfo
->dwMajorVersion
)
792 case VER_GREATER_EQUAL
:
793 if(ver
.dwMajorVersion
< lpVersionInfo
->dwMajorVersion
)
797 if(ver
.dwMajorVersion
>= lpVersionInfo
->dwMajorVersion
)
801 if(ver
.dwMajorVersion
> lpVersionInfo
->dwMajorVersion
)
806 SetLastError(ERROR_BAD_ARGUMENTS
);
809 if(dwTypeMask
& VER_MINORVERSION
&& res
)
810 switch(dwlConditionMask
>> 0*3 & 0x07) {
812 if(ver
.dwMinorVersion
!= lpVersionInfo
->dwMinorVersion
)
816 if(ver
.dwMinorVersion
<= lpVersionInfo
->dwMinorVersion
)
819 case VER_GREATER_EQUAL
:
820 if(ver
.dwMinorVersion
< lpVersionInfo
->dwMinorVersion
)
824 if(ver
.dwMinorVersion
>= lpVersionInfo
->dwMinorVersion
)
828 if(ver
.dwMinorVersion
> lpVersionInfo
->dwMinorVersion
)
833 SetLastError(ERROR_BAD_ARGUMENTS
);
836 if(dwTypeMask
& VER_SERVICEPACKMAJOR
&& res
)
837 switch(dwlConditionMask
>> 5*3 & 0x07) {
839 if(ver
.wServicePackMajor
!= lpVersionInfo
->wServicePackMajor
)
843 if(ver
.wServicePackMajor
<= lpVersionInfo
->wServicePackMajor
)
846 case VER_GREATER_EQUAL
:
847 if(ver
.wServicePackMajor
< lpVersionInfo
->wServicePackMajor
)
851 if(ver
.wServicePackMajor
>= lpVersionInfo
->wServicePackMajor
)
855 if(ver
.wServicePackMajor
> lpVersionInfo
->wServicePackMajor
)
860 SetLastError(ERROR_BAD_ARGUMENTS
);
863 if(dwTypeMask
& VER_SERVICEPACKMINOR
&& res
)
864 switch(dwlConditionMask
>> 4*3 & 0x07) {
866 if(ver
.wServicePackMinor
!= lpVersionInfo
->wServicePackMinor
)
870 if(ver
.wServicePackMinor
<= lpVersionInfo
->wServicePackMinor
)
873 case VER_GREATER_EQUAL
:
874 if(ver
.wServicePackMinor
< lpVersionInfo
->wServicePackMinor
)
878 if(ver
.wServicePackMinor
>= lpVersionInfo
->wServicePackMinor
)
882 if(ver
.wServicePackMinor
> lpVersionInfo
->wServicePackMinor
)
887 SetLastError(ERROR_BAD_ARGUMENTS
);
891 if(!(res
|| error_set
))
892 SetLastError(ERROR_OLD_WIN_VERSION
);
897 /***********************************************************************
898 * GetWinFlags (KERNEL.132)
900 DWORD WINAPI
GetWinFlags16(void)
902 static const long cpuflags
[5] =
903 { WF_CPU086
, WF_CPU186
, WF_CPU286
, WF_CPU386
, WF_CPU486
};
910 /* There doesn't seem to be any Pentium flag. */
911 result
= cpuflags
[min(si
.wProcessorLevel
, 4)] | WF_ENHANCED
| WF_PMODE
| WF_80x87
| WF_PAGING
;
912 if (si
.wProcessorLevel
>= 4) result
|= WF_HASCPUID
;
913 ovi
.dwOSVersionInfoSize
= sizeof(ovi
);
915 if (ovi
.dwPlatformId
== VER_PLATFORM_WIN32_NT
)
916 result
|= WF_WIN32WOW
; /* undocumented WF_WINNT */
922 /* Not used at this time. This is here for documentation only */
924 /* WINDEBUGINFO flags values */
925 #define WDI_OPTIONS 0x0001
926 #define WDI_FILTER 0x0002
927 #define WDI_ALLOCBREAK 0x0004
929 /* dwOptions values */
930 #define DBO_CHECKHEAP 0x0001
931 #define DBO_BUFFERFILL 0x0004
932 #define DBO_DISABLEGPTRAPPING 0x0010
933 #define DBO_CHECKFREE 0x0020
935 #define DBO_SILENT 0x8000
937 #define DBO_TRACEBREAK 0x2000
938 #define DBO_WARNINGBREAK 0x1000
939 #define DBO_NOERRORBREAK 0x0800
940 #define DBO_NOFATALBREAK 0x0400
941 #define DBO_INT3BREAK 0x0100
943 /* DebugOutput flags values */
944 #define DBF_TRACE 0x0000
945 #define DBF_WARNING 0x4000
946 #define DBF_ERROR 0x8000
947 #define DBF_FATAL 0xc000
949 /* dwFilter values */
950 #define DBF_KERNEL 0x1000
951 #define DBF_KRN_MEMMAN 0x0001
952 #define DBF_KRN_LOADMODULE 0x0002
953 #define DBF_KRN_SEGMENTLOAD 0x0004
954 #define DBF_USER 0x0800
955 #define DBF_GDI 0x0400
956 #define DBF_MMSYSTEM 0x0040
957 #define DBF_PENWIN 0x0020
958 #define DBF_APPLICATION 0x0008
959 #define DBF_DRIVER 0x0010
961 #endif /* NOLOGERROR */
964 /***********************************************************************
965 * GetWinDebugInfo (KERNEL.355)
967 BOOL16 WINAPI
GetWinDebugInfo16(WINDEBUGINFO16
*lpwdi
, UINT16 flags
)
969 FIXME("(%8lx,%d): stub returning 0\n",
970 (unsigned long)lpwdi
, flags
);
971 /* 0 means not in debugging mode/version */
972 /* Can this type of debugging be used in wine ? */
973 /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */
978 /***********************************************************************
979 * SetWinDebugInfo (KERNEL.356)
981 BOOL16 WINAPI
SetWinDebugInfo16(WINDEBUGINFO16
*lpwdi
)
983 FIXME("(%8lx): stub returning 0\n", (unsigned long)lpwdi
);
984 /* 0 means not in debugging mode/version */
985 /* Can this type of debugging be used in wine ? */
986 /* Constants: WDI_OPTIONS WDI_FILTER WDI_ALLOCBREAK */
991 /***********************************************************************
995 * Should fill lpBuffer only if DBO_BUFFERFILL has been set by SetWinDebugInfo()
997 void WINAPI
DebugFillBuffer(LPSTR lpBuffer
, WORD wBytes
)
999 memset(lpBuffer
, DBGFILL_BUFFER
, wBytes
);
1002 /***********************************************************************
1003 * DiagQuery (KERNEL.339)
1005 * returns TRUE if Win called with "/b" (bootlog.txt)
1007 BOOL16 WINAPI
DiagQuery16()
1009 /* perhaps implement a Wine "/b" command line flag sometime ? */
1013 /***********************************************************************
1014 * DiagOutput (KERNEL.340)
1016 * writes a debug string into <windir>\bootlog.txt
1018 void WINAPI
DiagOutput16(LPCSTR str
)
1021 DPRINTF("DIAGOUTPUT:%s\n", debugstr_a(str
));