RTFC Posted September 18, 2013 Share Posted September 18, 2013 (edited) Hello World! (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 June 10, 2014 by RTFC FireFox, ravkr and meoit 3 My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
Olex Posted March 30, 2015 Share Posted March 30, 2015 Excellent script! Was looking for it for months! Thank you! What about GPT disks? Link to comment Share on other sites More sharing options...
RTFC Posted March 30, 2015 Author Share Posted March 30, 2015 @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. My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
liuzhaoyzz Posted May 9, 2019 Share Posted May 9, 2019 Thank you. Link to comment Share on other sites More sharing options...
RTFC Posted May 9, 2019 Author Share Posted May 9, 2019 My pleasure. My Contributions and Wrappers Spoiler BitMaskSudokuSolver BuildPartitionTable CodeCrypter CodeScanner DigitalDisplay Eigen4AutoIt FAT Suite HighMem MetaCodeFileLibrary OSgrid Pool RdRand SecondDesktop SimulatedAnnealing Xbase I/O Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now