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:
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:
The VBS code is then simply:
Set objMSComm = CreateObject("MSCommLib.MSComm")
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:
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:
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.
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Licenses\4250E830-6AC2-11cf-8ADB-00AA00C00905] @="kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun"
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).
Was once an enthusiastic PepperByte employee but is now working elsewhere. His blogs are still valuable to us and we hope to you too.