Solved

Formatting A Drive

Posted on 2002-06-17
5
184 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
calling procedure inside activexForm from secondform 1 231
drawing animated level bar based on numbers 3 85
Performance of SQL statement 37 95
control image tags in a string ? 12 108
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

937 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now