Jump to content

Hijacking the COM Port


Recommended Posts

There is an application that is running on my machine, and it's using the COM1 serial port. Is there a way that I can steal the COM1 port from that application without shutting it down?

Thanks!

What kind of app is using the port, or do you have any clue

Link to post
Share on other sites

gumsho3, i've further investigated the issue... it's not pretty:

the application running creates a file handle to the COM port (as i suspected), but it uses the "DO NOT SHARE" flag in the handle creation, which is standard. this basically means that as long as the program has the handle, i can't rip the port.

so, to get around this, i have to create an upper level driver filter that monitors the port... this way i can send and receive the data i want to the external device.

it's a pretty difficult process, and it will take a while because driver development is a sticky, nasty process... and a faulty driver can easily bsod a computer.

so, if anyone stumbles upon this thread, here's a quick answer: most applications are written to hold exclusive access to the COM port, but there are cases where the application opens the file handle with sharing capabilities; however, this is very rare since it's not the standard. if you want to talk to the device through another piece of software, you will have to create an upper-level driver filter. for further assistance, i suggest looking up Walter Oney's books... he's an expert in this field.

Link to post
Share on other sites

Which is why programs like HHD's serial monitor create a psuedo driver that you load before the other program and it shares the COM port to that program but still allows you to monitor it.

You could also share the port by using CuriousTech's Xport. This will create a virtual serial port for the real one.

Either way these must be run BEFORE the program that is to use the port since as you've found, they lock the port for exclusive access.

Of course the other way is to put you're own serial device in-between by use of a vampire tap. Physical access trumps software.

Or method 3 is to use HHD to port mirror and take what's gozinta/outa com1 and pass it on through to Com2.

Link to post
Share on other sites
Which is why programs like HHD's serial monitor create a psuedo driver that you load before the other program and it shares the COM port to that program but still allows you to monitor it.

You could also share the port by using CuriousTech's Xport. This will create a virtual serial port for the real one.

Either way these must be run BEFORE the program that is to use the port since as you've found, they lock the port for exclusive access.

Of course the other way is to put you're own serial device in-between by use of a vampire tap. Physical access trumps software.

Or method 3 is to use HHD to port mirror and take what's gozinta/outa com1 and pass it on through to Com2.

Yeah, there are quite a few applications available that create virtual serial ports with functionality to reroute, clone, etc... but as breakmyn mentioned, unfortunately, they all require exclusive access to the port (i.e. before another program has it locked).

breakmyn, you mentioned a vampire tap... i'm not familiar with this. could you expound for me? I'm intrigued =)

Link to post
Share on other sites
Yeah, there are quite a few applications available that create virtual serial ports with functionality to reroute, clone, etc... but as breakmyn mentioned, unfortunately, they all require exclusive access to the port (i.e. before another program has it locked).

breakmyn, you mentioned a vampire tap... i'm not familiar with this. could you expound for me? I'm intrigued =)

The "vampire tap" was a device that you plugged inline with the serial port and allowed another device to monitor the data on the port and still allow normal data flow to the intended device. This one had the most bells & whistles of the one I used last (3 years ago). http://cgi.ebay.com/RS-232-RS-449-HP-4951-...1QQcmdZViewItem

Damn I wish I had one now! They come in real handy for troubleshoot archaic systems that no one remembers how they work.

To use it you have a DB9 or DB25 connector the looks like a straight though with another connector sticking out the top, the "vampire tap". What you hook up to it is your choice.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...