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.

212 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. wzcdlg.c
  5. Abstract:
  6. Main file for wzcdlg
  7. Author:
  8. SachinS 20-March-2001
  9. Environment:
  10. User Level: Win32
  11. Revision History:
  12. --*/
  13. #include <precomp.h>
  14. #include <wzcdlg.h>
  15. #include <wzcsapi.h>
  16. #include "wzcatl.h"
  17. #include "wzccore.h"
  18. // Global
  19. CComModule _Module;
  20. BEGIN_OBJECT_MAP(ObjectMap)
  21. END_OBJECT_MAP()
  22. //
  23. // WZCDlgMain
  24. //
  25. // Description:
  26. //
  27. // Dll Entry function
  28. //
  29. // Arguments:
  30. // hmod -
  31. // dwReason -
  32. // pctx -
  33. //
  34. // Return values:
  35. // TRUE
  36. // FALSE
  37. //
  38. EXTERN_C BOOL
  39. WZCDlgMain (
  40. IN HINSTANCE hInstance,
  41. IN DWORD dwReason,
  42. IN LPVOID lpReserved OPTIONAL)
  43. {
  44. DBG_UNREFERENCED_PARAMETER(lpReserved);
  45. switch (dwReason)
  46. {
  47. case DLL_PROCESS_ATTACH:
  48. DisableThreadLibraryCalls(hInstance);
  49. _Module.Init(ObjectMap, hInstance);
  50. SHFusionInitializeFromModuleID (hInstance, 2);
  51. break;
  52. case DLL_PROCESS_DETACH:
  53. SHFusionUninitialize();
  54. _Module.Term();
  55. break;
  56. }
  57. return TRUE;
  58. }
  59. //
  60. // WZCCanShowBalloon
  61. //
  62. // Description:
  63. //
  64. // Function called by netshell, to query if balloon is to be displayed
  65. //
  66. // Arguments:
  67. // pGUIDConn - Interface GUID string
  68. // pszBalloonText - Pointer to text to be display
  69. // pszCookie - WZC specific information
  70. //
  71. // Return values:
  72. // S_OK - Display balloon
  73. // S_FALSE - Do not display balloon
  74. //
  75. EXTERN_C HRESULT
  76. WZCCanShowBalloon (
  77. IN const GUID * pGUIDConn,
  78. IN const PCWSTR pszConnectionName,
  79. IN OUT BSTR * pszBalloonText,
  80. IN OUT BSTR * pszCookie
  81. )
  82. {
  83. HRESULT hr = S_FALSE;
  84. if (pszCookie != NULL)
  85. {
  86. PWZCDLG_DATA pDlgData = reinterpret_cast<PWZCDLG_DATA>(*pszCookie);
  87. if (WZCDLG_IS_WZC(pDlgData->dwCode))
  88. hr = WZCDlgCanShowBalloon(pGUIDConn, pszBalloonText, pszCookie);
  89. else
  90. {
  91. hr = ElCanShowBalloon (
  92. pGUIDConn,
  93. (WCHAR *)pszConnectionName,
  94. pszBalloonText,
  95. pszCookie
  96. );
  97. }
  98. }
  99. return hr;
  100. }
  101. //
  102. // WZCOnBalloonClick
  103. //
  104. // Description:
  105. //
  106. // Function called by netshell, in response to a balloon click
  107. //
  108. // Arguments:
  109. // pGUIDConn - Interface GUID string
  110. // pszCookie - WZC specific information
  111. //
  112. // Return values:
  113. // S_OK - No error
  114. // S_FALSE - Error
  115. //
  116. EXTERN_C HRESULT
  117. WZCOnBalloonClick (
  118. IN const GUID * pGUIDConn,
  119. IN const BSTR pszConnectionName,
  120. IN const BSTR szCookie
  121. )
  122. {
  123. HRESULT hr = S_OK;
  124. ULONG_PTR ulActivationCookie;
  125. PWZCDLG_DATA pDlgData = reinterpret_cast<PWZCDLG_DATA>(szCookie);
  126. SHActivateContext (&ulActivationCookie);
  127. if (WZCDLG_IS_WZC(pDlgData->dwCode))
  128. {
  129. hr = WZCDlgOnBalloonClick(
  130. pGUIDConn,
  131. (LPWSTR) pszConnectionName,
  132. szCookie);
  133. }
  134. else
  135. {
  136. hr = ElOnBalloonClick (
  137. pGUIDConn,
  138. (WCHAR *)pszConnectionName,
  139. szCookie
  140. );
  141. }
  142. SHDeactivateContext (ulActivationCookie);
  143. return hr;
  144. }
  145. //
  146. // WZCQueryConnectionStatusText
  147. //
  148. // Description:
  149. //
  150. // Function called by netshell, to query appropriate text for 802.1X states
  151. //
  152. // Arguments:
  153. // pGUIDConn - Interface GUID string
  154. // ncs - NETCON_STATUS for the interface
  155. // pszStatusText - Detailed 802.1X status to be displayed
  156. //
  157. // Return values:
  158. // S_OK - No error
  159. // S_FALSE - Error
  160. //
  161. EXTERN_C HRESULT
  162. WZCQueryConnectionStatusText (
  163. IN const GUID * pGUIDConn,
  164. IN const NETCON_STATUS ncs,
  165. IN OUT BSTR * pszStatusText
  166. )
  167. {
  168. HRESULT hr = S_OK;
  169. hr = ElQueryConnectionStatusText (
  170. pGUIDConn,
  171. ncs,
  172. pszStatusText
  173. );
  174. return hr;
  175. }