Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
48
5.19 Layer 1: The GetPartInfoNice Function
This function forms part of the interface between layers 1 and 2. It gives
the layer 2 part command access to the partition table information. The part
command is used to display the partition table information for all the disks
connected to the PC. The layer 2 function cannot access the layer 0
GetPartTable function directly as this breaks the integrity of the three layer
structure. This function returns a structure with some of the information from the
partition tables for each disk. The information is returned in a nicer format, more
suited to displaying to an end user by the calling application. The form of the
PARTINFO type is shown below:
As can be seen the partition_nice structure has elements for the disk drive and
partition number. These are in the more user friendly format of 1 is the 1st HDD
or Partition, 2 the second, etc. The uPartType is the hex value for the partition
type and sPartType is a small string describing the partition. The supported
partition types are shown below:
uPartType
sPartType
Partition Type
0x05
DOSEXT
DOS Extended Partition
0x06
DOS
DOS Primary Partition
0x83
LINUXSWP
Linux Swapfile Partition
0x82
LINUX
Linux filesystem Partition
The ulSize element gives the size of the partition in bytes.
The elements of the partinfo structure are the number of PARTITION
entries in the returned table, and a pointer to the location in memory containing
the partinfo structure.
typedef struct partition_nice {
unsigned uDisk;
unsigned uPart;
unsigned uPartType;
char sPartType[11];
unsigned long ulSize;
} PARTITION;
typedef struct partinfo {
unsigned short uParts;
PARTITION far *lpPartTbl;
} PARTINFO;