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.

349 lines
20 KiB

  1. //
  2. // This NonDelegating interface is completely for 3rd-party
  3. // extension objects based on our implementation only. NO need
  4. // to export to ADISclients or 3rd part writer or typelib.
  5. // Will put it here for now. Move -> ??
  6. //
  7. #ifndef _INonDelegatingUnknown
  8. #define _INonDelegatingUnknown
  9. interface INonDelegatingUnknown
  10. {
  11. //
  12. // Do I have to use __RPC_FAR * instead ?? (for marshalling?)
  13. // May be not now since in proc server now. But should make
  14. // it generalized. Look up and copy from IUnknown.
  15. virtual HRESULT STDMETHODCALLTYPE
  16. NonDelegatingQueryInterface(const IID&, void **) = 0;
  17. virtual ULONG STDMETHODCALLTYPE
  18. NonDelegatingAddRef() = 0;
  19. virtual ULONG STDMETHODCALLTYPE
  20. NonDelegatingRelease() = 0;
  21. };
  22. #endif
  23. #define BAIL_ON_NULL(p) \
  24. if (!(p)) { \
  25. goto error; \
  26. }
  27. #define BAIL_IF_ERROR(hr) \
  28. if (FAILED(hr)) { \
  29. goto cleanup; \
  30. }\
  31. #define BAIL_ON_FAILURE(hr) \
  32. if (FAILED(hr)) { \
  33. goto error; \
  34. }\
  35. #define CONTINUE_ON_FAILURE(hr) \
  36. if (FAILED(hr)) { \
  37. continue; \
  38. }\
  39. #define BAIL_ON_SUCCESS(hr) \
  40. if (SUCCEEDED(hr)) { \
  41. goto error; \
  42. }\
  43. #define QUERY_INTERFACE(hr, ptr, iid, ppObj) \
  44. hr = ptr->QueryInterface(iid, (void **)ppObj); \
  45. if (FAILED(hr)) { \
  46. goto cleanup;\
  47. }\
  48. #define RRETURN_ENUM_STATUS(hr) \
  49. if (hr != S_OK) { \
  50. RRETURN(S_FALSE); \
  51. } \
  52. RRETURN(S_OK);
  53. #define DEFINE_IDispatch_Implementation_Unimplemented(cls) \
  54. STDMETHODIMP \
  55. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  56. { \
  57. RRETURN(E_NOTIMPL); \
  58. } \
  59. \
  60. STDMETHODIMP \
  61. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  62. ITypeInfo FAR* FAR* pptinfo) \
  63. { \
  64. RRETURN(E_NOTIMPL); \
  65. } \
  66. \
  67. STDMETHODIMP \
  68. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  69. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  70. { \
  71. RRETURN(E_NOTIMPL); \
  72. } \
  73. \
  74. STDMETHODIMP \
  75. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  76. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  77. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  78. unsigned int FAR* puArgErr) \
  79. { \
  80. RRETURN(E_NOTIMPL); \
  81. }
  82. #define DEFINE_IDispatch_Implementation(cls) \
  83. STDMETHODIMP \
  84. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  85. { \
  86. RRETURN(_pDispMgr->GetTypeInfoCount(pctinfo)); \
  87. } \
  88. \
  89. STDMETHODIMP \
  90. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  91. ITypeInfo FAR* FAR* pptinfo) \
  92. { \
  93. RRETURN(_pDispMgr->GetTypeInfo(itinfo, \
  94. lcid, \
  95. pptinfo \
  96. )); \
  97. } \
  98. STDMETHODIMP \
  99. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  100. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  101. { \
  102. RRETURN(_pDispMgr->GetIDsOfNames(iid, \
  103. rgszNames, \
  104. cNames, \
  105. lcid, \
  106. rgdispid \
  107. )); \
  108. } \
  109. \
  110. STDMETHODIMP \
  111. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  112. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  113. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  114. unsigned int FAR* puArgErr) \
  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_IADs_Implementation(cls) \
  127. STDMETHODIMP \
  128. cls::get_Name(THIS_ BSTR FAR* retval) \
  129. { \
  130. RRETURN(get_CoreName(retval)); \
  131. } \
  132. \
  133. STDMETHODIMP \
  134. cls::get_ADsPath(THIS_ BSTR FAR* retval) \
  135. { \
  136. \
  137. RRETURN(get_CoreADsPath(retval)); \
  138. } \
  139. \
  140. STDMETHODIMP \
  141. cls::get_Class(THIS_ BSTR FAR* retval) \
  142. { \
  143. \
  144. RRETURN(get_CoreADsClass(retval)); \
  145. } \
  146. \
  147. \
  148. STDMETHODIMP \
  149. cls::get_Parent(THIS_ BSTR FAR* retval) \
  150. { \
  151. RRETURN(get_CoreParent(retval)); \
  152. } \
  153. \
  154. STDMETHODIMP \
  155. cls::get_Schema(THIS_ BSTR FAR* retval) \
  156. { \
  157. RRETURN(get_CoreSchema(retval)); \
  158. } \
  159. \
  160. STDMETHODIMP \
  161. cls::get_GUID(THIS_ BSTR FAR* retval) \
  162. { \
  163. RRETURN(get_CoreGUID(retval)); \
  164. }
  165. #define DEFINE_IADsPutGet_UnImplementation(cls) \
  166. STDMETHODIMP \
  167. cls::Get(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  168. { \
  169. RRETURN(E_NOTIMPL); \
  170. } \
  171. \
  172. STDMETHODIMP \
  173. cls::Put(THIS_ BSTR bstrName, VARIANT vProp) \
  174. { \
  175. RRETURN(E_NOTIMPL); \
  176. } \
  177. \
  178. STDMETHODIMP \
  179. cls::GetEx(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  180. { \
  181. RRETURN(E_NOTIMPL); \
  182. } \
  183. \
  184. STDMETHODIMP \
  185. cls::PutEx(THIS_ long lnControlCode, BSTR bstrName, VARIANT vProp) \
  186. { \
  187. RRETURN(E_NOTIMPL); \
  188. }
  189. #define DEFINE_IPrivateDispatch_Implementation(cls) \
  190. STDMETHODIMP \
  191. cls::ADSIGetTypeInfoCount(unsigned int FAR* pctinfo) \
  192. { \
  193. RRETURN(_pDispMgr->GetTypeInfoCount(pctinfo)); \
  194. } \
  195. \
  196. STDMETHODIMP \
  197. cls::ADSIGetTypeInfo(unsigned int itinfo, LCID lcid, \
  198. ITypeInfo FAR* FAR* pptinfo) \
  199. { \
  200. RRETURN(_pDispMgr->GetTypeInfo(itinfo, \
  201. lcid, \
  202. pptinfo \
  203. )); \
  204. } \
  205. STDMETHODIMP \
  206. cls::ADSIGetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  207. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  208. { \
  209. RRETURN(_pDispMgr->GetIDsOfNames(iid, \
  210. rgszNames, \
  211. cNames, \
  212. lcid, \
  213. rgdispid \
  214. )); \
  215. } \
  216. \
  217. STDMETHODIMP \
  218. cls::ADSIInvoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  219. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  220. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  221. unsigned int FAR* puArgErr) \
  222. { \
  223. RRETURN (_pDispMgr->Invoke(dispidMember, \
  224. iid, \
  225. lcid, \
  226. wFlags, \
  227. pdispparams, \
  228. pvarResult, \
  229. pexcepinfo, \
  230. puArgErr \
  231. )); \
  232. }
  233. //
  234. // add the shell of DEFINE_IADsExtension_Imp to VC++ template
  235. // for 3rd party extension - including Operate, can even include
  236. // dwCode switches - would be nice. Later
  237. //
  238. // Will not include Operate() in macro since funct'n sligthly more complicated ?
  239. //
  240. //
  241. // LPWSTR ?? OLECHAR * won't compile ?? but declaration use
  242. // OLECHAR * ?? win95/98 ??
  243. //
  244. #define DEFINE_IADsExtension_Implementation(cls) \
  245. STDMETHODIMP \
  246. cls::PrivateGetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  247. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  248. { \
  249. RRETURN(_pDispMgr->GetIDsOfNames(iid, \
  250. rgszNames, \
  251. cNames, \
  252. lcid, \
  253. rgdispid \
  254. )); \
  255. } \
  256. \
  257. STDMETHODIMP \
  258. cls::PrivateInvoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  259. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  260. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  261. unsigned int FAR* puArgErr) \
  262. { \
  263. RRETURN (_pDispMgr->Invoke(dispidMember, \
  264. iid, \
  265. lcid, \
  266. wFlags, \
  267. pdispparams, \
  268. pvarResult, \
  269. pexcepinfo, \
  270. puArgErr \
  271. )); \
  272. }
  273. #define DEFINE_DELEGATING_IDispatch_Implementation(cls) \
  274. STDMETHODIMP \
  275. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  276. { \
  277. RRETURN(_pADs->GetTypeInfoCount(pctinfo)); \
  278. } \
  279. \
  280. STDMETHODIMP \
  281. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  282. ITypeInfo FAR* FAR* pptinfo) \
  283. { \
  284. RRETURN(_pADs->GetTypeInfo(itinfo, \
  285. lcid, \
  286. pptinfo \
  287. )); \
  288. } \
  289. STDMETHODIMP \
  290. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  291. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  292. { \
  293. RRETURN(_pADs->GetIDsOfNames(iid, \
  294. rgszNames, \
  295. cNames, \
  296. lcid, \
  297. rgdispid \
  298. )); \
  299. } \
  300. \
  301. STDMETHODIMP \
  302. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  303. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  304. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  305. unsigned int FAR* puArgErr) \
  306. { \
  307. RRETURN (_pADs->Invoke(dispidMember, \
  308. iid, \
  309. lcid, \
  310. wFlags, \
  311. pdispparams, \
  312. pvarResult, \
  313. pexcepinfo, \
  314. puArgErr \
  315. )); \
  316. }