🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
13 messages
13 total messages Started by Zahir Fri, 12 May 2006 15:46
Port sharing/splitting?
#3659
Author: Zahir
Date: Fri, 12 May 2006 15:46
4 lines
888 bytes
hello!

i am wondering if there is an API i can use to give my application access to a comport to which a printer is connected, i would like to archive the data going to the printer.
Re: Port sharing/splitting?
#3660
Author: Remy Lebeau (TeamB)
Date: Fri, 12 May 2006 17:10
11 lines
1097 bytes
"Zahir" <zsquresh@yahoo.com> wrote in message
news:4464ade6$1@newsgroups.borland.com...

> i am wondering if there is an API i can use to give my application
> access to a comport to which a printer is connected

Use CreateFile() to open com ports.


Gambit
Re: Port sharing/splitting?
#3661
Author: Bob Gonder
Date: Fri, 12 May 2006 18:23
18 lines
1587 bytes
Remy Lebeau (TeamB) wrote:

>"Zahir"  wrote in message
>
>> i am wondering if there is an API i can use to give my application
>> access to a comport to which a printer is connected
>
>Use CreateFile() to open com ports.

I think he wants to intercept the data on it's way to the com port.

>>i would like to archive the data going to the printer

I'm thinking his app is an archiver, not a printing app, and he wants
something more like a global hook, or a printer driver replacement.
ie. the  man-in-the-middle or wire-tap models.

Perhaps Zahir could clear that up?
Re: Port sharing/splitting?
#3669
Author: Boba
Date: Tue, 16 May 2006 16:16
13 lines
1404 bytes
"Zahir" <zsquresh@yahoo.com> wrote in message
news:4464ade6$1@newsgroups.borland.com...
>
> hello!
>
> ... i would like to archive the data going to the printer.

if you are after the original data sent to the printer driver,
then i'd suggest forget the hardware port and write a filter
driver to back up the data. you may want to consider tapping
into printer spool and just archive only spooled data. if you
still need the binary data streamed through the port, then let
me ask: what do you plan to do with it?
Re: Port sharing/splitting?
#3675
Author: Zahir
Date: Wed, 17 May 2006 11:20
4 lines
1246 bytes
Oops! sorry guys had problems with my internet link, i am back now...
I want to sort-of intercept the data going to the printer, archive it and let the printer also make a hard copy. i mean something like to be able to make my app read the port memory without interfearing with the application that sent this data.
Why i need this? to save alarms from an old automation system that does not have an OPC server. Assist please.
Re: Port sharing/splitting?
#3677
Author: Bob Gonder
Date: Wed, 17 May 2006 16:44
10 lines
1372 bytes
Zahir wrote:

>Why i need this? to save alarms from an old automation system that does not have an OPC server. Assist please.

Low-tech method....
Add another computer.
Connect one of it's com ports to the automation system, and read the
data on that port.
Connect the other com port to the printer, and re-send the data to the
printer, or to a network printer.
Re: Port sharing/splitting?
#3679
Author: Zahir
Date: Thu, 18 May 2006 06:49
7 lines
1223 bytes
Bob Gonder wrote:
>Low-tech method....
>Add another computer.
>Connect one of it's com ports ....

Sure this should work. But as you put it, Low-tech method!...and since i have this feeling that it is possible to get this data from the com port buffer somehow....there should be another way out (i have seen some commercial port splitting softwares such as the one from Eltima)
Re: Port sharing/splitting?
#3589
Author: Eric Noel
Date: Thu, 18 May 2006 15:29
16 lines
2024 bytes
Zahir wrote:
> Sure this should work. But as you put it, Low-tech method!...and since i have this feeling that it is possible to get this data from the com port buffer somehow....there should be another way out (i have seen some commercial port splitting softwares such as the one from Eltima)

I don't think there is any way to tap into the serial port the way you 
want. Besides the 'low tech' method, I believe the only 'high tech' 
method is pretty much the same. Create a virtual port, log the data as 
it comes in, and then forward it on to the real port.

Creating a virtual serial port is not trivial, so if this is a one-off 
job, I'd use the low tech method. You don't need another PC though, just 
hook up 2 usb serial port adapters (about $20 each), hook up a null 
modem cable from the original port to one of the new ports. Write a 
simple app to read from the new port, log, and forward off to the second 
new port.

- Eric
Re: Port sharing/splitting?
#3594
Author: Jim Dodd
Date: Fri, 19 May 2006 14:11
26 lines
2241 bytes
Zahir wrote:
> Oops! sorry guys had problems with my internet link, i am back now...
> I want to sort-of intercept the data going to the printer, archive it and let the printer also make a hard copy. i mean something like to be able to make my app read the port memory without interfearing with the application that sent this data.
> Why i need this? to save alarms from an old automation system that does not have an OPC server. Assist please.

There must be a way to do this but I don't know how. However, there is a
utility at SysInternals called PortMon that will show activity and data
on serial and parallel ports. I don't know how to get it to give you the
data but perhaps you can get them to tell you how they did it.

