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.

101 lines
3.5 KiB

  1. #include <precomp.h>
  2. #include "intflist.h"
  3. #include "tracing.h"
  4. #include "dialog.h"
  5. //-----------------------------------------------------------------
  6. // Dialog function to be called from within WZC when a significant
  7. // event happens (i.e. going into the failed state)
  8. DWORD
  9. WzcDlgNotify(
  10. PINTF_CONTEXT pIntfContext,
  11. PWZCDLG_DATA pDlgData)
  12. {
  13. DWORD dwErr = ERROR_SUCCESS;
  14. BSTR bsDlgData;
  15. GUID guidIntf;
  16. DbgPrint((TRC_TRACK, "[WzcDlgNotify(0x%p, 0x%p:%d)", pIntfContext, pDlgData, pDlgData->dwCode));
  17. // prepare the BSTR data that goes with this dialog notification
  18. bsDlgData = SysAllocStringByteLen ((LPCSTR)pDlgData, sizeof(WZCDLG_DATA));
  19. if (bsDlgData == NULL)
  20. dwErr = ERROR_NOT_ENOUGH_MEMORY;
  21. // send everything down the COM pipe now..
  22. if (dwErr == ERROR_SUCCESS &&
  23. SUCCEEDED(CLSIDFromString(pIntfContext->wszGuid, &guidIntf)) &&
  24. SUCCEEDED(CoInitializeEx (NULL, COINIT_MULTITHREADED)))
  25. {
  26. INetConnectionRefresh *pNetman;
  27. if(SUCCEEDED(CoCreateInstance (
  28. &CLSID_ConnectionManager,
  29. NULL,
  30. CLSCTX_ALL,
  31. &IID_INetConnectionRefresh,
  32. (LPVOID *)&pNetman)))
  33. {
  34. pNetman->lpVtbl->ShowBalloon(pNetman, &guidIntf, bsDlgData, NULL); // no message text
  35. pNetman->lpVtbl->Release(pNetman);
  36. }
  37. CoUninitialize ();
  38. }
  39. if (bsDlgData != NULL)
  40. SysFreeString (bsDlgData);
  41. DbgPrint((TRC_TRACK, "WzcDlgNotify]=%d", dwErr));
  42. return dwErr;
  43. }
  44. //-----------------------------------------------------------------
  45. // Called from within WZC when the internal association state changes
  46. WzcNetmanNotify(
  47. PINTF_CONTEXT pIntfContext)
  48. {
  49. DWORD dwErr = ERROR_SUCCESS;
  50. GUID guidIntf;
  51. DbgPrint((TRC_TRACK, "[WzcNetmanNotify(0x%p)", pIntfContext));
  52. // For now (WinXP client RTM), Zero Config should report to NETMAN only the
  53. // disconnected state. This is to fix bug #401130 which is NETSHELL displaying
  54. // the bogus SSID from the {SF} state, while the IP address is lost and until
  55. // the media disconnect is received (10 seconds later).
  56. //
  57. // Do notify NETMAN only in the case when the device is under WZC control, that is
  58. // when it supports the OIDs and WZC is acting on it.
  59. if ((pIntfContext->dwCtlFlags & INTFCTL_OIDSSUPP) &&
  60. (pIntfContext->ncStatus == NCS_MEDIA_DISCONNECTED))
  61. {
  62. // send everything down the COM pipe now..
  63. if (SUCCEEDED(CLSIDFromString(pIntfContext->wszGuid, &guidIntf)) &&
  64. SUCCEEDED(CoInitializeEx (NULL, COINIT_MULTITHREADED)))
  65. {
  66. INetConnectionRefresh *pNetman;
  67. if(SUCCEEDED(CoCreateInstance (
  68. &CLSID_ConnectionManager,
  69. NULL,
  70. CLSCTX_ALL,
  71. &IID_INetConnectionRefresh,
  72. (LPVOID *)&pNetman)))
  73. {
  74. pNetman->lpVtbl->ConnectionStatusChanged(pNetman, &guidIntf, pIntfContext->ncStatus);
  75. pNetman->lpVtbl->Release(pNetman);
  76. }
  77. CoUninitialize ();
  78. }
  79. else
  80. {
  81. DbgAssert((FALSE,"Failed initializing COM pipe to NETMAN!"));
  82. dwErr = ERROR_GEN_FAILURE;
  83. }
  84. }
  85. DbgPrint((TRC_TRACK, "WzcNetmanNotify]=%d", dwErr));
  86. return dwErr;
  87. }