Sunday, February 27, 2011

Silverlight 1.1 Alpha Refresh patch to run after expiration date

Once upon a time I won a Silverlight coding competition by writing a simple game in Silverlight 1.1 Alpha Refresh. A few weeks ago a beta tester of my game requested to play with it, once more. Installing the redistributable (thanks god I keep an archive of these because I couldn’t find it on Microsoft’s site) I came up with a message box that said that this version has expired (the alpha version should expire on 1st nov 2007).

Thus, I tried the version 2.0 redistributable. To my disappointment, the Silverlight 2.0 that was released after the Silverlight 1.1 Alpha didn’t support the code I had written and I had to modify a couple of things to make it run under version 2.0.
In order to avoid editing the code I tried to “extend” the alpha expiration date. So I ended up installing a trial of IDA Pro 6 and checking the assembly of the “C:\Program Files\Microsoft Silverlight\npctrl.1.0.20816.0.dll” file. If you open up the file in a hex editor and go to the 00014EE5 address you will see the following hex values:
66 3D D8 07
  1. 66 3D is the CMP EAX operand. EAX contains the year (pushed there in the previous lines) and
  2. D8 07 represents the hex number 7D8 which is 2008.
After that, there is the JBE (0F 86,Jump short if below or equal) operand that leads to the nasty message box.

Thus, there are two ways to achieve the desired “extension”. Either change D8 07 to 34 08 (which will lead to an expiration in the year 2101, when I will be long gone) or change the JBE to JG (0F 8F, Jump short if greater) which will allow the alpha version to run only if the year is greater than 2008.
Just in case you are too lazy to open the file in a hex editor, I have packed both the redistributable and the patched dll in a zip file which you can download from here:

No comments: