Combined .com executable/DOS driver, multi-header drivers (Announce)
Just in case someone still cares about that:
DOS only checks the offset part, and never will look at the "next device header" field's segment. The offset indeed needs to be -1 to denote the last device header in an actual device chain, or the last device header in a multi-header device driver file. The trick is that (compatible) DOS doesn't care about the values until after the init request is issued to the device. This means you can fill the whole dword with garbage in the assembler and then initialize the first word with -1 (or the (near) pointer to your next header) in your init handler of the strategy or interrupt callback.
The FreeDOS kernel sources that I have examined again just now (2036 or maybe 2038) do handle this correctly, as do my current sources. (Which I wrote after I had examined MS-DOS 6.x and 7.x behaviour.)
The only thing to note on multi-header device drivers additionally is that DOS doesn't care about the segment field for these either. So all headers are in the same segment. (I.e. the first 64 KiB of the executable's image, no matter whether the .COM or .EXE file format is used.)
As for UPX, of course you can't use it on .COM/device driver executables unless it fully supported them. (As it does support .EXE/device driver executables. If it detects them correctly. It requires the whole dword to be initialized with -1 or something.) Even if you were to trick UPX into compressing the executable, it would do so either as .COM or as device driver, making the executable crash if invoked as the other format. This would make patching of the UPX header/decompressor necessary. I solved the problem by including a fake UPX header that reliably makes UPX output an error, i.e. protects the kernel/debugger from well-intentioned users that think UPX can handle everything.
---
l
Complete thread:
- "That Will Be ALL!" For UIDE and USB! - Jack, 06.06.2010, 20:37
![Open in board view [Board]](img/board_d.gif)
![Open in mix view [Mix]](img/mix_d.gif)
- "That Will Be ALL!" For UIDE and USB! - Rugxulo, 07.06.2010, 04:20
- Re: UIDE Unloading And Cache-Sizes. - Jack, 07.06.2010, 05:30
- Re: UIDE Unloading And Cache-Sizes. - Rugxulo, 08.06.2010, 01:35
- Re: UIDE Unloading And Cache-Sizes. - marcov, 08.06.2010, 23:18
- Re: UIDE Unloading And Cache-Sizes. - Rugxulo, 09.06.2010, 04:23
- Re: UIDE Unloading And Cache-Sizes. - marcov, 08.06.2010, 23:18
- Re: UIDE Unloading And Cache-Sizes. - Rugxulo, 08.06.2010, 01:35
- Re: UIDE Unloading And Cache-Sizes. - Jack, 07.06.2010, 05:30
- "That Will Be ALL!" For UIDE and USB! - Japheth, 07.06.2010, 07:51
- TSR vs DEVICE= - DOS386, 07.06.2010, 08:01
- TSR vs DEVICE= - RayeR, 08.06.2010, 15:46
- TSR vs DEVICE= - Arjay, 08.06.2010, 19:30
- TSR vs DEVICE= - RayeR, 09.06.2010, 02:00
- TSR vs DEVICE= - Japheth, 09.06.2010, 09:50
- TSR vs DEVICE= - RayeR, 09.06.2010, 16:15
- TSR vs DEVICE= - roytam, 09.06.2010, 18:18
- TSR vs DEVICE= - DOS386, 27.06.2010, 14:30
- TSR vs DEVICE= - Arjay, 08.06.2010, 19:30
- TSR vs DEVICE= - bretjohn, 18.06.2010, 21:50
- TSR vs DEVICE= - Jack, 18.06.2010, 23:29
- TSR vs DEVICE= - bretjohn, 19.06.2010, 01:18
- Nothing Against You! - Jack, 19.06.2010, 01:52
- TSR vs DEVICE= - Japheth, 19.06.2010, 09:02
- TSR vs DEVICE= - Arjay, 19.06.2010, 19:13
- TSR vs DEVICE= - bretjohn, 19.06.2010, 20:33
- TSR vs DEVICE= - Japheth, 20.06.2010, 09:04
- TSR vs DEVICE= - Arjay, 20.06.2010, 12:48
- TSR vs DEVICE= - bretjohn, 20.06.2010, 16:32
- TSR vs DEVICE= - Ninho, 20.06.2010, 17:34
- TSR vs DEVICE= - Japheth, 20.06.2010, 09:04
- TSR vs DEVICE= - Jack, 18.06.2010, 23:29
- TSR vs DEVICE= - RayeR, 08.06.2010, 15:46
- "That Will Be ALL!" For UIDE and USB! - marcov, 08.06.2010, 22:41
- "Capital Letters". - Jack, 08.06.2010, 23:15
- "Capital Letters". - marcov, 08.06.2010, 23:19
- No "Rants", But ... - Jack, 09.06.2010, 00:24
- "Capital Letters". - Arjay, 09.06.2010, 00:37
- "Capital Letters". - Jack, 09.06.2010, 00:48
- Seeking the middle ground: thinking re flexibility+realibity - Arjay, 09.06.2010, 02:29
- Bret's USB driver bugs - I was testing v0.11 by accident - Arjay, 09.06.2010, 02:50
- Seeking the middle ground ... - Jack, 09.06.2010, 04:29
- giving back a block of HMA - Ninho, 10.06.2010, 16:03
- Giving Back HMA ... - Jack, 10.06.2010, 17:03
- Giving Back HMA ... - Ninho, 11.06.2010, 09:48
- Giving Back HMA ... - Jack, 11.06.2010, 16:43
- Giving Back HMA ... - Ninho, 12.06.2010, 20:30
- Giving Back HMA ... - Jack, 11.06.2010, 16:43
- Giving Back HMA ... - Ninho, 11.06.2010, 09:48
- Giving Back HMA ... - Jack, 10.06.2010, 17:03
- Seeking the middle ground ... - Arjay, 11.06.2010, 19:29
- Seeking the middle ground ... - Jack, 11.06.2010, 21:42
- Seeking the middle ground ... - Arjay, 12.06.2010, 01:12
- Combined .com executable/DOS driver - Ninho, 12.06.2010, 14:37
- Combined .com executable/DOS driver - Arjay, 12.06.2010, 15:13
- Combined .com executable/DOS driver - Ninho, 12.06.2010, 15:49
- Combined .com executable/DOS driver - Arjay, 12.06.2010, 16:33
- Combined .com executable/DOS driver - RayeR, 13.06.2010, 10:41
- Combined .com executable/DOS driver - Arjay, 13.06.2010, 16:11
- Combined .com executable/DOS driver - Ninho, 13.06.2010, 13:24
- Combined .com executable/DOS driver - Arjay, 13.06.2010, 18:54
- Combined .com executable/DOS driver - RayeR, 13.06.2010, 10:41
- Combined .com executable/DOS driver - Arjay, 12.06.2010, 16:33
- Combined .com executable/DOS driver - Arjay, 13.06.2010, 20:42
- Combined .com executable/DOS driver - Rugxulo, 14.06.2010, 04:27
- Combined .com executable/DOS driver / RJDUMP - Arjay, 19.06.2010, 15:08
- Combined .com executable/DOS driver - Matjaz, 20.06.2010, 11:58
- Combined .com executable/DOS driver - Turbo pascal example - Arjay, 20.06.2010, 13:06
- Combined .com executable/DOS driver - Turbo pascal example - Arjay, 20.06.2010, 13:39
- Combined .com executable/DOS driver - Turbo pascal example - Arjay, 20.06.2010, 13:06
- Combined .com executable/DOS driver - Rugxulo, 14.06.2010, 04:27
- Combined .com executable/DOS driver - Ninho, 12.06.2010, 15:49
- Combined SYS device drivers - more than 1 driver in a file - Arjay, 21.06.2010, 17:48
- Combined .com executable/DOS driver, multi-header drivers - ecm, 10.08.2010, 18:49
- Combined .com executable/DOS driver, multi-header drivers - Arjay, 10.08.2010, 19:41
- Combined .com executable/DOS driver, multi-header drivers - ecm, 10.08.2010, 20:21
- Combined .com executable/DOS driver, multi-header drivers - Arjay, 10.08.2010, 19:41
- Combined .com executable/DOS driver - Arjay, 12.06.2010, 15:13
- Combined .com executable/DOS driver - Ninho, 12.06.2010, 14:37
- Seeking the middle ground ... - Arjay, 12.06.2010, 01:12
- Seeking the middle ground ... - Jack, 11.06.2010, 21:42
- giving back a block of HMA - Ninho, 10.06.2010, 16:03
- Seeking the middle ground: thinking re flexibility+realibity - Arjay, 09.06.2010, 02:29
- "Capital Letters". - Jack, 09.06.2010, 00:48
- "Capital Letters". - marcov, 08.06.2010, 23:19
- "Capital Letters". - Jack, 08.06.2010, 23:15
- No "Removable" HARD Disks Supported By UIDE! - Jack, 08.06.2010, 23:57
- "That Will Be ALL!" For UIDE and USB! - bretjohn, 15.06.2010, 22:47
- Further Comments ... - Jack, 16.06.2010, 01:35
- "That Will Be ALL!" For UIDE and USB! - Rugxulo, 17.06.2010, 12:07
- "That Will Be ALL!" For UIDE and USB! - bretjohn, 17.06.2010, 16:53
- "That Will Be ALL!" For UIDE and USB! - Rugxulo, 17.06.2010, 17:45
- "That Will Be ALL!" For UIDE and USB! - bretjohn, 17.06.2010, 16:53
- "That Will Be ALL!" For UIDE and USB! - Rugxulo, 07.06.2010, 04:20
Mix view