Commit e2ab5b76 authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Implement DnsHostnameToComputerNameExW().

parent 356d0fcc
......@@ -267,7 +267,7 @@
@ stdcall DisassociateCurrentThreadFromCallback(ptr) ntdll.TpDisassociateCallback
# @ stub DiscardVirtualMemory
@ stdcall DisconnectNamedPipe(long)
# @ stub DnsHostnameToComputerNameExW
@ stdcall DnsHostnameToComputerNameExW(wstr ptr ptr)
# @ stub DsBindWithSpnExW
# @ stub DsCrackNamesW
# @ stub DsFreeDomainControllerInfoW
......
......@@ -3046,6 +3046,38 @@ LSTATUS WINAPI RegLoadAppKeyW(const WCHAR *file, HKEY *result, REGSAM sam, DWORD
}
/***********************************************************************
* DnsHostnameToComputerNameExW (kernelbase.@)
*
* FIXME: how is this different from the non-Ex function?
*/
BOOL WINAPI DECLSPEC_HOTPATCH DnsHostnameToComputerNameExW( const WCHAR *hostname, WCHAR *computername,
DWORD *size )
{
static const WCHAR allowed[] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&')(-_{}";
WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1];
DWORD i, len;
lstrcpynW( buffer, hostname, MAX_COMPUTERNAME_LENGTH + 1 );
len = lstrlenW( buffer );
if (*size < len + 1)
{
*size = len;
SetLastError( ERROR_MORE_DATA );
return FALSE;
}
*size = len;
if (!computername) return FALSE;
for (i = 0; i < len; i++)
{
if (buffer[i] >= 'a' && buffer[i] <= 'z') computername[i] = buffer[i] + 'A' - 'a';
else computername[i] = wcschr( allowed, buffer[i] ) ? buffer[i] : '_';
}
computername[len] = 0;
return TRUE;
}
struct USKEY
{
HKEY HKCUstart; /* Start key in CU hive */
......
......@@ -1958,6 +1958,7 @@ WINBASEAPI BOOL WINAPI DisconnectNamedPipe(HANDLE);
WINBASEAPI BOOL WINAPI DnsHostnameToComputerNameA(LPCSTR,LPSTR,LPDWORD);
WINBASEAPI BOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR,LPWSTR,LPDWORD);
#define DnsHostnameToComputerName WINELIB_NAME_AW(DnsHostnameToComputerName)
WINBASEAPI BOOL WINAPI DnsHostnameToComputerNameExW(LPCWSTR,LPWSTR,LPDWORD);
WINBASEAPI BOOL WINAPI DosDateTimeToFileTime(WORD,WORD,LPFILETIME);
WINBASEAPI BOOL WINAPI DuplicateHandle(HANDLE,HANDLE,HANDLE,HANDLE*,DWORD,BOOL,DWORD);
WINADVAPI BOOL WINAPI DuplicateToken(HANDLE,SECURITY_IMPERSONATION_LEVEL,PHANDLE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment