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.

270 lines
6.6 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2001.
  5. //
  6. // File: stdafx.h
  7. //
  8. // Contents: WiF Policy Snapin
  9. //
  10. //
  11. // History: TaroonM
  12. // 10/30/01
  13. //
  14. //----------------------------------------------------------------------------
  15. // stdafx.h : include file for standard system include files,
  16. // or project specific include files that are used frequently,
  17. // but are changed infrequently
  18. #include <afxwin.h>
  19. #include <afxdisp.h>
  20. #include <afxcmn.h>
  21. #include <afxdlgs.h>
  22. #include <afxmt.h>
  23. #include <shfusion.h>
  24. #include <atlbase.h>
  25. //#include <atlwin.h>
  26. // We depend on this pretty heavily for cross module communication
  27. #include <shlobj.h>
  28. #include <dsclient.h>
  29. #include <windns.h>
  30. //You may derive a class from CComModule and use it if you want to override
  31. //something, but do not change the name of _Module
  32. extern CComModule _Module;
  33. #include <atlcom.h>
  34. #pragma comment(lib, "mmc")
  35. #include <mmc.h>
  36. #include "afxtempl.h"
  37. /*
  38. * Define/include the stuff we need for WTL::CImageList. We need prototypes
  39. * for IsolationAwareImageList_Read and IsolationAwareImageList_Write here
  40. * because commctrl.h only declares them if __IStream_INTERFACE_DEFINED__
  41. * is defined. __IStream_INTERFACE_DEFINED__ is defined by objidl.h, which
  42. * we can't include before including afx.h because it ends up including
  43. * windows.h, which afx.h expects to include itself. Ugh.
  44. */
  45. HIMAGELIST WINAPI IsolationAwareImageList_Read(LPSTREAM pstm);
  46. BOOL WINAPI IsolationAwareImageList_Write(HIMAGELIST himl,LPSTREAM pstm);
  47. #define _WTL_NO_AUTOMATIC_NAMESPACE
  48. #include <atlwin.h>
  49. #include "atlapp.h"
  50. #include "atlctrls.h"
  51. #include <vector>
  52. #include "resource.h"
  53. #include "winsock2.h"
  54. #include "helpids.h"
  55. #include "helparr.h"
  56. extern "C" {
  57. #include "wlstore2.h"
  58. };
  59. #include <initguid.h>
  60. #include "gpedit.h" // gpe interface for extending GPO
  61. //for wmi stuff begin
  62. #include <wbemidl.h>
  63. #include <oleauto.h>
  64. #include <objbase.h>
  65. #include <iads.h>
  66. #include <adshlp.h>
  67. #include <adserr.h>
  68. #include <userenv.h>
  69. #include <prsht.h>
  70. //for wmi stuff end
  71. #define SECURITY_WIN32
  72. #include <Security.h>
  73. #include "policycf.h"
  74. #include "snputils.h"
  75. /////////////////////////////////////////////////////////////////////////////
  76. // Helper functions
  77. template<class TYPE>
  78. inline void SAFE_RELEASE(TYPE*& pObj)
  79. {
  80. if (pObj != NULL)
  81. {
  82. pObj->Release();
  83. pObj = NULL;
  84. }
  85. else
  86. {
  87. TRACE(_T("Release called on NULL interface ptr\n"));
  88. }
  89. }
  90. // TODO: remove CLSID_Extension code -- as we are not an extenstion
  91. extern const CLSID CLSID_Snapin; // In-Proc server GUID
  92. extern const wchar_t* cszSnapin;
  93. extern const CLSID CLSID_Extension; // In-Proc server GUID
  94. extern const wchar_t* cszSnapin_ext;
  95. extern const CLSID CLSID_WIRELESSClientEx;
  96. extern const CLSID CLSID_About;
  97. extern const wchar_t *cszAbout;
  98. // OBJECT TYPE for Scope Nodes.
  99. // "IP Security Management" static folder NodeType GUID in numeric & string formats.
  100. extern const GUID cNodeTypeWirelessMan;
  101. extern const wchar_t* cszNodeTypeWirelessMan;
  102. // OBJECT TYPE for result items.
  103. // "Negotiation Policy" result NodeType GUID in numeric & string formats.
  104. extern const GUID cObjectTypeSecPolRes;
  105. extern const wchar_t* cszObjectTypeSecPolRes;
  106. // GPT guid
  107. extern const GUID cGPEguid;
  108. // Published context information for extensions to extend
  109. extern const wchar_t* SNAPIN_WORKSTATION;
  110. // the default folder images location in IDB_16x16 and IDB_32x32
  111. #define FOLDER_IMAGE_IDX 0
  112. #define OPEN_FOLDER_IMAGE_IDX 1
  113. #define SECPOLICY_IMAGE_IDX 7
  114. #define ENABLEDSECPOLICY_IMAGE_IDX 9
  115. #define OPENSECPOLICY_IMAGE_IDX 8
  116. #define NEGOTIATION_IMAGE_IDX 4
  117. #define NEGOTIATIONLINK_IMAGE_IDX 5
  118. #define NEGOTIATIONLINKOPEN_IMAGE_IDX 6
  119. #define FILTER_IMAGE_IDX 2
  120. #define FILTERLINK_IMAGE_IDX 3
  121. // some helper defines
  122. #define SAFE_ENABLEWINDOW(dlgID, bEnable) \
  123. { \
  124. CWnd* pWnd = 0; \
  125. pWnd = GetDlgItem (dlgID); \
  126. ASSERT (pWnd); \
  127. if (pWnd) \
  128. { \
  129. pWnd->EnableWindow (bEnable); \
  130. } \
  131. }
  132. #define SAFE_SHOWWINDOW(dlgID, nCmdShow ) \
  133. { \
  134. CWnd* pWnd = 0; \
  135. pWnd = GetDlgItem (dlgID); \
  136. ASSERT (pWnd); \
  137. if (pWnd) \
  138. { \
  139. pWnd->ShowWindow (nCmdShow ); \
  140. } \
  141. }
  142. inline CString ResourcedString (UINT nStringID)
  143. {
  144. CString strTemp;
  145. strTemp.LoadString (nStringID);
  146. return strTemp;
  147. }
  148. // helper functions and macros shared between directories wlsnp.
  149. #include "ipsutil.h"
  150. #define CONFIGUREITEM(TmItem, TstrName, TstrStatusBarText, TlCommandID, TlInsertionPointID, TfFlags, TfSpecialFlags) \
  151. { \
  152. TmItem.strName = TstrName.GetBuffer(20); \
  153. TmItem.strStatusBarText = TstrStatusBarText.GetBuffer(20); \
  154. TmItem.lCommandID = TlCommandID; \
  155. TmItem.lInsertionPointID = TlInsertionPointID; \
  156. TmItem.fFlags = TfFlags; \
  157. TmItem.fSpecialFlags = TfSpecialFlags; \
  158. }
  159. // Debug instance counter
  160. #ifdef _DEBUG
  161. inline void DbgInstanceRemaining(char * pszClassName, int cInstRem)
  162. {
  163. char buf[100];
  164. wsprintfA(buf, "%s has %d instances left over.", pszClassName, cInstRem);
  165. ::MessageBoxA(NULL, buf, "WIRELESS: Memory Leak!!!", MB_OK);
  166. }
  167. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls) extern int s_cInst_##cls = 0;
  168. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls) ++(s_cInst_##cls);
  169. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls) --(s_cInst_##cls);
  170. #define DEBUG_VERIFY_INSTANCE_COUNT(cls) \
  171. extern int s_cInst_##cls; \
  172. if (s_cInst_##cls) DbgInstanceRemaining(#cls, s_cInst_##cls);
  173. #ifdef DO_TRACE
  174. #define OPT_TRACE TRACE // optional trace on
  175. #else
  176. #define OPT_TRACE
  177. #endif //#ifdef DO_TRACE
  178. #else
  179. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls)
  180. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls)
  181. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls)
  182. #define DEBUG_VERIFY_INSTANCE_COUNT(cls)
  183. #define OPT_TRACE
  184. #endif
  185. #include "ccompdta.h"
  186. #include "ccomp.h"
  187. #include "DataObj.h"
  188. #include "snapin.h"
  189. #include "snpobj.h"
  190. #include "snpdata.h"
  191. #include "spolitem.h"
  192. #include "mngrfldr.h"
  193. #include "snppage.h"
  194. #include "wiz97pg.h"
  195. #include "nfabpage.h"
  196. //#include "warnDlg.h"
  197. #define BAIL_ON_WIN32_ERROR(dwError) \
  198. if (dwError) {\
  199. goto error; \
  200. }
  201. #define BAIL_ON_FAILURE(hr) \
  202. if (FAILED(hr)) {\
  203. goto error; \
  204. }
  205. #define DELETE_OBJECT(pObject) \
  206. if (pObject) \
  207. { \
  208. delete(pObject); \
  209. pObject=NULL; \
  210. }