Article View: comp.os.os2.programmer.misc
Article #264Re: HELP!!!: Doing INs and OUTs under OS/2 with BCC
From: David Bolen
Date: Tue, 06 Jul 1993 13:22
Date: Tue, 06 Jul 1993 13:22
53 lines
2776 bytes
2776 bytes
In article <16C02748F.CSCHUBER@bcsc02.gov.bc.ca> CSCHUBER@bcsc02.gov.bc.ca writes: >I've been having the same problem. I don't have the answer for you but >hopefully I can add to the problem description. I've created a DLL, actually >written by Michael Thompson (tommy@msc.cornell.edu). The .DEF file contains >LIBRARY PORTIO >CODE PRELOAD EXECUTEONLY IOPL >SEGMENTS _TEXT CLASS 'CODE' IOPL PRELOAD EXECUTEONLYSEGMENTS P@IOCODE CLASS 'COD >EXPORTS > @inp > @outp > @inpw > @outpw You need to remember to specify the number of words to transfer from the stack. This is important because the IOPL segment runs within a different privilege ring, which has an independent stack. During the transition to ring 2 (IOPL), OS/2 will transfer the specified number of 16-bit words from the callers stack to the ring 2 stack, which will allow the functions to locate their arguments appropriately. What you are probably running into with your exception is that the functions are looking up in the stack expecting to see their arguments and are overrunning the top of the stack since nothing was ever pushed there. I'm not sure I remember the exact definitions of these functions, but I think it was something like: inp (unsigned) inpw (unsigned) outp (unsigned, int) outpw (unsigned unsigned) so you're basically talking about one or two 16-bit arguments. Just change your exports to: inp 1 inpw 1 outp 2 outpw 2 and I think you'll be ok. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ Internet: db3l@ans.net / | Advanced Network & Services, Inc. \ Phone: (914) 789-5327 | / 100 Clearbrook Road, Elmsford, NY 10523 \ Fax: (914) 789-5310 \ \-----------------------------------------------------------------------/
Technical Details
Message-ID:
<1993Jul6.172008.38205@ans.net>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!news.ans.net!ans.net!db3lReferences:
<1993Jul2.165507@mantrasun2.epfl.ch> <16C02748F.CSCHUBER@bcsc02.gov.bc.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cd94,a442a22b1f775864 X-Google-Attributes: gid10cd94,public X-Google-Thread: 11307a,84a9ad67f9ec3d31 X-Google-Attributes: gid11307a,public X-Google-ArrivalTime: 1993-07-06 10:30:18 PST Newsgroups: comp.os.os2.programmer.misc,bit.listserv.os2-l Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!news.ans.net!ans.net!db3l From: db3l@ans.net (David Bolen) Subject: Re: HELP!!!: Doing INs and OUTs under OS/2 with BCC Sender: news@ans.net (News Administrator) Message-ID: <1993Jul6.172008.38205@ans.net> In-Reply-To: CSCHUBER@bcsc02.gov.bc.ca's message of Mon, 05 Jul 93 08: 17:16 PDT Date: Tue, 6 Jul 1993 13:22:04 GMT References: <1993Jul2.165507@mantrasun2.epfl.ch> <16C02748F.CSCHUBER@bcsc02.gov.bc.ca> Organization: Advanced NeAtwork & Services, Inc. - Elmsford, NY Lines: 53