Install Port Monitor and Create New Port Programmatically

Port Monitor

I have worked on the windows printer driver, where I have to install the port monitor silently without user interaction. It is a user-mode DLL which responsible for providing a communications path between the user-mode print spooler and the kernel-mode port drivers that access I/O port hardware.

It uses the CreateFile, WriteFile, ReadFile, and DeviceIOControl functions, described in the Microsoft Windows SDK documentation, to communicate with kernel-mode port drivers also responsible for management and configuration of a server’s printer ports.

Note: All the thing tested on the windows 10X64 machine (64 bits).


Here, I am assuming you are familiar with windows internals and API. If you are not familiar with windows internal and API, see this popular course: Windows Internals


You can install the port monitor to follow the below steps


Open the Administrative Tools.


port monitor


Open Print Management in admenestrative mode.


Add port monitor

Select the Printers folder and click on any printer.


install print monitor


Now click the Ports tab and then click Add Port button.


On the Printer Ports dialog, click the New Port Type button.


New port type

Enter the path to the INF file (port monitor) in the text input box, and then click OK.

print monitor inf


Note: Port Monitor DLL (package) should be present in system32 before running the below code.

After following the above steps you able to install your port monitor DLL. Here the task is not completed yet after installing the print monitor I need to create the port. I can also create the port manually, but here I want to create a custom application which installs the monitor silently and create the port. See the below example code it worked for me.


After running the above code you will find that the Aticleworld port monitor installed and it will show in port type.

print monitor



Leave a Reply