void freePartitionTable(struct HDTBPartition *partition) { D(bug("[HDToolBox] freePartitionTable()\n")); ClosePartitionTable(partition->ph); FreeMem(partition->table, sizeof(struct PartitionTable)); }
LONG PrintPartitionTable(struct PartitionHandle *root, ULONG i) { struct DosEnvec de; ULONG type = 0; ULONG reserved = 0; ULONG a; a = OpenPartitionTable(root); if (a) return a; GetPartitionTableAttrsTags(root, PTT_TYPE , &type, PTT_RESERVED, &reserved, TAG_DONE); GetPartitionAttrsTags(root, PT_DOSENVEC, &de, TAG_DONE); for (a=i;a;a--) printf(" "); printf("Partition table type is "); switch (type) { case PHPTT_RDB: printf("Rigid Disk Block\n"); break; case PHPTT_MBR: printf("MBR -> PC\n"); break; case PHPTT_EBR: printf("EBR -> PC\n"); break; default: printf("unknown\n"); break; } for (a=i;a;a--) printf(" "); printf("reserved blocks: %d\n", (int)reserved); PrintDE(&de,i); for (a=i;a;a--) printf(" "); printf("partitions:\n"); PrintPartitions(root,i+1); ClosePartitionTable(root); return 0; }
BOOL findPartitionTable(struct HDTBPartition *partition) { D(bug("[HDToolBox] findPartitionTable()\n")); if (OpenPartitionTable(partition->ph) == 0) { partition->table = newPartitionTable(partition->ph); if (partition->table != NULL) return TRUE; ClosePartitionTable(partition->ph); } return FALSE; }