BTTR Software

Home

Products

Hosted products

Ports & builds

Articles

Links

Forum

Articles /
A fix for the RENAME bug in OEM DR-DOS 7.04/7.05

First published on September 03, 2003 by Michal H. Tyc a, b
a) BTTR Software, http://www.bttr-software.de/
b) Institute of Physics, Wroclaw University of Technology, 50-370 Wroclaw, Poland

Abstract. A patch for OEM DR-DOS 7.04/7.05 is presented, which fixes the known bug in the RENAME function and makes this kernel more suitable for emergency FAT32 access and testing its FAT32 support. The patch is applied by means of a hexadecimal DEBUG script. No part of source code is presented in human-readable form.

Contents

Introduction

The last official release of DR-DOS by Caldera, Inc. is 7.03, dated January 7, 1999. However, there is an OEM version dated 1998 with IBMBIO.COM and IBMDOS.COM reporting itself as 7.04, and COMMAND.COM as 7.05. It was never publicly released, but it is shipped with some hard disk recovery and maintenance tools by Kroll Ontrack and Seagate Technology as operating system for their boot diskettes; at least some of these tools are available for download from the websites of their distributors.

This OEM version of DR-DOS (or, rather, DR-DOS kernel, because other system files are identical as in version 7.03) natively supports FAT32 drives and LBA addressing, giving full access to modern large hard disks. Unfortunately, as an OEM version not intended for regular use, it misses some features (one which the author certainly knows about is support for DR-DOS passwords) and is not yet fully compatible with MS-DOS 7.10 at API level, which may fool some application thinking that a system supporting FAT32 must be DOS 7.10+. Even worse, it appeared soon that it has a nasty bug which prevents the DOS RENAME function (INT 21h/AH=56h) from working in most cases, therefore breaking such a basic functionality like editing text files with backup copy creation (like with DR-DOS EDIT).

As it is known, DR-DOS was taken over by DeviceLogics, Inc. (now DRDOS, Inc.) in the end of 2002, and a forthcoming new release has been announced. It can be guessed that the new DR-DOS will be at least partially based on the 7.04/7.05 version. It is also known (also from author's own experience) that the FAT32 support offered by the 7.04 kernel is not perfect yet. Therefore, it is possible that the DR/OpenDOS community can help the developers by testing this kernel on wide variety of FAT32 disks.

This article presents a patch that fixes the RENAME bug, hence making the kernel much more useful either for emergency FAT32 access (e.g., for moving files between DOS FAT16 and MS Windows FAT32 disks) or simply for testing the FAT32 support.

Research and preparation of the patch

Obviously, the bug had to be located and fixed without access to the source code of the OEM DR-DOS 7.04 kernel. Fortunately, sources of one of its predecessors, OpenDOS 7.01, were once made available for download by Caldera, Inc. Therefore it was possible to partially decompile the OEM kernel and compare the debugger output with OpenDOS 7.01 sources in order to understand its working.

The details of the bug tracking are not published, as it would be in author's opinion beyond fair use conditions. But it can be frankly said, that the error at the source code level which (in author's imagination) resulted in the RENAME bug was of particularly malicious and hard to locate kind. The author a few times wasted many hours to correct mistakes of this kind in his own programs.

Small parts of the code had to be re-written, and some other parts had to be moved by a few bytes to still fit in the old frames. The changed part was assembled (with DEBUG) to a binary file. Then differences between this file and the corresponding block extracted from the original kernel were found (with FC /B command), and the result was converted to a DEBUG script, which reads the kernel, modifies it and writes back. This approach was chosen to avoid copyright violation by publishing parts of the source code in human-readable form or complete patched kernel file.

Applying the patch

The patch is applicable to IBMDOS.COM version 7.04, size 33,250 bytes. Its time and date may vary, depending on the OEM product that your copy of DR-DOS 7.04 was shipped with. To further ensure that one has the version that is referred to, the VERSION command from DR-DOS 7.03 should be used:

