Leaked source code of windows server 2003
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.

691 lines
20 KiB

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #include "diag.h"
  4. // Command strings
  5. //
  6. #define SZ_CMD_SHOW_BINDINGS L"showbindings"
  7. #define SZ_CMD_SHOW_COMPONENTS L"showcomponents"
  8. #define SZ_CMD_SHOW_STACK_TABLE L"showstacktable"
  9. #define SZ_CMD_SHOW_LAN_ADAPTER_PNPIDS L"showlanpnpids"
  10. #define SZ_CMD_ADD_COMPONENT L"addcomponent"
  11. #define SZ_CMD_REMOVE_COMPONENT L"removecomponent"
  12. #define SZ_CMD_UPDATE_COMPONENT L"updatecomponent"
  13. #define SZ_CMD_REMOVE_REFS L"removerefs"
  14. #define SZ_CMD_ENABLE_BINDING L"enablebinding"
  15. #define SZ_CMD_DISABLE_BINDING L"disablebinding"
  16. #define SZ_CMD_MOVE_BINDING L"movebinding"
  17. #define SZ_CMD_WRITE_BINDINGS L"writebindings"
  18. #define SZ_CMD_SET_WANORDER L"setwanorder"
  19. #define SZ_CMD_FULL_DIAGNOSTIC L"full"
  20. #define SZ_CMD_CLEANUP L"cleanup"
  21. #define SZ_CMD_ADD_REMOVE_STRESS L"arstress"
  22. #define SZ_CMD_SHOW_LAN_CONNECTIONS L"showlan"
  23. #define SZ_CMD_SHOW_LAN_DETAILS L"showlandetails"
  24. #define SZ_CMD_LAN_CHANGE_STATE L"changelanstate"
  25. #define SZ_CMD_SHOW_ALL_DEVICES L"showalldevices"
  26. #define SZ_PARAM_CONNECT L"connect"
  27. #define SZ_PARAM_DISCONNECT L"disconnect"
  28. // Parameter strings for SZ_CMD_SHOW_BINDINGS
  29. //
  30. #define SZ_PARAM_BELOW L"below"
  31. #define SZ_PARAM_INVOLVING L"involving"
  32. #define SZ_PARAM_UPPER L"upper"
  33. #define SZ_PARAM_DISABLED L"disabled"
  34. // Parameter strings for SZ_CMD_ADD_COMPONENT
  35. //
  36. #define SZ_PARAM_NET L"net"
  37. #define SZ_PARAM_INFRARED L"irda"
  38. #define SZ_PARAM_TRANS L"trans"
  39. #define SZ_PARAM_CLIENT L"client"
  40. #define SZ_PARAM_SERVICE L"service"
  41. // Parameter strings for SZ_CMD_MOVE_BINDING
  42. //
  43. #define SZ_PARAM_BEFORE L"before"
  44. #define SZ_PARAM_AFTER L"after"
  45. // Parameter strings for SZ_CMD_SET_WANORDER
  46. //
  47. #define SZ_PARAM_FIRST L"first"
  48. #define SZ_PARAM_LAST L"last"
  49. // Parameter strings for SZ_CMD_FULL_DIAGNOSTIC
  50. //
  51. #define SZ_PARAM_LEAK_CHECK L"leakcheck"
  52. // Aliases used when refering to components
  53. //
  54. #define SZ_ALIAS_ALL L"all"
  55. VOID
  56. Usage (
  57. IN PCTSTR pszProgramName,
  58. IN COMMAND Command)
  59. {
  60. switch (Command)
  61. {
  62. case CMD_SHOW_BINDINGS:
  63. g_pDiagCtx->Printf (ttidNcDiag,
  64. "\n"
  65. "%S %S [below | involving | upper | disabled] [all | <infid> | <pnpid>]\n"
  66. "\n"
  67. " below : show bindings below component\n"
  68. " involving : show bindings involving component\n"
  69. " upper : show adapter's upper bindings\n"
  70. " disabled : show disabled bindings\n"
  71. "\n"
  72. " to specify the component:\n"
  73. " all : matches all components\n"
  74. " <infid> : matches component with specified Inf Id\n"
  75. " <pnpid> : matches component with specified PpP Id\n"
  76. "\n",
  77. pszProgramName,
  78. SZ_CMD_SHOW_BINDINGS);
  79. break;
  80. case CMD_SHOW_COMPONENTS:
  81. break;
  82. case CMD_SHOW_STACK_TABLE:
  83. break;
  84. case CMD_SHOW_LAN_ADAPTER_PNPIDS:
  85. break;
  86. case CMD_ADD_COMPONENT:
  87. g_pDiagCtx->Printf (ttidNcDiag,
  88. "\n"
  89. "%S %S <class> <infid>\n"
  90. "\n"
  91. " <class> : one of 'net', 'irda', 'trans', 'client', 'service'\n"
  92. " <infid> : the Inf ID of the component to add\n"
  93. "\n",
  94. pszProgramName,
  95. SZ_CMD_ADD_COMPONENT);
  96. break;
  97. case CMD_REMOVE_COMPONENT:
  98. g_pDiagCtx->Printf (ttidNcDiag,
  99. "\n"
  100. "%S %S [<infid> | <pnpid>]\n"
  101. "\n"
  102. " <infid> : matches component with specified Inf Id\n"
  103. " <pnpid> : matches component with specified PnP Id\n"
  104. "\n",
  105. pszProgramName,
  106. SZ_CMD_REMOVE_COMPONENT);
  107. break;
  108. case CMD_UPDATE_COMPONENT:
  109. g_pDiagCtx->Printf (ttidNcDiag,
  110. "\n"
  111. "%S %S [<infid> | <pnpid>]\n"
  112. "\n"
  113. " <infid> : matches component with specified Inf Id\n"
  114. " <pnpid> : matches component with specified PnP Id\n"
  115. "\n",
  116. pszProgramName,
  117. SZ_CMD_UPDATE_COMPONENT);
  118. break;
  119. case CMD_REMOVE_REFS:
  120. g_pDiagCtx->Printf (ttidNcDiag,
  121. "\n"
  122. "%S %S <infid>\n"
  123. "\n"
  124. " <infid> : matches component with specified Inf Id\n"
  125. "\n",
  126. pszProgramName,
  127. SZ_CMD_REMOVE_REFS);
  128. break;
  129. case CMD_ENABLE_BINDING:
  130. case CMD_DISABLE_BINDING:
  131. g_pDiagCtx->Printf (ttidNcDiag,
  132. "\n"
  133. "%S %S <bindpath>\n"
  134. "\n"
  135. " <bindpath> : bindpath as specified like output of 'showbindings'\n"
  136. "\n",
  137. pszProgramName,
  138. (CMD_ENABLE_BINDING == Command)
  139. ? SZ_CMD_ENABLE_BINDING
  140. : SZ_CMD_DISABLE_BINDING);
  141. break;
  142. case CMD_MOVE_BINDING:
  143. g_pDiagCtx->Printf (ttidNcDiag,
  144. "\n"
  145. "%S %S <srcbindpath> [before | after] <dstbindpath>\n"
  146. "\n"
  147. " <srcbindpath> : bindpath as specified like output of 'showbindings'\n"
  148. " <dstbindpath> : bindpath as specified like output of 'showbindings'\n"
  149. " or 'null' to make srcbindpath first if 'before'\n"
  150. " is specified, or last if 'after' is specified\n"
  151. "\n",
  152. pszProgramName,
  153. SZ_CMD_MOVE_BINDING);
  154. break;
  155. case CMD_SET_WANORDER:
  156. g_pDiagCtx->Printf (ttidNcDiag,
  157. "\n"
  158. "%S %S [first | last]\n"
  159. "\n"
  160. " first : order WAN adapters before LAN adapters\n"
  161. " last : order WAN adapters after LAN adapters\n"
  162. "\n",
  163. pszProgramName,
  164. SZ_CMD_SET_WANORDER);
  165. break;
  166. case CMD_FULL_DIAGNOSTIC:
  167. break;
  168. case CMD_ADD_REMOVE_STRESS:
  169. break;
  170. case CMD_SHOW_LAN_CONNECTIONS:
  171. break;
  172. case CMD_SHOW_ALL_DEVICES:
  173. break;
  174. case CMD_SHOW_LAN_DETAILS:
  175. g_pDiagCtx->Printf (ttidNcDiag,
  176. "\n"
  177. "%S %S <lan connection name>\n"
  178. "\n"
  179. " <lan connection name> : friendly name of LAN connection\n"
  180. " (note: use quotes if name contains spaces\n"
  181. "\n",
  182. pszProgramName,
  183. SZ_CMD_SHOW_LAN_DETAILS);
  184. break;
  185. case CMD_LAN_CHANGE_STATE:
  186. g_pDiagCtx->Printf (ttidNcDiag,
  187. "\n"
  188. "%S %S <lan connection name> [connect | disconnect]\n"
  189. "\n"
  190. " <lan connection name> : friendly name of LAN connection\n"
  191. " (note: use quotes if name contains spaces\n\n"
  192. " <connect> : connects the given lan connection\n"
  193. " <disconnect> : disconnects the given lan connection\n"
  194. "\n",
  195. pszProgramName,
  196. SZ_CMD_LAN_CHANGE_STATE);
  197. break;
  198. default:
  199. g_pDiagCtx->Printf (ttidNcDiag,
  200. "\n"
  201. "Network Configuration Diagnostic\n"
  202. " View, manipulate, or test network configuration.\n"
  203. "\n"
  204. "%S [options]\n"
  205. " %-15S - Show the current bindings\n"
  206. " %-15S - Show the currently installed components\n"
  207. " %-15S - Show the current stack table\n"
  208. " %-15S - Show PnP ids of LAN adapters\n"
  209. " %-15S - Add a component\n"
  210. " %-15S - Remove a component\n"
  211. " %-15S - Update a component\n"
  212. " %-15S - Enable a binding\n"
  213. " %-15S - Disable a binding\n"
  214. " %-15S - Change binding order\n"
  215. " %-15S - Rewrite all bindings\n"
  216. " %-15S - Change WAN adapter order\n"
  217. " %-15S - Perform a full (non-destructive) diagnostic\n"
  218. " %-15S - Perform Add/Remove component stress\n"
  219. " %-15S - Show the current LAN connections\n"
  220. " %-15S - Show details for a specific LAN connection\n"
  221. " %-15S - Connects or disconnects a specific LAN connection\n"
  222. " %-15S - Lists all devices\n"
  223. "\n\n",
  224. pszProgramName,
  225. SZ_CMD_SHOW_BINDINGS,
  226. SZ_CMD_SHOW_COMPONENTS,
  227. SZ_CMD_SHOW_STACK_TABLE,
  228. SZ_CMD_SHOW_LAN_ADAPTER_PNPIDS,
  229. SZ_CMD_ADD_COMPONENT,
  230. SZ_CMD_REMOVE_COMPONENT,
  231. SZ_CMD_UPDATE_COMPONENT,
  232. SZ_CMD_ENABLE_BINDING,
  233. SZ_CMD_DISABLE_BINDING,
  234. SZ_CMD_MOVE_BINDING,
  235. SZ_CMD_WRITE_BINDINGS,
  236. SZ_CMD_SET_WANORDER,
  237. SZ_CMD_FULL_DIAGNOSTIC,
  238. SZ_CMD_ADD_REMOVE_STRESS,
  239. SZ_CMD_SHOW_LAN_CONNECTIONS,
  240. SZ_CMD_SHOW_LAN_DETAILS,
  241. SZ_CMD_LAN_CHANGE_STATE,
  242. SZ_CMD_SHOW_ALL_DEVICES);
  243. break;
  244. }
  245. }
  246. #define NthArgIsPresent(_i) (_i < argc)
  247. #define NthArgIs(_i, _sz) ((_i < argc) && (0 == _wcsicmp(argv[_i], _sz)))
  248. EXTERN_C
  249. VOID
  250. __cdecl
  251. wmain (
  252. IN INT argc,
  253. IN PCWSTR argv[])
  254. {
  255. CDiagContext DiagCtx;
  256. DIAG_OPTIONS Options;
  257. INT iArg;
  258. DiagCtx.SetFlags (DF_SHOW_CONSOLE_OUTPUT);
  259. g_pDiagCtx = &DiagCtx;
  260. ZeroMemory (&Options, sizeof(Options));
  261. Options.pDiagCtx = g_pDiagCtx;
  262. Options.Command = CMD_INVALID;
  263. if (argc < 2)
  264. {
  265. Usage (argv[0], Options.Command);
  266. return;
  267. }
  268. iArg = 1;
  269. if (NthArgIs (iArg, SZ_CMD_SHOW_BINDINGS))
  270. {
  271. Options.Command = CMD_SHOW_BINDINGS;
  272. iArg++;
  273. if (NthArgIs (iArg, SZ_PARAM_BELOW))
  274. {
  275. Options.ShowBindParam = SHOW_BELOW;
  276. }
  277. else if (NthArgIs (iArg, SZ_PARAM_INVOLVING))
  278. {
  279. Options.ShowBindParam = SHOW_INVOLVING;
  280. }
  281. else if (NthArgIs (iArg, SZ_PARAM_UPPER))
  282. {
  283. Options.ShowBindParam = SHOW_UPPER;
  284. }
  285. else if (NthArgIs (iArg, SZ_PARAM_DISABLED))
  286. {
  287. Options.ShowBindParam = SHOW_DISABLED;
  288. }
  289. else
  290. {
  291. Usage (argv[0], Options.Command);
  292. return;
  293. }
  294. if (SHOW_DISABLED != Options.ShowBindParam)
  295. {
  296. iArg++;
  297. if (NthArgIs (iArg, SZ_ALIAS_ALL))
  298. {
  299. Options.CompSpecifier.Type = CST_ALL;
  300. }
  301. else if (NthArgIsPresent (iArg))
  302. {
  303. Options.CompSpecifier.Type = CST_BY_NAME;
  304. Options.CompSpecifier.pszInfOrPnpId = argv[iArg];
  305. }
  306. else
  307. {
  308. Usage (argv[0], Options.Command);
  309. return;
  310. }
  311. }
  312. }
  313. else if (NthArgIs (iArg, SZ_CMD_SHOW_COMPONENTS))
  314. {
  315. Options.Command = CMD_SHOW_COMPONENTS;
  316. }
  317. else if (NthArgIs (iArg, SZ_CMD_SHOW_STACK_TABLE))
  318. {
  319. Options.Command = CMD_SHOW_STACK_TABLE;
  320. }
  321. else if (NthArgIs (iArg, SZ_CMD_SHOW_LAN_ADAPTER_PNPIDS))
  322. {
  323. Options.Command = CMD_SHOW_LAN_ADAPTER_PNPIDS;
  324. }
  325. else if (NthArgIs (iArg, SZ_CMD_ADD_COMPONENT))
  326. {
  327. Options.Command = CMD_ADD_COMPONENT;
  328. iArg++;
  329. if (NthArgIs (iArg, SZ_PARAM_NET))
  330. {
  331. Options.ClassGuid = GUID_DEVCLASS_NET;
  332. }
  333. else if (NthArgIs (iArg, SZ_PARAM_INFRARED))
  334. {
  335. Options.ClassGuid = GUID_DEVCLASS_INFRARED;
  336. }
  337. else if (NthArgIs (iArg, SZ_PARAM_TRANS))
  338. {
  339. Options.ClassGuid = GUID_DEVCLASS_NETTRANS;
  340. }
  341. else if (NthArgIs (iArg, SZ_PARAM_CLIENT))
  342. {
  343. Options.ClassGuid = GUID_DEVCLASS_NETCLIENT;
  344. }
  345. else if (NthArgIs (iArg, SZ_PARAM_SERVICE))
  346. {
  347. Options.ClassGuid = GUID_DEVCLASS_NETSERVICE;
  348. }
  349. else
  350. {
  351. Usage (argv[0], Options.Command);
  352. return;
  353. }
  354. iArg++;
  355. if (NthArgIsPresent (iArg))
  356. {
  357. Options.pszInfId = argv[iArg];
  358. iArg++;
  359. if (NthArgIs (iArg, SZ_PARAM_LEAK_CHECK))
  360. {
  361. Options.fLeakCheck = TRUE;
  362. }
  363. }
  364. else
  365. {
  366. Usage (argv[0], Options.Command);
  367. return;
  368. }
  369. }
  370. else if (NthArgIs (iArg, SZ_CMD_REMOVE_COMPONENT))
  371. {
  372. Options.Command = CMD_REMOVE_COMPONENT;
  373. iArg++;
  374. if (NthArgIsPresent (iArg))
  375. {
  376. Options.pszInfId = argv[iArg];
  377. iArg++;
  378. if (NthArgIs (iArg, SZ_PARAM_LEAK_CHECK))
  379. {
  380. Options.fLeakCheck = TRUE;
  381. }
  382. }
  383. else
  384. {
  385. Usage (argv[0], Options.Command);
  386. return;
  387. }
  388. }
  389. else if (NthArgIs (iArg, SZ_CMD_UPDATE_COMPONENT))
  390. {
  391. Options.Command = CMD_UPDATE_COMPONENT;
  392. iArg++;
  393. if (NthArgIsPresent (iArg))
  394. {
  395. Options.pszInfId = argv[iArg];
  396. iArg++;
  397. if (NthArgIs (iArg, SZ_PARAM_LEAK_CHECK))
  398. {
  399. Options.fLeakCheck = TRUE;
  400. }
  401. }
  402. else
  403. {
  404. Usage (argv[0], Options.Command);
  405. return;
  406. }
  407. }
  408. else if (NthArgIs (iArg, SZ_CMD_REMOVE_REFS))
  409. {
  410. Options.Command = CMD_REMOVE_REFS;
  411. iArg++;
  412. if (NthArgIsPresent (iArg))
  413. {
  414. Options.pszInfId = argv[iArg];
  415. iArg++;
  416. if (NthArgIs (iArg, SZ_PARAM_LEAK_CHECK))
  417. {
  418. Options.fLeakCheck = TRUE;
  419. }
  420. }
  421. else
  422. {
  423. Usage (argv[0], Options.Command);
  424. return;
  425. }
  426. }
  427. else if (NthArgIs (iArg, SZ_CMD_ENABLE_BINDING))
  428. {
  429. Options.Command = CMD_ENABLE_BINDING;
  430. iArg++;
  431. if (NthArgIsPresent (iArg))
  432. {
  433. Options.pszBindPath = argv[iArg];
  434. iArg++;
  435. if (NthArgIs (iArg, SZ_PARAM_LEAK_CHECK))
  436. {
  437. Options.fLeakCheck = TRUE;
  438. }
  439. }
  440. else
  441. {
  442. Usage (argv[0], Options.Command);
  443. return;
  444. }
  445. }
  446. else if (NthArgIs (iArg, SZ_CMD_DISABLE_BINDING))
  447. {
  448. Options.Command = CMD_DISABLE_BINDING;
  449. iArg++;
  450. if (NthArgIsPresent (iArg))
  451. {
  452. Options.pszBindPath = argv[iArg];
  453. iArg++;
  454. if (NthArgIs (iArg, SZ_PARAM_LEAK_CHECK))
  455. {
  456. Options.fLeakCheck = TRUE;
  457. }
  458. }
  459. else
  460. {
  461. Usage (argv[0], Options.Command);
  462. return;
  463. }
  464. }
  465. else if (NthArgIs (iArg, SZ_CMD_MOVE_BINDING))
  466. {
  467. Options.Command = CMD_MOVE_BINDING;
  468. iArg++;
  469. if (NthArgIsPresent (iArg) &&
  470. NthArgIsPresent (iArg+1) &&
  471. NthArgIsPresent (iArg+2))
  472. {
  473. Options.pszBindPath = argv[iArg];
  474. Options.pszOtherBindPath = argv[iArg+2];
  475. if (NthArgIs (iArg+1, SZ_PARAM_BEFORE))
  476. {
  477. Options.fMoveBefore = TRUE;
  478. }
  479. else if (NthArgIs (iArg+1, SZ_PARAM_AFTER))
  480. {
  481. Options.fMoveBefore = FALSE;
  482. }
  483. else
  484. {
  485. Usage (argv[0], Options.Command);
  486. return;
  487. }
  488. }
  489. else
  490. {
  491. Usage (argv[0], Options.Command);
  492. return;
  493. }
  494. }
  495. else if (NthArgIs (iArg, SZ_CMD_WRITE_BINDINGS))
  496. {
  497. Options.Command = CMD_WRITE_BINDINGS;
  498. iArg++;
  499. if (NthArgIs (iArg, SZ_PARAM_LEAK_CHECK))
  500. {
  501. Options.fLeakCheck = TRUE;
  502. }
  503. }
  504. else if (NthArgIs (iArg, SZ_CMD_SET_WANORDER))
  505. {
  506. Options.Command = CMD_SET_WANORDER;
  507. iArg++;
  508. if (NthArgIs (iArg+1, SZ_PARAM_FIRST))
  509. {
  510. Options.fWanAdaptersFirst = TRUE;
  511. }
  512. else if (NthArgIs (iArg+1, SZ_PARAM_LAST))
  513. {
  514. Options.fWanAdaptersFirst = FALSE;
  515. }
  516. else
  517. {
  518. Usage (argv[0], Options.Command);
  519. return;
  520. }
  521. }
  522. else if (NthArgIs (iArg, SZ_CMD_FULL_DIAGNOSTIC))
  523. {
  524. Options.Command = CMD_FULL_DIAGNOSTIC;
  525. iArg++;
  526. if (NthArgIs (iArg, SZ_PARAM_LEAK_CHECK))
  527. {
  528. Options.fLeakCheck = TRUE;
  529. }
  530. }
  531. else if (NthArgIs (iArg, SZ_CMD_CLEANUP))
  532. {
  533. Options.Command = CMD_CLEANUP;
  534. }
  535. else if (NthArgIs (iArg, SZ_CMD_ADD_REMOVE_STRESS))
  536. {
  537. Options.Command = CMD_ADD_REMOVE_STRESS;
  538. iArg++;
  539. if (NthArgIs (iArg, SZ_PARAM_LEAK_CHECK))
  540. {
  541. Options.fLeakCheck = TRUE;
  542. }
  543. }
  544. else if (NthArgIs (iArg, SZ_CMD_SHOW_LAN_CONNECTIONS))
  545. {
  546. Options.Command = CMD_SHOW_LAN_CONNECTIONS;
  547. }
  548. else if (NthArgIs (iArg, SZ_CMD_SHOW_ALL_DEVICES))
  549. {
  550. Options.Command = CMD_SHOW_ALL_DEVICES;
  551. }
  552. else if (NthArgIs (iArg, SZ_CMD_SHOW_LAN_DETAILS))
  553. {
  554. Options.Command = CMD_SHOW_LAN_DETAILS;
  555. iArg++;
  556. if (NthArgIsPresent (iArg))
  557. {
  558. Options.szLanConnection = argv[iArg];
  559. }
  560. else
  561. {
  562. Usage (argv[0], Options.Command);
  563. return;
  564. }
  565. }
  566. else if (NthArgIs (iArg, SZ_CMD_LAN_CHANGE_STATE))
  567. {
  568. Options.Command = CMD_LAN_CHANGE_STATE;
  569. iArg++;
  570. if (NthArgIsPresent (iArg))
  571. {
  572. Options.szLanConnection = argv[iArg];
  573. if (NthArgIs (iArg + 1, SZ_PARAM_CONNECT))
  574. {
  575. Options.fConnect = TRUE;
  576. }
  577. else if (NthArgIs (iArg + 1, SZ_PARAM_DISCONNECT))
  578. {
  579. Options.fConnect = FALSE;
  580. }
  581. else
  582. {
  583. Usage (argv[0], Options.Command);
  584. return;
  585. }
  586. }
  587. else
  588. {
  589. Usage (argv[0], Options.Command);
  590. return;
  591. }
  592. }
  593. else
  594. {
  595. Usage (argv[0], Options.Command);
  596. return;
  597. }
  598. // If we're doing leak checking, preload some DLLs that are delayloaded.
  599. // If we don't do this, we see a buncn of "leaks" associated with
  600. // the loader bringing in DLLs in the middle of our tests.
  601. //
  602. if (Options.fLeakCheck)
  603. {
  604. LoadLibraryW (L"mswsock.dll");
  605. LoadLibraryW (L"comctl32.dll");
  606. LoadLibraryW (L"comdlg32.dll");
  607. LoadLibraryW (L"mprapi.dll");
  608. LoadLibraryW (L"mswsock.dll");
  609. LoadLibraryW (L"netapi32.dll");
  610. LoadLibraryW (L"rtutils.dll");
  611. LoadLibraryW (L"setupapi.dll");
  612. LoadLibraryW (L"shell32.dll");
  613. LoadLibraryW (L"userenv.dll");
  614. LoadLibraryW (L"winspool.drv");
  615. LoadLibraryW (L"ws2_32.dll");
  616. }
  617. HRESULT hr = CoInitializeEx (
  618. NULL,
  619. COINIT_DISABLE_OLE1DDE | COINIT_APARTMENTTHREADED);
  620. if (FAILED(hr))
  621. {
  622. g_pDiagCtx->Printf (ttidNcDiag,
  623. "Problem 0x%08x initializing COM library", hr);
  624. return;
  625. }
  626. // Call each of the external command processors
  627. //
  628. NetCfgDiagFromCommandArgs (&Options);
  629. NetManDiagFromCommandArgs (&Options);
  630. g_pDiagCtx->Printf (ttidNcDiag, "\n");
  631. }