Jump to content

BuildPartitionTable


RTFC
 Share

Recommended Posts

Hello World! :bye: (always wanted to say that)

Wrote this  when I needed low-level access to unmountable parts of a physical drive. The resulting UDF is BuildPartitionTable, and takes as single argument a designated physical drive ID, for example: BuildPartitionTable(".physicaldrive0") for your first harddisk.

This UDF scans a physical drive's partition table to fill three partition-related arrays:

  • partition_table      extracted from the MBR and its linked list(s)
  • allocation_table    entire disk mapping
  • volumes_table      subset of $allocation_table with volumes only

It does NOT alter your data or drives; it just reads and reports.

BuildPartitionTable.v1.1.zip (AutoIt 3.3.12-1 compliant updated version, with small example)

You can use the UDF's output for low-level drive I/O (use at your own risk!), for example (NB code for this is not included):

  • identify unallocated regions for space optimisation or hidden storage (listed in allocation table array)
  • resize/remove existing partitions
  • change which single partition is primary (i.e., used for booting)
  • change an existing partition's type
  • add new partitions of any type
  • hide/unhide logical volumes (simply set/reset bit4 of a volume's Partition_Type in its (E)MBR partition entry)

It should in theory be able to handle many types of MBR partition tables, not just Microsoft-approved ones. If you're going to analyse Linux MBRs or ancient tech, you may want to replace internal calls to _Partition_type_string() (DOS/Microsoft only) to its internal alternative _Partition_Anytype_string(), which supports many types I'd never heard of before (but results can be unreliable).

Furthermore,  you may be puzzled by references in the annotations to my "FATsuite UDF". Please follow the link in my signature if you wish to know more.

Should the script crash or produce wrong results at your end, there's unfortunately not much I can do at this end, since the problem is likely related to the specific hardware you're testing. :( Of course, I'll try to fix whatever bugs I am able to reproduce...

Hope it helps!

RT

Edited by RTFC
Link to comment
Share on other sites

  • 1 year later...

@Olex: you're very welcome, and welcome to the AutoIt forums! :)

Re GPT, I currently lack the hardware to develop this, but I'll soon be acquiring a new workhorse, and if that is UEFI-enabled I may be able to add this functionality in future (I guess that's progress, gotta keep running just to stay in the same place), However, to be honest, it's not the top item on my todo list at the moment, being an MBR dinosaur myself (asteroid? what asteroid?) But as my work environment is upgraded, I may suddenly develop an urgent need for it, in which case I'll post it here, of course.

Link to comment
Share on other sites

  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...