EnumerateLocalComputerNames (kernel32)
Last changed: anfortas.geo@yahoo.com-216.204.61.86

.
Summary
Enumerates the local network names for the computer from which it is called.

C# Signature:

[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
static extern uint EnumerateLocalComputerNames(
    COMPUTER_NAME_TYPE NameType,
    uint ulFlags,
    IntPtr lpBuffer,
    ref uint nSize);

User-Defined Types:

COMPUTER_NAME_TYPE

Notes:

Returns ERROR_SUCCESS on success or an error code on failure. Unless only the primary computer name is requested, the buffer will be filled with a series of null-terminated strings followed by a final null terminator. To measure the required number of characters, not including the final null terminator, use a null buffer and a zero size. This function is similar to GetComputerNameEx, and delegates to it to obtain the primary computer name.

The caller may request the primary name only, the alternate names only, or all computer names. Each name returned is a fully qualified DNS name. This function has both ANSI and Unicode versions, but since it only exists on XP and later, the signature shown will always use Unicode.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

Do you know one? Please contribute it!

Documentation