TomTom GO 910 infected with a virus out of the box?!

This weekend I bought a TomTom navigation system, I chose the GO 910 because it is easy to update, works well and has a lot of nice extra features (bluetooth handsfree, mp3 playback, …) When I came home and hooked it up to my pc using the USB docking station, avast gave with a warning that it detected a virus.

Naively, I assumed that a brand new device could never be infected with a virus, and ignored the warning thinking that avast was over sensitive about some TomTom component. This was not the smartest thing, because soon I realised that there was indeed a virus on the TomTom harddrive, and I couldn’t open any of my drives from explorer anymore.

I did some surfing and noticed that a lot of people had this problem, there even was an official statement from TomTom, saying they know the problem exists, that it wasn’t all that bad, and that all antivirus software would spot the threat. They also mentioned that: “the virus does not impact the navigation performance of the TomTom GO 910″; good to know when no drives on my PC will open through Windows Explorer…

A good thing I probably know my way around computers better than the average TomTom customer, it still took me quite some time to realize exactly what happened and fix my system.

I must have missed something, but how can a company get away with keeping a known virus-infected device in stores? Why can’t the infected devices be tracked and cleaned by TomTom before a user has to find out the hard way?

Related links:

Computing MD5 hashes in C#

I’ve had to create md5 hashes in php before, which can be done by simply using the md5() function. Because I always try to avoid reinventing the wheel, I googled for an example on how to compute these kinds of hashes from c#. It directed me to the Microsoft knowledgebase, article KB307020, but that didn’t work as expected.

That particular article shows how you can compute the MD5 hash of a string and then display the resulting byte array as a new string containing the hexadeximal representation of each byte. Since I needed to compare the hash to a string that was generated by a script on a linux machine, I was especially interested in the ByteArrayToString method from the knowledge base article. I have pasted it below, see if you can spot the error:

static string ByteArrayToString(byte[] arrInput)
{
  int i;
  StringBuilder sOutput = new StringBuilder(arrInput.Length);
  for (i=0;i < arrInput.Length -1; i++) 
    {
      sOutput.Append(arrInput[i].ToString("X2"));
    }
  return sOutput.ToString();
}

Continue Reading »

Custom paste behaviour for Windows Forms controls

Some Windows Forms controls come with copy/paste functionality out of the box. This is great when you just want the standard copy/paste behaviour, but what if you want to do some transformation of the data on the clipboard prior to displaying it in the Windows Forms control?

In my case I needed to convert a selection copied from Excel to a comma-delimited list of values when they were pasted in a TextBox. Since there is no OnPaste() method on the TextBox to override, I had to dig deeper to get the job done.

Usually something like this can be done by creating a subclass of the component and overriding the WndProc method to capture the right message. So I created a class called MyTextBox which extends TextBox and I trapped the windows Paste message, like this:

private const int WM_PASTE = 0x302;
 
protected override void WndProc(ref Message m)
{
    if (m.Msg == WM_PASTE)
    {
        // trigger our custom paste logic
        OnPaste();
    }
    else
    {
        base.WndProc(ref m);
    }
}
 
protected virtual void OnPaste() 
{
    // put custom logic here    
}

There you go, now my own protected virtual OnPaste() method is called when the control receives a PASTE message, and the message is not passed to the base class to prevent the default paste behavior from being executed.

All that is left to do now is get the text data from the clipboard, do my own transformations and change the Text property of the TextBox accordingly.

Continue Reading »

« Prev - Next »