Results 1 to 5 of 5

Thread: Domain Name?

  1. #1

    Thread Starter
    Fanatic Member vb_dba's Avatar
    Join Date
    Jun 2001
    Location
    Somewhere aloft between the real world and insanity
    Posts
    1,016

    Domain Name?

    How can I return the Domain Name of the network I'm connected to? I've looked for an API for this, but can't seem to find one.

    Thanks
    Chris

    Master Of My Domain
    Got A Question? Look Here First

  2. #2
    jim mcnamara
    Guest
    Check out GetNetworkParams() -- I did this from memory so check it
    Code:
    long cbRequired;
    char *buf;
    FIXED_INFO * Info;
    long result =  GetNetworkParams(NULL, cbRequired);
    if(cbRequired){    
         buf = (char*) malloc(cbRequired);     
         if(GetNetWorkParams(buf,cbRequired) ) == ERROR_SUCCESS)  { 
             Info = (FIXED_INFO*) buf;
             printf("Domain name = ",%s,Info->DomainName);
         }    
    }

  3. #3

    Thread Starter
    Fanatic Member vb_dba's Avatar
    Join Date
    Jun 2001
    Location
    Somewhere aloft between the real world and insanity
    Posts
    1,016
    Do I need to declare the FIXED_INFO datatype? I get an undeclared identifier error when trying to declare Info as that type.
    Chris

    Master Of My Domain
    Got A Question? Look Here First

  4. #4
    jim mcnamara
    Guest
    Code:
    #include <Iptypes.h>
    Code:
    typedef struct {
    char HostName [MAX_HOSTNAME_LEN + 4];
    char DomainName [MAX_DOMAIN_NAME_LEN + 4];
    PIP_ADDR_STRING CurrentDnsServer;
    IP_ADDR_STRING DnsServerList; 
    UINT NodeType;
    char ScopeId [MAX_SCOPE_ID_LEN + 4];
    UINT EnableRouting;
    UINT EnableProxy;
    UINT EnableDns;
    } FIXED_INFO, *PFIXED_INFO;
    Members
    HostName[MAX_HOSTNAME_LEN + 4] 
    Specifies the host name for the local computer. 
    DomainName[MAX_DOMAIN_NAME_LEN + 4] 
    Specifies the domain in which the local computer is registered. 
    CurrentDnsServer 
    Specifies the current DNS server. 
    DnsServerList 
    Specifies the set of DNS servers used by the local computer. 
    NodeType 
    Specifies whether the local computer uses dynamic host configuration protocol (DHCP). 
    ScopeId[MAX_SCOPE_ID_LEN + 4] 
    Specifies the DHCP scope name. 
    EnableRouting 
    Specifies whether routing is enabled on the local computer. 
    EnableProxy 
    Specifies whether the local computer is acting as an ARP proxy. 
    EnableDns 
    Specifies whether DNS is enabled on the local computer.

  5. #5
    jim mcnamara
    Guest
    You can declare
    Code:
    PFIXED_INFO Info;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width