EXTENDING DOS a Programmers's Guide to Protected-Mode DOS Second Edition

Total Page:16

File Type:pdf, Size:1020Kb

EXTENDING DOS a Programmers's Guide to Protected-Mode DOS Second Edition EXTENDING DOS A Programmers's Guide to Protected-Mode DOS Second Edition Edited by Ray Duncan Ray Duncan Charles Petzold Andrew Schulman M. Steven Baker Ross P. Nelson Stephen R. Davis Robert Moote Addison-Wesley Publishing Company, Inc. Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario Wokingham, England Amsterdam Bonn Sydney Singapore Tokyo Madrid San Juan Paris Seoul Milan Mexico City Taipei Chapter 1—Programming the IBM PC j By Ross P. Nelson DOS Lives -i The Quest for RAM 2 The IBM PC Architecture 5 A New Family Member 7 Solving Real Problems IQ Using Protected Mode 25 DOS Extenders 23 Intel's 32-bit Microprocessors 24 Operating Environments 3Q What About OS/2? 31 Choosing Your Market 32 Chapter 2—Expanded Memory and the EMS 35 By Ray Duncan Components of Expanded Memory 37 Obtaining Access to Expanded Memory 40 Using Expanded Memory 44 EMS Pitfalls for Drivers and TSRs 49 EMS Emulators 52 EMS Example Program 54 Chapter 3—Extended Memory and the XMS 75 By Ray Duncan Reaching Extended Memory in Real Mode 78 The ROM BIOS Extended Memory Functions 79 Primitive Extended Memory Management 85 The eXtended Memory Specification (XMS) EXTENDING DOS, Second Edition Programming Example: The XMSDISK.SYS Driver 96 XMS Example Program 97 LOADALL: The Back Door to Extended Memory 116 Chapter 4—16-bit Protected-Mode DOS Extenders 121 By Andrew Schulman 123 Isn't the 286 Outdated? 124 DOS: The Outer Limits Protected-Mode MS-DOS ^7 No More Overlays BigMalloc Protected-Mode C++ Creating the Illusion 143 INT 21h Isn't Enough 146 The RUN286 Loader 150 Compatibility 153 Debugging with CVP and TDW under DOS 159 Isn't There Any Work Involved? 162 Bugs! 164 Real-Mode Practices 173 Limits to Transparency 188 New Features 191 Benefits and Limitations 295 Chapter 5—32-bit Protected-Mode DOS Extenders By M. Steven Baker 196 Looking Back in Time 202 Onward to 32 Bits 206 Benefits of Using 386 Protected-Mode DOS Extenders 20216 The 386 Dos Extenders—How They Work 220 Software Interrupt Processing 223 Hardware Choices 228 Moving to 32-bit Programming—It's Easy 229 A Simple C Example n Similarities and Differences Between 386 DOS Extenders IM Contents How Windows 3.0 Bugs Affect DOS Extenders 252 Special DOS Extender Features 263 A Simple 386 DOS Extender Application 277 Summary 2«9 Chapter 6—The Windows Operating Environment 291 By Charles Petzold Windows: A GUI for MS-DOS 292 The Future of Windows 296 Commitments and Trade-offs 298 Architecture and Features 299 A Sample Program 319 The 32-Bit Future 343 Chapter 7—DESQview ^45 By Stephen R. Davis Quarterdeck Expanded Memory Manager 345 DESQview 348 The DESQview API 350 The Clock Example 353 Windowing 3g4 Panels 368 DESQview Tasks 372 DESQview Processes 376 Memory Under DESQview 379 Intertask Communication 3g4 Intertask Messages 3og How DESQview Uses Messages 393 Why Use DESQview? 401 Chapter 8—VCPI for EMS/DOS Extender Compatibility 403 By Robert Moote End-User Encounters with VCPI 404 Why VCPI: Incompatibilities Between EMS Emulators and DOS Extenders 407 The VCPI Interface 412 vi EXTENDING DOS, Second Edition ScenarioofVCPIUse 418 InsideVCPI 423 Summary 4^2 Chapter 9—The DOS Protected-Mode Interface (DPMI) 433 By Ray Duncan The Politics of Protected Mode 434 The DPMI Programming Interface 438 Using DPMI Functions 443 Programming Example: TheTINYDOSX.ASM DOS Extender 448 Chapter 10—Multitasking and DOS Extenders 463 By Robert Moote Windows Standard Mode 464 Windows Enhanced Mode and DPMI 465 DESQview and VCPI 476 Windows/DPMI vs. DESQview/VCPI 481 482 Summary 483 Appendix A 491 Appendix B 495 Appendix C 499 Appendix D 511 Appendix E Exploring Protected Mode with Instant-C 511 Using Protection 515 Appendix F ^ Documents and Specifications 5zy Index 531 .
Recommended publications
  • Software Requirements Specification
    Software Requirements Specification for Connectome Version 3.0 Prepared by: 1. Jon Schuck 2. Kennan Meyer 3. Nate Bender 4. Sheik Hassan 5. Khaled Alhendi 6. Bairavi Venkatesh 7. Kevin Garrone Senior Design Project Advisor: Mr. Jeff Salvage Fall 2016 to Spring 2017 1 Table of Contents Revision History.............................................................................................................................. 4 1. Introduction ............................................................................................................................. 5 1.1. Purpose ............................................................................................................................. 5 1.2. Overview .......................................................................................................................... 5 1.3. Product Scope ................................................................................................................... 6 1.3.1. In Scope .................................................................................................................... 6 1.3.2. Out of Scope ............................................................................................................. 7 1.4. Definitions ........................................................................................................................ 7 2. Overall Description ................................................................................................................. 9 2.1. Hardware Functions
    [Show full text]
  • Guidelines for Tools Development and Operating Environments
    Managing social, behavioral and economic data and metadata Guidelines for Tools Development and Operating Environments Author/Maintainer Pascal Heus, Open Data Foundation Contributors Jack Gager(Metadata Technology), Jannick Jensen (Danish Data Archive), Herve Lhours (UKDA) Version 2010-08-03 Table of Contents Overview....................................................................................................................................................2 Product Development.................................................................................................................................3 Environment.......................................................................................................................................... 3 Collaborative environment.................................................................................................................... 4 Licensing............................................................................................................................................... 5 Products Guide...........................................................................................................................................8 Overview............................................................................................................................................... 8 Web server software.............................................................................................................................. 8 Rich client Platforms...........................................................................................................................10
    [Show full text]
  • Standard Operating Environment Guideline
    STANDARD This guideline outlines the scope OPERATING and approach to the Computer Desktop Standard Operating ENVIRONMENT Environment (SOE) implemented by GUIDELINE Massey University. This guideline is intended to apply to computers and devices owned by Massey University and supported by Information Technology Services. Standard Operating Environment Guideline Purpose Massey University Information Technology Services (ITS) support a Standard Operating Environment (SOE) for desktop and notebook computers. The SOE is designed to ensure that the large number of desktop and notebook computers provide the necessary functionality to staff and students; can be loaded with a standard software image, maintained, updated, audited and repaired by ITS staff in a manner that improves availability and reliability, with a minimum disruption to staff and students; and at a cost that is appropriate to the University. The delivery of the Standard Operating Environment (SOE) to client computers is achieved through automated deployment and management tools. The expanded use of automation tools across all levels of ITS infrastructure, systems and services is designed to minimise support costs. The maintenance of desktop computers is most efficiently managed and delivered through the deployment of operating systems, software applications, patches and updates via online desktop management applications and tools. As part of its objective to provide cost effective and efficient management of ICT resources, Information Technology Services (ITS) maintains a Standard
    [Show full text]
  • Beyond MOV ADD XOR – the Unusual and Unexpected
    Beyond MOV ADD XOR the unusual and unexpected in x86 Mateusz "j00ru" Jurczyk, Gynvael Coldwind CONFidence 2013, Kraków Who • Mateusz Jurczyk o Information Security Engineer @ Google o http://j00ru.vexillium.org/ o @j00ru • Gynvael Coldwind o Information Security Engineer @ Google o http://gynvael.coldwind.pl/ o @gynvael Agenda • Getting you up to speed with new x86 research. • Highlighting interesting facts and tricks. • Both x86 and x86-64 discussed. Security relevance • Local vulnerabilities in CPU ↔ OS integration. • Subtle CPU-specific information disclosure. • Exploit mitigations on CPU level. • Loosely related considerations and quirks. x86 - introduction not required • Intel first ships 8086 in 1978 o 16-bit extension of the 8-bit 8085. • Only 80386 and later are used today. o first shipped in 1985 o fully 32-bit architecture o designed with security in mind . code and i/o privilege levels . memory protection . segmentation x86 - produced by... Intel, AMD, VIA - yeah, we all know these. • Chips and Technologies - left market after failed 386 compatible chip failed to boot the Windows operating system. • NEC - sold early Intel architecture compatibles such as NEC V20 and NEC V30; product line transitioned to NEC internal architecture http://www.cpu-collection.de/ x86 - other manufacturers Eastern Bloc KM1810BM86 (USSR) http://www.cpu-collection.de/ x86 - other manufacturers Transmeta, Rise Technology, IDT, National Semiconductor, Cyrix, NexGen, Chips and Technologies, IBM, UMC, DM&P Electronics, ZF Micro, Zet IA-32, RDC Semiconductors, Nvidia, ALi, SiS, GlobalFoundries, TSMC, Fujitsu, SGS-Thomson, Texas Instruments, ... (via Wikipedia) At first, a simple architecture... At first, a simple architecture... x86 bursted with new functions • No eXecute bit (W^X, DEP) o completely redefined exploit development, together with ASLR • Supervisor Mode Execution Prevention • RDRAND instruction o cryptographically secure prng • Related: TPM, VT-d, IOMMU Overall..
    [Show full text]
  • Computing :: Operatingsystems :: DOS Beyond 640K 2Nd
    DOS® Beyond 640K 2nd Edition DOS® Beyond 640K 2nd Edition James S. Forney Windcrest®/McGraw-Hill SECOND EDITION FIRST PRINTING © 1992 by James S. Forney. First Edition © 1989 by James S. Forney. Published by Windcrest Books, an imprint of TAB Books. TAB Books is a division of McGraw-Hill, Inc. The name "Windcrest" is a registered trademark of TAB Books. Printed in the United States of America. All rights reserved. The publisher takes no responsibility for the use of any of the materials or methods described in this book, nor for the products thereof. Library of Congress Cataloging-in-Publication Data Forney, James. DOS beyond 640K / by James S. Forney. - 2nd ed. p. cm. Rev. ed. of: MS-DOS beyond 640K. Includes index. ISBN 0-8306-9717-9 ISBN 0-8306-3744-3 (pbk.) 1. Operating systems (Computers) 2. MS-DOS (Computer file) 3. PC -DOS (Computer file) 4. Random access memory. I. Forney, James. MS-DOS beyond 640K. II. Title. QA76.76.063F644 1991 0058.4'3--dc20 91-24629 CIP TAB Books offers software for sale. For information and a catalog, please contact TAB Software Department, Blue Ridge Summit, PA 17294-0850. Acquisitions Editor: Stephen Moore Production: Katherine G. Brown Book Design: Jaclyn J. Boone Cover: Sandra Blair Design, Harrisburg, PA WTl To Sheila Contents Preface Xlll Acknowledgments xv Introduction xvii Chapter 1. The unexpanded system 1 Physical limits of the system 2 The physical machine 5 Life beyond 640K 7 The operating system 10 Evolution: a two-way street 12 What else is in there? 13 Out of hiding 13 Chapter 2.
    [Show full text]
  • Open WATCOM Programmer's Guide
    this document downloaded from... Use of this document the wings of subject to the terms and conditions as flight in an age stated on the website. of adventure for more downloads visit our other sites Positive Infinity and vulcanhammer.net chet-aero.com Watcom FORTRAN 77 Programmer's Guide Version 1.8 Notice of Copyright Copyright 2002-2008 the Open Watcom Contributors. Portions Copyright 1984-2002 Sybase, Inc. and its subsidiaries. All rights reserved. Any part of this publication may be reproduced, transmitted, or translated in any form or by any means, electronic, mechanical, manual, optical, or otherwise, without the prior written permission of anyone. For more information please visit http://www.openwatcom.org/ Portions of this manual are reprinted with permission from Tenberry Software, Inc. ii Preface The Watcom FORTRAN 77 Programmer's Guide includes the following major components: · DOS Programming Guide · The DOS/4GW DOS Extender · Windows 3.x Programming Guide · Windows NT Programming Guide · OS/2 Programming Guide · Novell NLM Programming Guide · Mixed Language Programming · Common Problems Acknowledgements This book was produced with the Watcom GML electronic publishing system, a software tool developed by WATCOM. In this system, writers use an ASCII text editor to create source files containing text annotated with tags. These tags label the structural elements of the document, such as chapters, sections, paragraphs, and lists. The Watcom GML software, which runs on a variety of operating systems, interprets the tags to format the text into a form such as you see here. Writers can produce output for a variety of printers, including laser printers, using separately specified layout directives for such things as font selection, column width and height, number of columns, etc.
    [Show full text]
  • NASM — the Netwide Assembler Version 2.09.04
    NASM — The Netwide Assembler version 2.09.04 -~~..~:#;L .-:#;L,.- .~:#:;.T -~~.~:;. .~:;. E8+U *T +U' *T# .97 *L E8+' *;T' *;, D97 `*L .97 '*L "T;E+:, D9 *L *L H7 I# T7 I# "*:. H7 I# I# U: :8 *#+ , :8 T, 79 U: :8 :8 ,#B. .IE, "T;E* .IE, J *+;#:T*" ,#B. .IE, .IE, © 1996−2010 The NASM Development Team — All Rights Reserved This document is redistributable under the license given in the file "LICENSE" distributed in the NASM archive. Contents Chapter 1: Introduction . .15 1.1 What Is NASM? . .15 1.1.1 Why Yet Another Assembler?. .15 1.1.2 License Conditions . .15 1.2 Contact Information . .16 1.3 Installation. .16 1.3.1 Installing NASM under MS−DOS or Windows . .16 1.3.2 Installing NASM under Unix . .17 Chapter 2: Running NASM . .18 2.1 NASM Command−Line Syntax . .18 2.1.1 The −o Option: Specifying the Output File Name . .18 2.1.2 The −f Option: Specifying the Output File Format . .19 2.1.3 The −l Option: Generating a Listing File . .19 2.1.4 The −M Option: Generate Makefile Dependencies . .19 2.1.5 The −MG Option: Generate Makefile Dependencies . .19 2.1.6 The −MF Option: Set Makefile Dependency File . .19 2.1.7 The −MD Option: Assemble and Generate Dependencies. .19 2.1.8 The −MT Option: Dependency Target Name. .20 2.1.9 The −MQ Option: Dependency Target Name (Quoted) . .20 2.1.10 The −MP Option: Emit phony targets. .20 2.1.11 The −F Option: Selecting a Debug Information Format .
    [Show full text]
  • DR DOS for the Zfx86
    DR DOS for the ZFx86 Cost Effective, Reliable, Rapid Deployment of Embedded Systems w DR DOS on the ZFx86 gets products to market quickly at the lowest development and ownership cost. w Thousands of compatible applications, drivers and utilities available free or at minimal cost. w Full documentation available. DR DOS 7.03 Key Features of DR DOS Online Manual - DRDOS is supplied with a complete The ideal embedded DOS system, online manual that contains detailed information about all designed for out-of-the-box of the features of the operating system including the basic implementation into ROM or Flash commands, and the advanced utilities. It also has online ROM with tools and associated help available for all its commands. documents available in the DRDOS Memory Management - Memory management features OEM Documentation Kit. include a set of device drivers and commands that enable w 100% MS-DOS 6.22 compatible.. you to manage memory efficiently and make as much memory as possible available to your applications. w Comprehensive DOS utility set DOS Protected Mode Services - DOS Protected Mode w Multitasking, with API for developers Services (DPMS) interface allows specially-implemented w DPMS memory manager in addition to DPMI device drivers and TSRs to operate in extended memory. w Stacker disk compression This makes more memory within the first megabyte w NWCACHE - disk caching program available to applications and other conventionally-written drivers and TSRs. Both Stacker* (the disk compression w EMM386 memory manager program), and NWCACHE (the disk cache) use DPMS. w DOS Protected Mode Services (DPMS) Disk Compression - The disk compression component w Multitasking enables you to store more information by compressing the w DR-DOS provides a full multitasking environment data.
    [Show full text]
  • Microsoft Plays Hardball: Use of Exclusionary Pricing and Technical
    Antitrust Bulletin, XL:2, Summer 1995, 265-315 MICROSOFT PLAYS HARDBALL: The Use of Exclusionary Pricing and Technical Incompatibility to Maintain Monopoly Power in Markets for Operating System Software† by KENNETH C. BASEMAN* FREDERICK R. WARREN-BOULTON* and GLENN A. WOROCH** May 1995 ___________________ * Principals, MiCRA: Microeconomic Consulting and Research Associates, Inc., Washington, DC. ** University of California, Berkeley. † Forthcoming, Antitrust Bulletin, June 1995. We would like to express our appreciation for helpful comments and other assistance to Sturge Sobin, Linnet Harlan, Paul Dennis and the participants at the Columbia Business School's Institute for Tele-Information's Seminar on Sustaining Competition in Network Industries through Regulating and Pricing Access, especially Janusz Ordover and Bobby Willig. TABLE OF CONTENTS I. INTRODUCTION AND SUMMARY ................................... 1 II. BACKGROUND .................................................... 3 A. THE MARKET FOR PERSONAL COMPUTER OPERATING SYSTEMS ............................................................ 3 TABLE: NEW SHIPMENTS OF PERSONAL COMPUTER OPERATING SYSTEMS .............................................. 8 B. MICROSOFT'S PRACTICES ..................................... 9 III. FIRST-DEGREE PRICE DISCRIMINATION vs. INEFFICIENT SUBSTITUTION ................................................... 15 A. FIRST-DEGREE PRICE DISCRIMINATION ........................ 16 B. INEFFICIENT SUBSTITUTION ................................. 20 IV. ANTIFRAUD AND ANTIPIRACY
    [Show full text]
  • Sample Content from Programming Microsoft Windows Forms
    Programming Microsoft® Windows® Forms Charles Petzold To learn more about this book, visit Microsoft Learning at http://www.microsoft.com/MSPress/books/7824.aspx 9780735621534 Publication Date: November 2005 A04T621535.fm Page v Friday, September 30, 2005 10:18 AM Table of Contents Introduction. xi Your Background and Needs . .xi Organization of This Book . xii System Requirements. xiii Prerelease Software . xiii Technology Updates. .xiii Code Samples . .xiv Support for This Book . xiv Questions and Comments . .xiv The Author’s Web Site . .xiv Special Thanks. xv 1 Creating Applications . 1 Orientation . 1 Programming Tools . 2 The Docs . 3 Development . 5 The Littlest Programs . 5 Visual Studio Projects. 6 References . 8 From Console to Windows . 9 Fixing the Flaws . 11 Events and Event Handlers . 13 Inheriting from Form . 16 Properties and Events in Visual Studio . 19 Children of the Form . 22 Subclassing Controls . 26 Device-Independent Coding . 29 Assembly Information . 33 Dialog Boxes . 34 DLLs . .44 What do you think of this book? Microsoft is interested in hearing your feedback about this publication so we can continually improve our books and learning resources for you. To participate in a brief We want to hear from you! online survey, please visit: www.microsoft.com/learning/booksurvey/ v A04T621535.fm Page vi Friday, September 30, 2005 10:18 AM vi Table of Contents 2 The Control Cornucopia . 47 Controls in General . 48 Parents and Children . 48 Visibility and Response . 50 Location and Size . 51 Fonts and Color . 52 Keeping Track of Controls . 53 Image Lists . 54 ToolTips . 54 Static (and Not Quite so Static) Controls .
    [Show full text]
  • Microsoft Windows Resource
    Appendix D Articles This appendix contains technical articles on these topics: • Microsoft Windows for Pens • Quarterdeck’s QEMM –386 and Windows 3.1 • PC-NFS and Windows 3.1 • FastDisk: An Introduction to 32–Bit Access Contents of this appendix Windows for Pens.............................................................................................506 Why Pens?.................................................................................................506 Technical Highlights .................................................................................508 The Internal Architecture of Pen for Windows..........................................509 RC Manager ..............................................................................................510 Pen for Windows Support Resources ........................................................511 Quarterdeck’s QEMM –386 and Windows 3.1 ..................................................515 QEMM –386 Features for Windows ...........................................................515 Troubleshooting for QEMM -386 ...............................................................516 Getting Additional Help ............................................................................518 PC-NFS and Windows 3.1.................................................................................519 Installation Tips.........................................................................................519 Using PC-NFS With Windows ...................................................................519
    [Show full text]
  • Memory Management
    University of Mississippi eGrove American Institute of Certified Public Guides, Handbooks and Manuals Accountants (AICPA) Historical Collection 1993 Memory management American Institute of Certified Public Accountants. Information echnologyT Division Follow this and additional works at: https://egrove.olemiss.edu/aicpa_guides Part of the Accounting Commons, and the Taxation Commons Recommended Citation American Institute of Certified Public Accountants. Information echnologyT Division, "Memory management" (1993). Guides, Handbooks and Manuals. 486. https://egrove.olemiss.edu/aicpa_guides/486 This Book is brought to you for free and open access by the American Institute of Certified Public Accountants (AICPA) Historical Collection at eGrove. It has been accepted for inclusion in Guides, Handbooks and Manuals by an authorized administrator of eGrove. For more information, please contact [email protected]. INFORMATION TECHNOLOGY DIVISION BULLETIN AICPA American Institute of Certified Public Accountants TECHNOLOGY Notice to Readers This technology bulletin is the first in a series of bulletins that provide accountants with information about a particular technology. These bulletins are issued by the AICPA Information Technology Division for the benefit of Information Technology Section Members. This bulletin does not establish standards or preferred practice; it represents the opinion of the author and does not necessarily reflect the policies of the AICPA or the Information Technology Division. The Information Technology Division expresses its appreciation to the author of this technology bulletin, Liz O’Dell. She is employed by Crowe, Chizek and Company in South Bend, Indiana, as a manager of firmwide microcomputer operations, supporting both hardware and software applications. Liz is an Indiana University graduate with an associate’s degree in computer information systems and a bachelor’s degree in business management.
    [Show full text]