Name of Domain

Hi experts!

How can i get name of domain with Win API?

Thanx!
LVL 2
danelroismanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ufolk123Commented:
May be this will help

struct HOSTENT FAR * gethostbyname ( const char FAR * name
 
);
 
Where hostent is defined as
struct hostent {
    char FAR *       h_name;
    char FAR * FAR * h_aliases;
    short            h_addrtype;
    short            h_length;
    char FAR * FAR * h_addr_list;
};
 
Members
h_name

Official name of the host (PC).If using the DNS or similar resolution system, it is the Fully Qualified Domain Name (FQDN) that caused the server to return a reply. If using a local "hosts" file, it is the first entry after the IP address.

So you can get the DN name giving the local name of host.


0
danelroismanAuthor Commented:
Thanx ufolk123!

But i need the name of
LAN Domain - no loclal host or DNS resolving.

Daniel

0
mstoutCommented:
Do you want the domain name that the machine is currently a member of, or the domain of the account that is running the current process.
0
Stevex2Commented:
Look at the NetEnum functions in the Help files and check for all containers. They should have the Domain in there if you have problems let me know i got some code i have done it with.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
danelroismanAuthor Commented:
Thanx Stevex2!

The function is NetServerEnum()

Daniel

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.