Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

104 lines
2.2 KiB

//----------------------------------------------------------------------------
//
// File: WEXIT.cpp
//
// Contents: Contins DNS specific routines
//
//
// Notes:
//
// History:
// July 8, 1995 MikeMi - Created
//
//
//----------------------------------------------------------------------------
#include "pch.hxx"
#pragma hdrstop
WCHAR PSZ_TCPCFGDLL[] = L"TcpCfg.Dll";
CHAR PSZ_DNSVALIDATEHOSTNAME[] = "DNSValidateHostName";
CHAR PSZ_DNSCHANGEHOSTNAME[] = "DNSChangeHostName";
typedef
DWORD
(* DNSValidateHostNameProc) (
PWSTR pszComputerName,
PWSTR pszHostName,
PDWORD pcchHostName );
typedef
DWORD
(* DNSChangeHostNameProc) (
PWSTR pszHostName );
//----------------------------------------------------------------------------
//
//
//----------------------------------------------------------------------------
APIERR DNSValidateHostName( PWSTR pszComputerName, PWSTR pszHostName, PDWORD pcchHostName )
{
APIERR err;
HINSTANCE hinstTcpcfg;
hinstTcpcfg = ::LoadLibrary( PSZ_TCPCFGDLL );
if (NULL != hinstTcpcfg)
{
DNSValidateHostNameProc fp;
fp = (DNSValidateHostNameProc)::GetProcAddress( hinstTcpcfg, PSZ_DNSVALIDATEHOSTNAME );
if (NULL != fp)
{
err = fp( pszComputerName, pszHostName, pcchHostName );
}
else
{
err = GetLastError();
}
::FreeLibrary( hinstTcpcfg );
}
else
{
err = GetLastError();
}
return( err );
}
//----------------------------------------------------------------------------
//
//
//----------------------------------------------------------------------------
APIERR DNSChangeHostName( PWSTR pszHostName )
{
LONG lrt;
HINSTANCE hinstTcpcfg;
hinstTcpcfg = ::LoadLibrary( PSZ_TCPCFGDLL );
if (NULL != hinstTcpcfg)
{
DNSChangeHostNameProc fp;
fp = (DNSChangeHostNameProc)::GetProcAddress( hinstTcpcfg, PSZ_DNSCHANGEHOSTNAME );
if (NULL != fp)
{
lrt = fp( pszHostName );
}
else
{
lrt = GetLastError();
}
::FreeLibrary( hinstTcpcfg );
}
else
{
lrt = GetLastError();
}
return( lrt );
}