Sign in to follow this  
Followers 0
adamxp

IOCTL_DISK_GET_PARTITION_INFO_EX and IOCTL_DISK_SET_PARTITION_INFO_EX

7 posts in this topic

Need some help importing the Dllcalls to get the partition type and set the partition type. I already have a function to get the correct volume ID that requires the change, but need an example how how to use the deviceiocontrol.

IOCTL_DISK_GET_PARTITION_INFO_EX

http://msdn.microsoft.com/en-us/library/aa365180(v=VS.85).aspx

IOCTL_DISK_SET_PARTITION_INFO_EX

http://msdn.microsoft.com/en-us/library/aa365191(v=VS.85).aspx

Share this post


Link to post
Share on other sites



This does some partition processing. Maybe a good starting point.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

This does some partition processing. Maybe a good starting point.

Thanks water, I did check out that project already but the project is abandoned?? (no update since 07) and no longer works. Also the XP (vista/server 08/Windows 7 do) version of diskpart does not have the set id command required to change the partition type.

Share this post


Link to post
Share on other sites

Another thing to try is the WinAPIEx UDF. It contains some _WinAPI_GetDrive* functions that - at least - show how to call the DeviceIoControl API.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I found the post below:

http://www.autoitscript.com/forum/index.php?showtopic=105701

But the code does not appear to return the mbr data even when $tpix is change to point to the MBR dll structure constaint.

code modified:

Local $tPIX = DllStructCreate($tagPARTITION_INFORMATION_EX_MBR)

ConsoleWrite(@TAB & "PartitionType: " & DllStructGetData($tPIX, "PartitionType") & @CRLF)

returns zero each time

Share this post


Link to post
Share on other sites

I've never done this before - I'm just searching the forum. But this thread is reading the MBR.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I've never done this before - I'm just searching the forum. But this thread is reading the MBR.

Got the code working by making these changes:

Local Const $tagPARTITION_INFORMATION_MBR = "uint PartitionType;ubyte BootIndicator;ubyte RecognizedPartition;uint HiddenSectors;"

ConsoleWrite(@TAB & "PartitionType: " & "0x" & Hex(DllStructGetData($tPIX, "PartitionType"),2) & @CRLF)

Thanks for the help

Edited by adamxp

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0