⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ptab.h

📁 XOSL 多操作系统管理工具 源代码 多系统引导工具
💻 H
字号:
/*
 * Extended Operating System Loader (XOSL)
 * Copyright (c) 1999 by Geurt Vos
 *
 * This code is distributed under GNU General Public License (GPL)
 *
 * The full text of the license can be found in the GPL.TXT file,
 * or at http://www.gnu.org
 */

#ifndef __ptab__
#define __ptab__

#include <defs.h>

#define PART_PRIMARY 0
#define PART_LOGICAL 1
#define PART_MBR     2
#define PART_FLOPPY  3

typedef struct {
	unsigned char Activated;
	unsigned char StartHead;
	unsigned short StartSectCyl;
	unsigned char FSType;
	unsigned char EndHead;
	unsigned short EndSectCyl;
	unsigned long RelativeSector;
	unsigned long SectorCount;
} TPartEntry;

typedef struct {
	char IPL[446];
	TPartEntry Entries[4];
	unsigned short MagicNumber; // 0xaa55
} TPartTable;

typedef struct S_MBRNode {
	unsigned long AbsoluteSector;
	short Drive;
	short Type; // primary or logical
	TPartTable *Table;
	struct S_MBRNode *Next;
} TMBRNode;

typedef struct {
	short Drive;
	unsigned long StartSector;
	unsigned long SectorCount;
	const char *FSName;
	short FSType;
	short Type; // primary, logical, mbr or floppy
} TPartition;

typedef struct S_PartNode {
	TPartEntry *Entry;
	TPartition *Partition;
	struct S_PartNode *Next;
} TPartNode;

class CPartList {
	public:
		CPartList();
		~CPartList();
		void ReadStructure();
		void WriteStructure();
		const TPartition *GetPartition(int Index);
		int Locate(int Drive, unsigned long StartSector);
		int GetCount();
		int CanHide(int Index);
		void Hide(int Index);
		void Reveal(int Index);
		int CanActivate(int Index);
		void SetAllowActiveHD(int Status);
		void SetActive(int Index);
		void SetFsType(int Index, int FsType);
	public:
		typedef struct {
			int FSID;
			const char *FSName;
		} TFSNameEntry;
	private:
		void ClearActive(int Drive);

		TMBRNode *AddDrive(int Drive, unsigned long StartSector, unsigned long ExtStart, int Type, TMBRNode *MBRList);
		void CreatePartList(int FloppyCount);
		TPartNode *CreatePartNode(const TMBRNode *MBRNode, int Index);
		TPartNode *CreateNonPartNode(int Drive);
		const char *GetFSName(int FSID);
		void CreatePLUP();

		TMBRNode MBRList;
		TPartNode PartList;
		int Count;
		TPartNode **PLUP;
		static TFSNameEntry FSNameList[];
		int AllowActiveHD;
};



#endif

⌨️ 快捷键说明

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