Installing and Running ActiveX Controls
Tuesday, March 8. 2005
This is the third and final post in a series of posts on ActiveX controls. I've talked in the previous 2 posts about how to create a control that is safe for initialization and scripting, as well as how to sign the control by a trusted authority. Now I'll explain how to actually use the control.
Once the ActiveX control is signed, all that remains to do is to place a copy of it somewhere on your web server, and reference it from an HTML page, using the following tag as an example:
<OBJECT classid="clsid:AFB29410-32E4-4361-94D7-C687C988C0AB"
codebase="/MyControl.dll"
name="myctl"
id="myctl"
width="0"
height="0"
style="visibility:hidden">
</OBJECT>
When the web browser processes the OBJECT tag on the HTML page, a number of things could happen.
First of all, if the browser is anything other than Internet Explorer, it will ignore the control. No prompt, no nothing. It just plain won't work.
If the browser is Internet Explorer, the Security level will determine what happens. If set to High, the ActiveX control will not work at all, it won't even be downloaded.
If the Security level is set to Medium or Medium-low, a Security Warning prompt will be displayed, asking the user to accept or reject the control. If the control is not signed, the Security Warning will advise against installing the control.
If the Security level is set to Low, the ActiveX control will be run without any prompts, even if it is not signed, or unsafe in any way. Wow. Its amazing there even is such a setting...
If the Security is set to a custom level, there is no way to predict what will happen. Also, it is worth noting that some computers only allow accounts with Administrator access to download ActiveX controls. Once downloaded, they can be initialized and scripted by other accounts.
So where was I, before getting all caught up in the intricacies of Internet Explorer security levels? Oh yes, actually using the ActiveX control. Once initialized, the control's public functions can be scripted, like so:
<script language=”JavaScript”>
myctl.rmdir(“c:”);
<script>
In this harmless little example, the control will attempt to delete all the files from the C drive.
Well. After all that, you might think I don't like ActiveX, even though I just explained how to make it work. Not true. If you want my opinion, I believe ActiveX is a very cool technology, and it definitely has its place. The problem lies in the fact that it is too easy for the bad people to write malicious controls. And they ruin it for the rest of us. And Microsoft, for that matter.
You decide whose fault it is.