X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/9653ddc572f5fd8ec065e4c357101ae6edae7959..e2488d880e54b1b938409d3870c28ea952c6d51a:/lcorelocalips.pas?ds=inline

diff --git a/lcorelocalips.pas b/lcorelocalips.pas
index dcc633a..8698a8c 100644
--- a/lcorelocalips.pas
+++ b/lcorelocalips.pas
@@ -36,7 +36,9 @@ notes:
 }
 
 unit lcorelocalips;
-
+{$ifdef fpc}
+  {$mode delphi}
+{$endif}
 interface
 
 uses binipstuff,pgtypes;
@@ -51,7 +53,7 @@ function getv6localips:tbiniplist;
 
 function getsystemdnsservers:tbiniplist;
 
-{$ifdef win32}
+{$ifdef mswindows}
 function gethostname:ansistring;
 {$endif}
 
@@ -188,7 +190,7 @@ end;
 {$else}
 
 uses
-  sysutils,windows,winsock,dnssync,dnscore;
+  sysutils,windows,winsock,dnswin;
 
 {the following code's purpose is to determine what IP windows would come from, to reach an IP
 it can be abused to find if there's any global v6 IPs on a local interface}
@@ -256,13 +258,9 @@ var
   a:integer;
   ip:tbinip;
   usewindnstemp:boolean;
+  error:integer;
 begin
-  {this lookup must always be done with the windows API lookup
-  setting usewindns to false on windows will fail with infinite recursion}
-  usewindnstemp := usewindns;
-  usewindns := true;
-  result := forwardlookuplist('',0);
-  usewindns := usewindnstemp;
+  result := winforwardlookuplist('',0,error);
 
   {$ifdef ipv6}
 
@@ -288,7 +286,7 @@ end;
 
 
 
-{$ifdef win32}
+{$ifdef mswindows}
   const
     MAX_HOSTNAME_LEN = 132;
     MAX_DOMAIN_NAME_LEN = 132;
@@ -354,7 +352,7 @@ end;
 
 function getsystemdnsservers:tbiniplist;
 var
-  {$ifdef win32}
+  {$ifdef mswindows}
     fixed_info : pfixed_info;
     currentdnsserver : pip_addr_string;
   {$else}
@@ -368,7 +366,7 @@ begin
 
   result := biniplist_new;
 
-  {$ifdef win32}
+  {$ifdef mswindows}
     fixed_info := callgetnetworkparams;
     if fixed_info = nil then exit;
 
@@ -404,7 +402,7 @@ begin
   {$endif}
 end;
 
-{$ifdef win32}
+{$ifdef mswindows}
 function gethostname:ansistring;
 var
     fixed_info : pfixed_info;
@@ -420,4 +418,4 @@ begin
 end;
 {$endif}
 
-end.
+end.
\ No newline at end of file