Files
PowerShell/impl/getcomputername.cpp
T

19 lines
335 B
C++
Raw Normal View History

#include "getcomputername.h"
#include <unistd.h>
2015-07-30 12:46:28 -07:00
#include <errno.h>
2015-04-06 09:57:16 -07:00
BOOL GetComputerName(LPTSTR name, LPDWORD len)
{
2015-07-30 12:46:28 -07:00
errno = 0;
size_t len2 = *len;
int host = gethostname(name, len2);
if(host == 0)
{
return TRUE;
2015-07-30 12:46:28 -07:00
}
else
{
errno = ERROR_BUFFER_OVERFLOW;
return FALSE;
}
}