mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
20 lines
324 B
C++
20 lines
324 B
C++
#include "getcomputername.h"
|
|
#include <unistd.h>
|
|
#include <errno.h>
|
|
|
|
BOOL GetComputerName(LPTSTR name, LPDWORD len)
|
|
{
|
|
errno = 0;
|
|
|
|
int host = gethostname(name, HOST_NAME_MAX);
|
|
if(host == 0)
|
|
{
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
errno = ERROR_BUFFER_OVERFLOW;
|
|
return FALSE;
|
|
}
|
|
}
|