I needed to obtain the Fully Qualified Domain Name (FQDN) for a given NetBios domain name. Eg from MYDOMAIN to dc=mydomain,dc=local.
I did some tests with the TranslateName API and if you append a \ to the domain name it returns the FQDN.
Here is a short example:
objectpascal
Download
var
Buffer: array[0..MAX_PATH] of Char;
nSize: DWORD;
begin
nSize := Length(Buffer);
ZeroMemory(@Buffer, SizeOf(Buffer));
Win32Check(TranslateName('MYDOMAIN\'), NameSamCompatible, NameFullyQualifiedDN, Buffer, nSize))
end;
Can we rely on this function if the computer on which the above code is executed is not joined to the MYDOMAIN?
@Petar: MSDN docs state that it needs to bind to an Active Directory Domain Controller. So I think the computer must be joined to MYDOMAIN or another domain that can resolve the netbios domain (eg a trusted domain).