Link to the utility:
http://www.sysinternals.com/Utilities/Portmon.html

Description:
Portmon is a utility that monitors and displays all serial and parallel
port activity on a system. It has advanced filtering and search
capabilities that make it a powerful tool for exploring the way Windows
works, seeing how applications use ports, or tracking down problems in
system or application configurations.

Portmon works on NT 4.0, Win2K, XP and Server 2003, Windows 95 and
Windows 98.

Regards,
Jim Dodd
Onset Computer Corp.
Re: Port sharing/splitting?
#3596
Author: Mike Collins
Date: Fri, 19 May 2006 15:56
57 lines
3753 bytes
There are many ways to achieve this depending on how complex or robust you 
want to make it.  If you are writing a system that needs to be deployed on 
many different systems then your best options is to write some sort of 
filter driver.  However this is not a straightforward task and requires the 
MS DDK which is costly and complicated.

Another option is to use DLL-injection and API hooking.  If it is aimed at 
capturing one specific application then this shouldn't be a big deal.  You 
need to determine how the legacy application is communicating with the com 
port and then inject into it's process space and hook the api that it uses. 
Once this is done, you hook / callback procedure will be called before the 
API in question, and it will give you the facility to achieve the data and 
reject or relay the call on to the real api.

If you feel this is an option that you would like to pursue then post back 
with your e-mail address and i can contact you.  I can provide you with some 
information and some starting points, although i can't actually provide you 
with source code as my injection system is based on another's that i have 
licensing for.  As a starting point, look at www.codeproject.com and do a 
search for dll-injection and api hooking.

HTH, Mike C



"Jim Dodd" <bcbuilderboy@yahoo.com> wrote in message 
news:446dd227$1@newsgroups.borland.com...
> Zahir wrote:
>> Oops! sorry guys had problems with my internet link, i am back now...
>> I want to sort-of intercept the data going to the printer, archive it and 
>> let the printer also make a hard copy. i mean something like to be able 
>> to make my app read the port memory without interfearing with the 
>> application that sent this data.
>> Why i need this? to save alarms from an old automation system that does 
>> not have an OPC server. Assist please.
>
> There must be a way to do this but I don't know how. However, there is a
> utility at SysInternals called PortMon that will show activity and data
> on serial and parallel ports. I don't know how to get it to give you the
> data but perhaps you can get them to tell you how they did it.
>
> Link to the utility:
> http://www.sysinternals.com/Utilities/Portmon.html
>
> Description:
> Portmon is a utility that monitors and displays all serial and parallel
> port activity on a system. It has advanced filtering and search
> capabilities that make it a powerful tool for exploring the way Windows
> works, seeing how applications use ports, or tracking down problems in
> system or application configurations.
>
> Portmon works on NT 4.0, Win2K, XP and Server 2003, Windows 95 and
> Windows 98.
>
> Regards,
> Jim Dodd
> Onset Computer Corp. 
Re: Port sharing/splitting?
#3608
Author: Jim Dodd
Date: Sat, 20 May 2006 21:20
33 lines
2668 bytes
Mike Collins wrote:
> There are many ways to achieve this depending on how complex or robust you 
> want to make it.  If you are writing a system that needs to be deployed on 
> many different systems then your best options is to write some sort of 
> filter driver.  However this is not a straightforward task and requires the 
> MS DDK which is costly and complicated.
> 
> Another option is to use DLL-injection and API hooking.  If it is aimed at 
> capturing one specific application then this shouldn't be a big deal.  You 
> need to determine how the legacy application is communicating with the com 
> port and then inject into it's process space and hook the api that it uses. 
> Once this is done, you hook / callback procedure will be called before the 
> API in question, and it will give you the facility to achieve the data and 
> reject or relay the call on to the real api.
> 
> If you feel this is an option that you would like to pursue then post back 
> with your e-mail address and i can contact you.  I can provide you with some 
> information and some starting points, although i can't actually provide you 
> with source code as my injection system is based on another's that i have 
> licensing for.  As a starting point, look at www.codeproject.com and do a 
> search for dll-injection and api hooking.
> 
> HTH, Mike C
> 
> 

This is very generous offer. But I am not the one wishing to do this. I 
hope Zahir realizes that you were probably responding to him and takes 
you up on your offer.

Zahir, offers like Mike's don't come every day. I suggest you contact him.

Jim
Re: Port sharing/splitting?
#3630
Author: Zahir
Date: Thu, 25 May 2006 10:33
3 lines
1023 bytes
hello Mike,
Yes i am interested. My email is zsquresh@yahoo.com  . Thanks alot.
Re: Port sharing/splitting?
#3632
Author: Zahir
Date: Thu, 25 May 2006 10:37
4 lines
872 bytes
Hello Mike,

Yes i am interested. My email is zsquresh@yahoo.com . Thanks
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads