Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!digi.lonestar.org!cfoughty From: cfoughty@digi.lonestar.org (Cy Foughty) Newsgroups: comp.os.os2.programmer Subject: Problem with OS/2 monitor program Message-ID: <1544@digi.lonestar.org> Date: 17 Jan 91 20:47:38 GMT Organization: DSC Communications, Plano Tx. Lines: 76 The function "DosMonReg()" returns an "8" (ERROR_NOT_ENOUGHT_MEMORY) in the following following program. I'm running OS/2 1.2 WR4098 and compiling under Microsoft "C" 6.0 running PWB. It compiles and links fine. The machine I'm using is an IBM PS/2 Model 80 with 8 megabytes of ram and 330 megabyte winchester. No other processes, other than the standard OS/2 processes, were running. What am I doing wrong? #include #include #include #define INCL_BASE #include MONIN moninOutput ; MONIN moninInput ; #define MAXBUFF 0x7fff VOID main(int argc,char **argv) { USHORT usFlag ; USHORT usRtnCode ; HMONITOR hmonDevice ; BYTE bCom = 0 ; PUCHAR pucInBuff ; USHORT usMax = MAXBUFF ; USHORT usIndex ; usRtnCode = DosMonOpen(argv[1],&hmonDevice) ; if(usRtnCode){ printf("Error:could not open %s\n",argv[1]) ; exit(-1) ; } usRtnCode = DosDevIOCtl(0L,&bCom,0x0060,0x000b,hmonDevice) ; if(usRtnCode){ printf("Error:%s dos not support monitors\n",argv[1]) ; usRtnCode = DosMonClose(hmonDevice) ; exit(-1) ; } pucInBuff = (PUCHAR)calloc(1,MAXBUFF) ; usIndex = 0 ; usRtnCode = DosMonReg( hmonDevice, (PBYTE)&moninInput, (PBYTE)&moninOutput, MONITOR_BEGIN, usIndex) ; if( usRtnCode ){ printf("Error:DosMonReg returned %d\n",usRtnCode) ; usRtnCode = DosMonClose(hmonDevice) ; exit(-1) ; } usFlag = TRUE ; while(usFlag){ usRtnCode = DosMonRead((PBYTE)&moninInput,DCWW_WAIT,(PBYTE)pucInBuff,&usMax) ; if(usRtnCode){ usRtnCode = DosMonClose(hmonDevice) ; usFlag = FALSE ; } printf(":%s:\n",pucInBuff) ; } usRtnCode = DosMonClose(hmonDevice) ; if(usRtnCode){ printf("Error:could not close %s\n",argv[1]) ; exit(-1) ; } exit(0) ; } -- Cy Foughty DSC Communications, Inc. 1000 Coit Rd., Plano,TX 75075 Work:214.519.4237 La Casa:214.578.8837 Don't compromise your compromises.