[DR-DOS 7.03] C:>VERSION A:\IBMDOS.COM

It should report:

IBMDOS.COM:
   Version 7.04 (990819).
   Copyright (C) 1983-1998 Caldera, Inc. All rights reserved.
   Checksum is 1A0C48DAF614D8E181E2.

Then, a backup of original IBMDOS.COM should be made. It should be noted that to modify the system file its attributes need to be changed first. Then DEBUG can be run with input redirected from the script file, presented in Listing 1. The whole session may look as follows:

[DR-DOS 7.03] C:>A:
[DR-DOS 7.03] A:>ATTRIB -R-S-H IBMBIO.COM
[DR-DOS 7.03] A:>COPY IBMBIO.COM *.BAK
[DR-DOS 7.03] A:>DEBUG <PATCH704.DBG
[DR-DOS 7.03] A:>ATTRIB +R+S+H IBM*.*

Now the system can be rebooted from the diskette and the patch may by tested by attempting to rename a file on hard disk (accidentally, RENAME at least sometimes works on diskettes, even with the bug).

Listing 1. The DEBUG script. It should be saved as file PATCH704.DBG; blank lines are important and should be kept
N IBMDOS.COM
L 1000
R DI=49DD

E DI+0036
87 DB FF 36 2A 12

E DI+0055
CB

E DI+0070
79

E DI+007D
6C

E DI+00A0
65

E DI+00A5
07 58 50 E8 84 00 EB 0A F6 06 F3 11 10 75 53 E8

E DI+00B5
CB 26 BE DD 11 8B 3E 28 12 B9 0B 00 F3 A4 BE F3

E DI+00C5
11 B1 15 F3 A4 E8 48 2D E8 74 00 74 18 BE C7 11

E DI+00D5
BF C2 11 A5 A5 A4 58 50 E8 4F 00 8B 1E 28 12 C6

E DI+00E5
07 E5 E8 2B 2D 36 83 3E 72 05 00 74 17 E8 22 02 8F 06

E DI+00F9
33 C0 A3 2E 12 E8 43 23 74 07 E9 16 FF E9 55 F4 58

E DI+0133
33 C0 A3 2E 12 A3 6C 12 91 E9 08 23

W 1000
Q
Q

Additional notes

The patched kernel should access FAT16X (LBA-addressed, i.e., located beyond the 8 Gbytes limit) and FAT32/FAT32X hard disk partitions, although it apparently has problems with some FAT32 disks.

It should be noted that it can boot only from diskette or standard FAT16 disks, as it is not accompanied with SYS program that could write a boot sector compatible with LBA and FAT32. Hard disks must be SYS-ed under DR-DOS 7.03, and then system files replaced with OEM DR-DOS 7.04/7.05 by simple copying. It is not recommended to permanently replace the 7.03 kernel with 7.04 one (the latter is not designed for common use).

Drive letter assignment may change when switching between DR-DOS 7.03 and 7.04, because: (1) some disks can be seen by 7.04 only, (2) 7.04 apparently uses different (MS-DOS compatible) rules of drive letter ordering.

Disclaimer and legal notes

DR-DOS is copyrighted software; the author of the patch owns a licensed copy of DR-DOS 7.03. The source code of the patch will not be presented to anyone except employees of DeviceLogics, Inc.

This patch comes WITHOUT ANY WARRANTY. You are using it at your own risk. Neither the author nor DeviceLogics, Inc. are responsible for any data loss resulting from use of this patch.

All registered names and trademarks in this document are used solely for identification purposes.

Acknowledgements

The author wishes to thank DeviceLogics, Inc. for permitting this publication and Matthias Paul for finding a few mistakes in the text and suggesting doubled Q at the end of the DEBUG script.

Page last modified on May 05, 2006.
Copyright © 1997-2024 BTTR Software. All rights reserved.
Favicon contributed by Paul Blair. Used with permission.

Valid HTML 4.01 Transitional