Sysinternals' Portmon: Error 2

Serial Port

Serial Port Problem Overview


When I try to connect to local ports, Computer -> Connect local, using Portmon v. 3.02, I'm getting an error message, Error 2, in a small error dialog box:

Enter image description here

I run the tool as an administrator (if not, I get error 6).

By the way this is a Windows 7 x64. On 32-bit, in Windows 7 x86, it works fine. How can I fix this problem?

Serial Port Solutions


Solution 1 - Serial Port

Sysinternals' Portmon works only on 32-bit versions of Windows. It does not support 64-bit (probably its driver is not signed).

From the Portmon homepage:

  • Runs on:
    • Client: Windows XP (32-bit) and higher (32-bit).
    • Server: Windows Server 2003 (32-bit) and higher (32-bit).

Solution 2 - Serial Port

In Windows Explorer, right click on portmon.exe --> select Properties --> click the Compatibility tab, and Run in Windows XP compatibility mode. It works fine like that in Windows 7 64-bit.

Solution 3 - Serial Port

"Error 2" is "Cannot find the file specified", that is, cannot find a required DLL file.

Originally, you got this error when you tried to run Portmon from a network location: that broke the security trust, causing Portmon to be untrusted (or perhaps just messing up the search path somehow).

On my copy of Windows 7 64 bit, Microsoft Dependency Walker (depends.exe) tells me that PORTMSYS.SYS (the file created/loaded by Portmon.exe), has unresolved dependencies on ci.dll, clfs.sys, hal.dll and kdcom.dll.

Those are the

code integrity
common log file system
hardware abstraction layer
kernel debugger com

libraries, and they aren't actually missing: if they were, Windows wouldn't boot. However, I don't see a copy of those files in SysWow64. This suggests to me that the problem is not with portman.sys: the problem is with the win32 compatibility layer in Windows 7/64 bit: It doesn't support debug properly.

It is now 2018. There is no 64-bit version of Portmon. Serial ports are a legacy standard. The Windows 7 problem was fixed by the release of Windows 8.1. However, there is a faint chance that some Visual Studio utility or security update back-ported to Windows 7 will fix the problem. Perhaps someone who is familiar with SysWow and debugging will comment.

Solution 4 - Serial Port

Instead of portmon for Windows x64, you can use an emulator of a pair of virtual COM ports and a simple program that will connect the physical port and one of the virtual ones, as well as perform the logging function.

To create a pair of virtual COM ports you can use:

  • com0com (preferably version "com0com-2.2.2.0-x64-fre-signed", because it contains signed x64 driver)
  • Virtual Serial Ports Emulator (VSPE), every time it starts on x64 it asks to purchase a driver, but it works even if you refuse.

Simple mapping and logging program can be found e.g. here or you can write it yourself, it is simple.

The sequence of actions is follows:

  • Сreate a pair of virtual COM ports using emulator (for example, COM28 and COM29)
  • Let the external device be connected to the computer COM1 port. In the program, whose exchange with external device we want to listen to, we set up a port COM28 (instead of СОМ1) for communication.
  • In the mapping program, we set up that we want to bind and log ports COM1 and COM29 (don't forget to set the port baud rate).

Solution 5 - Serial Port

I haven't tried it yet, but this question mentions com0com. It creates two virtual serial ports and emulates a null modem cable between them. It claims to be able to run on 64 bit Windows. I'm not sure whether it comes with software that lets you just pipe input from a real port into one of the virtual ports. One of the FAQ's says that you can turn on logging.

I guess in the worst case, you could write your own small program that pipes data from a real port to one of the virtual ports and logs it all.

There's also this question on open-source alternatives that mentions a couple of projects.

Solution 6 - Serial Port

I've used AccessPort http://sudt.com/en/ap/download.htm and it works great. Very similar to Portmon

Solution 7 - Serial Port

Don't start Portmon from a network drive/path or something else.

Copy on to the hard disk drive, e.g. on the desktop, restart and try again!

Solution 8 - Serial Port

If you run Portmon in compatibility mode, it will work.

Check Make older programs run in this version of Windows.

It says:

> To run the Program Compatibility troubleshooter: > > 1. Open the Program Compatibility troubleshooter by clicking the Start button Picture of the Start button, and then clicking Control Panel. In the search box, type troubleshooter, and then click Troubleshooting. Under Programs, click Run programs made for previous versions of Windows. > 2. Follow the instructions in the troubleshooter.

The above is a public explanation from Microsoft for a common situation when running older applications in Windows.

But, I can say it briefly;

  1. Right click on portmon.exe
  2. Select menu about "troubleshooting compatibility problem" or something like that (I'm using a foreign version of Windows, so I don't see correct name of that menu in English.)
  3. Select automatic mode
  4. It will detect the problem and recommend Windows XP (SP2) mode
  5. Select it and execute Portmon again.

I hope it works!

Solution 9 - Serial Port

Instead of Portmon you can also use the IO Ninja program with the "Serial Monitor" plugin.

It gives a little less information than Portmon, but in a more understandable form. The main thing is, just like a Portmon, it allows you to see the data that is transmitted between a third-party application and an external device via a serial port. The program works under modern versions of Windows (I tried it myself on Windows 10 x64). The aforementioned plugin "Serial Monitor" is paid (but has an evaluation period).

Note: the port that you want to monitor must first be connected to the "IO Ninja" program, and then opened in a third-party application whose exchange with an external device you want to track.

Solution 10 - Serial Port

Just to test that the hardware is working, you could perhaps boot a Linux live CD and run the statserial and/or minicom program to verify that it works. The Knoppix distribution seems to contain both those programs.

Serial ports on Linux are named /dev/ttyS0 for COM1, /dev/ttyS1 for COM2, etc.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJAGView Question on Stackoverflow
Solution 1 - Serial PortswatkatView Answer on Stackoverflow
Solution 2 - Serial PortDomView Answer on Stackoverflow
Solution 3 - Serial PortdavidView Answer on Stackoverflow
Solution 4 - Serial PortDmitro25View Answer on Stackoverflow
Solution 5 - Serial PortDon KirkbyView Answer on Stackoverflow
Solution 6 - Serial PortcodevisionView Answer on Stackoverflow
Solution 7 - Serial PortFound elswhereView Answer on Stackoverflow
Solution 8 - Serial PortTaehoon KeeView Answer on Stackoverflow
Solution 9 - Serial PortDmitro25View Answer on Stackoverflow
Solution 10 - Serial PorthlovdalView Answer on Stackoverflow