Microsoft KB Archive/161734

= Windows NT and Windows 2000 print browsing architecture =

Article ID: 161734

Article Last Modified on 2/27/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Windows 2000 Datacenter Server
 * Microsoft Windows NT Workstation 3.51
 * Microsoft Windows NT Workstation 4.0 Developer Edition
 * Microsoft Windows NT Server 3.51
 * Microsoft Windows NT Server 4.0 Standard Edition

-



This article was previously published under Q161734



Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows registry



SUMMARY
Windows NT and Windows 2000 leverage 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 environment and the registry keys that effect its behavior.



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 more information about how the master browser is selected, click the following article number to view the article in the Microsoft Knowledge Base:

102878 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 AddPrinter function.

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
Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

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

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.

To disable the server thread on a non-domain computer using the following registry setting:

Range: 0 or 1

Default: 1 (enabled)

Set this entry to 0 to disable the server thread. For more information, visit the following Web site:

http://technet2.microsoft.com/WindowsServer/en/Library/c0eb9b7d-f28f-478a-a31c-523af67695141033.mspx

Non-printing registry changes
SizReqBuf REG_DWORD

Range: 512 - 65535 (bytes in decimal, or 200 - FFFF in hexadecimal)

Default: 4356

Note In Windows 2000, the minimum setting is 1024. Small buffers use less memory, and large buffers can improve performance. The exact value that works best in a specific environment will depend on the specific configuration of that environment. For an optional value, try 4410 (hexadecimal). This value has been shown to work well in a standard Ethernet environment. By default, this setting is 4356 bytes on computers. On servers that have more than 512 MB of memory, this value is increased to 16 KB. A receive buffer that is larger can improve performance on query directory and similar commands, but at the price of more memory per work item.

EnableBroadcastSpoolerStatus REG_DWORD

Range: 0 or 1

Default: 0 (false)

Forces the broadcast of WM_SPOOLERSTATUS messages on Windows 2000; ignored by other platforms. By default, Windows 2000 does not broadcast WM_SPOOLERSTATUS messages. Set this registry value to 1 if you have a program that is designed for earlier versions of Windows that rely on receipt of the WM_SPOOLERS ATUS messages. Note that the WM_SPOOLERSTATUS message does not have guaranteed delivery semantics, so programs should not rely upon its receipt.

Shared printer announcements
When a printer is shared, the share name is announced to 3+n/32 servers, where "n" is the number of print servers in that domain. Then, the selection algorithm is re-announced every 10 minutes. Names are also re-announced when new shares are created on the server. The Spooler service listens to these announcements, adds the printer(s) to its list of printers, and records a time stamp. The time stamp is refreshed every 10 minutes. If a printer is not refreshed in 70 minutes, it is removed from the list.

