/* Write New Information to MBR *\
/* To write the values to MBR partition table,
Uncomment the biosdisk function given below */
// biosdisk ( 3, 0x80, 0, 0, 1, 1, &p ) ;
display(); /* Display the Modified
Information */
getch();
}
Comments on coding:
The program given above is a sample program to show how we can modify the values of partition table entry of MBR. If you want to modify the values of partition entry for such logical partitions, which lie in extended partition, you have to modify the values in partition table of Extended MBR.
The values which have been given here to modify the partition table entry are just for demonstrate, how to modify. Never modify partition table with illegal or illogical values. By doing so the entire partition may become inaccessible.
The structure partition is used to read the partition entry from partition table and structure part to read MBR. To actually make the modifications in partition table uncomment the biosdisk( ) function.
If you want to modify the values of starting and ending, sectors and cylinder numbers of the partition, calculate the values, as described in the comments of the program to read and display the partition table of MBR, discussed in the starting of this chapter.
|