Ullis Roboter Seite
FTDI driver check: Hands off my drivers!
Last modified: 03/03/2016   Drucken        Zur deutschen Version Zur deutschen Version wechseln

Again FTDI seems to distribute destructive drivers. See the following links:

The simplest solution is to persuade Windows not to update any drivers. This can be done as described here:
     Stop automatic driver updates on Windows 10

But this can not be the solution. I looked on my PC, where the driver files are and have written a small Visual Basic program that warns me when new FTDI drivers are installed.

Concerning the problem that FTDI changes the USB identifier see (German): Boards: Unvergessene Dokumentationen.

Content

Concept

Konfiguration

Installation

Internals

Download


Concept

The driver package consists of seven files

All these files also could be found in the directories

The file ftd2xx.dll has the name ftd2xx64.dll there. The final part of the directory name "... \ ftdibus.inf_amd64_54aa41742b0abca5 \ amd64" will be very computer-specific. I have a 64-bit AMD computer.

All these files of my driver version 2:12:00 have the time stamp (last modified date) "09/09/2014".

When Windows starts a small VB program examines the time stamp of these files and checks for "09/09/2014". If one of these time stamps have changed the program raises an alarm.

The entire driver package consists of some more files. Those noted above seem to be the most important.

It makes sense to copy the content of both folders from the directory "DriverStore" to a safe place, from which you can retrieve them if necessary. The files from PC can bei found at the download chapter below.


Konfiguration

Unfortunately I don't know, how to get to the file paths generally. Therefore, for other users it is necessary to adjust the path to the driver files inside the program and to recompile it. The program was developed with Visual Studio 2012. Later VS versions should deal with it. Using a previous version you probably have to create a new project and take over only the source files. Important is to add a reference to assembly System.Management.

For individual configuration only the file ModCheck.vb has to be modified. First the directory names have to be adapted:

'Adjust the following three directories to your own system!
Public SystemDir As String = "C:\\windows\\System32\\"
Public DriversDir As String = "C:\\windows\\System32\\drivers\\"
Public StoreDir As String = "C:\\Windows\\System32\\DriverStore\\FileRepository\\ftdibus.inf_amd64_54aa41742b0abca5\\amd64\\"
Public StoreDir2 As String = "C:\\Windows\\System32\\DriverStore\\FileRepository\\ftdiport.inf_amd64_52a0a468ba08593c\\amd64\\"

Second, in 32-Bit-systems a file name has to be patched:

FtdiFileList.Add(New FileCheck(StoreDir & "ftd2xx64.dll")) '<- Check this filename!

Important note: The separator between parts of the directories has to be "\\" (double back slash). The string is passed to a WMI query. There the escape symbol is "\".


Installation

After adapting file and directory names you can compile the program. The resulting executable FtdiChk.exe file should be copies into a save place e.g. the Windows folder.

Use the context menu to create a shortcut to the copied file. This shortcut can be moved to the Autostart folder (enter "autostart" in the Windows search box or look here: How to find auto startup folder in Windows 10). If you want that you also receive a message if no error was found, add the command line parameter "-V". Now it looks like this (it's a German screenshot but sould be easy to translate):

Shortcut properties

If all files have the right date and the message is activated ("-V") the program will display:

OK-Meldung

If the program finds a discrepancy this problem report will be shown:

Problem report


Programm-Interna

The program has only two noteworthy points:

Program-Start

To be an perfectly invisble program the file check is done before them main windows is shown. For this purpose, the WindowsFormsApplicationBase.Startup event can be used.

Imports Microsoft.VisualBasic.ApplicationServices

Namespace My

   ' Für MyApplication sind folgende Ereignisse verfügbar:
   ' 
   ' Startup: Wird beim Starten der Anwendung noch vor dem Erstellen des Startformulars ausgelöst.
   ' Shutdown: Wird nach dem Schließen aller Anwendungsformulare ausgelöst. Dieses Ereignis wird nicht ausgelöst,
   '           wenn die Anwendung nicht normal beendet wird.
   ' UnhandledException: Wird ausgelöst, wenn in der Anwendung eine unbehandelte Ausnahme auftritt.
   ' StartupNextInstance: Wird beim Starten einer Einzelinstanzanwendung ausgelöst, wenn diese bereits aktiv ist. 
   ' NetworkAvailabilityChanged: Wird beim Herstellen oder Trennen der Netzwerkverbindung ausgelöst.
   Partial Friend Class MyApplication
      Public Sub Me_Startup(ByVal sender As Object, ByVal e As StartupEventArgs) Handles Me.Startup
         Dim mVerbose As Boolean = False
         For Each s In From s1 In e.CommandLine Where s1.ToUpper() = "-V" Or s1.ToUpper() = "/V"
            mVerbose = True
         Next
         Dim mResult = FtdiCheck()

         If mResult = ProblemType.NoProblem Then
            If mVerbose Then
               MsgBox("FTDI drivers were checked")
            End If
            e.Cancel = True ' Everything is ok. No further action required
         Else
            'Files have been modified, display problem report
         End If
      End Sub
   End Class
End Namespace

Access to the application events must first be activated via the project properties (screenshot shows a German dialog, the English one should loo similar:

Anwendungsereignisse

File access

Windows has refused to grant access to the system files strictly using the available normal .net functions. Therefore  retrieved the file informations via WMI (Windows Management Instrumentation).

For Each File In FtdiFileList

   Dim mSearchString As String = "SELECT * FROM CIM_Datafile WHERE Name = '" & File.FilePath & "'"

   Dim searcher As ManagementObjectSearcher = New ManagementObjectSearcher(mSearchString)
   Dim mManagementObjectCollection As ManagementObjectCollection = searcher.Get

   If mManagementObjectCollection.Count <> 1 Then
      File.TestResult = ProblemType.MissingFile
      mOverallProblem = ProblemType.MissingFile
   Else
      Dim mFile As New CIM_Datafile(mManagementObjectCollection(0))
      If Not mFile.LastModified.StartsWith("20140909") Then
         File.TestResult = ProblemType.Modified
         mOverallProblem = ProblemType.Modified
      End If
   End If
Next

Über das WMI bekommt man auch die Programmversionen geliefert. Diese sind jedoch rechtunterschiedlich für die einzelnen Treiberkomponenten, während das Änderungsdatum über gleich ist. Deshalb habe ich dieses zur Prüfung benutzt. Ich hoffe, das reicht.

WMI delibers the program versions too. However, these versions are quite different for the individual driver components, while the last modification date is identical to all files. Therefore, I have used the date for file checking. I hope this is sufficient.

Download

FTDI-DriverStore from PC from today (2016-2-3)

VB-Projekt for Visual Studio 2012