Yesterday I wrote about troubleshooting an application that used Com Port redirection in Citrix.

During the troubleshoot I noticed that the application used an ActiveX component, MSCOMM32.OCX, for serial communication.

I wanted to quickly test if the component was correctly registered so I searched the registry from HKEY_CLASSES_ROOT for mscomm32.ocx.

This confirmed that the component was registered:

image

My next check was to confirm if the control was actually working with a VB Script. For that I needed the ProgID from the same registry key:

image

The VBS code is then simply:

Executing the script failed with error 80040112. I looked up this error code and it stands for CLASS_E_NOTLICENSED.

A google search lead me to this kb article which explains that it’s a license issue that only occurs when you create the control at run-time.

At this point I wasn’t sure if my problem was related to

I decided to open MSCOMM32.OCX in Ida Pro to see where this error comes from. I searched in the Strings Tab for the word Licenses which brought up this part of the code:

image

So a registry key under HKEY_CLASSES_ROOT\Licenses is checked. I opened sub_21C118D3 and set a breakpoint on RegQueryValueA. The debugger shows us the contents of lpString and lpString2 when we hover the mouse over:

image

and lpString2:

image

So by creating the key HKEY_CLASSES_ROOT\Licenses\4250E830-6AC2-11cf-8ADB-00AA00C00905 and set it’s default value to kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun we will pass the license check.

After creating the registry key, the vbs script worked (it didn’t make the application work though but more about that in yesterday’s post).