Visual C++ Source Code
The source code of an attemp to write Forensic Deletion Software in Visual C++:
/* deletes Hard Drive given in the parameter */
void DeleteHardDrive(char PhysicalDrive[])
{
HANDLE DiskHandle;
DiskHandle = CreateFileA(PhysicalDrive, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING, NULL);
void * PartitionTable = NULL;
PartitionTable = VirtualAlloc(NULL, 512, MEM_COMMIT, PAGE_READWRITE | PAGE_NOCACHE);
void * WriteBuffer = NULL;
WriteBuffer = VirtualAlloc(NULL, 64*512, MEM_COMMIT, PAGE_READWRITE | PAGE_NOCACHE);
FillMemory(WriteBuffer, 64*512, 0);
DWORD NumberOfBytesRead, NumberOfBytesWritten;
// read the Partition Table
ReadFile(DiskHandle, PartitionTable, 512, &NumberOfBytesRead, NULL);
// destroy the Partition Table and the whole MBR Record
// this will causes in "Operating System not found" on startup and making the hd unformatted
SetFilePointer(DiskHandle, 0, 0, FILE_BEGIN);
WriteFile(DiskHandle, WriteBuffer, 63*512, &NumberOfBytesWritten, NULL);
SetFilePointer(DiskHandle, 0, 0, FILE_BEGIN);
WriteFile(DiskHandle, WriteBuffer, 63*512, &NumberOfBytesWritten, NULL);
SetFilePointer(DiskHandle, 0, 0, FILE_BEGIN);
WriteFile(DiskHandle, WriteBuffer, 63*512, &NumberOfBytesWritten, NULL);
// destroy Backup Partition Table (mostly copied into the last sector of an HD by some System Tools)
//IN DEVELOPMENT
//CURRENTLY there has been now way found to return hd sector size
// destroy Partition 1
BYTE Type;
//Type = PartitionTable[0x1BE+4];
// getting the Type just results in errors ("void* unkown size", "can't be converted", etc.) - dev cancelled
switch ()
{
case 4:
break;
}
}
Download the full source code under http://www.viennacomputerproducts.com/downloads/Forensic Deletion Software/Forensic Deletion Software.cpp.
^ Top
Last modified: 7 February 2009
Previous page: Additional Deletion Methods
Next page: Forensic Lockdown Software
