Skip to content

Latest commit

 

History

History
134 lines (98 loc) · 4.98 KB

nf-winbase-dnshostnametocomputernamew.md

File metadata and controls

134 lines (98 loc) · 4.98 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:winbase.DnsHostnameToComputerNameW
DnsHostnameToComputerNameW function (winbase.h)
Converts a DNS-style host name to a NetBIOS-style computer name. (Unicode)
DnsHostnameToComputerName
DnsHostnameToComputerName function
DnsHostnameToComputerNameW
_win32_dnshostnametocomputername
base.dnshostnametocomputername
winbase/DnsHostnameToComputerName
winbase/DnsHostnameToComputerNameW
base\dnshostnametocomputername.htm
winprog
d5646fe6-9112-42cd-ace9-00dd1b590ecb
12/05/2018
DnsHostnameToComputerName, DnsHostnameToComputerName function, DnsHostnameToComputerNameA, DnsHostnameToComputerNameW, _win32_dnshostnametocomputername, base.dnshostnametocomputername, winbase/DnsHostnameToComputerName, winbase/DnsHostnameToComputerNameA, winbase/DnsHostnameToComputerNameW
winbase.h
Windows.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
DnsHostnameToComputerNameW (Unicode) and DnsHostnameToComputerNameA (ANSI)
Kernel32.lib
Kernel32.dll
Windows
19H1
DnsHostnameToComputerNameW
winbase/DnsHostnameToComputerNameW
c++
APIRef
kbSyntax
DllExport
Kernel32.dll
API-MS-Win-Core-Kernel32-Legacy-l1-1-0.dll
kernel32legacy.dll
API-MS-Win-Core-Kernel32-Legacy-l1-1-1.dll
API-MS-Win-Core-Kernel32-Legacy-l1-1-2.dll
API-MS-Win-DownLevel-Kernel32-l2-1-0.dll
API-MS-Win-Core-Kernel32-Legacy-L1-1-3.dll
API-MS-Win-Core-Kernel32-Legacy-L1-1-4.dll
API-MS-Win-Core-Kernel32-Legacy-L1-1-5.dll
DnsHostnameToComputerName
DnsHostnameToComputerNameA
DnsHostnameToComputerNameW

DnsHostnameToComputerNameW function

-description

Converts a DNS-style host name to a NetBIOS-style computer name.

-parameters

-param Hostname [in]

The DNS name. If the DNS name is not a valid, translatable name, the function fails. For more information, see Computer Names.

-param ComputerName [out]

A pointer to a buffer that receives the computer name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.

-param nSize [in, out]

On input, specifies the size of the buffer, in TCHARs. On output, receives the number of TCHARs copied to the destination buffer, not including the terminating null character.

If the buffer is too small, the function fails, GetLastError returns ERROR_MORE_DATA, and nSize receives the required buffer size, not including the terminating null character.

-returns

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError. Possible values include the following.

Return code Description
ERROR_MORE_DATA
The ComputerName buffer is too small. The nSize parameter contains the number of bytes required to receive the name.

-remarks

This function performs a textual mapping of the name. This convention limits the names of computers to be the common subset of the names. (Specifically, the leftmost label of the DNS name is truncated to 15-bytes of OEM characters.) Therefore, do not use this function to convert a DNS domain name to a NetBIOS domain name. There is no textual mapping for domain names.

To compile an application that uses this function, define _WIN32_WINNT as 0x0500 or later. For more information, see Using the Windows Headers.

Note

The winbase.h header defines DnsHostnameToComputerName as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

GetComputerNameEx

SetComputerNameEx

System Information Functions