source code

Mar 16, 2015 at 2:28 PM
Hi

Downloaded the source code so I could take a closer look in Visual Studio

Trouble is I can't open the project, get lots of errors such as below - any clues to why I can't view your source code?

Error 1 Type 'LDM.Ribbons.RibbonButton' is not defined. C:\Users\Darren\Desktop\temp\Logical Disk Monitor\LDM.Designer.vb 31 28 Logical Disk Monitor

Error 9 'Ribbons' is not a member of 'ldm.LDM'. C:\Users\Darren\Desktop\temp\Logical Disk Monitor\LDM.Designer.vb 99 36 Logical Disk Monitor
Coordinator
Mar 16, 2015 at 3:21 PM
Hi,

The Visual Studio file contains four projects: HDD Guardian, Translation Tool, Logical Disk Monitor (LDM) and Toolbox.
LDM is not fundamental for HDD Guardian, it provides only a little utility that allow to place into tray area an icon for each partition that display the drive activity (read/write), but I don't think that is so much used... ;)
Since on the next version I have in my mind to remove it, if you want you can exclude it from the project. Anyway, and I don't know why, it provides me the same errors, and I have to modify some files to make it works! :/
If needed, I'm here to help you! ;)

Greetings,
Sam
Mar 16, 2015 at 3:35 PM
Hi Sam

Thanks for your prompt reply

I tried removing LDM from project but still get following error which stops me building - something about a missing file called private.xml??

Error 1 Invalid Resx file. Could not find file 'C:\Users\Darren\Desktop\hddguardian_0.6.2-source_vb.net\HDD Guardian\Resources\private.xml'. Line 141, position 5. C:\Users\Darren\Desktop\hddguardian_0.6.2-source_vb.net\HDD Guardian\My Project\Resources.resx 141 5 HDD Guardian

And if I try to open main.vb I get 187 errors at bottom of screen and a screen saying "to prevent data loss the following errors must be fixed ....." - error such as below:-

Message 2 The variable 'RibbonHorizontalSeparator2' is either undeclared or was never assigned. 0 0

Please any clues on sorting this so I can build project and look at forms/code properly would be much appreciated
Coordinator
Mar 16, 2015 at 4:26 PM
The file called "private.xml" contains the keys for encrypt/decrypt the mail password stored into the setting file.
The standard setting file is a normal xml file, so is not secure to store a password not encrypted since can be stolen...
For this reason I don't have published the keys for encryption/decryption, to make a little more secure store an encrypted password into the settings file, or encrypt the password is more or less useless. ;)

Before to open the "main.vb" file you have to compile the code (or run the project), or the custom controls like "RibbonHorizonalSeparator" (that is not the only one) can't be displayed in the main form and, in the worst case, you loose all the controls (also the standard ones contained in a custom control). ;)
Mar 16, 2015 at 4:39 PM
okay that makes sense - but without that file it won't run so I can't build/compile it

Will try removing the reference to private.xml in resources.resx and see if it then works okay

Just trying to work out how you use smartctl to get SMART data - as for an app I am writing I want to retrieve basic information from hard disk, not so much information as you do, but just enough to show if disk is healthy etc
Coordinator
Mar 16, 2015 at 5:40 PM
After removing the reference to resource file you have also to remove some lines of code or you get some errors.

If you need to gather the only data needed to give an overview of drive health, I can suggest to gather ATA errors count (but you need also to tell the type of error), raw values of ID 5, 196, 197, 198 that are all relative to disk surface (bad sectors) and the value of overall health check, that tell if the disk have values under/over the threshold.
All these values are the same gathered by HDD Guardian to tell if something is not working fine. ;)
Mar 16, 2015 at 6:05 PM
Thank you that is very useful and yes that is about all I need to retrieve really - just the basics and then if issues would run your tool to get further details anyway

