Jump to content

IOCTL_DISK_GET_PARTITION_INFO_EX and IOCTL_DISK_SET_PARTITION_INFO_EX


Recommended Posts

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

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 2021-11-10 - Version 1.6.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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.

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 2021-11-10 - Version 1.6.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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

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 2021-11-10 - Version 1.6.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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.

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
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...