The Black Ice printer drivers can communicate with an application through named pipe interface. This method is compatible with Windows 11/10/8/7 and Windows Servers 2022/2019/2016/2012.
This method is supported on Windows Server Systems (Terminal Servers) as well as non-terminal server systems: Windows 11 / 10 / 8 / 7.
This is the recommended messaging method. This method was created to provide compatibility across the evolving Microsoft operating systems. The printer driver uses a named pipe interface to communicate with an application. The BLICECTR.DLL captures the pipe messages sent by the printer driver and converts them to window messages. (“WM_”) The application captures the window messages and extracts information from the message parameters.
The name of the pipe should be specified in the InterfaceName member of the BlackIceDEVMODE structure. The pipe name in the InterfaceName member should not contain the “\\.\pipe\ prefix”, the printer driver will insert this prefix when it is opening or writing into the named pipe.
NOTE: On Windows Server Systems (Terminal Servers), the printer driver will add the Session ID to the InterfaceName. The Printer Driver session ID can be set by calling the DEVMODE_SetSessionID function. To use your current session ID:
1. Call – GetCurrentProcessId - Windows API
2. Call – ProcessIdToSessionId - Windows API
3. Call – DEVMODE_SetSessionID - BlackIceDEVMODE.dll
The DEVMODE_SetSessionID function calls and sets the SessionID member of the extended Devmode structure.
The name of the pipe should be set:
swprintf(szPipeName, L"\\\\.\\pipe\\%s%d", DEVMODE_GetInterfaceName(lpDevMode), dwSessionId);
The application should create a window to process messages sent by the printer driver and should register a private windows message to communicate with the printer driver.
Once the message loop is created the application should call the WaitForPrnPipe function from the BLICECTR.DLL. The parameters of this function are the following:
· LPWSTR pszPipeName - pointer to a NULL terminated UNICODE string that contains the pipe name, including the “\\.\pipe\ prefix”.
· HWND hMsgWnd - A Window handle. The BLICECTR.DLL will send window messages to this window.
· DWORD dwMessageNum - The message number of the registered window message the printer driver will send. Register a message with the RegisterWindowMessage Windows API call or use a value above WM_USER, e.g., WM_USER+1000
Once the WaitForPrnPipe function is called, the application can start receiving messages from the printer driver.
When a document is being printed to the printer driver, the BLICECTR.DLL will capture the pipe messages sent by the printer, will convert the pipe messages into window messages and forward them to the application.
To stop processing messages, the application should call the EndWaitPrnPipe function from the BLICECTR.DLL. The function takes the following parameter:
PWCHAR pszPipeName - pointer to a NULL terminated UNICODE string that contains the pipe name, including the “\\.\pipe\ prefix”.
NOTE: On Windows Server Systems (Terminal Servers), when a Windows Test Page is printed, the test page is printed by the spooler. In that particular case the messages will be captured on the server machine by the administrator account, not by the user who prints.
ADDITIONAL NOTES:
The Message Capture controls for Terminal and Non Terminal Server systems are different, make sure that you do not mix these components.
The sample installations included in the Resource Toolkit install the Black Ice printer drivers only, they do not install or register the additional components of the RTK, such as the Message Capture or Auto-print controls. In order to use these components, you must add the to your custom installation project.