?
Solved

current dns server

Posted on 2003-03-06
9
Medium Priority
?
252 Views
Last Modified: 2010-04-04
hi im looking for a way to get the current dns server, anyone ? does anyone no any freeware components or code ? any help appreciated.
0
Comment
Question by:adrenalindx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:Wax0r
ID: 8081344
It's available in the registry.


HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\NetBT\Parameters\Interfaces\

has some TCP_IP subkeys, enumerate them and check for the NameServerList string, it holds the nameservers :)
0
 

Author Comment

by:adrenalindx
ID: 8082011
yes but this does not allways work, anything else ? there is a way to do it like winipcfg does it it required the iphlpapi or something ??
0
 
LVL 1

Expert Comment

by:Munim
ID: 8082790
This code should work...

--begin of code--
program dnslist;

{$APPTYPE CONSOLE}

uses
  SysUtils, Windows, Iphlpapi, Ipexport, IpTypes;

var
  pFixedInfo: PFIXED_INFO;
  pDnsInfo: PIP_ADDR_STRING;
  BufLen, Ret: DWORD;
  Cnt: Integer;
begin
  ret := GetNetworkParams(nil, @BufLen);
  if ret <> ERROR_BUFFER_OVERFLOW then
    Exit;
  GetMem(pFixedInfo, BufLen);

  ret := GetNetworkParams(@pFixedInfo, @BufLen);
  if ret <> ERROR_SUCCESS then
    Exit;

  pDnsInfo := @(pFixedInfo^.DnsServerList);
  if pDnsInfo^.IpAddress.S[0] = #0 then
    Writeln('DNSƒT[ƒo‚͐ݒ肳‚ê‚Ä‚¢‚Ü‚¹‚ñB');

  Cnt := 1;
  repeat
    Writeln('DNSƒT[ƒo' + IntToStr(Cnt) + ' = ' + pDnsInfo^.IpAddress.S);
    pDnsInfo := pDnsInfo^.Next;
    Inc(Cnt);
  until pDnsInfo = nil;
end.
--end of code--
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:adrenalindx
ID: 8111041
thanks ill check it out and get back to u,
0
 

Author Comment

by:adrenalindx
ID: 8119209
i tried to compile like this but it wood not work and had to do this


 ret := GetNetworkParams(@pFixedInfo, @BufLen);


to


 ret := GetNetworkParams(pFixedInfo, BufLen);

i got rid of the @ otheriwse it wont compile

wen i run it it crashes, not crashes but raises an exception ??
0
 

Expert Comment

by:CleanupPing
ID: 9316905
adrenalindx:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 10044985
Hi!
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:

To be deleted and points refunded

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

...Snehanshu
EE Cleanup Volunteer
0
 
LVL 5

Expert Comment

by:Lukasz Lach
ID: 10045166
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10113871
PAQed, with points refunded (50)

modulo
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question