次の方法で共有


Applications Relying on GetProfileString Function or VB.Global.Printers for Printer Enumeration May Experience Performance Issues on Windows Server 2008 Terminal Server

The VB6.0 Runtime is continued to be supported in Windows Server 2008 and Windows 7. Consequently, many ISVs continue to deploy VB6.0 applications to the new operating systems. I would like to comment possible performance issue that you may encounter in Terminal Server 2008 if you deploy a an application to TS users. The issue here is currently under investigation and treated as a bug. My intention is to give you some more information about it before we have official statement from the product group on it. In particular, if you have source code of the application you could work around the issue. Note, that the information below is based on my practical experience where we could help customers experiencing the issue by pointing them to the recommended API. In a nutshell if possible re-factor the code substituting the GetProfileSeting() call and Printers object with the result of EnumPrinters function call.

I will post an update once product group completes its investigation, for the time being here are the details:

Symptoms:

If the following conditions hold:

-You have deployed an application that calls GetProfileString or makes use of VB6.0 Printers collection object to Windows Terminal Server 2008 or later

and

-You have enabled Easy Print feature in the Terminal Server

then

your application can experience performance issues in the printer enumeration routine because of the increasing size of the Printers collection over time.

Additionally you observe large number of entries accumulating in the HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devicesregistry hive.

More Information

Some legacy  applications often rely on the Vb.Global.Printers (PrinterCollection) collection object or GetProfileString() function to enumerate printer objects. The Printers object utilizes a function call GetProfileString() that in turn reads information from the HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices registry hive. As stated in the documentation GetProfileString() should not be called from server side code.

The registry key accumulation under HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices that is the root cause of the issue reported there is currently treated as bug and we are working on resolving this issue.

Workaround:

It is recommended that the Winspool API function EnumPrinters is used as a mechanism to obtain a list of user printers in terminal session instead of relying on the Printers object. If the source code is available, references to Printers collection should be substituted with the call to the EnumPrinters function. Performance of this function will vary depending on the type PRINTER_INFO structure returned as described in the Remarks section of the referenced document below.

References

EnumPrinters Function

https://msdn.microsoft.com/en-us/library/dd162692(VS.85).aspx

ACC: Enumerating Local and Network Printers

https://support.microsoft.com/default.aspx/kb/166008

GetProfileString Function

https://msdn.microsoft.com/en-us/library/ms724366(VS.85).aspx

Printer Object, Printers Collection

https://msdn.microsoft.com/en-us/library/aa267233(VS.60).aspx

Introducing Terminal Services Easy Print: Part 2-Per Session Default Printers

https://blogs.msdn.com/rds/archive/2007/05/03/introducing-terminal-services-easy-print-part-2.aspx

Applies to:

Windows Server 2008 Terminal Server

Windows Server 2008 R2 Terminal Server

Visual Basic 6.0

Comments

  • Anonymous
    October 04, 2010
    When will the accumulation of the registry key problem be fixed?

  • Anonymous
    March 23, 2011
    The comment has been removed

  • Anonymous
    July 17, 2011
    Do you have any idea when the registry key problem will be fixed ? Thanks.

  • Anonymous
    August 16, 2011
    See also this work around from citrix support.citrix.com/.../CTX129985