kernelbase: Implement DnsHostnameToComputerNameExW().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-12-12 17:48:18 +01:00
parent 356d0fcc5b
commit e2ab5b76c1
3 changed files with 34 additions and 1 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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);