Which part of your VB would show me how you retrieve this information using smartctl etc? basically just want to click a button and it displays that information for all hard disks in system (usually just one with most of my customers)
Coordinator
Mar 16, 2015 at 9:26 PM
You can get these information on file Devices.vb, on subs called GetHealth (for overall health check), GetAttributes (for raw values of ID 5, 196, 197, 198) and GetErrors (for ATA errors count).

I've done in the past something similar for a company with a couple of programs, based on the code of HDD Guardian and using smartctl: one that gather data from a maximum of 8 (ATA/SATA/SCSI/USB) disks with a little analysis, the possibility to run tests and with an option to export smartctl result encrypted (so a customer can't change the output) and one that provide a more deeper analysis for the company... I think that with a little modification of code (in fact a mere copy/paste and a deletion of unwanted parts) from that code is possible to obtain something similar to what you want! ;)

The project is stored here and executables here. Note that the programs are in Italian language! ;)
Marked as answer by Eruestan on 3/19/2015 at 4:48 PM
Mar 16, 2015 at 10:02 PM
Thank you so much for that - very much appreciated - just had a quick look and will be perfect for me to fiddle about with to achieve what I need!!!

Thanks again

P.S. Google translate needed I think - but will soon work it out :)
Coordinator
Mar 16, 2015 at 10:45 PM
Nice to know that it can be useful also to you! :)

I can help, if you need a hand with Italian - English translation! ;)
Mar 17, 2015 at 5:06 PM
Yes is definitely very useful thanks

Managed to understand/convert all the Italian I think - so definitely makes sense now

One question though - on the "checker" app - what is the use of the Run tests button? I can see from the code it does a short self test, but it doesn't pop up and show results, so couldn't work out why/when you would use it?
Coordinator
Mar 17, 2015 at 6:25 PM
The task for "checker" (created for customers) app was only to gather data and display some details; the run test option was useful only to the "analyzer" (used by the company) that tell to technician the last test result (this thing was asked directly from that company).

If you want, you can do a little change of the code (copy from "analyzer" code) and, from an single app, run and display the last test result.
Mar 19, 2015 at 7:52 PM
Thanks again for your help - I have now created an app that does exactly what I need thanks to your example code

Couple of questions though:-

1) This applies to both this code and HDD Guardian - it doesn't pick up a hard disk connected via USB - why would this be?

2) This is an odd one - in HDD Guardian on the device health tab for a HD with issues under Last Test it says "Completed : Read Failure at 10%" - but with my app and the "checker/analyzer" code above it says "Completed: Read failure al 10%" - i.e. showing "al" rather than "at" - but for life of me I can't find where it is picking this spelling mistake up from - any clues?
Coordinator
Mar 19, 2015 at 11:47 PM
If you want to keep only the English language, you have to remove from the code of the main form (Main.vb) this portion (you can find it at the end of file):
Public Class ResultsList
    Inherits List(Of Results)
End Class

Public Structure Results
    Dim Original, Change As String
    Sub New(ByVal orig As String, ByVal chng As String)
        Original = orig
        Change = chng
    End Sub
End Structure
You have to delete also the portions of code that generate an error when you remove that code.
This portion of code (and all related parts) is useful only to translate the output of smartctl (that is in English) to another language.
Mar 20, 2015 at 12:06 AM
okay thanks - I get why it is doing it now - that code is not in main.vb though in the code you gave me, it is in devices.vb

Tried removing it, but it gives a lot of errors - mainly ones to do with "m_testresults" not being defined due to the line "Dim m_testresults As New ResultsList" not working once I remove above code, is late now so will look in more details tomorrow

What about question 1 re HD Guardian not showing my USB hard disk - is this correct behaviour?
Coordinator
Mar 20, 2015 at 12:25 AM
About the errors is normal, when you remove a custom type... ;)

