Skip to content

Commit

Permalink
added more verbose info
Browse files Browse the repository at this point in the history
  • Loading branch information
tenox7 committed May 21, 2016
1 parent 55a8693 commit 952915e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions disktrim.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// DiskTrim 1.0 by Antoni Sawicki and Tomasz Nowak
// DiskTrim 1.1 by Antoni Sawicki and Tomasz Nowak
// Requires Windows 2008 R2 / Windows 8.1 or above
//
// DiskTrim is a small command line application for Windows that allows
Expand Down Expand Up @@ -137,7 +137,7 @@ int wmain(int argc, WCHAR *argv[]) {
PREAD_CAPACITY pReadCapacity;
ULONG DiskLbaCount, DiskBlockSize;

wprintf(L"=[ DiskTrim v1.0 by Antoni Sawicki & Tomasz Nowak, %s %s ]=\n\n", __WDATE__, __WTIME__);
wprintf(L"=[ DiskTrim v1.1 by Antoni Sawicki & Tomasz Nowak, %s %s ]=\n\n", __WDATE__, __WTIME__);


if(argc==3) {
Expand Down Expand Up @@ -178,6 +178,8 @@ int wmain(int argc, WCHAR *argv[]) {
//
// Query disk size
//
wprintf(L"Querying drive parameters...\n");

TransferSize = 36;

BufLen = sizeof(SCSI_PASS_THROUGH) + SENSE_INFO_LENGTH + TransferSize;
Expand Down Expand Up @@ -228,13 +230,15 @@ int wmain(int argc, WCHAR *argv[]) {
//
// Uninitialize disk so it doesn't have any partitions
//
wprintf(L"Deleting disk partitions...\n");
if(!DeviceIoControl(hDisk, IOCTL_DISK_DELETE_DRIVE_LAYOUT, NULL, 0, NULL, 0, &BytesRet, NULL))
error(1, L"Error on DeviceIoControl IOCTL_DISK_DELETE_DRIVE_LAYOUT [%d] ", BytesRet );


//
// Write test pattern
//
wprintf(L"Writing test pattern...\n");
ZeroMemory(&Ovr, sizeof(Ovr));
Ovr.Offset = 0x00;
Ovr.OffsetHigh = 0;
Expand All @@ -258,6 +262,7 @@ int wmain(int argc, WCHAR *argv[]) {
//
// UNMAP
//
wprintf(L"Performing UNMAP on the LBA range...\n");
TransferSize = sizeof(UNMAP_LIST_HEADER) + sizeof(UNMAP_BLOCK_DESCRIPTOR);

BufLen = sizeof(SCSI_PASS_THROUGH) + SENSE_INFO_LENGTH + TransferSize;
Expand Down Expand Up @@ -307,6 +312,7 @@ int wmain(int argc, WCHAR *argv[]) {

ZeroMemory(TestBuff, sizeof(TestBuff));

wprintf(L"Reading test pattern...\n");
if(!ReadFile(hDisk, TestBuff, sizeof(TestBuff), NULL, &Ovr))
error(1, L"Error reading disk");

Expand Down

0 comments on commit 952915e

Please sign in to comment.