How to Find the Version Number of Win32sLast reviewed: January 22, 1997Article ID: Q125014 |
The information in this articles applies to:
SUMMARYThis article describes how to obtain the version number information for Win32s installed on a Windows 3.1 machine from one of the following places:
MORE INFORMATION
From an End User PerspectiveBecause Win32s does not have a user interface, there is no obvious way to get the version number information for Win32s that is installed on Windows 3.1. However, end users have the following two options:
Version InformationWin32s Release versions and corresponding build numbers:
Win32s Release # Build # ---------------- ------- 1.1 1.1.88 1.1a 1.1.89 1.15 1.15.103 1.15a 1.15.111 1.2 1.2.123 1.25 1.2.141 1.25a 1.2.142 1.30 1.2.159 1.30a 1.2.166 1.30c 1.2.172OLE versions shipped with corresponding Win32s versions:
Release # OLE32 OLE16 --------- ----- ----- 1.2 2.02 2.02 1.25 2.03 2.03 1.25a 2.03a 2.03a 1.30 2.03b 2.03a 1.30a 2.03c 2.03b 1.30c 2.03d 2.03b From a 16-Bit ApplicationTo get version number information for Win32s from a 16-bit application, use the Win32s specific function, GetWin32sInfo(), which is documented in the Win32s Programmer's Reference. This function is exported by the 16-bit W32SYS.DLL file in Win32s 1.1 and later. The GetWin32sInfo() function fills a specified structure with the information from Win32s VxD. Usually a 16- bit Windows setup program should use this function to determine if Win32s is already installed before continuing installation. Note that a 16-bit program must use LoadLibrary and GetProcAddress to call the function because the function did not exist in Win32s version 1.0. The following example on using GetWin32sInfo() is extracted from the Win32s Programmer's Reference:
// Example of a 16-bit application that indicates whether Win32s is // installed, and the version number if Win32s is loaded and VxD is // functional. // // NOTE: There is no header file in the SDK which has a definition // for the WIN32SINFO structure. Include the following structure // definition into the source code.typedef struct { BYTE bMajor; BYTE bMinor; WORD wBuildNumber; BOOL fDebug;} WIN32SINFO, FAR * LPWIN32SINFO; BOOL FAR PASCAL IsWin32sLoaded(LPSTR szVersion) { BOOL fWin32sLoaded = FALSE; FARPROC pfnInfo; HANDLE hWin32sys; WIN32SINFO Info; hWin32sys = LoadLibrary("W32SYS.DLL"); if (hWin32sys > HINSTANCE_ERROR) { pfnInfo = GetProcAddress(hWin32sys, "GETWIN32SINFO"); if (pfnInfo) { // Win32s version 1.1 is installed if (!(*pfnInfo)((LPWIN32SINFO) &Info)) { fWin32sLoaded = TRUE; wsprintf(szVersion, "%d.%d.%d.0", Info.bMajor, Info.bMinor, Info.wBuildNumber); } else fWin32sLoaded = FALSE; // Win32s VxD not loaded. } else { // Win32s version 1.0 is installed. fWin32sLoaded = TRUE; lstrcpy( szVersion, "1.0.0.0" ); } FreeLibrary( hWin32sys ); } else // Win32s not installed. fWin32sLoaded = FALSE; return fWin32sLoaded;}
From a 32-Bit ApplicationTo determine if Win32s is installed, use the function GetVersion(); to then get the version of Win32s use the function, GetVersionEx(). This function fills a specified structure with version information of Win32s on Windows 3.1. The following is an example illustrating the use of this function:
// Example of a 32-bit code that determines the operating system installed // and the version number on all platforms: Windows NT, Windows 95, Win32s.typedef BOOL (*LPFNGETVERSIONEX) (LPOSVERSIONINFO); BOOL IsWin32sLoaded(char *szVersion) { BOOL fWin32sLoaded = FALSE; DWORD dwGetVer; HMODULE hKernel32; OSVERSIONINFO ver; LPFNGETVERSIONEX lpfnGetVersionEx; // First, check if Win32s is installed dwGetVer = GetVersion(); if (!(dwGetVer & 0x80000000)) { // Windows NT is loaded // Note, GetVersion will also return version number on Windows NT return; } else if (LOBYTE(LOWORD(dwVersion))< 4) { // Win32s is loaded fWin32sLoaded = TRUE; } else { // Windows 95 is loaded // Note, GetVersion will also return version number on Windows 95 return; } // Now, let's find the version number of Win32s hKernel32 = GetModuleHandle("Kernel32"); if (hKernel32) { lpfnGetVersionEx = (LPFNGETVERSIONEX)GetProcAddress(hKernel32,"GetVersionExA"); if (lpfnGetVersionEx) { // Win32s version 1.15 or later is installed ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!(*lpfnGetVersionEx)((LPOSVERSIONINFO) &ver)) DisplayError("GetVersionEx"); else wsprintf(szVersion, "%d.%d.%d - %s", ver.dwMajorVersion,ver.dwMinorVersion, ver.dwBuildNumber, PlatformName(ver.dwPlatformId)); } else { // This failure could mean several things // 1. On an NT system, it indicates NT version 3.1 because GetVersionEx() // is only implemented on NT 3.5. // 2. On Windows 3.1 system, it means either Win32s version 1.1 or 1.0 is // installed. You can distinguish between 1.1 and 1.0 in two ways: // a. Get version info from WIN32S16.DLL like File Manager on NT does. // b. Thunk to 16-bit side and call GetWin32sInfo. } } return (fWin32sLoaded);} NOTE: In general, 32-bit applications that use Win32s should always ship with the latest version of Win32s. Therefore the detection code above can be greatly simplified if determination of previous versions of Win32s is not needed.
|
KBCategory: kbenv kbhowto
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |