🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2698

Re: Windows3/TSR interface HELP

#2698
From: ROGER JAMES
Date: Thu, 16 May 1991 18:44
31 lines
2199 bytes
In article <1991May15.133642.40@mgc.uucp> dave@mgc.UUCP (Dave Lockwood) writes:
>
>I'm trying to write a Windows 3 application which needs to interface to a
>DOS TSR which communicates via an interrupt. Everything works fine in real
>mode, but I get UAEs and reboots in both standard and 386 enhanced mode.
>
>My suspicions are that lpBuffer above is a 'selector' (whatever that is)
>rather than a true, _far address, and when the TSR (assembler) uses the
>ES:DI register pair, some sort of protect trap takes place.
>
Your suspiscions are correct. The TSR needs to be a passed an address that
is valid in real mode (i.e it is a segment/offset rather than a selector/offset
). You can allocate a buffer that has such a valid address by using the
GlobalDOSAlloc function. However you will not be able to pass this address
to your TSR in a segment register. This will cause a UAE. You can pass
this address in a non segment register, which is the easiest way to do it
if you have access to the source of the TSR. If you dont have access to
the source then _here comes the bit you dont want to hear_. You need
to call your TSR via DPMI, there are various examples of how to do this
knocking around on Online and Compuserve, it is not straightforward.
Here comes the _next bit you dont want to hear_. If the buffer you passed
to the TSR is going to be used at interrupt time (i.e. from within a
hardware interrupt service routine). Then your system will crash
whenever you run DOS shells from windows. There are a number of ways round
this, all of which are very messy.


-- 
roger@bj.co.uk 				(UK only)
roger@boldon-james-limited.co.uk	(Internet)
..!mcsun!ukc!pyrltd!bjcong!roger
Technical Details
Message-ID: <1390@bjcong.bj.co.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!pyrltd!bjcong!roger
References: <1991May15.133642.40@mgc.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!pyrltd!bjcong!roger
From: roger@bjcong.bj.co.uk (ROGER JAMES)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Windows3/TSR interface HELP
Keywords: win3 tsr interrupt selector far
Message-ID: <1390@bjcong.bj.co.uk>
Date: 16 May 91 18:44:31 GMT
References: <1991May15.133642.40@mgc.uucp>
Reply-To: roger@bjcong.UUCP (ROGER JAMES)
Organization: Boldon James Limited (Congleton, UK)
Lines: 31