views:

29

answers:

1

Hint: this one might sound complicated, because I am trying to give as much info as possible, but I suspect that I just want someone to tell me "yes, you are correct".

On this legacy system, which dates from 2002, the user visits a web page and uses an RFID reader to read a tag number, which is then written to an input field on the web page.

The only s/w that comes with the reader is a custom DLL, nop .exe.

The very sparse documentation insists that only MSIE be used and that all security relating to ActiveX be disabled.

When I look into the source of the web page I see calls to functions in the DLL.

Now, here's the fun part: I know zilch about ActiveX, I have to make a minor change to the DLL _but_ the VB6 source code has been lost, so I guess that I have to recreate the (seemingly very simple) DLL from scratch - this week.

Decompiling the DLL shows me the functions (locateReader, getTagVal, closeReader). However, by decompiling I can't really know the number or type of the parameters, nor the return values ... and if anyone knows the API they are refusing to share it, but basically it all seems to have been lost in the mists of time as companies went bust, were bought & sold, merged & demerged and the initial DLL might have been written by an external guy, but no one knows who.

So, can I get the function params & type from the ASP page source?

I see things like

Reader = new ActiveXObject("<dllName>.Reader");
Reader.locateReader();
tagVal = Reader.getTagVal();
Reader.closeReader();

So, I would say that none of the fn()s take parameters, that closeReader doesn't have to return anything; it looks like locateReader doesn't return anything either, so I guess that error handling will have to be in the DLL (loop forever with a popup demanding that a reader be attached; and getTagVal seems to return a string.

Does that sound about right? Any other comments (other than lessons to be learned)?

+2  A: 

The 'code' you've put here looks like the a direct call to the device. And getTagVal() seems to get the RFID value? Since this is an COM (Active X) call can you call this in a simple .net program and see if you can access the reader? If you can then you may be able to just wrap the existing functionaliy in your wrapper.

You need to try and generate a TLB from the component:

So, if you only have a COM dll, you need to get an idl-file from it:

  1. Visual Studio, start it and go to the meny Tools->OLE/COM Object Viewer. This is called oleview.exe and can also be got from the windows sdk

  2. In that application, select meny File->View Typelib..

  3. Select the COM dll and you will see the Typelib.

  4. Select the meny File->Save as. Save it with an appropriate name. For example "mycom.idl"

  5. start midl.exe or mktyplib.exe with the idl-filname as the argument. "midl mycom.idl"

Read MSDN for more info about midl and mktyplib

Preet Sangha
Thanks for the comprehensive answer. I will try it right away and get back to you.
Mawg
Actually, in VB Express, I don't see an option Tools->OLE/COM Object Viewer :-(
Mawg