I've forgot the question of USB, focusing on the code, I'm sorry (it's late also for me)... The thing is that smartctl, when compiled, has some built-in USB bridges that you find into the file called drivedb.h of the package. This file, that is used also as external database, is updated by smartctl developers by adding new bridges and drives that are unknown at the moment of the release of package.
The code that I've provided you can't include this file, but you can do the works by updating drivedb.h (on _...\HDD Guardian\Smartctl_ subfolder you can get all files that are needed), attaching it to the project as resource and extracting it in the same folder of smartctl.

On some cases, is possible that the USB bridge is not in database. On this case you have to test it by using Toolbox of HDD Guardian (better to keep all HDD Guardian folder) and analyze the output of USB scan. After that you need to edit the file drivedb.h, adding the new entry.
I guarantee that is not so difficult, it's more simple done it than explain it! ;)
Mar 20, 2015 at 12:13 PM
Fixed the language problem - was obvious when I looked this morning - think I should stop trying to code late at night, as keep missing the obvious!

As for the USB issue - very odd as whatever computer I use HDD Guardian doesn't recognize my Lacie USB hard disk - but other SMART tools including GSmartControl (which uses smartctl) show it (well at least it shows basic information about it) - and the USB controllers used on my computers are common ones used in most computers

Thanks again
Coordinator
Mar 20, 2015 at 2:25 PM
For the USB problem, try to update smartctl database from HDD Guardian (File -> Update smartctl database) and the click on "Rescan external devices" from the Overview tab, your device should appear.
Remember that to detect USB devices, you have to run HDD Guardian with admin rights (right click on executable and then choose "Run as administrator"): in this manner also smartctl (called via command prompt) inherits the same rights and it can access to USB devices.
Mar 20, 2015 at 2:44 PM
smartctl updated and clicked rescan - but still not showing my Lacie USB Hard Disk on either computer I use

Another question re HD Guardian - on the Device Health page for a hard disk with issues! - for current pending sector and offline correctable it says 11/10 - surely you can't have 11/10 only 10/10?
Coordinator
Mar 20, 2015 at 4:07 PM
Sound strange... Can you provide me the output of Toolbox page called USB scan?

The value of 11/10 represents the current amount of device pending sectors (11) over the maximum value set on HDD Guardian (10), so, yes, it can be over the value of 10/10. ;)
In example, I've loaded at work an old report of a dead IBM disk: on Device Health page report a value of 19/5 for reallocated sectors count, 27/10 for reallocation events count, 14/10 for current pending sectors and 13/10 for uncorrectable sectors.
Maybe I have to report more clear, like "Current value: 11, Warning threshold: 10". :D
Mar 20, 2015 at 4:29 PM
Thank you - that makes sense now - one value is current and one is the threshold - might be worth showing that on the display to make it clearer perhaps

log is too big to paste it in a reply - so can be downloaded from my website = usbtest.txt
Coordinator
Mar 20, 2015 at 6:05 PM
I've read your output, but it seems that smartctl can't know how to handle your device, so it's for this reason that is missed under HDD Guardian; I'm curious about the output of GSmartControl: can you provide a screenshot?
Thank you very much! ;)
Mar 20, 2015 at 6:31 PM
actually checking in more details it seems GSmartControl shows it in the drive list - but when you try to go into the drive for more details it only gives basic output - so obviously something odd about my external drives :)

smartctl 5.43 2012-06-30 r3573 [i686-w64-mingw32-win8(64)] (sf-5.43-1)
Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

Vendor: LaCie
Product: Rugged Mini USB3
Revision: 1053
User Capacity: 500,107,862,016 bytes [500 GB]
Logical block size: 512 bytes
Logical Unit id: 0x5000000000000001
Serial number: 8601bcb07b5100000000
Device type: disk
Local Time is: Fri Mar 20 18:29:10 2015 GMTST
Device supports SMART and is Enabled
Temperature Warning Disabled or Not Supported
SMART Health Status: OK

Error Counter logging not supported
Device does not support Self Test logging
Coordinator
Apr 22, 2015 at 3:07 PM
Hi,

Sorry for the very late reply, but I've taken a little pause... :)

The output that you have pasted in the previous post is the classical output of a SCSI device, and I'm not so sure that this output can report the correct SMART status of the device that is inside the enclosure...
Apr 22, 2015 at 3:09 PM
Okay thanks - that makes sense