BUG: GetComputerNameEx() Returns a Buffer Size of Zero (254073)
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), when used with:
- the operating system: Microsoft Windows 2000
This article was previously published under Q254073 SYMPTOMS
When you attempt to determine the buffer size required by the GetComputerNameEx function, the function always returns a buffer size of zero.
RESOLUTION
If the buffer size needs to be determined in advance, the Unicode version of the GetComputerNameEx function, which is GetComputerNameExW, can be used. The GetComputerNameExW function returns the required buffer size.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. MORE INFORMATION
The information returned by the GetComputerNameEx function can vary in size. This function allows you to call it with a NULL pointer and a buffer size of zero. This function then returns the buffer size required. If the ANSI version is required, it is necessary to allocate a large enough buffer to satisfy the function call or it will fail.
Modification Type: | Major | Last Reviewed: | 11/3/2003 |
---|
Keywords: | kbAPI kbbug kbKernBase kbSysSettings KB254073 |
---|
|