This program displays partition information from a disk image file. It defines a Partition class to store data for each partition, including the start sector, size, and file system type. The program reads in the disk image, extracts the partition table contents using the Partition class, and outputs the number of partitions and details about each partition such as size and file system type.
Assignment of SOS operating systemThe file lmemman.c has one incom.pdf
Partition Tool
1. Title : Tool to display the partition information only
Name : Shivakumar Koppad
ID : 14043513
Date : 06/03/2015
Module code : EE6012
Lecturer : Dr. Donal Heffernan
Assignment#1
Requirements :
This program was created by using Microsoft Visual C++ 2010. Class for the
partition table was defined in order to restores information about partitions, to
configure the location of the first byte of the partition Information and to copy
the contents of an array from the memory cache to the private member array.
Features that were implemented:
There are four features that were implemented in this program:
1- The number of partitions on the disk is represented.
2- The start sector of the partition is represented.
3- The file system type of the partition is represented.
4- The size of the partition in sectors in MB is represented.
Testing and Result:
1- The source code EE6012_phase1 was created and implemented.
2- The new folder which named Shiva was created in the local Disk(E:).
3- The executed file in the debug in Shiva.exe was copied and pasted in Shiva in
order to read the image.
4- The Sample_1.dd image file was used in Shiva.
5- Program is implemented in a command window by going to the
right path (E: Shiva >) and typing (Shiva.exe Sample_1.dd)
Instructions for running the program:
1. The executable file Shiva.exe was created.
2. The folder called Shiva was created in the local Disk(E:).
3. Copied the executable file Shiva.exe (found in ‘Debug ‘ folder and Sample_1.dd
and put them in Shiva in the local Disk(E:).
4. Implement the program in the command window by going to the right path
(E: Shiva >) and typing (Shiva.exe Sample_1.dd)
2. Drawbacks:
To calculate the partition in MB, multiplying the partition in sectors by 512,
because sector size is 512 and divide the result by 1MB = 1024 * 1024 Bytes.
To calculate the information correctly, information must be changed to
big_endian format because the format of information is little_endian.
Source code:
//////////////////////////////////////////////////////////////////////
/////////////////
//Student Name: Shivakumar Koppad
// Student ID: 14043513
//////////////////////////////////////////////////////////////////////
/////////////////
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
class Partition
{
public:
Partition( unsigned int byte);
string getFileSysType();
unsigned int getSizeOfPartition();
unsigned int getStartSector();
unsigned int get1stByteOfPartition();
void setFields(unsigned char *store);
bool isAssigned();
private:
unsigned char bytes[32];
unsigned int firstByteOfPartition;
};
Partition::Partition( unsigned int newbyte)
{
firstByteOfPartition = newbyte;
}
void Partition::setFields( unsigned char *store)
{
for(int i = 0; i < 32; i++)