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.

252 lines
14 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. //
  144. // Use this if the object needs to go on the wire to
  145. // get any of the core properties (will be case for FAST_BIND
  146. // and GUID in all cases). Also takes care of <WkGuid=...> case.
  147. //
  148. #define DEFINE_IADs_Shorter_Implementation(cls) \
  149. STDMETHODIMP \
  150. cls::get_ADsPath(THIS_ BSTR FAR* retval) \
  151. { \
  152. \
  153. RRETURN(get_CoreADsPath(retval)); \
  154. } \
  155. #define DEFINE_IADsPutGet_UnImplementation(cls) \
  156. STDMETHODIMP \
  157. cls::Get(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  158. { \
  159. RRETURN(E_NOTIMPL); \
  160. } \
  161. \
  162. STDMETHODIMP \
  163. cls::Put(THIS_ BSTR bstrName, VARIANT vProp) \
  164. { \
  165. RRETURN(E_NOTIMPL); \
  166. } \
  167. \
  168. STDMETHODIMP \
  169. cls::GetEx(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  170. { \
  171. RRETURN(E_NOTIMPL); \
  172. } \
  173. \
  174. STDMETHODIMP \
  175. cls::PutEx(THIS_ long lnControlCode, BSTR bstrName, VARIANT vProp) \
  176. { \
  177. RRETURN(E_NOTIMPL); \
  178. }
  179. #define DEFINE_IDispatch_ExtMgr_Implementation(cls) \
  180. STDMETHODIMP \
  181. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  182. { \
  183. RRETURN(_pExtMgr->GetTypeInfoCount(pctinfo)); \
  184. } \
  185. \
  186. STDMETHODIMP \
  187. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  188. ITypeInfo FAR* FAR* pptinfo) \
  189. { \
  190. RRETURN(_pExtMgr->GetTypeInfo(itinfo, \
  191. lcid, \
  192. pptinfo \
  193. )); \
  194. } \
  195. STDMETHODIMP \
  196. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  197. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  198. { \
  199. RRETURN(_pExtMgr->GetIDsOfNames(iid, \
  200. rgszNames, \
  201. cNames, \
  202. lcid, \
  203. rgdispid \
  204. )); \
  205. } \
  206. \
  207. STDMETHODIMP \
  208. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  209. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  210. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  211. unsigned int FAR* puArgErr) \
  212. { \
  213. RRETURN (_pExtMgr->Invoke(dispidMember, \
  214. iid, \
  215. lcid, \
  216. wFlags, \
  217. pdispparams, \
  218. pvarResult, \
  219. pexcepinfo, \
  220. puArgErr \
  221. )); \
  222. }
  223. /* Macro to call the ADsSetLastError function */
  224. #define Macro_ClearADsLastError(providerString) \
  225. ADsSetLastError(NO_ERROR, NULL, providerString);