Vb6 Serial Port Sniffer Source Code
Well, as far as i know, IoGetDeviceObjectPointer() can not be used for all devices, specially when those devices already 'being opened' by another application. But there is another way to do 'attach and detach device', by creating a filter driver for those devices, modify some registry(ies) and let the PnP Manager and/or I/O Manager do that for you. For the detail how to do this, you can see the the sample in WDK, unfortunately i forgot what sample for specific, but i think (if i'm not mistaken) sample about disk performance. Member 10398370 7-Jan-14 21:58 7-Jan-14 21:58 Hello,Good afternoon,I have a question need to ask you.
Feb 26, 2009 - Net To install Serial Port Sniffer ActiveX Control into Visual Studio, click. For more information see the example source code for MS Visual C++. Menu item and choose “Serial Port Sniffer ActiveX Control”.
In the filter driver development, when there is data in the data queue, using the event to notify the application. Create an event in the application, It is passed to the driver via DeviceIoControl. While waiting for an event using threads in the application, there is a signal event, to fetch data.
Such a program structure, when the application is running, and the serial transceivers the data transceiver, PC happens blue screen. If the application and the serial are not both running, PC does not blue screen.what causes the problem? In your routine, the application uses the OVERLAPPED structure, does OVERLAPPED I / O in the filter driver is necessary? Thank you very much. Member 10398370 wrote:Hello,Good afternoon,I have a question need to ask you.
In the filter driver development, when there is data in the data queue, using the event to notify the application. Create an event in the application, It is passed to the driver via DeviceIoControl. While waiting for an event using threads in the application, there is a signal event, to fetch data. Such a program structure, when the application is running, and the serial transceivers the data transceiver, PC happens blue screen.
If the application and the serial are not both running, PC does not blue screen.what causes the problem? Well, unfortunately I've never use that event mechanism, so I can tell you nothing. Member 10398370 wrote:In your routine, the application uses the OVERLAPPED structure, does OVERLAPPED I / O in the filter driver is necessary?
Actually it is just a trick. I was using OVERLAPPED structure, create asynchronous I/O, so I can make the handle of I/O request invalid from another thread by issuing CloseHandle() thus stopping 'the loop reader' (check out CDkPortClient::GetData(.) in file DkPortClient.cpp), without that 'the loop reader' will not stop and this will make application unstable or hung.
Note that, this is the behavior of window application not DOS application. In DOS application I can make 'the loop reader' without create asynchronous operation, just create the loop in another thread then make handle invalid in the main thread, maybe this because NTVDM, which running below DOS application, might do some filtering mechanism before I/O operation reach the kernel. This behaviour is true, at least in the Windows XP with SP 2. .inf file is not part of the codes, it is more like a hint for Windows to install driver, and I wrote it 'manually' by 'guiden' of the samples in WDK. But unfortunately I'have no experience building driver on 64bit version of windows and I think it is the same as for 32bit.cat file is used for signing driver. I should sign this driver but since this is just for experiment and for educational purpose, I didn't do that.
Babriniya slyozi tekst. This file can be produced by a utility program called 'inf2cat.exe', you can find this program in your WDK installation directory. Member 9939548 wrote:Is it possible to monitor or detect hardware events like attaching/detaching the V24 cable? Yes it is possible as long as your serial device has a capabilities to actively send some data to serial port of PC.
You can do that either from 'user space' or 'kernel space'. In 'user space' you can use general I/O function like ReadFile() to accomplish this. In 'kernel space' you can reference serial device object then create appropriate IRP then send it to this serial device object. Member 9939548 wrote:I installed the driver and the GUI on my XP machine and i can see all events send by e.g. HyperTerminal to the serial device, but i cannot see any hardware related events. This serial port monitor can't do that, because it act like 'a bridge' between application and driver, watch what come in or come out and it doesn't read serial port. In your case, application read serial port intensively so it sees the data.