Solved

Formatting A Drive

Posted on 2002-06-17
5
194 Views
Last Modified: 2010-04-04
Hi Guyz,

I need to format a hard drive the quickest way possible, without the user knowing what is happening?

For those people who may think tis is dodgy stuff, read on.

I am writing a little program that starts then hides itself when windows starts.
It then wait's say 10 minutes then calls the number that  my computer is plugged into, if the number is engaged then fine, but if the computer has been stolen and plugged into another phone line  it will ring my number, and when it does I want to Format my hard drive remotely.

That's it..

200 point for the smothest answer..
Andy
0
Comment
Question by:Asw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Expert Comment

by:yk030299
ID: 7084816
see Win32 Developer's Reference about DeviceloControl
IOCTL_DISK_SET_DRIVE_LAYOUT     Partitions a disk.
IOCTL_DISK_SET_PARTITION_INFO     Sets the disk partition type.
IOCTL_DISK_VERIFY     Performs logical format of a disk extent.
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7085102
const SHFMT_DRV_A = 0;
const SHFMT_DRV_B = 1;

const SHFMT_ID_DEFAULT = $FFFF;

const SHFMT_OPT_QUICKFORMAT = 0;
const SHFMT_OPT_FULLFORMAT = 1;
const SHFMT_OPT_SYSONLY = 2;

const SHFMT_ERROR = -1;
const SHFMT_CANCEL = -2;
const SHFMT_NOFORMAT = -3;

function SHFormatDrive(hWnd : HWND;
                       Drive : Word;
                       fmtID : Word;
                       Options : Word) : Longint
   stdcall; external 'Shell32.dll' name 'SHFormatDrive';

procedure TForm1.Button1Click(Sender: TObject);
// formating a floppy drive, or another drive
var
  FmtRes : longint;
begin
  try
    FmtRes:= ShFormatDrive(Handle,
                           SHFMT_DRV_A,
                           SHFMT_ID_DEFAULT,
                           SHFMT_OPT_QUICKFORMAT);
    case FmtRes  of
     SHFMT_ERROR : ShowMessage('Error formatting the drive');
     SHFMT_CANCEL :
       ShowMessage('User canceled formatting the drive');
     SHFMT_NOFORMAT : ShowMessage('No Format')
    else
     ShowMessage(''Disk has been formatted!');
    end;
  except
  end;
end;
0
 
LVL 1

Author Comment

by:Asw
ID: 7091173
Hi ginsonic ,yk,

I need to format the C: drive transparently without any messages, I am looking for a complete solution.

Andy
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 7091661
Sorry, I see now that :(
Thinking ...
0
 
LVL 6

Accepted Solution

by:
Mindphaser earned 0 total points
ID: 7125364
Points refunded per request and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question