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.

306 lines
18 KiB

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