🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5367

Re: Function to enumerate domains?

#5367
From: TerryC
Date: Wed, 07 Sep 2005 16:44
29 lines
1851 bytes
JF Jolin <jfj@nospam.com> wrote:
>That question have been asked before.  Here is one answer.
>
>http://tinyurl.com/74rg4

I ended up using DsEnumerateDomainTrusts(), since our network is 
all Win2000 or higher.  That worked out pretty well.

----------------------------------------------------------

void __fastcall TfMain::FormShow(TObject *Sender)
{
   PDS_DOMAIN_TRUSTS pDomainTrusts = 0;
   unsigned long DomainCount;

   int Result = ::DsEnumerateDomainTrusts(NULL, DS_DOMAIN_IN_FOREST, &pDomainTrusts, &DomainCount);

   if(!Result && DomainCount)
      for(unsigned long i = 0; i < DomainCount; ++i)
         cbDomains->Items->Append((pDomainTrusts + i)->NetbiosDomainName);

   ::NetApiBufferFree(pDomainTrusts);
}

----------------------------------------------------------

Many thanks!
-Terry
Technical Details
Message-ID: <431f18e3$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newscon02.news.prodigy.com!prodigy.net!nx02.iad01.newshosting.com!newshosting.com!diablo.voicenet.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4318b2cc$1@newsgroups.borland.com> <431b62be@newsgroups.borland.com> <431da0da$1@newsgroups.borland.com> <opswoyog1qz6rw7b@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,60e85a5f942051e5
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "TerryC" <nope@nada.org>
Sender: "TerryC" <nope@nada.org>
Reply-To: "TerryC" <nope@nada.org>
Subject: Re: Function to enumerate domains?
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 63.250.179.198     
References: <4318b2cc$1@newsgroups.borland.com> <431b62be@newsgroups.borland.com> <431da0da$1@newsgroups.borland.com> <opswoyog1qz6rw7b@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <431f18e3$1@newsgroups.borland.com>
Date: 7 Sep 2005 09:44:19 -0700
X-Trace: newsgroups.borland.com 1126111459 207.105.83.66 (7 Sep 2005 09:44:19 -0700)
Lines: 29
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newscon02.news.prodigy.com!prodigy.net!nx02.iad01.newshosting.com!newshosting.com!diablo.voicenet.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail