📄 fdisk.c
字号:
;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1983 - 1991
; * All Rights Reserved.
; */
/******************************************************************************
*
* Change Log:
*
* Date Who # Description
* -------- --- --- ------------------------------------------------------
* 03/08/90 EGH C00 Cleaned up build by removing unused variables, declaring
* functions properly, changing long JMPs to short JMPs,
* etc.
* 05/22/90 EGH C17 Don't display message "Press ESC to return to FDISK
* options" if it is immediately going to be overwritten
* by "Press ESC to continue".
* 05/24/90 EGH C20 Problem fixed - a second reboot screen was added that
* does not instruct the user to insert a bootable DOS
* diskette.
* 06/19/90 EGH C21 Added a prompt for the volume label when deleting a
* primary DOS partition to be consistent with deleting
* logical DOS drives.
* 10/19/90 EGH C32 Added code to handle multiple primary DOS partitions.
*
******************************************************************************/
/* */
/******************* START OF SPECIFICATIONS *******************/
/* */
/* SOURCE FILE NAME: FDISK */
/* */
/* DESCRIPTIVE NAME: FIXED DISK PARTITIONING UTILITY */
/* */
/* FUNCTION: */
/* Allows creation and deletion of DOS related partitions */
/* on fixed disk devices 80-81h (int 13h BIOS defined, */
/* DOS). Also allows display of all partitions, and will */
/* allow a partition to be marked active (bootable). The */
/* user will be prompted for action thru a full screen */
/* interface. The user can also create, delete and display */
/* logical DOS drives within a EXTENDED DOS Partition. If a*/
/* regular DOS partition is created, the beginning of the */
/* partition will be scanned to insure a contiguous area of*/
/* good sectors on the disk large enough to satisfy the */
/* DOS system requirements. If a bad spot is found, the */
/* start of the partition will be moved out until a good */
/* area is located */
/* */
/* NOTES: The program will work by setting up a logical image */
/* of all relevant disk information at initilization */
/* time. All operations will be performed on this */
/* logical image, thus reducing disk accesses to only */
/* those required to initially set up the logical image,*/
/* and to write the changed information at the end. The */
/* user will be informed if there is a problem writing */
/* the logical image back to the disk. */
/* */
/* FDISK will interface with the partition table in the */
/* master boot record as defined in the PC-DOS technical*/
/* reference manual. It will also create and manage the */
/* EXTENDED DOS partition architecture as defined in the*/
/* PC-DOS 3.30 functional spec (CP/DOS spec dcr pending)*/
/* */
/* ENTRY POINTS: MAIN */
/* LINKAGE: [d:] [path] FDISK */
/* */
/* EXTERNAL REFERENCES: */
/* Fixed Disk Master Boot Record */
/* EXTENDED Partition Volume Boot Records */
/* Note: Both of the above are physical data structures on */
/* the surface of the disk */
/* */
/* P.S. - To whoever winds up maintaining this, I will */
/* apoligize in advance. I had just learned 'C' when */
/* writing this, so out of ignorance of the finer points*/
/* of the langauge I did a lot of things by brute force.*/
/* Hope this doesn't mess you up too much - MT 5/20/86 */
/******************** END OF SPECIFICATIONS ********************/
#include <dos.h>
#include <fdisk.h>
#include <subtype.h>
#include <extern.h>
#include <doscall.h>
#include <ctype.h>
#include <string.h> /* AN000 */
#include <fdiskmsg.h> /* AN000 */
#include "msgret.h" /* AN000 */
#include <process.h> /* AN000 */
#include <stdio.h> /* AN000 */
/* */
/**************************************************************************/
/* */
/* UTILITY NAME: FDISK.com */
/* SOURCE FILE NAME: FDISK.c */
/* STATUS: FDISK utility, DOS 3.3 */
/* CHANGE HISTORY: UPDATED 5-29-87 DOS4.0 DRM */
/* SYNTAX (Command line) */
/* */
/* [d:][path]FDISK */
/* */
/* or */
/* */
/* [d:][path]FDISK d [/PRI:m | /EXT:n | /LOG:o ...] */
/* */
/* d: Drive to load FDISK utility from */
/* */
/* path path to the directory on specified drive to */
/* load FDISK from */
/* */
/* d Drive (1 or 2) that FDISK should operate on */
/* */
/* /PRI:m Size of Primary DOS partition to create in K */
/* */
/* /EXT:n Size of Extended DOS partition to create in K */
/* */
/* /LOG:o Size of Logical drive to create in K in the */
/* extended partition */
/* */
/* UTILITY FUNCTION: */
/* Allows you to create, set up, display, and delete the */
/* DOS partitions on a fixed disk. */
/* */
/**************************************************************************/
/* */
/******************* START OF SPECIFICATIONS *******************/
/* */
/* SUBROUTINE NAME: CHANGE_ACTIVE_PARTITION */
/* */
/* DESCRIPTIVE NAME: Change bootable partition */
/* */
/* FUNCTION: Will allow user to select the partition that will */
/* recieve control when system is IPL'd. This is */
/* only for the first hardfile as far as booting is */
/* concerned, although partitions can be set active */
/* the second. There are reserved partitions that may*/
/* not be set active and this routine will enforce */
/* that. */
/* */
/* NOTES: If no valid partition is specified, then the active */
/* partition setting is left unchanged. Screen can be */
/* exited via the ESC command before active partition */
/* is changed and no action will take place */
/* */
/* The following screen is managed */
/* */
/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -