FIX: PWB 1.0 Extensions Will Only Return True Under MS-DOS (63052)



The information in this article applies to:

  • Microsoft Programmer's Workbench for MS-DOS 1.0
  • Microsoft Programmer's Workbench for OS/2 1.0

This article was previously published under Q63052

SYMPTOMS

Extensions written for use by the Programmer's WorkBench (PWB) version 1.0 under the DOS operating system are recognized as returning true regardless of their actual return values.

STATUS

Microsoft has confirmed this to be a problem in PWB version 1.0. This problem was corrected in PWB version 1.1.

MORE INFORMATION

The use of return values as a way of providing conditional jumps inside PWB macros is a common practice that is affected by the above limitation for PWB extensions. The sample extension and macros below demonstrate the above problem. Once installed, both the f1() and f2() functions will be seen as returning true to PWB.

Sample Code

// TEST.C

#include <string.h>
#include <stdlib.h>
#include <ext.h>

PWBFUNC f1( unsigned argData, ARG far *pArg, flagType fMeta );
PWBFUNC f2( unsigned argData, ARG far *pArg, flagType fMeta);

// Switches.
struct swiDesc swiTable[] =
{
   { NULL, NULL, 0 }
};

// Commands.
struct cmdDesc cmdTable[] =
{
   { "f1", f1, 0, NOARG },
   { "f2",f2,0, NOARG },
   { NULL, NULL, 0, 0 }
};

void EXTERNAL WhenLoaded()
{
    SetKey( "f1",         "alt+f" );
    SetKey( "f2",       "ctrl+f" );
    return;
}

PWBFUNC f1( unsigned argData, ARG far *pArg, flagType fMeta )
{
 return(FALSE);  /* FALSE is defined as 0 in ext.h */ 
}

PWBFUNC f2( unsigned argData, ARG far *pArg, flagType fMeta)
{
 return(TRUE);   /* TRUE is defined as 1 in ext.h  */ 
}

// End of TEST.C

Sample Macros

; sample macros  for TOOLS.INI to test f1 and f2

load f1

test:=f1 ->loc1 arg "true" message => :>loc1 arg "false" message
test2:=f2 ->loc2 arg "true" message => :>loc2 arg "false" message

test:alt+t
test2:ctrl+2

				

Modification Type:MajorLast Reviewed:10/23/2003
Keywords:kb16bitonly kbfix KB63052 kbAudDeveloper