[comp.sys.mac.programmer] PrDrvrClose cause system crash

GG.RAL@forsythe.stanford.edu (Rich Levitt) (02/03/89)

I'm trying to print on a directly connected Imagewriter using
the following sequence (MPW 2.0.2 C):

.
.
char pBuff[128];
long pBuffDataLen;
        PrDrvrOpen();
        PrCtlCall(iPrDevCtl,lPrDocOpen,0,0);
        PrCtlCall(iPrDevCtl,lPrPageOpen,0,0);
        PrCtlCall(iPrIOCtl,(long)pBuff,pBuffDataLen,0);
        PrCtlCall(iPrDevCtl,lPrPageClose,0,0);
        PrCtlCall(iPrDevCtl,lPrDocClose,0,0);
        PrDrvrClose();
.
.

Everything works ok until the PrDrvrClose call which causes
the system to crash.  Removing that call seems to cure the
problem however Chooser then thinks the printer is still
busy and won't let me change print devices.  If I remove the
iPrIOCtl call (which sends the data) the PrDrvrClose call
works fine and Chooser is happy.  I get the same results
under Finder or Multi-finder.

The system is 6.0.2 and the Imagewriter driver is version
2.7 (which was distributed with 6.0.2) running on a Mac II.
Any insights would be greatly appreciated.

Rich Levitt             INTERNET: ral@lindy.stanford.edu
Stanford University       BITNET: gg.ral@stanford