www.pudn.com > SmartFDISK.zip > klmsg.cpp


/**************************************************************************** 
 * 
 * Smart FDISK 
 * 
 * This program is a powerful Harddisk Partitioning Tool including a 
 * easy-to-use Boot Manager. 
 * 
 * 
 *     Copyright (C) 1999 Suzhe (suzhe@263.net) 
 * 
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 2 of the License, or 
 * (at your option) any later version. 
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
 * General Public License for more details. 
 * 
 * You should have received a copy of the GNU General Public License 
 * along with this program; if not, write to the Free Software Foundation, 
 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
 * 
 ****************************************************************************/ 
/* 
 * klmsg.cpp : kernel message strings 
 */ 
 
#define Uses_KernelMessage 
#define Uses_DataType 
#include "Kernel.h" 
 
static TErrorMessage GlobeErrorMessageEng[]= 
{ 
	{0x00,"No Error"}, 
	{0x01,"Bad command"}, 
	{0x02,"Address mark not found"}, 
	{0x03,"Attempt to write to write-protected disk"}, 
	{0x04,"Sector not found"}, 
	{0x05,"Reset failed"}, 
	{0x06,"Disk changed since last operation"}, 
	{0x07,"Drive parameter activity failed"}, 
	{0x08,"Direct memory access (DMA) overrun"}, 
	{0x09,"Attempt to perform DMA across 64K boundary"}, 
	{0x0A,"Bad sector detected"}, 
	{0x0B,"Bad track detected"}, 
	{0x0C,"Unsupported track"}, 
	{0x10,"Bad CRC/ECC on disk read"}, 
	{0x11,"CRC/ECC corrected data error"}, 
	{0x20,"Controller has failed"}, 
	{0x40,"Seek operation failed"}, 
	{0x80,"Attachment failed to respond"}, 
	{0xAA,"Drive not ready"}, 
	{0xB0,"Volume not locked in drive"}, 
	{0xB1,"Volume locked in drive"}, 
	{0xB2,"Volume not removable"}, 
	{0xB3,"Volume in use"}, 
	{0xB4,"Lock count exceeded"}, 
	{0xB5,"Valid eject request failed"}, 
	{0xBB,"Undefined error occurred"}, 
	{0xCC,"Write fault occurred"}, 
	{0xE0,"Status error"}, 
	{0xFF,"Sense operation failed"}, 
	{0x100,"Int 13 Extension is not present"}, 
	{0x101,"Drive number out of range"}, 
	{0x102,"Drive is not useable"}, 
	{0x103,"Drive is not lockable"}, 
	{0x104,"Drive is not removeable"}, 
	{0x200,"Partition is not useable"}, 
	{0x201,"Partition duplicated"}, 
	{0x202,"Invalid partition"}, 
	{0x203,"Partition not found"}, 
	{0x204,"Invalid partition table"}, 
	{0x205,"Cannot create primary partition"}, 
	{0x206,"Cannot create logical partition"}, 
	{0x207,"Cannot delete partition"}, 
	{0x208,"Cannot mark as active"}, 
	{0x209,"Cannot toggle bootable"}, 
	{0x300,"File System is not useable"}, 
	{0x301,"File System cannot be formated"}, 
	{0x302,"FAT table read error"}, 
	{0x303,"File System not formated"}, 
	{0x400,"No enough memory"}, 
	{0x401,"Invalid parameter"}, 
	{0x500,"No room for Boot Manager"}, 
	{0x501,"Cannot install Boot Manager"}, 
	{0x502,"Boot Manager is not installed"}, 
	{0x503,"Cannot use Boot Manager"}, 
	{0x504,"Too many Bootable Partitions"}, 
	{-1,NULL} 
}; 
 
