X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <4010E5D7.4050907@hccnet.nl> Date: Fri, 23 Jan 2004 10:13:59 +0100 From: Rob Hamerling User-Agent: Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en, fr, nl, de-de MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: error 4 with write to serial port References: <40101D96 DOT 8070103 AT hccnet DOT nl> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Hello Andrew, Andrew Cottrell wrote: >>I have built a DOS program with DJGPP to access a serial port. >>This program works fine under plain DOS (ic IBM PC/DOS 6.3). >>However when I boot from a bootable diskette created with >>WinXP and start the program it returns error 4 with a write() >>to the serial port. > > You don't mention the comms method you used. I'm using file-I/O functions (open/write/read/close). I want to stick to this method, because the original is an OS/2 program. DJGPP allows me to generate a DOS-version with only minor differences (for which I use a pre-oprocessor directive). And as I said the DOS version runs perfectly under 'normal' DOS! A quote from the 'errno' info of DJGPP: > `4' > EACCES - Permission denied. Attempt to write to a read-only file, > or remove a non-empty directory, or open a directory as if it were > a file, etc. In essence, it's a DOS way of saying "You can't do > that, but I'm too stupid to know why." So I must conclude that the bootable diskette generated under XP contains a 'stupid' subset of DOS. Well, it looks like DOS, it may be not DOS at all (although it starts my program!). > be aware that under XP using a 16 bit app you cannot access the > hardware, but with DJGPP beign 32 bit DPMI you can and do have access > to the hardware under XP. This is not to say that when performing > int21 or other intxx calls that they work correctly due to XP puting > in hooks and redirecting the call!!!!! I'm not familiar with Windows (any version), and I don't know how a program generated with DJGPP accesses the serial port when using file-I/O functions. > There are a number of comms libraries in the V2TK directory with > varying features, so have a look a good look at your requirements > before you start. I know, but this doesn't fit my requirements (having a source compatible DOS-version of my OS/2 program). > I have data sniffer that I can send to you with full source code > (relased under GPL by me) that works under XP if you need to see how > it can be done. Thank you, but I don't work with XP. The DOS-version of my program is not meant to run under XP, but in a plain DOS environment. The reason for this excercise (building a bootable 'DOS'-diskette under XP) is to make my program useable for XP-only users. Regards, Rob. -- Rob Hamerling, Vianen, NL phone +31-347-322822 homepage: http://www.robh.nl/