home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 14 Text / 14-Text.zip / C6_BUGS.ZIP / C6_20053.BUG < prev    next >
Text File  |  1990-09-11  |  2KB  |  75 lines

  1. Q61872 DosDevIOCtl() Category 5 Subfunction 66H Fails with C 6.00 API
  2. Microsoft C Compiler (C)
  3. 6.00   | 6.00
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.  
  8. The DOS version of DosDevIOCtl() Category 5 Subfunction 66H, found in
  9. the API.LIB shipped with Microsoft C version 6.00, fails in native
  10. DOS. The failure consists of returning an invalid printer status byte,
  11. regardless of the printer's current status.
  12.  
  13. More Information:
  14.  
  15. The DosDevIOCtl() function is used to determine printer status.
  16. Although the function seems to work correctly when used from either
  17. OS/2 or the DOS compatibility box of OS/2, it fails when run from
  18. native DOS. When called, this function sets the value pointed to by
  19. its first parameter to a status byte whose bits have the following
  20. significance.
  21.  
  22.    Bit(s)  Significance (if set)
  23.    ------  ---------------------
  24.  
  25.    0       Timed Out
  26.    1-2     Reserved
  27.    3       I/O error
  28.    4       Printer selected
  29.    5       Out of paper
  30.    6       Acknowledge
  31.    7       Printer not busy
  32.  
  33. The failure of this function results in a status byte value of 2 being
  34. returned from the function regardless of the printer's status. This is
  35. particularly bad because 2 is not even a valid return value for this
  36. function. If the Microsoft C version 5.10 API.LIB is used, the
  37. function works correctly, returning a status of 144 if the printer is
  38. ready and 24 if the printer is off line. The only known workaround is
  39. to use the earlier version of the library for this function call.
  40.  
  41. To reproduce the problem, create a bound version of the following
  42. program using the C 6.00 API.LIB and run it on a computer physically
  43. connected to a printer under native DOS:
  44.  
  45. Sample Code
  46. -----------
  47.  
  48. #define INCL_DOSDEVICES
  49. #define INCL_DOSFILEMGR
  50. #include<os2.h>
  51. #include<stdio.h>
  52.  
  53. void main(void)
  54. {
  55.  int handle;
  56.  unsigned char pfstat,x=0;
  57.  unsigned short actiontaken;
  58.  unsigned short p;
  59.  
  60.  p=DosOpen("lpt1",&handle,&actiontaken,0l,0,0x0001,0x0041,0l);
  61.  p=DosDevIOCtl(&pfstat,&x,0x0066,0x0005,handle);
  62.  
  63.  printf("pfstat=%d \n",(int)pfstat);
  64.  
  65. }
  66.  
  67. Microsoft has confirmed this to be a problem with C version 6.00. We
  68. are researching the problem and will post new information here as it
  69. becomes available.
  70.  
  71. Keywords:  buglist6.00
  72.  
  73. COPYRIGHT Microsoft Corporation, 1990.
  74. Updated  90/06/14 06:15
  75.