static TErrorMessage GlobeErrorMessageChn[]= 
{ 
	{0x00,"没有错误"}, 
	{0x01,"命令无效"}, 
	{0x02,"没有找到地址标记"}, 
	{0x03,"试图向写保护的磁盘写入数据"}, 
	{0x04,"扇区没有找到"}, 
	{0x05,"复位失败"}, 
	{0x06,"上一次操作以后磁盘改变了"}, 
	{0x07,"驱动器参数激活失败"}, 
	{0x08,"直接内存存取 (DMA) 溢出"}, 
	{0x09,"试图跨越 64K 边界执行 DMA"}, 
	{0x0A,"检测到坏扇区"}, 
	{0x0B,"检测到坏磁道"}, 
	{0x0C,"不支持的磁道"}, 
	{0x10,"磁盘读取过程中发现 CRC/ECC 错误"}, 
	{0x11,"发现 CRC/ECC 数据错误,已纠正"}, 
	{0x20,"控制器失效"}, 
	{0x40,"定位操作失败"}, 
	{0x80,"联接应答失败"}, 
	{0xAA,"驱动器没有准备好"}, 
	{0xB0,"驱动器中的卷没有锁定"}, 
	{0xB1,"驱动器中的卷已锁定"}, 
	{0xB2,"卷不可移动"}, 
	{0xB3,"卷正在使用"}, 
	{0xB4,"锁定计数溢出"}, 
	{0xB5,"合法的弹出请求失败"}, 
	{0xBB,"发生了未定义的错误"}, 
	{0xCC,"写失败"}, 
	{0xE0,"状态错误"}, 
	{0xFF,"敏感操作失败"}, 
	{0x100,"不存在扩展 Int 13H"}, 
	{0x101,"驱动器号超出范围"}, 
	{0x102,"驱动器不可用"}, 
	{0x103,"驱动器不能锁定"}, 
	{0x104,"驱动器不能移动"}, 
	{0x200,"分区不可用"}, 
	{0x201,"分区重叠"}, 
	{0x202,"无效分区"}, 
	{0x203,"分区未找到"}, 
	{0x204,"分区表无效"}, 
	{0x205,"不能建立基本分区"}, 
	{0x206,"不能建立逻辑分区"}, 
	{0x207,"不能删除分区"}, 
	{0x208,"不能标记为激活"}, 
	{0x209,"不能改变引导状态"}, 
	{0x300,"文件系统不可用"}, 
	{0x301,"文件系统不能格式化"}, 
	{0x302,"文件分配表错误"}, 
	{0x303,"文件系统没有格式化"}, 
	{0x400,"没有足够的内存"}, 
	{0x401,"无效的参数"}, 
	{0x500,"没有空间安装启动管理器"}, 
	{0x501,"不能安装启动管理器"}, 
	{0x502,"未安装启动管理器"}, 
	{0x503,"不能使用启动管理器"}, 
    {0x504,"可启动分区太多"}, 
	{-1,NULL} 
}; 
 
static char *KernelMsgEng[] = 
{ 
	"Scanning %5lu Mb -- %-3u%% Completed", 
	"Scan Completed.                     ", 
	"Formatting %5lu Mb -- %-3u%% Completed", 
	"Reading Bad Blocks Record...          ", 
	"Creating FAT Table...                 ", 
	"Writing Bad Blocks Record...          ", 
	"Creating Root Directory...            ", 
	"Creating Boot Record...               ", 
	"Format Completed.                     ", 
	"Unknow Error 0x%X !" 
}; 
 
static char *KernelMsgChn[] = 
{ 
	"正在检查 %5lu Mb -- 已完成 %-3u%%", 
	"检查完毕.                        ", 
	"正在格式化 %5lu Mb -- 已完成 %-3u%%", 
	"正在读出坏块记录...                ", 
	"正在建立文件分配表...              ", 
	"正在写入坏块记录...                ", 
	"正在建立根目录...                  ", 
	"正在建立引导记录...                ", 
	"格式化完毕.                        ", 
	"未知的错误 0x%X !" 
}; 
 
char **KernelMsg = KernelMsgEng; 
TErrorMessage *ErrorMsg = GlobeErrorMessageEng; 
 
 
void SetKernelLanguage( int language ) 
{ 
	if( language == 0 ) 
	{ 
		KernelMsg = KernelMsgEng; 
		ErrorMsg = GlobeErrorMessageEng; 
	} 
	else 
	{ 
		KernelMsg = KernelMsgChn; 
		ErrorMsg = GlobeErrorMessageChn; 
	} 
} 
 
const char * GetKernelErrorMsg(int32 ErrorNumber) 
{ 
	static char Unknow[20]; 
	for( int i=0; ErrorMsg[i].Code >= 0 && 
		ErrorMsg[i].Message!=NULL; i++ ) 
		if( ErrorMsg[i].Code == ErrorNumber ) 
			return ErrorMsg[i].Message; 
 
	sprintf(Unknow, KernelMsg[9], ErrorNumber); 
	return Unknow; 
}