fmtboot.c

来自「[随书类]Dos6.0源代码」· C语言 代码 · 共 41 行

C
41
字号
/***************************************************************************/
/*																									*/
/*	FMTBOOT.C																					*/
/*																									*/
/*		Copyright (c) 1991 - Microsoft Corp.											*/
/*		All rights reserved.																	*/
/*		Microsoft Confidential																*/
/*                                                                         */
/* Determines if a boot record if from a partition that was formatted		*/
/* under any version of DOS. Checks for proper opcode in the first 3 bytes */
/* (e9,XX,XX or eb,XX,90).																	*/
/* 																								*/
/* int IsFmtedBoot( char *SectorBuf )													*/
/* 																								*/
/* ARGUMENTS:	SectorBuf	- Ptr to buf holding the boot sector to check	*/
/* RETURNS: 	int			- TRUE if a formatted boot record else FALSE 	*/
/*																									*/
/* Created 02-07-90 johnhe																	*/
/***************************************************************************/

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

#define	SECTOR_SIZE		512

unsigned IsFmtedBoot( char *SectorBuf )
{
	struct BPB	*Bpb;

	Bpb = (struct BPB *)(SectorBuf + 11);
	
	if ( Bpb->uBytesPerSec < SECTOR_SIZE ||
		  (Bpb->uBytesPerSec % SECTOR_SIZE) ||
		  (Bpb->uchMediaDescr != (UCHAR)0xf8 &&
		   Bpb->uchMediaDescr != (UCHAR)0xfa) ) 
		return( FALSE );
	return( TRUE );
}

⌨️ 快捷键说明

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