I have a VC++ application that calls DsGetDcName() to determine the sites
(and domains) of servers in the network. I have found that DsGetDcName()
fails rather often, and the reason(s) is not obvious. The typical error
code
is RPC_S_SERVER_UNAVAILABLE, although RPC_E_ACCESS_DENIED is popular, as
well. Often simply retrying the call will result in success (even for
"access
denied"), but usually it does not.
I'm passing a NETBIOS name as the first parameter and requesting a
DNS-style
name by setting flag DS_RETURN_DNS_NAME. If the initial call fails with
ERROR_NO_SUCH_DOMAIN, I set the DS_FORCE_REDISCOVERY flag and repeat the
call. If the call fails for any other reason, I wait a bit (200 ms, I
believe), and repeat the call. Ten strikes and you're out.
What can cause DsGetDcName() to fail (excluding the obvious situation
where
the server is down or otherwise not accessible)?
Thanks,
-Nick


|