From: "Ben Davis" Newsgroups: comp.os.msdos.djgpp Subject: Some dodgy FILE hackery Date: Tue, 14 Mar 2000 22:48:21 -0000 Organization: Customer of Planet Online Lines: 17 Message-ID: <8amfqu$ue5$1@newsg2.svr.pol.co.uk> NNTP-Posting-Host: modem-78.fluvoxamine.dialup.pol.co.uk X-Trace: newsg2.svr.pol.co.uk 953074334 31173 62.136.207.78 (14 Mar 2000 22:52:14 GMT) NNTP-Posting-Date: 14 Mar 2000 22:52:14 GMT X-Complaints-To: abuse AT theplanet DOT net X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I use DJGPP and Allegro. Most of my files (eg. levels) are saved using the packfile functions of Allegro. I need to encrypt some of these files without making them bigger. I have to do the encryption manually; the built-in password function isn't secure enough. I want to intercept all the low-level file inputs/outputs (where DOS takes over from Allegro) so that I can modify the bytes at this stage. But I don't want to modify the Allegro source. The packfile functions of Allegro ultimately use read() and write(), and the DOS file handle is stored in the PACKFILE structure so I can access it readily. So, using DJGPP, is there a way to intercept read() and write() in order to encrypt/decrypt the data they are writing/reading? How do I do it? Ben Davis