Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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"


View products that this article applies to.

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.

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Status

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

↑ Back to the top


Keywords: KB920754, kbprb, kbbug, kbtshoot

↑ Back to the top

Article Info
Article ID : 920754
Revision : 5
Created on : 10/11/2007
Published on : 10/11/2007
Exists online : False
Views : 530