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.

322 lines
5.5 KiB

  1. #include "iisext.hxx"
  2. #pragma hdrstop
  3. #define VALIDATE_PTR(pPtr) \
  4. if (!pPtr) { \
  5. hr = E_ADS_BAD_PARAMETER;\
  6. }\
  7. BAIL_ON_FAILURE(hr);
  8. HRESULT
  9. put_BSTR_Property(
  10. IADs * pADsObject,
  11. BSTR bstrPropertyName,
  12. BSTR pSrcStringProperty
  13. )
  14. {
  15. HRESULT hr = S_OK;
  16. VARIANT varInputData;
  17. hr = PackStringinVariant(
  18. pSrcStringProperty,
  19. &varInputData
  20. );
  21. BAIL_ON_FAILURE(hr);
  22. hr = pADsObject->Put(
  23. bstrPropertyName,
  24. varInputData
  25. );
  26. BAIL_ON_FAILURE(hr);
  27. error:
  28. VariantClear( &varInputData );
  29. RRETURN(hr);
  30. }
  31. HRESULT
  32. get_BSTR_Property(
  33. IADs * pADsObject,
  34. BSTR bstrPropertyName,
  35. BSTR *ppDestStringProperty
  36. )
  37. {
  38. HRESULT hr = S_OK;
  39. VARIANT varOutputData;
  40. VALIDATE_PTR( ppDestStringProperty );
  41. VariantInit( &varOutputData );
  42. hr = pADsObject->Get(
  43. bstrPropertyName,
  44. &varOutputData
  45. );
  46. BAIL_ON_FAILURE(hr);
  47. hr = UnpackStringfromVariant(
  48. varOutputData,
  49. ppDestStringProperty
  50. );
  51. BAIL_ON_FAILURE(hr);
  52. error:
  53. VariantClear( &varOutputData );
  54. RRETURN(hr);
  55. }
  56. HRESULT
  57. put_LONG_Property(
  58. IADs * pADsObject,
  59. BSTR bstrPropertyName,
  60. LONG lSrcProperty
  61. )
  62. {
  63. HRESULT hr = S_OK;
  64. VARIANT varInputData;
  65. hr = PackLONGinVariant(
  66. lSrcProperty,
  67. &varInputData
  68. );
  69. BAIL_ON_FAILURE(hr);
  70. hr = pADsObject->Put(
  71. bstrPropertyName,
  72. varInputData
  73. );
  74. BAIL_ON_FAILURE(hr);
  75. error:
  76. VariantClear( &varInputData );
  77. RRETURN(hr);
  78. }
  79. HRESULT
  80. get_LONG_Property(
  81. IADs * pADsObject,
  82. BSTR bstrPropertyName,
  83. PLONG plDestProperty
  84. )
  85. {
  86. HRESULT hr = S_OK;
  87. VARIANT varOutputData;
  88. VALIDATE_PTR( plDestProperty );
  89. VariantInit( &varOutputData );
  90. hr = pADsObject->Get(
  91. bstrPropertyName,
  92. &varOutputData
  93. );
  94. BAIL_ON_FAILURE(hr);
  95. hr = UnpackLONGfromVariant(
  96. varOutputData,
  97. plDestProperty
  98. );
  99. BAIL_ON_FAILURE(hr);
  100. error:
  101. VariantClear( &varOutputData );
  102. RRETURN(hr);
  103. }
  104. HRESULT
  105. put_DATE_Property(
  106. IADs * pADsObject,
  107. BSTR bstrPropertyName,
  108. DATE daSrcProperty
  109. )
  110. {
  111. HRESULT hr = S_OK;
  112. VARIANT varInputData;
  113. hr = PackDATEinVariant(
  114. daSrcProperty,
  115. &varInputData
  116. );
  117. BAIL_ON_FAILURE(hr);
  118. hr = pADsObject->Put(
  119. bstrPropertyName,
  120. varInputData
  121. );
  122. BAIL_ON_FAILURE(hr);
  123. error:
  124. VariantClear( &varInputData );
  125. RRETURN(hr);
  126. }
  127. HRESULT
  128. get_DATE_Property(
  129. IADs * pADsObject,
  130. BSTR bstrPropertyName,
  131. PDATE pdaDestProperty
  132. )
  133. {
  134. HRESULT hr = S_OK;
  135. VARIANT varOutputData;
  136. VALIDATE_PTR( pdaDestProperty );
  137. VariantInit( &varOutputData );
  138. hr = pADsObject->Get(
  139. bstrPropertyName,
  140. &varOutputData
  141. );
  142. BAIL_ON_FAILURE(hr);
  143. hr = UnpackDATEfromVariant(
  144. varOutputData,
  145. pdaDestProperty
  146. );
  147. BAIL_ON_FAILURE(hr);
  148. error:
  149. VariantClear( &varOutputData );
  150. RRETURN(hr);
  151. }
  152. HRESULT
  153. put_VARIANT_BOOL_Property(
  154. IADs * pADsObject,
  155. BSTR bstrPropertyName,
  156. VARIANT_BOOL fSrcProperty
  157. )
  158. {
  159. HRESULT hr = S_OK;
  160. VARIANT varInputData;
  161. hr = PackVARIANT_BOOLinVariant(
  162. fSrcProperty,
  163. &varInputData
  164. );
  165. BAIL_ON_FAILURE(hr);
  166. hr = pADsObject->Put(
  167. bstrPropertyName,
  168. varInputData
  169. );
  170. BAIL_ON_FAILURE(hr);
  171. error:
  172. VariantClear( &varInputData );
  173. RRETURN(hr);
  174. }
  175. HRESULT
  176. get_VARIANT_BOOL_Property(
  177. IADs * pADsObject,
  178. BSTR bstrPropertyName,
  179. PVARIANT_BOOL pfDestProperty
  180. )
  181. {
  182. HRESULT hr = S_OK;
  183. VARIANT varOutputData;
  184. VALIDATE_PTR( pfDestProperty );
  185. VariantInit( &varOutputData );
  186. hr = pADsObject->Get(
  187. bstrPropertyName,
  188. &varOutputData
  189. );
  190. BAIL_ON_FAILURE(hr);
  191. hr = UnpackVARIANT_BOOLfromVariant(
  192. varOutputData,
  193. pfDestProperty
  194. );
  195. BAIL_ON_FAILURE(hr);
  196. error:
  197. VariantClear( &varOutputData );
  198. RRETURN(hr);
  199. }
  200. HRESULT
  201. put_VARIANT_Property(
  202. IADs * pADsObject,
  203. BSTR bstrPropertyName,
  204. VARIANT vSrcProperty
  205. )
  206. {
  207. HRESULT hr = S_OK;
  208. VARIANT varInputData;
  209. hr = PackVARIANTinVariant(
  210. vSrcProperty,
  211. &varInputData
  212. );
  213. BAIL_ON_FAILURE(hr);
  214. hr = pADsObject->Put(
  215. bstrPropertyName,
  216. varInputData
  217. );
  218. BAIL_ON_FAILURE(hr);
  219. error:
  220. VariantClear( &varInputData );
  221. RRETURN(hr);
  222. }
  223. HRESULT
  224. get_VARIANT_Property(
  225. IADs * pADsObject,
  226. BSTR bstrPropertyName,
  227. PVARIANT pvDestProperty
  228. )
  229. {
  230. HRESULT hr = S_OK;
  231. VARIANT varOutputData;
  232. VALIDATE_PTR( pvDestProperty );
  233. VariantInit( &varOutputData );
  234. hr = pADsObject->Get(
  235. bstrPropertyName,
  236. &varOutputData
  237. );
  238. BAIL_ON_FAILURE(hr);
  239. hr = UnpackVARIANTfromVariant(
  240. varOutputData,
  241. pvDestProperty
  242. );
  243. BAIL_ON_FAILURE(hr);
  244. error:
  245. VariantClear( &varOutputData );
  246. RRETURN(hr);
  247. }