Error message when you call the WTSQueryUserToken API function in a 32-bit application or a Windows Service that is running on an x64-based Windows system: "ERROR_INSUFFICIENT_BUFFER" (920754)



The information in this article applies to:

  • Microsoft Windows Server 2003 R2 Enterprise x64 Edition
  • Microsoft Windows Server 2003 R2 Standard x64 Edition
  • Microsoft Windows Server 2003, Enterprise x64 Edition
  • Microsoft Windows Server 2003, Standard x64 Edition
  • Microsoft Windows XP Professional x64 Edition
  • Microsoft Win32 Application Programming Interface (API)

SYMPTOMS

Consider the following scenario. A 32-bit application or a Microsoft Windows Service is running on an x64-based Windows system. The 32-bit application or the Microsoft Windows Service has appropriate permissions. The 32-bit application or the Windows Service makes a call to the WTSQueryUserToken API function.

In this scenario, the call fails. Additionally, the GetLastError API function returns the following Windows error message:
ERROR_INSUFFICIENT_BUFFER
The error code indicates that the data area that is passed to the system call is too small.

CAUSE

This issue occurs because the WTSQueryUserToken API function internally passes a structure to another system call. However, the size of the buffer is incorrectly set to the 32-bit structure size.

WORKAROUND

To work around this issue, you must port the functionality to a native 64-bit version. Depending on the functionality that is required, you may also encapsulate the Terminal Services API functions inside a native 64-bit out-of-process COM server.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

Modification Type:MajorLast Reviewed:8/4/2006
Keywords:kbBug kbprb KB920754 kbAudDeveloper