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.

318 lines
5.0 KiB

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