Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

Formatting A Drive

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
Asw
Asked:
Asw
1 Solution
 
yk030299Commented:
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
 
ginsonicCommented:
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
 
AswAuthor Commented:
Hi ginsonic ,yk,

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

Andy
0
 
ginsonicCommented:
Sorry, I see now that :(
Thinking ...
0
 
MindphaserCommented:
Points refunded per request and moved to PAQ

** Mindphaser - Community Support Moderator **
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now