Windows NT Print Browsing Architecture

ID: Q161734


The information in this article applies to:


SUMMARY

Windows NT leverages the familiar browsing mechanism found in File Manager to enumerate printers for remote printing. This article describes the mechanism used for print browsing in a Windows NT Environment and the registry keys that effect its behavior.


MORE INFORMATION

How Shared Printers Are Found

When a user chooses to browse for a printer in the domain, a remote procedure call (RPC) (EnumPrinters) is made to the browse master. EnumPrinters returns only the computers in the browse list that have set the printer flag (SV_TYPE_PRINT) in their host announcements.

For additional information on how the master browser is elected, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q102878
TITLE : Information on Browser Operation
Below is a network trace fragment that illustrates a client browsing a Windows NT Print Server:

Client Request


FRAME: Base frame properties
ETHERNET: 802.3 Length = 1042
LLC: UI DSAP=0xE0 SSAP=0xE0 C
IPX: NetBIOS Packet - 6112.08003E3046DE.455 -> 6112.02608C3F3E55.455 - 0
Hops
NBIPX: Session Data
SMB: C transact TransactNmPipe, FID = 0x80a
MSRPC: c/o RPC Request: call 0x1  opnum 0x0  context 0x0  hint 0x364
R_WINSPOOL: RPC Client call winspool:RpcEnumPrinters(..)
R_WINSPOOL: DWORD Flags = 64 (0x40)
R_WINSPOOL: STRING_HANDLE Name = \\NTSERVER
R_WINSPOOL: DWORD Level = 1 (0x1)
R_WINSPOOL: LPBYTE pPrinterEnum [..] = 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00...
R_WINSPOOL: DWORD cbBuf = 804 (0x324) 

Server Response


FRAME: Base frame properties ETHERNET: 802.3 Length = 970LLC: UI DSAP=0xE0
SSAP=0xE0 CIPX: NetBIOS Packet - 6112.02608C3F3E55.455 ->
6112.08003E3046DE.455 - 0 Hops
NBIPX: Session Data
SMB: R transact TransactNmPipe (response to frame 89)
MSRPC: c/o RPC Response: call 0x1 context 0x0 hint 0x338 cancels 0x0
R_WINSPOOL: RPC Server response winspool:RpcEnumPrinters(..)
R_WINSPOOL: LPBYTE pPrinterEnum [..] = 08 00 00 00 DA 02 00 00 B4 02 00 00
B2 02 00 00 08 00 00 00 58 02 00...
R_WINSPOOL: LPDWORD pcbNeeded = 460 (0x1CC)
R_WINSPOOL: LPDWORD pcReturned = 3 (0x3)
R_WINSPOOL: Return Value = 0 (0x0) 

The network trace above shows the network client receiving back a response from the server containing information from the RPC call EnumPrinters. (Additional information on this function is available in the Win32 SDK.)

How Existing Printers Get Enumerated to the Print Browse Master

Windows NT Server and Workstation computers update the browse master by default every 10 minutes with print share information. This is done via the Win32 API AddPrinter.

Below is a network trace fragment that demonstrates a client enumerating shared resources to the print browse master:

FRAME: Base frame properties ETHERNET: 802.3 Length = 458LLC: UI DSAP=0xE0
SSAP=0xE0 CIPX: NetBIOS Packet - 6112.08003E3046DE.455 ->
6112.02608C3F3E55.455 - 0 Hops
NBIPX: Session Data
SMB: C transact TransactNmPipe, FID = 0x200c
MSRPC: c/o RPC Request: call 0x1  opnum 0x5  context 0x0  hint 0x11C
R_WINSPOOL: RPC Client call winspool:RpcAddPrinter(..)
R_WINSPOOL: STRING_HANDLE pName = \\NTSERVER
R_WINSPOOL: PPRINTER_CONTAINER pPrinterContainer {..}
R_WINSPOOL: DWORD Level = 1 (0x1)
R_WINSPOOL: (Untyped 1) PrinterInfo {..}
R_WINSPOOL: Switch Value = 1 (0x1)
R_WINSPOOL: LPPRINTER_INFO_1W pPrinterInfo1 {..}
R_WINSPOOL: DWORD Flags = 24 (0x18)
R_WINSPOOL: LPWSTR pDescription = 35780264 (0x221F6A8)
R_WINSPOOL: LPWSTR pName = 35781864 (0x221FCE8)
R_WINSPOOL: LPWSTR pComment = 12163832 (0xB99AF8)
R_WINSPOOL: LPWSTR pDescription = \\NTCLIENT\Lexmark Optra PS,Lexmark Optra
PS,
R_WINSPOOL: LPWSTR pName = \\NTCLIENT\Lexmark Optra PS
R_WINSPOOL: LPWSTR pComment =
R_WINSPOOL: PDEVMODE_CONTAINER pDevModeContainer {..}
R_WINSPOOL: DWORD cbBuf = 0 (0x0)
R_WINSPOOL: LPBYTE pDevMode = 0 (0x0)
R_WINSPOOL: PSECURITY_CONTAINER pSecurityContainer {..}
R_WINSPOOL: DWORD cbBuf = 0 (0x0)
R_WINSPOOL: LPBYTE pSecurity = 0 (0x0) 

Registry Entries

Below is a list of registry entries that will manipulate client and server behavior in regard to print browsing.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print

DisableServerThread REG_DWORD
Range: 0 or 1
Default: 0 (false)

Set this to 1 (true) to disable the browse thread on the current computer. This thread is used to call other print servers to notify them that this printer exists.

ServerThreadTimeout REG_DWORD

Range: Milliseconds

Default: 36,000 (36 seconds)

Specifies the amount of time the ServerThread sleeps for before it calls all the other print servers to notify them of the printers on this computer.

NetPrinterDecayPeriod REG_DWORD

Range: Milliseconds

Default: 3,600,000 (1 hour)

Specifies how long to cache a network printer. The cache is used to present the list of printers when the browse dialog is used.

RefreshTimesPerDecayPeriod REG_DWORD

Range: 1 - 5

Default: 2

Specifies how many times to inform the browse masters and backup servers per decay period. Default value is two times per hour. Do not set a zero value if you specify both RefreshTimesPerDecayPeriod and ServerThreadTimeout; the system will wait for the maximum of either the ServerThreadTimeout or the RefreshTimesPerDecayPeriod.

Non-Printing Registry Changes


HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer
\Parameters


NOTE: The above registry key is one path; it has been wrapped for readability.

SizReqBuf REG_DWORD

Range: 512 - 65536 bytes

Default: 4356

Specifies the size of request buffers that the server uses. Small buffers use less memory; large buffers may improve performance. For an optional value try 4410.(Hex)


Keywords          : kbnetwork ntprint NTSrvWkst 
Version           : WinNT:3.51,4.0
Platform          : winnt 
Issue type        : 

Last Reviewed: February 2, 1999