Return a computername constructed from the hostname.

This commit is contained in:
Hans Leidekker 2005-03-30 17:04:55 +00:00 committed by Alexandre Julliard
parent 09e00cf412
commit 6199b28238
1 changed files with 44 additions and 12 deletions

View File

@ -683,23 +683,55 @@ BOOL WINAPI SetComputerNameExA( COMPUTER_NAME_FORMAT type, LPCSTR lpComputerName
/***********************************************************************
* DnsHostnameToComputerNameA (KERNEL32.@)
*/
BOOL WINAPI DnsHostnameToComputerNameA(LPCSTR Hostname, LPSTR ComputerName,
LPDWORD nSize)
BOOL WINAPI DnsHostnameToComputerNameA(LPCSTR hostname,
LPSTR computername, LPDWORD size)
{
FIXME("(%s, %s, %08lx): stub\n", debugstr_a(Hostname),
debugstr_a(ComputerName), *nSize);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
DWORD len;
FIXME("(%s, %p, %p): stub\n", debugstr_a(hostname), computername, size);
if (!hostname || !size) return FALSE;
len = lstrlenA(hostname);
if (len > MAX_COMPUTERNAME_LENGTH)
len = MAX_COMPUTERNAME_LENGTH;
if (*size < len)
{
*size = len;
return FALSE;
}
if (!computername) return FALSE;
memcpy( computername, hostname, len );
computername[len + 1] = 0;
return TRUE;
}
/***********************************************************************
* DnsHostnameToComputerNameW (KERNEL32.@)
*/
BOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR Hostname, LPWSTR ComputerName,
LPDWORD nSize)
BOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR hostname,
LPWSTR computername, LPDWORD size)
{
FIXME("(%s, %s, %08lx): stub\n", debugstr_w(Hostname),
debugstr_w(ComputerName), *nSize);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
DWORD len;
FIXME("(%s, %p, %p): stub\n", debugstr_w(hostname), computername, size);
if (!hostname || !size) return FALSE;
len = lstrlenW(hostname);
if (len > MAX_COMPUTERNAME_LENGTH)
len = MAX_COMPUTERNAME_LENGTH;
if (*size < len)
{
*size = len;
return FALSE;
}
if (!computername) return FALSE;
memcpy( computername, hostname, len * sizeof(WCHAR) );
computername[len + 1] = 0;
return TRUE;
}