Microsoft KB Archive/254073

{|
 * width="100%"|

BUG: GetComputerNameEx Returns a Buffer Size of Zero

 * }

Q254073

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * the operating system: Microsoft Windows 2000

-

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.

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products 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.

Additional query words:

Keywords : kbAPI kbKernBase kbSysSettings kbDSupport kbGrpDSKernBase

Issue type : kbbug

Technology : kbAudDeveloper kbWin32sSearch kbWin32API