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.

312 lines
18 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1997
  5. //
  6. // File: cmacro.h
  7. //
  8. // Contents: Macros for adsi IIS provider
  9. //
  10. // History: 21-04-97 sophiac Created.
  11. //
  12. //----------------------------------------------------------------------------
  13. #define BAIL_ON_NULL(p) \
  14. if (!(p)) { \
  15. goto error; \
  16. }
  17. #define BAIL_IF_ERROR(hr) \
  18. if (FAILED(hr)) { \
  19. goto cleanup; \
  20. }\
  21. #define BAIL_ON_FAILURE(hr) \
  22. if (FAILED(hr)) { \
  23. goto error; \
  24. }\
  25. #define CONTINUE_ON_FAILURE(hr) \
  26. if (FAILED(hr)) { \
  27. hr = NO_ERROR; \
  28. continue; \
  29. }\
  30. #define BAIL_ON_SUCCESS(hr) \
  31. if (SUCCEEDED(hr)) { \
  32. goto error; \
  33. }\
  34. #define QUERY_INTERFACE(hr, ptr, iid, ppObj) \
  35. hr = ptr->QueryInterface(iid, (void **)ppObj); \
  36. if (FAILED(hr)) { \
  37. goto cleanup;\
  38. }\
  39. #define RRETURN_ENUM_STATUS(hr) \
  40. if (hr != S_OK) { \
  41. RRETURN(S_FALSE); \
  42. } \
  43. RRETURN(S_OK);
  44. #define DEFINE_IDispatch_Implementation_Unimplemented(cls) \
  45. STDMETHODIMP \
  46. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  47. { \
  48. RRETURN(E_NOTIMPL); \
  49. } \
  50. \
  51. STDMETHODIMP \
  52. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  53. ITypeInfo FAR* FAR* pptinfo) \
  54. { \
  55. RRETURN(E_NOTIMPL); \
  56. } \
  57. \
  58. STDMETHODIMP \
  59. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  60. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  61. { \
  62. RRETURN(E_NOTIMPL); \
  63. } \
  64. \
  65. STDMETHODIMP \
  66. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  67. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  68. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  69. unsigned int FAR* puArgErr) \
  70. { \
  71. RRETURN(E_NOTIMPL); \
  72. }
  73. #define DEFINE_IDispatch_Implementation(cls) \
  74. STDMETHODIMP \
  75. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  76. { \
  77. RRETURN(_pDispMgr->GetTypeInfoCount(pctinfo)); \
  78. } \
  79. \
  80. STDMETHODIMP \
  81. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  82. ITypeInfo FAR* FAR* pptinfo) \
  83. { \
  84. RRETURN(_pDispMgr->GetTypeInfo(itinfo, \
  85. lcid, \
  86. pptinfo \
  87. )); \
  88. } \
  89. STDMETHODIMP \
  90. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  91. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  92. { \
  93. DWORD MetaID; \
  94. \
  95. HRESULT hr = (_pDispMgr->GetIDsOfNames(iid, \
  96. rgszNames, \
  97. cNames, \
  98. lcid, \
  99. rgdispid \
  100. )); \
  101. \
  102. \
  103. RRETURN(hr); \
  104. } \
  105. \
  106. STDMETHODIMP \
  107. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  108. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  109. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  110. unsigned int FAR* puArgErr) \
  111. { \
  112. HRESULT hr; \
  113. WCHAR szPropName[64]; \
  114. BSTR bstrPropName = NULL; \
  115. \
  116. RRETURN (_pDispMgr->Invoke(dispidMember, \
  117. iid, \
  118. lcid, \
  119. wFlags, \
  120. pdispparams, \
  121. pvarResult, \
  122. pexcepinfo, \
  123. puArgErr \
  124. )); \
  125. }
  126. #define DEFINE_Simple_IDispatch_Implementation(cls) \
  127. STDMETHODIMP \
  128. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  129. { \
  130. RRETURN(_pDispMgr->GetTypeInfoCount(pctinfo)); \
  131. } \
  132. \
  133. STDMETHODIMP \
  134. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  135. ITypeInfo FAR* FAR* pptinfo) \
  136. { \
  137. RRETURN(_pDispMgr->GetTypeInfo(itinfo, \
  138. lcid, \
  139. pptinfo \
  140. )); \
  141. } \
  142. STDMETHODIMP \
  143. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  144. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  145. { \
  146. RRETURN(_pDispMgr->GetIDsOfNames(iid, \
  147. rgszNames, \
  148. cNames, \
  149. lcid, \
  150. rgdispid \
  151. )); \
  152. } \
  153. \
  154. STDMETHODIMP \
  155. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  156. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  157. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  158. unsigned int FAR* puArgErr) \
  159. { \
  160. RRETURN (_pDispMgr->Invoke(dispidMember, \
  161. iid, \
  162. lcid, \
  163. wFlags, \
  164. pdispparams, \
  165. pvarResult, \
  166. pexcepinfo, \
  167. puArgErr \
  168. )); \
  169. }
  170. #define DEFINE_IADs_Implementation(cls) \
  171. STDMETHODIMP \
  172. cls::get_Name(THIS_ BSTR FAR* retval) \
  173. { \
  174. RRETURN(get_CoreName(retval)); \
  175. } \
  176. \
  177. STDMETHODIMP \
  178. cls::get_ADsPath(THIS_ BSTR FAR* retval) \
  179. { \
  180. \
  181. RRETURN(get_CoreADsPath(retval)); \
  182. } \
  183. \
  184. STDMETHODIMP \
  185. cls::get_Class(THIS_ BSTR FAR* retval) \
  186. { \
  187. \
  188. RRETURN(get_CoreADsClass(retval)); \
  189. } \
  190. \
  191. \
  192. STDMETHODIMP \
  193. cls::get_Parent(THIS_ BSTR FAR* retval) \
  194. { \
  195. RRETURN(get_CoreParent(retval)); \
  196. } \
  197. \
  198. STDMETHODIMP \
  199. cls::get_Schema(THIS_ BSTR FAR* retval) \
  200. { \
  201. RRETURN(get_CoreSchema(retval)); \
  202. } \
  203. \
  204. STDMETHODIMP \
  205. cls::get_GUID(THIS_ BSTR FAR* retval) \
  206. { \
  207. RRETURN(get_CoreGUID(retval)); \
  208. } \
  209. STDMETHODIMP \
  210. cls::GetInfoEx(THIS_ VARIANT vProperties, long lnReserved) \
  211. { \
  212. RRETURN(E_NOTIMPL); \
  213. }
  214. #define CHECK_AND_SET_EXTENDED_ERROR(dwStatus, hr) \
  215. if (dwStatus) { \
  216. hr = CheckAndSetExtendedError(dwStatus); \
  217. BAIL_ON_FAILURE(hr); \
  218. }
  219. #define DEFINE_IADs_PutGetUnImplementation(cls) \
  220. STDMETHODIMP \
  221. cls::Get(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  222. { \
  223. RRETURN(E_NOTIMPL); \
  224. } \
  225. \
  226. STDMETHODIMP \
  227. cls::Put(THIS_ BSTR bstrName, VARIANT vProp) \
  228. { \
  229. RRETURN(E_NOTIMPL); \
  230. } \
  231. STDMETHODIMP \
  232. cls::GetEx(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  233. { \
  234. RRETURN(E_NOTIMPL); \
  235. } \
  236. \
  237. STDMETHODIMP \
  238. cls::PutEx(THIS_ long lnControlCode, BSTR bstrName, VARIANT vProp) \
  239. { \
  240. RRETURN(E_NOTIMPL); \
  241. }
  242. #define DEFINE_IDispatch_ExtMgr_Implementation(cls) \
  243. STDMETHODIMP \
  244. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  245. { \
  246. RRETURN(_pExtMgr->GetTypeInfoCount(pctinfo)); \
  247. } \
  248. \
  249. STDMETHODIMP \
  250. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  251. ITypeInfo FAR* FAR* pptinfo) \
  252. { \
  253. RRETURN(_pExtMgr->GetTypeInfo(itinfo, \
  254. lcid, \
  255. pptinfo \
  256. )); \
  257. } \
  258. STDMETHODIMP \
  259. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  260. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  261. { \
  262. RRETURN(_pExtMgr->GetIDsOfNames(iid, \
  263. rgszNames, \
  264. cNames, \
  265. lcid, \
  266. rgdispid \
  267. )); \
  268. } \
  269. \
  270. STDMETHODIMP \
  271. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  272. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  273. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  274. unsigned int FAR* puArgErr) \
  275. { \
  276. RRETURN (_pExtMgr->Invoke(dispidMember, \
  277. iid, \
  278. lcid, \
  279. wFlags, \
  280. pdispparams, \
  281. pvarResult, \
  282. pexcepinfo, \
  283. puArgErr \
  284. )); \
  285. }