This section contains porting notes that pertain to print drivers only.
In general, print drivers have become more complex than display drivers, largely due to fonts. However, Windows NT kernel-mode drivers should be as simple as possible, dealing only with the tasks required to render an image. Tasks unrelated to rendering should be moved, if possible, into the User Interface (UI) portion of the driver or into the print processor. The UI portion of the driver still runs in user mode. If you have a library that is shared by both DLLs, you need to write it so that it can be built and run in both kernel- and user-mode.
Journaling has been replaced by metafile spooling, making the Windows NT model more similar to Windows 95. Metafile spooling also allows GDI to have a single recording model. See the reference pages for EngMarkBandingSurface, DrvStartBanding, and DrvNextBand for more details.
New kernel-mode GDI functions have been implemented to replace some of the Win32 functions commonly used by print drivers. References pages for these functions are provided in this package. Parameters and usage should be checked in all cases, as the new GDI functions are not exact replacement functions.The following table shows the old Win32 functions and their corresponding new kernel-mode engine functions:
Win32 Function |
Kernel-mode Engine Function |
GetLastError | |
EnumForms, GetForm, GetPrinter, GetPrinterData, SetPrinterData, WritePrinterData |
EngEnumForms, EngGetForm, EngGetPrinter, EngGetPrinterData, EngSetPrinterData, EngWritePrinter |
FindResource | |
LoadLibrary, GetProcAddress | |
GetFileTime, GetLocalTime | |
QueryPerformanceCounter, QueryPerformanceFrequency | |
MultiByteToWideChar, WideCharToMultiByte | |
MulDiv |
#include <ntverp.h> #define VER_FILEVERSION 0,2,0,0
Version 2 drivers runs in kernel mode. The spooler ensures that the driver is kept separate from the older, non-kernel-mode drivers.
Limited ANSI-to UNICODE and UNICODE-to ANSI translation is available through GDI. See the EngMultiByteToUnicodeN and EngUnicodeToMultiByteN reference pages for more details.
The set of spooler functions is limited to UNICODE and those from a driver that make sense.
Impersonate client and RevertToSelf are handled automatically by spooler functions.
There are no plans to support registry functions passing data to kernel-mode drivers. Settings from the driver should be retrieved using EngGetPrinterData.
GDI now supplies file mapping support. See the reference pages for EngLoadModule, EngLoadModuleForWrite, EngMapFontFile, EngMapModule, and EngUnmapFontFile for more information.
There are no plans to support file read/write/create, file path, or file find functions.
See the reference page for EngFindResource for more details.