private void GetDCInfo(string domain) { CNetlogon.LWNET_DC_INFO DCInfo; if (String.IsNullOrEmpty(domain)) { CNetlogon.GetCurrentDomain(out sDomain); } else { sDomain = domain; } uint netlogonError = CNetlogon.GetDCName(sDomain, 0, out DCInfo); if (netlogonError == 0 && !String.IsNullOrEmpty(DCInfo.DomainControllerName)) { sDomainController = DCInfo.DomainControllerName; } if (netlogonError == 0 && !String.IsNullOrEmpty(DCInfo.FullyQualifiedDomainName)) { sDomain = DCInfo.FullyQualifiedDomainName; } }
private static void GetUserDomain(out string domain) { domain = string.Empty; try { string domainName = string.Empty; CNetlogon.LWNET_DC_INFO DCInfo; uint netlogonError = CNetlogon.GetDCName(domainName, 0, out DCInfo); if (netlogonError == 0 && !String.IsNullOrEmpty(DCInfo.DomainControllerName)) { domain = DCInfo.FullyQualifiedDomainName; } } catch (Exception ex) { Logger.Log("Exception occured while getting DCInfo ," + ex.Message); return; } }