diff --git a/src/context.h b/src/context.h index bf5c4fc..63dea2e 100644 --- a/src/context.h +++ b/src/context.h @@ -169,7 +169,7 @@ typedef struct nwipe_context_t_ // don't support DCO/HPA and those that do. Also drives that can't provide // HPA/DCO due to the chips they use (USB adapters) char DCO_reported_real_max_size_text[NWIPE_DEVICE_SIZE_TXT_LENGTH]; // real max size in human readable form i.e 1TB - // etc + char Calculated_real_max_size_in_bytes_text[NWIPE_DEVICE_SIZE_TXT_LENGTH]; // calculated real max human readable u64 HPA_sectors; // The size of the host protected area in sectors char HPA_size_text[NWIPE_DEVICE_SIZE_TXT_LENGTH]; // Human readable size bytes, KB, MB, GB .. int HPA_display_toggle_state; // 0 or 1 Used to toggle between "[1TB] [ 33C]" and [HDA STATUS] diff --git a/src/create_pdf.c b/src/create_pdf.c index f7b7289..21c5fea 100644 --- a/src/create_pdf.c +++ b/src/create_pdf.c @@ -189,8 +189,8 @@ int create_pdf( nwipe_context_t* ptr ) pdf_add_text( pdf, NULL, "Size(Apparent): ", 12, 60, 390, PDF_GRAY ); pdf_set_font( pdf, "Helvetica-Bold" ); snprintf( device_size, sizeof( device_size ), "%s, %lli bytes", c->device_size_text, c->device_size ); - if( ( c->device_size == c->DCO_reported_real_max_size ) || c->device_type == NWIPE_DEVICE_NVME - || c->device_type == NWIPE_DEVICE_VIRT || c->HPA_status == HPA_NOT_APPLICABLE ) + if( ( c->device_size == c->Calculated_real_max_size_in_bytes ) || c->device_type == NWIPE_DEVICE_NVME + || c->device_type == NWIPE_DEVICE_VIRT || c->HPA_status == HPA_NOT_APPLICABLE || c->HPA_status != HPA_UNKNOWN ) { pdf_add_text( pdf, NULL, device_size, text_size_data, 145, 390, PDF_DARK_GREEN ); } @@ -211,17 +211,17 @@ int create_pdf( nwipe_context_t* ptr ) } else { - /* If there is a real max size always show in green, if the drive doesn't - * support HPA show device size as that is the real size. + /* If the calculared real max size as determined from HPA/DCO and libata data is larger than + * or equal to the apparent device size then display that value in green. */ - if( c->DCO_reported_real_max_size > 1 ) + if( c->Calculated_real_max_size_in_bytes >= c->device_size ) { /* displays the real max size of the disc from the DCO displayed in Green */ snprintf( device_size, sizeof( device_size ), "%s, %lli bytes", - c->DCO_reported_real_max_size_text, - c->DCO_reported_real_max_size ); + c->Calculated_real_max_size_in_bytes_text, + c->Calculated_real_max_size_in_bytes ); pdf_add_text( pdf, NULL, device_size, text_size_data, 125, 370, PDF_DARK_GREEN ); } else @@ -543,7 +543,7 @@ int create_pdf( nwipe_context_t* ptr ) { if( c->HPA_status == HPA_UNKNOWN ) { - snprintf( HPA_size_text, sizeof( HPA_size_text ), "UNKNOWN" ); + snprintf( HPA_size_text, sizeof( HPA_size_text ), "Unknown" ); pdf_add_text( pdf, NULL, HPA_size_text, text_size_data, 390, 210, PDF_RED ); } } @@ -585,7 +585,7 @@ int create_pdf( nwipe_context_t* ptr ) { if( c->HPA_status == HPA_UNKNOWN ) { - snprintf( HPA_status_text, sizeof( HPA_status_text ), "Status unknown" ); + snprintf( HPA_status_text, sizeof( HPA_status_text ), "Unknown" ); pdf_set_font( pdf, "Helvetica-Bold" ); pdf_add_text( pdf, NULL, HPA_status_text, text_size_data, 130, 210, PDF_RED ); pdf_set_font( pdf, "Helvetica" ); @@ -648,6 +648,22 @@ int create_pdf( nwipe_context_t* ptr ) 170, PDF_RED ); } + else + { + if( c->HPA_status == HPA_UNKNOWN ) + { + pdf_add_ellipse( pdf, NULL, 160, 173, 30, 9, 2, PDF_RED, PDF_BLACK ); + pdf_add_text( pdf, NULL, "Warning", text_size_data, 140, 170, PDF_YELLOW ); + + pdf_add_text( pdf, + NULL, + "HPA/DCO data unavailable, can not determine hidden sector status.", + text_size_data, + 200, + 170, + PDF_RED ); + } + } /* info descripting what bytes erased actually means */ pdf_add_text( pdf, @@ -658,11 +674,11 @@ int create_pdf( nwipe_context_t* ptr ) 137, PDF_BLACK ); - /* meaning of abreviation DDNSHDA */ + /* meaning of abreviation DDNSHPA */ if( c->HPA_status == HPA_NOT_SUPPORTED_BY_DRIVE ) { pdf_add_text( - pdf, NULL, "** DDNSHDA = Drive does not support HPA/DCO", text_size_data, 60, 125, PDF_DARK_GREEN ); + pdf, NULL, "** DDNSHPA = Drive does not support HPA/DCO", text_size_data, 60, 125, PDF_DARK_GREEN ); } pdf_set_font( pdf, "Helvetica" ); diff --git a/src/gui.c b/src/gui.c index 3676376..2a150a8 100644 --- a/src/gui.c +++ b/src/gui.c @@ -2905,7 +2905,7 @@ void* nwipe_gui_status( void* ptr ) else { wattron( main_window, COLOR_PAIR( 9 ) ); - mvwprintw( main_window, yy++, 4, "(>>>FAILURE!<<<, code %i) ", c[i]->result ); + mvwprintw( main_window, yy++, 4, "(>>> IOERROR! <<<, code %i) ", c[i]->result ); wattroff( main_window, COLOR_PAIR( 9 ) ); } diff --git a/src/hpa_dco.c b/src/hpa_dco.c index 705e27f..78e2972 100644 --- a/src/hpa_dco.c +++ b/src/hpa_dco.c @@ -565,7 +565,7 @@ int hpa_dco_status( nwipe_context_t* ptr ) { /* This occurs when a SG_IO error occurs with USB devices that don't support ATA pass * through */ - if( c->HPA_reported_set == 0 && c->HPA_reported_real == 1 && c->DCO_reported_real_max_sectors <= 1 ) + if( c->HPA_reported_set == 0 && c->HPA_reported_real == 0 && c->DCO_reported_real_max_sectors <= 1 ) { c->HPA_status = HPA_UNKNOWN; if( c->device_bus == NWIPE_DEVICE_USB ) @@ -583,14 +583,7 @@ int hpa_dco_status( nwipe_context_t* ptr ) } } - /* ------------------------------------------------------------------- - * create two variables for later use based on real max sectors - * DCO_reported_real_max_size = real max sectors * sector size = bytes - * DCO_reported_real_max_size_text = human readable string, i.e 1TB etc. - */ c->DCO_reported_real_max_size = c->DCO_reported_real_max_sectors * c->device_sector_size; - Determine_C_B_nomenclature( - c->DCO_reported_real_max_size, c->DCO_reported_real_max_size_text, NWIPE_DEVICE_SIZE_TXT_LENGTH ); nwipe_dco_real_max_sectors = nwipe_read_dco_real_max_sectors( c->device_name ); @@ -637,6 +630,19 @@ int hpa_dco_status( nwipe_context_t* ptr ) } } + /* ------------------------------------------------------------------- + * create two variables for later use by the PDF creation function + * based on real max sectors and calculated real max size in bytes. + * + * DCO_reported_real_max_size = real max sectors * sector size = bytes + * DCO_reported_real_max_size_text = human readable string, i.e 1TB etc. + */ + + Determine_C_B_nomenclature( + c->DCO_reported_real_max_size, c->DCO_reported_real_max_size_text, NWIPE_DEVICE_SIZE_TXT_LENGTH ); + Determine_C_B_nomenclature( + c->Calculated_real_max_size_in_bytes, c->Calculated_real_max_size_in_bytes_text, NWIPE_DEVICE_SIZE_TXT_LENGTH ); + /* ---------------------------------------------------------------------------------- * Determine the size of the HPA if it's enabled and store the results in the context */ diff --git a/src/logging.c b/src/logging.c index 9a1740a..4438d05 100644 --- a/src/logging.c +++ b/src/logging.c @@ -797,7 +797,7 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected ) } else { - if( c[i]->wipe_status == 0 && user_abort != 1 ) + if( c[i]->wipe_status == 0 /* && user_abort != 1 */ ) { strncpy( exclamation_flag, " ", 1 ); exclamation_flag[1] = 0; @@ -809,7 +809,7 @@ void nwipe_log_summary( nwipe_context_t** ptr, int nwipe_selected ) } else { - if( user_abort == 1 ) + if( c[i]->wipe_status == 1 && user_abort == 1 ) { strncpy( exclamation_flag, "!", 1 ); exclamation_flag[1] = 0; diff --git a/src/version.c b/src/version.c index 8fc3fd1..d66560d 100644 --- a/src/version.c +++ b/src/version.c @@ -4,7 +4,7 @@ * used by configure to dynamically assign those values * to documentation files. */ -const char* version_string = "0.34.85 Development code, not for production use!"; +const char* version_string = "0.34.86 Development code, not for production use!"; const char* program_name = "nwipe"; const char* author_name = "Martijn van Brummelen"; const char* email_address = "git@brumit.nl"; @@ -14,4 +14,4 @@ Modifications to original dwipe Copyright Andy Beverley \n\ This is free software; see the source for copying conditions.\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS\n\ FOR A PARTICULAR PURPOSE.\n"; -const char* banner = "nwipe 0.34.85 Development code, not for production use!"; +const char* banner = "nwipe 0.34.86 Development code, not for production use!";