|
-
Jun 20th, 2002, 11:08 AM
#1
Thread Starter
Fanatic Member
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
-
Jun 20th, 2002, 12:11 PM
#2
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);
}
}
-
Jun 20th, 2002, 12:26 PM
#3
Thread Starter
Fanatic Member
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
-
Jun 20th, 2002, 02:24 PM
#4
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.
-
Jun 20th, 2002, 02:27 PM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|