CASE STUDY / WINDOWS DRIVER / INDEPENDENT CLIENT

Windows thermal-printer driver and deployment workflow

A production-oriented Windows driver that translates ordinary GDI/Unidrv print output into a dedicated thermal printer's strict monochrome raster protocol, while providing operator settings and an installable field-deployment workflow.

  • C++
  • Windows Driver Kit
  • Unidrv
  • GDI raster
  • DEVMODE
  • Spooler
DRIVER TYPEUser-mode OEM plug-in
INPUTGDI bitmap surface
OUTPUTFramed thermal raster lines
DELIVERYx86/x64 install automation

Problem

The printer needed an installable Windows driver, not a custom application that sent raw commands. Standard applications had to print through the normal Windows dialog while the driver handled the physical device's raster polarity, rotation, bit order, line framing, feed/cut control, and hardware-specific transfer limits.

System context

Windows application → GDI → Unidrv
│ ▼
OEM rendering plug-in
rotate / mirror / frame raster
│
▼
spooler → USB printer port

The solution is split into a rendering plug-in, a Common Printer UI plug-in, GPD capability definitions, a shared private DEVMODE contract, and distribution scripts. Each layer carries a different part of the printer-product responsibility.

Engineering challenge

Windows provides a bitmap surface with its own stride and rendering behavior; the printer expects a constrained sequence of monochrome lines. The driver must make that mapping without corrupting the image, duplicating output, or triggering a device fault. In this case, odd byte counts could crash the printer, and default banding/rotation behavior could introduce visible artifacts.

Implementation approach

Take control at the final raster boundary

Use the `DrvSendPage` hook to process the finished GDI bitmap and write the printer-specific line stream through the spooler.

Transform bits deliberately

Handle 0/90/180/270 degree rotation, mirror mode, polarity normalization, byte ordering, bit ordering, and actual GDI stride rather than relying on a UI-only setting.

Turn hardware failures into invariants

Bound line buffers and pad each output line to the required transfer alignment before framing it for the printer.

Keep preferences durable and safe

Use a versioned DEVMODE, validated UI fields, per-queue printer data, and printer-setting commands for feed, media, speed, and related options.

Outcome

The project turned a device-specific command protocol into a Windows-native product with property pages, diagnostics, and installation support. It is a rare example of work at the boundary between OS graphics, spooler behavior, COM-based printer interfaces, and physical peripheral constraints.

PUBLIC-SAFE SUMMARY: Client/brand identity, command bytes, signing status, and proprietary device specifications are intentionally omitted.