There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Formatting a drive from C++


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
jimboa's Avatar
Junior Member with 3 posts.
 
Join Date: Jul 2008
Location: Maryland
Experience: Advanced
03-Jul-2008, 07:03 PM #1
Formatting a drive from C++
I have a need to format a multi-partitioned hard drive from C++ code on an XP system. None of the IOCTL type calls seem to fit the bill from XP. I can create the partitions but I can't format them. Is there something I'm missing. If Windows can do it via the format command why can't I do it from code?

Thanks.
lotuseclat79's Avatar
Distinguished Member with 10,037 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
04-Jul-2008, 12:15 PM #2
Hi jimboa,

Let's understand some context of what you are trying to do here first.

You are booted up in a WinXP system running a C++ compiler writing system code that has the task of creating and formatting a partition on the disk.

So far, you have created a partition with your C++ code.

As I understand your question - it is: How do I format a partition?

Q: Are you running your code from a SysAdmin account?

-- Tom
__________________
The independence created by philosophical insight is - in my opinion - the mark of distinction between a mere artisan or specialist and a real seeker after truth. - Einstein wrote in 1944.

Some say knowledge is power, I say knowledge without action is powerless. - lotuseclat79

Don't confuse action with movement. - Hemingway to Gardner

Imagination is more important than knowledge. - Einstein
jimboa's Avatar
Junior Member with 3 posts.
 
Join Date: Jul 2008
Location: Maryland
Experience: Advanced
04-Jul-2008, 05:01 PM #3
The application is run under an account that is part of the Administrators group. It is fully privileged. Ultimately, the application will run as a service.

One of the many things this application is called on to do is create 4 partitions on a hard drive then format the partitions as FAT32 drives (not NTFS). I have identified IOCTL calls to format a floppy but the only calls I can find to format a hard drive are only available if you are running Server 2003; we are limited to Windows/XP.

J.
pvc_'s Avatar
Computer Specs
Member with 91 posts.
 
Join Date: Feb 2008
Location: Orlando, FL
Experience: Advanced
05-Jul-2008, 04:44 AM #4
This approach may seem kindda funny, but it may actually work. If it's a console application, you might be able to use system("format") or perhaps use a bat file.
jimboa's Avatar
Junior Member with 3 posts.
 
Join Date: Jul 2008
Location: Maryland
Experience: Advanced
05-Jul-2008, 06:59 AM #5
I don't know about 'funny' but it is a workaround. We have coded in a shell out to a batch file (we thought of that too) but we would prefer to do the format in code if at all possible.

J.
lotuseclat79's Avatar
Distinguished Member with 10,037 posts.
 
Join Date: Sep 2003
Location: -71.45091, 42.27841
05-Jul-2008, 11:59 AM #6
Hi jimboa,

It sounds like you may have to either add the ioctl code to the WinXP driver, or possibly get the Resource Kit for Server 2003 from the MS website.

-- Tom
Reply

Tags
c++, format, windows/xp


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:08 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.