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.

306 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. HRESULT hr = (_pDispMgr->GetIDsOfNames(iid, \
  94. rgszNames, \
  95. cNames, \
  96. lcid, \
  97. rgdispid \
  98. )); \
  99. \
  100. \
  101. RRETURN(hr); \
  102. } \
  103. \
  104. STDMETHODIMP \
  105. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  106. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  107. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  108. unsigned int FAR* puArgErr) \
  109. { \
  110. RRETURN (_pDispMgr->Invoke(dispidMember, \
  111. iid, \
  112. lcid, \
  113. wFlags, \
  114. pdispparams, \
  115. pvarResult, \
  116. pexcepinfo, \
  117. puArgErr \
  118. )); \
  119. }
  120. #define DEFINE_Simple_IDispatch_Implementation(cls) \
  121. STDMETHODIMP \
  122. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  123. { \
  124. RRETURN(_pDispMgr->GetTypeInfoCount(pctinfo)); \
  125. } \
  126. \
  127. STDMETHODIMP \
  128. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  129. ITypeInfo FAR* FAR* pptinfo) \
  130. { \
  131. RRETURN(_pDispMgr->GetTypeInfo(itinfo, \
  132. lcid, \
  133. pptinfo \
  134. )); \
  135. } \
  136. STDMETHODIMP \
  137. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  138. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  139. { \
  140. RRETURN(_pDispMgr->GetIDsOfNames(iid, \
  141. rgszNames, \
  142. cNames, \
  143. lcid, \
  144. rgdispid \
  145. )); \
  146. } \
  147. \
  148. STDMETHODIMP \
  149. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  150. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  151. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  152. unsigned int FAR* puArgErr) \
  153. { \
  154. RRETURN (_pDispMgr->Invoke(dispidMember, \
  155. iid, \
  156. lcid, \
  157. wFlags, \
  158. pdispparams, \
  159. pvarResult, \
  160. pexcepinfo, \
  161. puArgErr \
  162. )); \
  163. }
  164. #define DEFINE_IADs_Implementation(cls) \
  165. STDMETHODIMP \
  166. cls::get_Name(THIS_ BSTR FAR* retval) \
  167. { \
  168. RRETURN(get_CoreName(retval)); \
  169. } \
  170. \
  171. STDMETHODIMP \
  172. cls::get_ADsPath(THIS_ BSTR FAR* retval) \
  173. { \
  174. \
  175. RRETURN(get_CoreADsPath(retval)); \
  176. } \
  177. \
  178. STDMETHODIMP \
  179. cls::get_Class(THIS_ BSTR FAR* retval) \
  180. { \
  181. \
  182. RRETURN(get_CoreADsClass(retval)); \
  183. } \
  184. \
  185. \
  186. STDMETHODIMP \
  187. cls::get_Parent(THIS_ BSTR FAR* retval) \
  188. { \
  189. RRETURN(get_CoreParent(retval)); \
  190. } \
  191. \
  192. STDMETHODIMP \
  193. cls::get_Schema(THIS_ BSTR FAR* retval) \
  194. { \
  195. RRETURN(get_CoreSchema(retval)); \
  196. } \
  197. \
  198. STDMETHODIMP \
  199. cls::get_GUID(THIS_ BSTR FAR* retval) \
  200. { \
  201. RRETURN(get_CoreGUID(retval)); \
  202. } \
  203. STDMETHODIMP \
  204. cls::GetInfoEx(THIS_ VARIANT vProperties, long lnReserved) \
  205. { \
  206. RRETURN(E_NOTIMPL); \
  207. }
  208. #define CHECK_AND_SET_EXTENDED_ERROR(dwStatus, hr) \
  209. if (dwStatus) { \
  210. hr = CheckAndSetExtendedError(dwStatus); \
  211. BAIL_ON_FAILURE(hr); \
  212. }
  213. #define DEFINE_IADs_PutGetUnImplementation(cls) \
  214. STDMETHODIMP \
  215. cls::Get(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  216. { \
  217. RRETURN(E_NOTIMPL); \
  218. } \
  219. \
  220. STDMETHODIMP \
  221. cls::Put(THIS_ BSTR bstrName, VARIANT vProp) \
  222. { \
  223. RRETURN(E_NOTIMPL); \
  224. } \
  225. STDMETHODIMP \
  226. cls::GetEx(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  227. { \
  228. RRETURN(E_NOTIMPL); \
  229. } \
  230. \
  231. STDMETHODIMP \
  232. cls::PutEx(THIS_ long lnControlCode, BSTR bstrName, VARIANT vProp) \
  233. { \
  234. RRETURN(E_NOTIMPL); \
  235. }
  236. #define DEFINE_IDispatch_ExtMgr_Implementation(cls) \
  237. STDMETHODIMP \
  238. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  239. { \
  240. RRETURN(_pExtMgr->GetTypeInfoCount(pctinfo)); \
  241. } \
  242. \
  243. STDMETHODIMP \
  244. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  245. ITypeInfo FAR* FAR* pptinfo) \
  246. { \
  247. RRETURN(_pExtMgr->GetTypeInfo(itinfo, \
  248. lcid, \
  249. pptinfo \
  250. )); \
  251. } \
  252. STDMETHODIMP \
  253. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  254. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  255. { \
  256. RRETURN(_pExtMgr->GetIDsOfNames(iid, \
  257. rgszNames, \
  258. cNames, \
  259. lcid, \
  260. rgdispid \
  261. )); \
  262. } \
  263. \
  264. STDMETHODIMP \
  265. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  266. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  267. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  268. unsigned int FAR* puArgErr) \
  269. { \
  270. RRETURN (_pExtMgr->Invoke(dispidMember, \
  271. iid, \
  272. lcid, \
  273. wFlags, \
  274. pdispparams, \
  275. pvarResult, \
  276. pexcepinfo, \
  277. puArgErr \
  278. )); \
  279. }