2

I am trying to build an application for Windows XP 64bit which is able to detect drives of a particular model in the system, and if they are not initialized & formatted perform these processes.

I would also like to be able to query and set the partition information(including the volume label).

I have started putting together code using DeviceIoControl, but I have not been able to figure out how to set/get partition/volume labels or format drives with the method, I have got SMART access working.

Is there any other method that is any easier to use?

Zac

Shalom Craimer
21.6k10 gold badges73 silver badges108 bronze badges
asked Oct 7, 2010 at 6:46
2
  • possible duplicate: stackoverflow.com/questions/2648305/format-drive-by-c Commented Oct 7, 2010 at 7:02
  • None of that quite covers what I want to achieve. WMI only allows querying of information and not creating partitions and other things that I want to do. I am trying not to go down the path of wrapping command-line applications I would prefer to have everything as C/C++. I guess if I have to go down that route "diskpart" may be an option. Commented Oct 7, 2010 at 7:06

2 Answers 2

0

Sounds like you are looking for Disk Management Control Codes.

answered Oct 7, 2010 at 11:10
Sign up to request clarification or add additional context in comments.

2 Comments

ThI have ended up using a combination of WMI & DeviceIoControl with the Disk Management Control Codes. This looks to be able to do everything that I want, except that currently I am having some issues with using the Win32_Volume Format method in C++, I am constantly getting a WBEM_E_INVALID_METHOD_PARAMETERS error.
Hi, @ZacShenker, are you able to format the newly created partition that was created using IOCTL_DISK_SET_DRIVE_LAYOUT ? I couldn't figure out a way to format the new partition.
0

If I were doing this I would use my own code only to detect things. I would do the partitioning and formatting through diskpart and/or format commands instead. diskpart accepts file argument with a script to execute.

answered Oct 7, 2010 at 12:57

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.