Microsoft KB Archive/174561

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.6, 2.6a
 * Microsoft FoxPro for MS-DOS, versions 2.6, 2.6a

-

SYMPTOMS
The OS function returns incorrect operating system information when executed from FoxPro for Windows 2.6x or FoxPro for MS-DOS 2.6x running under Windows NT 4.0. The OS function returns the value DOS 05.00 for the MS-DOS version. Adding the "1" switch available in the OS function under FoxPro for Windows 2.6x should report the current version of Windows. When running under Windows NT 4.0, the OS(1) function incorrectly identifies the Windows version as Windows 3.10

RESOLUTION
In FoxPro for Windows 2.6x, you can use the GetWinFlags API to determine whether the application is running on Windows NT 4.0. The code example sends a message to the FoxPro desktop indicating whether Windows NT is the current operating system. It does not include the version of NT. Since the code includes Windows API calls, it will not work in FoxPro for MS-DOS.

  **** Begin Code Example****

CLEAR SET LIBRARY TO home + "foxtools.fll"

* WF-WINNT represented as the 0-based bit number that must be on  * in the returned WinFlags for the program to be running under NT.

WF_WINNT = 14

m.getwinflags = RegFN("GetWinFlags", "", "L") m.retval = callfn(m.getwinflags)

IF testbit(m.retval, WF_WINNT) ? "Running NT" ELSE ? "Not running NT" ENDIF

*****************  * function testbit - determines if a specific bit of a passed number is   * on/off *  * passed: number (m.number) *     bit number (m.bitnum, 0 - 31) *  * returns: .f. for off, .t. for on, .f. for illegal function call ****************

FUNCTION testbit

PARAMETERS m.number, m.bitnum

* number too big - exit IF NOT BETWEEN(m.bitnum, 0, 31) RETURN .F.  ENDIF

m.ascii = m.number FOR i = 31 TO 0 STEP -1 m.newascii = MOD(m.ascii, 2 ^ i)        IF m.bitnum = i            IF m.newascii # m.ascii RETURN .T.           ELSE RETURN .F.           ENDIF ENDIF m.ascii = m.newascii NEXT **** End Code Example****

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION
The OS function differs slightly between FoxPro for MS-DOS and FoxPro for Windows 2.6x. In FoxPro for Windows, the OS function has an optional parameter of 1. This returns the version of Windows. The OS function simply returns the MS-DOS operating system version.

Steps to Reproduce Behavior
 Start FoxPro for MS-DOS on a machine running Windows NT 4.0.  In the Command window, type the following:      ? OS  The OS function incorrectly reports MS-DOS 05.00. Start FoxPro for Windows 2.6x on a machine running Windows NT 4.0.  In the Command window, type the following commands:       ? OS ? OS(1)  The OS function incorrectly reports MS-DOS 05.00 as the MS-DOS version and Windows 3.10 as the version of Windows.</ol>