Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

692 lines
20 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. atkpnp.c
  5. Abstract:
  6. This module contains the support code for handling PnP events
  7. Author:
  8. Shirish Koti
  9. Revision History:
  10. 16 Jun 1997 Initial Version
  11. --*/
  12. #include <atalk.h>
  13. #pragma hdrstop
  14. #define FILENUM ATKPNP
  15. #ifdef ALLOC_PRAGMA
  16. #pragma alloc_text(PAGE, AtalkPnPHandler)
  17. #pragma alloc_text(PAGE, AtalkPnPReconfigure)
  18. #pragma alloc_text(PAGE, AtalkPnPEnableAdapter)
  19. #endif
  20. NDIS_STATUS
  21. AtalkPnPHandler(
  22. IN NDIS_HANDLE NdisBindCtx,
  23. IN PNET_PNP_EVENT pPnPEvent
  24. )
  25. {
  26. NDIS_STATUS Status=STATUS_SUCCESS;
  27. PAGED_CODE();
  28. ASSERT(pPnPEvent);
  29. ASSERT(KeGetCurrentIrql() == 0);
  30. switch (pPnPEvent->NetEvent)
  31. {
  32. case NetEventReconfigure:
  33. DBGPRINT(DBG_COMP_ACTION, DBG_LEVEL_INFO,
  34. ("AtalkPnPHandler: NetEventReconfigure event\n"));
  35. Status = AtalkPnPReconfigure(NdisBindCtx,pPnPEvent);
  36. break;
  37. case NetEventCancelRemoveDevice:
  38. DBGPRINT(DBG_COMP_ACTION, DBG_LEVEL_ERR,
  39. ("AtalkPnPHandler: NetEventCancelRemoveDevice event\n"));
  40. break;
  41. case NetEventQueryRemoveDevice:
  42. DBGPRINT(DBG_COMP_ACTION, DBG_LEVEL_ERR,
  43. ("AtalkPnPHandler: NetEventQueryRemoveDevice event\n"));
  44. break;
  45. case NetEventQueryPower:
  46. DBGPRINT(DBG_COMP_ACTION, DBG_LEVEL_ERR,
  47. ("AtalkPnPHandler: NetEventQueryPower event\n"));
  48. break;
  49. case NetEventSetPower:
  50. DBGPRINT(DBG_COMP_ACTION, DBG_LEVEL_ERR,
  51. ("AtalkPnPHandler: NetEventSetPower event\n"));
  52. break;
  53. case NetEventBindsComplete:
  54. DBGPRINT(DBG_COMP_ACTION, DBG_LEVEL_ERR,
  55. ("AtalkPnPHandler: NetEventBindsComplete event\n"));
  56. break;
  57. case NetEventBindList:
  58. DBGPRINT(DBG_COMP_ACTION, DBG_LEVEL_ERR,
  59. ("AtalkPnPHandler: NetEventBindList event\n"));
  60. break;
  61. default:
  62. DBGPRINT(DBG_COMP_ACTION, DBG_LEVEL_ERR,
  63. ("AtalkPnPHandler: what is this event?, verify if it is valid/new = %ld\n", pPnPEvent->NetEvent));
  64. break;
  65. }
  66. ASSERT(Status == STATUS_SUCCESS);
  67. return(STATUS_SUCCESS);
  68. }
  69. NDIS_STATUS
  70. AtalkPnPReconfigure(
  71. IN NDIS_HANDLE NdisBindCtx,
  72. IN PNET_PNP_EVENT pPnPEvent
  73. )
  74. {
  75. NTSTATUS Status=STATUS_SUCCESS;
  76. NTSTATUS LocStatus=STATUS_SUCCESS;
  77. PPORT_DESCRIPTOR pPortDesc;
  78. PPORT_DESCRIPTOR pPrevPortDesc;
  79. PPORT_DESCRIPTOR pNextPortDesc;
  80. PPORT_DESCRIPTOR pFirstPortDesc;
  81. PPORT_DESCRIPTOR pWalkerPortDesc;
  82. PATALK_PNP_EVENT pPnpBuf;
  83. BOOLEAN fWeFoundOut;
  84. pPortDesc = (PPORT_DESCRIPTOR)NdisBindCtx;
  85. pPnpBuf = (PATALK_PNP_EVENT)(pPnPEvent->Buffer);
  86. //
  87. // if it's a global configuration message, just ignore it because we will
  88. // be getting (or have already got) specific messages
  89. //
  90. if (pPnpBuf == NULL)
  91. {
  92. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  93. ("AtalkPnPReconfigure: ignoring global config message\n"));
  94. return(STATUS_SUCCESS);
  95. }
  96. if ((!pPortDesc) &&
  97. (pPnpBuf->PnpMessage != AT_PNP_SWITCH_ROUTING) &&
  98. (pPnpBuf->PnpMessage != AT_PNP_SWITCH_DEFAULT_ADAPTER))
  99. {
  100. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  101. ("AtalkPnPReconfigure: ignoring NULL context (pnp msg = %d)\n",
  102. pPnpBuf->PnpMessage));
  103. return(STATUS_SUCCESS);
  104. }
  105. if (AtalkBindnUnloadStates & ATALK_UNLOADING)
  106. {
  107. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  108. ("AtalkPnPReconfigure: stack is shutting down, ignoring pnp\n"));
  109. return(STATUS_SUCCESS);
  110. }
  111. AtalkBindnUnloadStates |= ATALK_PNP_IN_PROGRESS;
  112. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR, ("\n\nProcessing PnP Event....\n\n"));
  113. AtalkLockInitIfNecessary();
  114. ASSERT(pPnpBuf != NULL);
  115. switch (pPnpBuf->PnpMessage)
  116. {
  117. //
  118. // user just checked (or unchecked) the router checkbox! If we are
  119. // currently not routing, we must start routing. If we are currently
  120. // routing, we must stop routing. "Disable" all the adapters, go read
  121. // the global config info and "Enable" all the adapters back.
  122. //
  123. case AT_PNP_SWITCH_ROUTING:
  124. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  125. ("AtalkPnPReconfigure: AT_PNP_SWITCH_ROUTING. Currently, routing is %s\n"
  126. ,(AtalkRouter)? "ON" : "OFF" ));
  127. pPortDesc = pFirstPortDesc = AtalkPortList;
  128. pPrevPortDesc = pPortDesc;
  129. if (!pPortDesc)
  130. {
  131. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  132. ("AtalkPnPReconfigure: no adapter configured! no action taken\n"));
  133. break;
  134. }
  135. //
  136. // if we are currently running the router, first stop the global
  137. // rtmp and zip timers
  138. //
  139. if (AtalkRouter)
  140. {
  141. if (AtalkTimerCancelEvent(&atalkRtmpVTimer, NULL))
  142. {
  143. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  144. ("AtalkPnPReconfigure: cancelled atalkRtmpValidityTimer\n"));
  145. }
  146. else
  147. {
  148. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  149. ("AtalkPnPReconfigure: couldn't cancel atalkRtmpValidityTimer\n"));
  150. }
  151. if (AtalkTimerCancelEvent(&atalkZipQTimer, NULL))
  152. {
  153. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  154. ("AtalkPnPReconfigure: cancelled atalkZipQueryTimer\n"));
  155. }
  156. else
  157. {
  158. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  159. ("AtalkPnPReconfigure: couldn't cancel atalkZipQueryTimer\n"));
  160. }
  161. }
  162. atalkRtmpVdtTmrRunning = FALSE;
  163. atalkZipQryTmrRunning = FALSE;
  164. //
  165. // now, disable all the ports in the list one by one. This actually
  166. // removes the adapter from the list as well. Link all these adapters
  167. // together so we can enable all of them.
  168. // (NDIS guaranteed that no ndis event (pnp, unbind etc.) can happen
  169. // when one is in progress, so we don't need lock here)
  170. //
  171. while (pPortDesc != NULL)
  172. {
  173. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  174. ("AtalkPnPReconfigure: disabling pPortDesc %lx\n",pPortDesc));
  175. Status = AtalkPnPDisableAdapter(pPortDesc);
  176. pPortDesc = AtalkPortList;
  177. pPrevPortDesc->pd_Next = pPortDesc;
  178. pPrevPortDesc = pPortDesc;
  179. }
  180. // unlock the pages that we locked when router was first started
  181. if (AtalkRouter)
  182. {
  183. AtalkUnlockRouterIfNecessary();
  184. }
  185. if (AtalkDefaultPortName.Buffer)
  186. {
  187. AtalkFreeMemory(AtalkDefaultPortName.Buffer);
  188. AtalkDefaultPortName.Buffer = NULL;
  189. }
  190. if (AtalkDesiredZone)
  191. {
  192. ASSERT(AtalkDesiredZone->zn_RefCount >= 1);
  193. AtalkZoneDereference(AtalkDesiredZone);
  194. AtalkDesiredZone = NULL;
  195. }
  196. // get rid of routing table, if one exists
  197. AtalkRtmpInit(FALSE);
  198. // go read all the parms again: registry must have changed
  199. LocStatus = atalkInitGlobal();
  200. ASSERT(NT_SUCCESS(LocStatus));
  201. // now, enable all the adapters back!
  202. pPortDesc = pFirstPortDesc;
  203. while (pPortDesc != NULL)
  204. {
  205. pNextPortDesc = pPortDesc->pd_Next;
  206. pPortDesc->pd_Next = NULL;
  207. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  208. ("AtalkPnPReconfigure: enabling pPortDesc %lx\n",pPortDesc));
  209. Status = AtalkPnPEnableAdapter(pPortDesc);
  210. pPortDesc = pNextPortDesc;
  211. }
  212. break;
  213. //
  214. // user has changed the default adapter. First, "disable" our
  215. // current default adapter and the wannabe default adapter. Then,
  216. // "enable" both the adapters, and that should take care of everything!
  217. //
  218. case AT_PNP_SWITCH_DEFAULT_ADAPTER:
  219. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  220. ("AtalkPnPReconfigure: AT_PNP_SWITCH_DEFAULT_ADAPTER (old=(%lx) new=(%lx)\n",
  221. AtalkDefaultPort,pPortDesc));
  222. pPrevPortDesc = AtalkDefaultPort;
  223. // check if default adapter exists: it's possible that at this moment there isn't one
  224. if (pPrevPortDesc)
  225. {
  226. Status = AtalkPnPDisableAdapter(pPrevPortDesc);
  227. }
  228. // release the default adapter name buffer, and desired zone buffer
  229. if (AtalkDefaultPortName.Buffer)
  230. {
  231. AtalkFreeMemory(AtalkDefaultPortName.Buffer);
  232. AtalkDefaultPortName.Buffer = NULL;
  233. }
  234. if (AtalkDesiredZone)
  235. {
  236. ASSERT(AtalkDesiredZone->zn_RefCount >= 1);
  237. AtalkZoneDereference(AtalkDesiredZone);
  238. AtalkDesiredZone = NULL;
  239. }
  240. // go read all the parms again: registry must have changed
  241. LocStatus = atalkInitGlobal();
  242. ASSERT(NT_SUCCESS(LocStatus));
  243. fWeFoundOut = FALSE;
  244. ASSERT(AtalkDefaultPortName.Buffer != NULL);
  245. // if we know who the new default adapter is going to be, disable him now
  246. if (pPortDesc != NULL)
  247. {
  248. Status = AtalkPnPDisableAdapter(pPortDesc);
  249. }
  250. //
  251. // UI doesn't know who the default adapter is, so let's find out
  252. // AtalkDefaultPortName.Buffer can not be null, but let's not bugcheck if
  253. // there is some problem in how UI does things.
  254. //
  255. else if (AtalkDefaultPortName.Buffer != NULL)
  256. {
  257. //
  258. // note that we aren't holding AtalkPortLock here. The only way
  259. // the list can change is if an adapter binds or unbinds. Since ndis
  260. // guarantees that all bind/unbind/pnp operations are serialized, and
  261. // since ndis has already called us here, the list can't change.
  262. //
  263. pPortDesc = AtalkPortList;
  264. while (pPortDesc != NULL)
  265. {
  266. if (RtlEqualUnicodeString(&pPortDesc->pd_AdapterName,
  267. &AtalkDefaultPortName,
  268. TRUE))
  269. {
  270. fWeFoundOut = TRUE;
  271. break;
  272. }
  273. pPortDesc = pPortDesc->pd_Next;
  274. }
  275. if (pPortDesc == NULL)
  276. {
  277. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  278. ("AtalkPnPReconfigure: still no default port????\n"));
  279. }
  280. }
  281. //
  282. // if there default adapter existed before this, reenable it (to be
  283. // a non-default adapter)
  284. //
  285. if (pPrevPortDesc)
  286. {
  287. Status = AtalkPnPEnableAdapter(pPrevPortDesc);
  288. }
  289. //
  290. // if we were told who the default adapter is, or if we found out
  291. // ourselves and one of the existing adapters is the default adatper,
  292. // disable it and reenable
  293. //
  294. if (pPortDesc)
  295. {
  296. // disable this guy if we found him out
  297. if (fWeFoundOut)
  298. {
  299. Status = AtalkPnPDisableAdapter(pPortDesc);
  300. }
  301. // reenable the new adapter so that it is now the default adatper
  302. Status = AtalkPnPEnableAdapter(pPortDesc);
  303. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  304. ("AtalkPnPReconfigure: %lx is the new default adapter\n",pPortDesc));
  305. ASSERT(AtalkDefaultPort == pPortDesc);
  306. }
  307. else
  308. {
  309. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  310. ("AtalkPnPReconfigure: no default adapter configured!\n"));
  311. }
  312. break;
  313. //
  314. // user has changed some parameter on the adapter (e.g. the desired zone,
  315. // or some seeding info etc.). Just "disable" and then "enable" this
  316. // adapter, and everything should just work!
  317. //
  318. case AT_PNP_RECONFIGURE_PARMS:
  319. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  320. ("AtalkPnPReconfigure: AT_PNP_RECONFIGURE_PARMS on pPortDesc %lx\n",pPortDesc));
  321. Status = AtalkPnPDisableAdapter(pPortDesc);
  322. // release the default adapter name buffer, and desired zone buffer
  323. if (AtalkDefaultPortName.Buffer)
  324. {
  325. AtalkFreeMemory(AtalkDefaultPortName.Buffer);
  326. AtalkDefaultPortName.Buffer = NULL;
  327. }
  328. if (AtalkDesiredZone)
  329. {
  330. ASSERT(AtalkDesiredZone->zn_RefCount >= 1);
  331. AtalkZoneDereference(AtalkDesiredZone);
  332. AtalkDesiredZone = NULL;
  333. }
  334. // go read all the parms again: registry must have changed
  335. LocStatus = atalkInitGlobal();
  336. ASSERT(NT_SUCCESS(LocStatus));
  337. Status = AtalkPnPEnableAdapter(pPortDesc);
  338. break;
  339. default:
  340. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  341. ("AtalkPnPReconfigure: and what msg is this (%ld) ??\n",pPnpBuf->PnpMessage));
  342. ASSERT(0);
  343. break;
  344. }
  345. AtalkUnlockInitIfNecessary();
  346. ASSERT(Status == STATUS_SUCCESS);
  347. AtalkBindnUnloadStates &= ~ATALK_PNP_IN_PROGRESS;
  348. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  349. ("\n\n.... completed processing PnP Event\n\n"));
  350. return(STATUS_SUCCESS);
  351. }
  352. NTSTATUS
  353. AtalkPnPDisableAdapter(
  354. IN PPORT_DESCRIPTOR pPortDesc
  355. )
  356. {
  357. NTSTATUS Status;
  358. KIRQL OldIrql;
  359. PLIST_ENTRY pList;
  360. PARAPCONN pArapConn;
  361. PATCPCONN pAtcpConn;
  362. BOOLEAN fDllDeref;
  363. BOOLEAN fLineDownDeref;
  364. if (!pPortDesc)
  365. {
  366. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  367. ("AtalkPnPDisableAdapter: pPortDesc is NULL!!!\n"));
  368. return(STATUS_SUCCESS);
  369. }
  370. ASSERT(VALID_PORT(pPortDesc));
  371. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  372. ("AtalkPnPDisableAdapter: entered with %lx\n",pPortDesc));
  373. //
  374. // we are going to "disable" this port due to PnP: note that fact!
  375. //
  376. ACQUIRE_SPIN_LOCK(&pPortDesc->pd_Lock, &OldIrql);
  377. pPortDesc->pd_Flags |= PD_PNP_RECONFIGURE;
  378. RELEASE_SPIN_LOCK(&pPortDesc->pd_Lock, OldIrql);
  379. // First and foremost: tell guys above so they can cleanup
  380. if (pPortDesc->pd_Flags & PD_DEF_PORT)
  381. {
  382. ASSERT(pPortDesc == AtalkDefaultPort);
  383. if (TdiAddressChangeRegHandle)
  384. {
  385. TdiDeregisterNetAddress(TdiAddressChangeRegHandle);
  386. TdiAddressChangeRegHandle = NULL;
  387. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  388. ("AtalkPnPDisableAdapter: TdiDeregisterNetAddress on %Z done\n",
  389. &pPortDesc->pd_AdapterName));
  390. }
  391. // this will tell AFP
  392. if (TdiRegistrationHandle)
  393. {
  394. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  395. ("AtalkPnPDisableAdapter: telling AFP about PnP\n"));
  396. TdiDeregisterDeviceObject(TdiRegistrationHandle);
  397. TdiRegistrationHandle = NULL;
  398. }
  399. // this will take care of informing ARAP and PPP engine above
  400. AtalkPnPInformRas(FALSE);
  401. }
  402. //
  403. // if this is RAS port or the Default port, kill all the ARAP and PPP
  404. // connections if any are left.
  405. // Since we've marked that PnpReconfigure is in progress, no more
  406. // new connections will be allowed
  407. //
  408. if ((pPortDesc == RasPortDesc) ||
  409. ((pPortDesc->pd_Flags & PD_DEF_PORT) && (RasPortDesc != NULL)))
  410. {
  411. ACQUIRE_SPIN_LOCK(&RasPortDesc->pd_Lock, &OldIrql);
  412. pList = RasPortDesc->pd_ArapConnHead.Flink;
  413. // first, the ARAP guys
  414. while (pList != &RasPortDesc->pd_ArapConnHead)
  415. {
  416. pArapConn = CONTAINING_RECORD(pList, ARAPCONN, Linkage);
  417. ASSERT(pArapConn->Signature == ARAPCONN_SIGNATURE);
  418. // if this connection is already disconnected, skip it
  419. ACQUIRE_SPIN_LOCK_DPC(&pArapConn->SpinLock);
  420. if (pArapConn->State == MNP_DISCONNECTED)
  421. {
  422. pList = pArapConn->Linkage.Flink;
  423. RELEASE_SPIN_LOCK_DPC(&pArapConn->SpinLock);
  424. continue;
  425. }
  426. RELEASE_SPIN_LOCK_DPC(&pArapConn->SpinLock);
  427. RELEASE_SPIN_LOCK(&RasPortDesc->pd_Lock, OldIrql);
  428. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  429. ("AtalkPnPDisableAdapter: killing ARAP connection %lx\n",pArapConn));
  430. ArapCleanup(pArapConn);
  431. ACQUIRE_SPIN_LOCK(&RasPortDesc->pd_Lock, &OldIrql);
  432. pList = RasPortDesc->pd_ArapConnHead.Flink;
  433. }
  434. // and now, the PPP guys
  435. // if there are any ppp guys, remove them from this list and dereference
  436. // them. In most cases, they will get freed right away. If someone had
  437. // a refcount, it will get freed when that refcount goes away
  438. while (!(IsListEmpty(&RasPortDesc->pd_PPPConnHead)))
  439. {
  440. pList = RasPortDesc->pd_PPPConnHead.Flink;
  441. pAtcpConn = CONTAINING_RECORD(pList, ATCPCONN, Linkage);
  442. ASSERT(pAtcpConn->Signature == ATCPCONN_SIGNATURE);
  443. ACQUIRE_SPIN_LOCK_DPC(&pAtcpConn->SpinLock);
  444. RemoveEntryList(&pAtcpConn->Linkage);
  445. InitializeListHead(&pAtcpConn->Linkage);
  446. fDllDeref = (pAtcpConn->Flags & ATCP_DLL_SETUP_DONE)? TRUE : FALSE;
  447. fLineDownDeref = (pAtcpConn->Flags & ATCP_LINE_UP_DONE)? TRUE : FALSE;
  448. pAtcpConn->Flags &= ~(ATCP_DLL_SETUP_DONE|ATCP_LINE_UP_DONE);
  449. RELEASE_SPIN_LOCK_DPC(&pAtcpConn->SpinLock);
  450. RELEASE_SPIN_LOCK(&RasPortDesc->pd_Lock, OldIrql);
  451. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  452. ("AtalkPnPDisableAdapter: deref'ing PPP conn %lx (%d+%d times)\n",
  453. pAtcpConn,fDllDeref,fLineDownDeref));
  454. // remove the DLL refcount
  455. if (fDllDeref)
  456. {
  457. DerefPPPConn(pAtcpConn);
  458. }
  459. // remove the NDISWAN refcount
  460. if (fLineDownDeref)
  461. {
  462. DerefPPPConn(pAtcpConn);
  463. }
  464. ACQUIRE_SPIN_LOCK(&RasPortDesc->pd_Lock, &OldIrql);
  465. }
  466. RELEASE_SPIN_LOCK(&RasPortDesc->pd_Lock, OldIrql);
  467. }
  468. //
  469. // "Disable" the adapter (basically we do everything except close the
  470. // adapter with ndis and freeing up the pPortDesc memory)
  471. //
  472. Status = AtalkDeinitAdapter(pPortDesc);
  473. if (!NT_SUCCESS(Status))
  474. {
  475. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  476. ("AtalkPnPDisableAdapter: AtalkDeinitAdapter failed %lx\n",Status));
  477. ASSERT(0);
  478. }
  479. return(Status);
  480. }
  481. NTSTATUS
  482. AtalkPnPEnableAdapter(
  483. IN PPORT_DESCRIPTOR pPortDesc
  484. )
  485. {
  486. NTSTATUS Status;
  487. if (!pPortDesc)
  488. {
  489. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  490. ("AtalkPnPDisableAdapter: pPortDesc is NULL!!!\n"));
  491. return(STATUS_SUCCESS);
  492. }
  493. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  494. ("AtalkPnPEnableAdapter: entered with %lx\n",pPortDesc));
  495. //
  496. // "Enable" the adapter (we do everything except that we don't
  497. // allocate memory for pPortDesc - since we didn't free it, and we don't
  498. // open the adapter with ndis - since we didn't close it).
  499. //
  500. Status = AtalkInitAdapter(NULL, pPortDesc);
  501. // we are done with the PnPReconfigure evnet: reset that bit
  502. AtalkPortSetResetFlag(pPortDesc, TRUE, PD_PNP_RECONFIGURE);
  503. // tell ARAP everything is ok
  504. if (pPortDesc->pd_Flags & (PD_DEF_PORT | PD_RAS_PORT))
  505. {
  506. ASSERT((pPortDesc == AtalkDefaultPort) || (pPortDesc == RasPortDesc));
  507. // this will take care of informing ARAP and PPP engine above
  508. AtalkPnPInformRas(TRUE);
  509. }
  510. if (!NT_SUCCESS(Status))
  511. {
  512. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  513. ("AtalkPnPEnableAdapter: AtalkInitAdapter failed %lx\n",Status));
  514. ASSERT(0);
  515. }
  516. DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR,
  517. ("AtalkPnPEnableAdapter: completed PnP on %lx (flag %lx)\n",
  518. pPortDesc,pPortDesc->pd_Flags));
  519. return(Status);
  520. }