Skip to content

Instantly share code, notes, and snippets.

@egonelbre
Created August 11, 2014 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egonelbre/a5a82c17cdec87c4dc7d to your computer and use it in GitHub Desktop.
Save egonelbre/a5a82c17cdec87c4dc7d to your computer and use it in GitHub Desktop.
DnsNameCompare_W from ReactOS
BOOL WINAPI DnsNameCompare_W( PCWSTR name1, PCWSTR name2 )
{
PCWSTR p, q;
if (!name1 && !name2) return TRUE;
if (!name1 || !name2) return FALSE;
p = name1 + lstrlenW( name1 ) - 1;
q = name2 + lstrlenW( name2 ) - 1;
while (*p == '.' && p >= name1) p--;
while (*q == '.' && q >= name2) q--;
if (p - name1 != q - name2) return FALSE;
while (name1 <= p)
{
if (towupper( *name1 ) != towupper( *name2 ))
return FALSE;
name1++;
name2++;
}
return TRUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment