Реферат: Making Utilities For MSDOS Essay Research Paper
intentionally in order to get an unfair advantage over its competitors. My
reasoning for this was that Microsoft’s own utilities have never stopped working
with a new DOS version.
To find the magic of “correct” use of DOS internals, I started disassembling
Microsoft’s utilities. First I looked at three DOS external commands, SHARE,
JOIN, and SUBST. All three programs check for exact DOS version number match.
This means that they can work only with one specific version of MS-DOS. This
makes sense, given that these utilities are bundled with MS-DOS and can be
considered to be parts of MS-DOS. One of the utilities, SHARE, unlike other DOS
external commands, accesses the DOS kernel variables by absolute offsets in
DOSGROUP, the DOS kernel data segment, in addition to getting pointers to
certain DOS internal structures and accessing their fields. SHARE not only
checks the MS-DOS version number, but also checks the flag at offset 4 in
DOSGROUP. In DOS Internals, Geoff Chappell says that this flag indicates the
format (or style) of DOSGROUP layout (501). If you look at the MS-DOS source
code (I’ll explain how to do it in a few paragraphs), you’ll see that programs
like SHARE access the kernel variables in the following way:
The kernel modules defining these variables in DOSGROUP are linked in with
SHARE’s own modules. Since the assembler always works the same way, the DOS
kernel variables get the same offsets in the SHARE’s copy of DOSGROUP as in the
DOS kernel’s copy. When SHARE needs to access a DOS kernel variable, it loads
the real DOSGROUP segment into a segment register, tells the assembler that the
segment register points to SHARE’s own copy of DOSGROUP, and accesses the
variable through that segment register. Although the segment register points to
one copy of DOSGROUP and assembler thinks that it points to another one,
everything works correctly because they have the same format. The reader can
drawn the following conclusion from this aside: MS-DOS designers have made the
MS-DOS internal structures accessible to other programs only for DOS’own use
(since linking DOS modules in with a program is acceptable only for the parts of