Article View: comp.os.os2.programmer.misc
Article #182Calling 16 bit code: special considerations? (DosMonXxx)
From: Keith Bennett
Date: Mon, 01 May 1995 00:00
Date: Mon, 01 May 1995 00:00
50 lines
2816 bytes
2816 bytes
I need some serious help understanding the calling of 16 bit code. I'm using the DosMonXxx calls to create a printer monitor that intercepts printer output. It has worked fine on occasion, but every time I make a modification I experience a different bug or an occasional success. Because of this I suspect that it has something to do with byte alignment or addresses, something that might shift when code is added or changed. The calls are being packaged in a DLL which is used by several executables. At times they were successful in some .exe's but not in others. Now they uniformly fail on the DosMonOpen(). I have the DosMon calls prototyped as follows: typedef SHORT HFILE16; typedef HFILE16 *PHFILE16; APIRET16 APIENTRY16 Dos16MonRead ( PUCHAR, USHORT, PMONITORPACKET, PUSHORT); APIRET16 APIENTRY16 Dos16MonWrite ( PUCHAR, PMONITORPACKET, USHORT); APIRET16 APIENTRY16 Dos16MonOpen ( PSZ, PHFILE16); APIRET16 APIENTRY16 Dos16MonClose ( HFILE16); APIRET16 APIENTRY16 Dos16MonReg ( HFILE16, PUCHAR, PUCHAR, USHORT, USHORT); Lately I've been getting an error on the first DosMon function called, Dos16MonOpen(). It returns 380, which means Invalid Device Name. I've tried "lpt1", "lpt1:", "lpt2", and others. Yet I know it's not the actual name that's wrong because this call has succeeded before. For a while a couple of days ago, this call always succeeded, but the next call, Dos16MonReg() failed with an error code of 379, Invalid Parameters. Is there something special I have to do to the parameters to make them usable by the 16-bit functions? Or does the compiler do that automatically when it sees APIENTRY16 in the prototype? By the way, I'm using the C/Set++ 2.1 compiler, and running this under OS/2 2.1. Any help would be ***greatly*** appreciated. In the US and Cananda, call me collect if you like from 11 AM to 6 PM eastern time at (703) 941-5952. Electronic responses are also welcome. Sweating, Keith -- -------------------------------------------------------------------------- Keith Bennett Bennett Business Solutions, Inc. Silver Spring, MD USA OS/2 & DOS Software Development kbennett@cpcug.org (301) 871-7696
Technical Details
Message-ID:
<3o40gu$2ji@cpcug.org>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cd94,97ba1f88170614c3,start X-Google-Attributes: gid10cd94,public X-Google-Thread: 11307a,97ba1f88170614c3,start X-Google-Attributes: gid11307a,public From: kbennett@cpcug.org (Keith Bennett) Subject: Calling 16 bit code: special considerations? (DosMonXxx) Date: 1995/05/01 Message-ID: <3o40gu$2ji@cpcug.org> X-Deja-AN: 101878377 organization: Express Access Online Communications USA: 800-969-9090 newsgroups: comp.os.os2.programmer.misc,bit.listserv.os2-l