WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Determine Platform - OS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Determine the Service Release
Level of Win95/NT.

Keywords: service pack SP1 SP2 SP3 WinMetrics WinVersion release level kernel32.dll getversionexa 

In WinBatch 98A the WinVersion function has been expanded to obtain the service release of Windows. In the 32-bit version, we added additional options for the "level" parameter in WinVersion, e.g.:
Level Returns
----- -------
2 (i) Build number
3 (s) CSD version
Under Windows NT, CSD version is a string indicating the latest service pack that has been installed (eg, "Service Pack 1"), or a blank string ("") if no service pack has been installed. Under Windows 95, it is a string that may indicate arbitrary additional information about the operating system, or may be blank.

Otherwise, for versions of Winbatch prior to 98:

To determine the service release level of Windows 95:

WinBatch functions can tell if you have win95 installed, but if you need a finer view of the situation, use the following script:

	     
	buf=BinaryAlloc(148)
	BinaryEODSet(buf,148)
	BinaryPoke4(buf,0,148)
	dllname=strcat(dirwindows(1),"Kernel32.DLL")
	RVal=DllCall(dllname, long:"GetVersionExA", lpbinary:buf)
	Message("RVAL is",rval)
	
	XMajor=BinaryPeek4(buf,4)
	Message("XMajor",xmajor)
	
	XMinor=BinaryPeek4(buf,8)
	Message("XMinor",XMinor)
	
	XBuild=BinaryPeek4(buf,12)
	Message("XBuild",XBuild)
	
	xPlat=BinaryPeek4(buf,16)
	Message("xPlat",xPlat)
	
	xInfo=BinaryPeekStr(buf,20,128)
	Message("xInfo",xInfo)
	BinaryFree(buf)

Question:

How do I tell if the service release is OSR1 or OSR2?

Answer:

Run it on a few machines. I think you want the XBUILD number. Maybe the XINFO. I think the answer is Xinfo.

After checking the SDK, here's what it says:

See szCSDVersion near the end. I don't like the "arbitrary" but there it is.

It's probably fairly safe. The build number might be interesting, but there might be thousands of those.

_ _ _ _ _ _ _ _ _ _ _ _

typedef struct _OSVERSIONINFO{ 

DWORD dwOSVersionInfoSize; 
DWORD dwMajorVersion; 
DWORD dwMinorVersion; 
DWORD dwBuildNumber; 
DWORD dwPlatformId; 
TCHAR szCSDVersion[ 128 ]; 
} OSVERSIONINFO; 
- The OSVERSIONINFO data structure contains operating system version information. The information includes major and minor version numbers, a build number, a platform identifier, and descriptive text about the operating system. This structure is used with the GetVersionEx function.
Members

dwOSVersionInfoSize
- Specifies the size, in bytes, of this data structure. Set this member to sizeof(OSVERSIONINFO) before calling the GetVersionEx function.
dwMajorVersion
- Identifies the major version number of the operating system. For example, the major version number of the Daytona release of Windows NT is 3.
dwMinorVersion
- Identifies the minor version number of the operating system. For example, the minor version number of the Daytona release of Windows NT is 5.
dwBuildNumber
- Identifies the build number of the operating system in the low-order word. (The high-order word contains the major and minor version numbers.)
dwPlatformId
- Identifies the platform supported by the operating system. This member can have one of the following values:
Value Platform
VER_PLATFORM_WIN32s Win32s on Windows 3.1 
VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95
VER_PLATFORM_WIN32_NT Windows NT 





szCSDVersion !!!!!!!!!!!!!!
- Contains a zero-terminated string that provides arbitrary additional information about the operating system.

Determine Service Release and What Service Packs are Installed

Question:

I'm trying to detect whether or not the machine is running win95 and if so, i'd like to know if Service Pack 1 is installed. I found a registry key that gives a long version number. Do you know what version #'s are before and after SP1 is installed?

Answer:

Try this:
Winver=RegQueryValue(@REGMACHINE,"Software\Microsoft\Windows\CurrentVersion[Version]")
VerNum=RegQueryValue(@REGMACHINE,"Software\Microsoft\Windows\CurrentVersion[VersionNumber]")
VerSub=RegQueryValue(@REGMACHINE,"Software\Microsoft\Windows\CurrentVersion[SubVersionNumber]")
If VerSub == 0 then VerSub=" "
If WinVer is "Windows 95" and verSub = "a" then you have Windows 95 with service pack 1 installed.
4.00.950 - original Win95
4.00.950a - service pack 1 installed

4.00.1111 - Win 95 OSR 2
4.00.1233 - and others - Win95 OSR2/B/C

4.10.1655 - BETA Win98 (Nashville and others)
4.10.1998 - Initial release of Windows 98
Remember that anything other than the original Windows 95 (950) does not need The old service pack 1. OSR2 (B) doesn't.
Article ID:   W13149
Filename:   Determine the Service Release Level  for 95 or NT.txt
File Created: 1999:08:11:13:54:46
Last Updated: 1999:08:11:13:54:46