dnswin init must be called from lcoreinit to support NT service
[lcore.git] / lcorewsaasyncselect.pas
index b64797ae174c9f2959f0fb776a2be77a04ee481c..075d5587622d40177d71ec9bc23bceff58784716 100755 (executable)
@@ -2,9 +2,14 @@ unit lcorewsaasyncselect;
 \r
 interface\r
 \r
+procedure lcoreinit;\r
 \r
 implementation\r
-uses wcore,lcore,bsearchtree,sysutils,windows,winsock,pgtypes,messages,classes,lsocket;\r
+\r
+uses\r
+  dnswin, //to call init\r
+  wcore,lcore,bsearchtree,sysutils,windows,winsock,pgtypes,messages,classes,lsocket;\r
+\r
 type\r
   twineventcore=class(teventcore)\r
   public\r
@@ -197,7 +202,14 @@ var
                                  lpszClassName : 'lcoreClass');\r
   GInitData: TWSAData;\r
 \r
+var\r
+  inited:boolean;\r
+procedure lcoreinit;\r
 begin\r
+  if (inited) then exit;\r
+\r
+  dnswin.init;\r
+\r
   eventcore := twineventcore.create;\r
   if Windows.RegisterClass(MyWindowClass) = 0 then halt;\r
   //writeln('about to create lcore handle, hinstance=',hinstance);\r
@@ -216,6 +228,12 @@ begin
   onaddtask := winaddtask;\r
   timerwrapperinterface := twintimerwrapperinterface.create(nil);\r
 \r
-  WSAStartup($200, GInitData);\r
+  WSAStartup(2, GInitData);\r
   absoloutemaxs := maxlongint;\r
+\r
+  wcoreinit;\r
+\r
+  inited := true;\r
+end;\r
+\r
 end.\r