SetupDiGetDeviceRegistryProperty function returns an incorrect RequiredSize value on DBCS characters in Windows 2000 (888609)
The information in this article applies to:
- Microsoft Windows 2000 Advanced Server
- Microsoft Windows 2000 Server
- Microsoft Windows 2000 Professional
SYMPTOMSIf a call occurs to the SetupDiGetDeviceRegistryProperty function on a double-byte character set (DBCS) character in Microsoft Windows 2000, the function may unexpectedly generate the following error message: ERROR_INSUFFICIENT_BUFFER This symptom occurs if the buffer size that was passed to the function was the required size ( RequiredSize) value that was returned by the previous call to the same function. Similar functions that return a RequiredSize out parameter, such as the SetupDiGetClassRegistryProperty function, may also return the incorrect RequiredSize value. Note Examples of double-byte character set (DBCS) languages are Japanese, Korean, and Simplified Chinese. CAUSEThis problem occurs because the size-conversion logic does not calculate the required buffer size correctly if there are DBCS characters. When a call occurs to the SetupDiGetDeviceRegistryProperty function on DBCS characters, the size that is returned (RequiredSize) is not large enough.WORKAROUNDTo work around this problem, use one of the following methods.Method 1When you compile your program, compile the source as Unicode so that wide versions of the functions are called directly.Method 2Before you call the SetupDiGetDeviceRegistryProperty function, create a buffer that is large enough to handle the function call. If the function still generates the error message, you can repeatedly add static increments to the buffer size until the function no longer generates the error message.Method 3If a call occurs to the SetupDiGetDeviceRegistryProperty function and the function returns the required buffer size in the PDWORD RequiredSize out parameter, double the returned RequiredSize value when you create the buffer.STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Modification Type: | Major | Last Reviewed: | 11/11/2004 |
---|
Keywords: | kbprb kbtshoot KB888609 kbAudDeveloper |
---|
|