Microsoft KB Archive/259394

{|
 * width="100%"|

BUG: The RegQueryValueExA Function May Return an Incomplete List of Performance Objects

 * }

Q259394

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * Microsoft Windows NT Workstation version 4.0
 * Microsoft Windows NT Server version 4.0

-

SYMPTOMS
When you call the ANSI version of the RegQueryValueEx function with HKEY_PERFORMANCE_DATA to retrieve &quot;Global&quot; performance data, the function may not return the complete list of all performance objects. If the application supplies a big enough buffer, RegQueryValueEx may succeed with ERROR_SUCCESS, but the buffer may contain only a partial list of performance objects.

RESOLUTION
Instead, use the Unicode version of the RegQueryValueEx function. You can do this by calling the RegQueryValueExW function explicitly (note the trailing &quot;W&quot;). Pass a Unicode string for lpValueName, which is the second parameter.

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in Microsoft Windows 2000.

MORE INFORMATION
This behavior is seen only when the application uses the ANSI version of RegQueryValueEx. The Unicode version of RegQueryValueEx correctly returns all the performance objects when retrieving the &quot;Global&quot; performance data.

The performance data block that is returned by the RegQueryValueExA function (ANSI version) is the same as RegQueryValueExW (Unicode version). Therefore, an application can call RegQueryValueExW explicitly, even from an ANSI build. This method requires that you pass a Unicode string for lpValueName, which is the second parameter of RegQueryValueExW.

Performance Data Helper (PDH) functions use the Unicode version of RegQueryValueEx to retrieve the performance data, and therefore an application can also use PDH to collect the complete list of all performance objects.