[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

Name of Domain

Hi experts!

How can i get name of domain with Win API?

Thanx!
0
danelroisman
Asked:
danelroisman
1 Solution
 
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
 
danelroismanAuthor Commented:
Thanx Stevex2!

The function is NetServerEnum()

Daniel

0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now