🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.os2.programmer.misc
2 messages
2 total messages Started by Keith Bennett Mon, 01 May 1995 00:00
Calling 16 bit code: special considerations? (DosMonXxx)
#182
Author: Keith Bennett
Date: Mon, 01 May 1995 00:00
50 lines
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
Re: Calling 16 bit code: special considerations? (DosMonXxx)
#181
Author: Keith Bennett
Date: Tue, 02 May 1995 00:00
12 lines
1105 bytes
Please disregard the previous message.  The problem had nothing to do 
with the obscurity of the 16 bit calls.  I was inadvertently passing a 
device name of "LPT1   [some more text]"  instead of just "LPT1".  Of 
course the open failed!

- Keith

-- 
--------------------------------------------------------------------------
Keith Bennett                             Bennett Business Solutions, Inc.
Silver Spring, MD USA                     OS/2 & DOS Software Development
kbennett@cpcug.org                        (301) 871-7696
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads