getsec.c

来自「MS DOS 6.0 操作系统源码完整版,对于研制操作系统结构,构建个人的操作系」· C语言 代码 · 共 36 行

C
36
字号
/***************************************************************************/
/*																									*/
/*	GETSECT.C																					*/
/*																									*/
/*		Copyright (c) 1991 - Microsoft Corp.											*/
/*		All rights reserved.																	*/
/*		Microsoft Confidential																*/
/*                                                                         */
/* Calculates the total sectors on a hard disk based on the values in a 	*/
/* hard disk parameters structure.														*/
/* 																								*/
/* UL GetTotalHdSectors( struct HdParms *Parms )									*/
/* 																								*/
/* ARGUMENTS:	Parms 			- Ptr to hard disk parameters structure		*/
/* RETURNS: 	unsigned long	- Total physical sectors on the hard disk		*/
/* 																								*/
/* NOTE: 																						*/
/* 		Need to remember that heads and cylinders begin with 0 and			*/
/* 		sectors begin with 1.															*/
/* 																								*/
/* Created 02-07-90 johnhe																	*/
/***************************************************************************/

#include		<alias.h>
#include 	<hdisk.h>


UL GetTotalHdSectors( struct HdParms *Parms )
{
	return( (UL)(Parms->MaxHead+1) *
			  (UL)(Parms->MaxSec) *
			  (UL)( Parms->MaxCyl+1) );
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?