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.

745 lines
20 KiB

  1. /****************************************************************************
  2. *
  3. * (C) COPYRIGHT 2000, MICROSOFT CORP.
  4. *
  5. * FILE: wiaprop.cpp
  6. *
  7. * VERSION: 1.0
  8. *
  9. * DATE: 11/10/2000
  10. *
  11. * AUTHOR: Dave Parsons
  12. *
  13. * DESCRIPTION:
  14. * Helper functions for initializing WIA driver properties.
  15. *
  16. *****************************************************************************/
  17. #include "pch.h"
  18. //
  19. // Constructor
  20. //
  21. CWiauPropertyList::CWiauPropertyList() :
  22. m_NumAlloc(0),
  23. m_NumProps(0),
  24. m_pId(NULL),
  25. m_pNames(NULL),
  26. m_pCurrent(NULL),
  27. m_pPropSpec(NULL),
  28. m_pAttrib(NULL)
  29. {
  30. }
  31. //
  32. // Destructor
  33. //
  34. CWiauPropertyList::~CWiauPropertyList()
  35. {
  36. if (m_pId)
  37. delete []m_pId;
  38. if (m_pNames)
  39. delete []m_pNames;
  40. if (m_pCurrent)
  41. delete []m_pCurrent;
  42. if (m_pPropSpec)
  43. delete []m_pPropSpec;
  44. if (m_pAttrib)
  45. delete []m_pAttrib;
  46. }
  47. //
  48. // This function allocates the property arrays
  49. //
  50. // Input:
  51. // NumProps -- number of properties to reserve space for. This number can be larger
  52. // than the actual number used, but cannot be smaller.
  53. //
  54. HRESULT
  55. CWiauPropertyList::Init(INT NumProps)
  56. {
  57. HRESULT hr = S_OK;
  58. REQUIRE_ARGS(NumProps < 1, hr, "Init");
  59. if (m_NumAlloc > 0)
  60. {
  61. wiauDbgError("Init", "Property list already initialized");
  62. hr = E_FAIL;
  63. goto Cleanup;
  64. }
  65. m_pId = new PROPID[NumProps];
  66. m_pNames = new LPOLESTR[NumProps];
  67. m_pCurrent = new PROPVARIANT[NumProps];
  68. m_pPropSpec = new PROPSPEC[NumProps];
  69. m_pAttrib = new WIA_PROPERTY_INFO[NumProps];
  70. REQUIRE_ALLOC(m_pId, hr, "Init");
  71. REQUIRE_ALLOC(m_pNames, hr, "Init");
  72. REQUIRE_ALLOC(m_pCurrent, hr, "Init");
  73. REQUIRE_ALLOC(m_pPropSpec, hr, "Init");
  74. REQUIRE_ALLOC(m_pAttrib, hr, "Init");
  75. m_NumAlloc = NumProps;
  76. m_NumProps = 0;
  77. Cleanup:
  78. if ((m_pId == NULL) ||
  79. (m_pNames == NULL) ||
  80. (m_pCurrent == NULL) ||
  81. (m_pPropSpec == NULL) ||
  82. (m_pAttrib == NULL))
  83. {
  84. delete m_pId;
  85. delete m_pNames;
  86. delete m_pCurrent;
  87. delete m_pPropSpec;
  88. delete m_pAttrib;
  89. m_pId = NULL;
  90. m_pNames = NULL;
  91. m_pCurrent = NULL;
  92. m_pPropSpec = NULL;
  93. m_pAttrib = NULL;
  94. hr = E_OUTOFMEMORY;
  95. }
  96. return hr;
  97. }
  98. //
  99. // This function adds a property definition to the arrays
  100. //
  101. // Input:
  102. // index -- pointer to an int that will be set to the array index, useful
  103. // for passing to other property functions
  104. // PropId -- property ID constant
  105. // PropName -- property name string
  106. // Access -- determines access to the property, usually either
  107. // WIA_PROP_READ or WIA_PROP_RW
  108. // SubType -- indicates subtype of the property, usually either WIA_PROP_NONE,
  109. // WIA_PROP_RANGE, or WIA_PROP_LIST
  110. //
  111. HRESULT
  112. CWiauPropertyList::DefineProperty(int *pIdx, PROPID PropId, LPOLESTR PropName, ULONG Access, ULONG SubType)
  113. {
  114. HRESULT hr = S_OK;
  115. REQUIRE_ARGS(!pIdx, hr, "DefineProperty");
  116. if (m_NumProps >= m_NumAlloc)
  117. {
  118. wiauDbgError("DefineProperty", "PropertyList is full. Increase number passed to Init");
  119. hr = E_FAIL;
  120. goto Cleanup;
  121. }
  122. int idx = m_NumProps++;
  123. m_pId[idx] = PropId;
  124. m_pNames[idx] = PropName;
  125. m_pCurrent[idx].vt = VT_EMPTY;
  126. m_pPropSpec[idx].ulKind = PRSPEC_PROPID;
  127. m_pPropSpec[idx].propid = PropId;
  128. m_pAttrib[idx].vt = VT_EMPTY;
  129. m_pAttrib[idx].lAccessFlags = Access | SubType;
  130. if (pIdx)
  131. *pIdx = idx;
  132. Cleanup:
  133. return hr;
  134. }
  135. //
  136. // This function sends all the newly created properties to WIA
  137. //
  138. // Input:
  139. // pWiasContext -- pointer to the context passed to drvInitItemProperties
  140. //
  141. HRESULT
  142. CWiauPropertyList::SendToWia(BYTE *pWiasContext)
  143. {
  144. HRESULT hr = S_OK;
  145. REQUIRE_ARGS(!pWiasContext, hr, "SendToWia");
  146. if (m_NumProps == 0)
  147. {
  148. wiauDbgError("SendToWia", "No properties in the array, use DefineProperty");
  149. hr = E_FAIL;
  150. goto Cleanup;
  151. }
  152. //
  153. // Set the property names
  154. //
  155. hr = wiasSetItemPropNames(pWiasContext, m_NumProps, m_pId, m_pNames);
  156. REQUIRE_SUCCESS(hr, "SendToWia", "wiasSetItemPropNames failed");
  157. //
  158. // Set the default values for the properties
  159. //
  160. hr = wiasWriteMultiple(pWiasContext, m_NumProps, m_pPropSpec, m_pCurrent);
  161. REQUIRE_SUCCESS(hr, "SendToWia", "wiasWriteMultiple failed");
  162. //
  163. // Set property access and valid value info
  164. //
  165. hr = wiasSetItemPropAttribs(pWiasContext, m_NumProps, m_pPropSpec, m_pAttrib);
  166. REQUIRE_SUCCESS(hr, "SendToWia", "wiasSetItemPropAttribs failed");
  167. Cleanup:
  168. return hr;
  169. }
  170. //
  171. // This function can be used to reset the access and subtype of a property
  172. //
  173. // Input:
  174. // index -- the index into the arrays, pass in value returned from DefineProperty
  175. // Access -- determines access to the property, usually either
  176. // WIA_PROP_READ or WIA_PROP_RW
  177. // SubType -- indicates subtype of the property, usually either WIA_PROP_NONE,
  178. // WIA_PROP_RANGE, or WIA_PROP_LIST
  179. //
  180. HRESULT
  181. CWiauPropertyList::SetAccessSubType(INT index, ULONG Access, ULONG SubType)
  182. {
  183. HRESULT hr = S_OK;
  184. if (m_pAttrib == NULL)
  185. {
  186. hr = E_POINTER;
  187. }
  188. else if (index >= m_NumAlloc)
  189. {
  190. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  191. }
  192. if (hr == S_OK)
  193. {
  194. m_pAttrib[index].lAccessFlags = Access | SubType;
  195. }
  196. return hr;
  197. }
  198. //
  199. // Polymorphic function for setting the type and current, default, and valid values of a
  200. // property. This function handles flag properties.
  201. //
  202. // Input:
  203. // index -- the index into the arrays, pass in value returned from DefineProperty
  204. // defaultValue -- default setting of this property on the device
  205. // currentValue -- current setting of this property on the device
  206. // validFlags -- combination of all valid flags
  207. //
  208. HRESULT
  209. CWiauPropertyList::SetValidValues(INT index, LONG defaultValue, LONG currentValue, LONG validFlags)
  210. {
  211. HRESULT hr = S_OK;
  212. if ((m_pAttrib == NULL) ||
  213. (m_pCurrent == NULL))
  214. {
  215. hr = E_POINTER;
  216. }
  217. else if (index >= m_NumAlloc)
  218. {
  219. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  220. }
  221. if (hr == S_OK)
  222. {
  223. m_pAttrib[index].vt = VT_I4;
  224. m_pAttrib[index].ValidVal.Flag.Nom = defaultValue;
  225. m_pAttrib[index].ValidVal.Flag.ValidBits = validFlags;
  226. m_pAttrib[index].lAccessFlags |= WIA_PROP_FLAG;
  227. m_pCurrent[index].vt = VT_I4;
  228. m_pCurrent[index].lVal = currentValue;
  229. }
  230. return hr;
  231. }
  232. //
  233. // Polymorphic function for setting the type and current, default, and valid values of a
  234. // property. This function handles VT_I4 range.
  235. //
  236. // Input:
  237. // index -- the index into the arrays, pass in value returned from DefineProperty
  238. // defaultValue -- default setting of this property on the device
  239. // currentValue -- current setting of this property on the device
  240. // minValue -- minimum value for the range
  241. // maxValue -- maximum value for the range
  242. // stepValue -- step value for the range
  243. //
  244. HRESULT
  245. CWiauPropertyList::SetValidValues(INT index, LONG defaultValue, LONG currentValue,
  246. LONG minValue, LONG maxValue, LONG stepValue)
  247. {
  248. HRESULT hr = S_OK;
  249. if ((m_pAttrib == NULL) ||
  250. (m_pCurrent == NULL))
  251. {
  252. hr = E_POINTER;
  253. }
  254. else if (index >= m_NumAlloc)
  255. {
  256. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  257. }
  258. if (hr == S_OK)
  259. {
  260. m_pAttrib[index].vt = VT_I4;
  261. m_pAttrib[index].ValidVal.Range.Nom = defaultValue;
  262. m_pAttrib[index].ValidVal.Range.Min = minValue;
  263. m_pAttrib[index].ValidVal.Range.Max = maxValue;
  264. m_pAttrib[index].ValidVal.Range.Inc = stepValue;
  265. m_pAttrib[index].lAccessFlags |= WIA_PROP_RANGE;
  266. m_pCurrent[index].vt = VT_I4;
  267. m_pCurrent[index].lVal = currentValue;
  268. }
  269. return hr;
  270. }
  271. //
  272. // Polymorphic function for setting the type and current, default, and valid values of a
  273. // property. This function handles VT_I4 list.
  274. //
  275. // Input:
  276. // index -- the index into the arrays, pass in value returned from DefineProperty
  277. // defaultValue -- default setting of this property on the device
  278. // currentValue -- current setting of this property on the device
  279. // numValues -- number of values in the list
  280. // pValues -- pointer to the value list
  281. //
  282. HRESULT
  283. CWiauPropertyList::SetValidValues(INT index, LONG defaultValue, LONG currentValue,
  284. INT numValues, PLONG pValues)
  285. {
  286. HRESULT hr = S_OK;
  287. if ((m_pAttrib == NULL) ||
  288. (m_pCurrent == NULL))
  289. {
  290. hr = E_POINTER;
  291. }
  292. else if (index >= m_NumAlloc)
  293. {
  294. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  295. }
  296. if (hr == S_OK)
  297. {
  298. m_pAttrib[index].vt = VT_I4;
  299. m_pAttrib[index].ValidVal.List.Nom = defaultValue;
  300. m_pAttrib[index].ValidVal.List.cNumList = numValues;
  301. m_pAttrib[index].ValidVal.List.pList = (BYTE*)pValues;
  302. m_pAttrib[index].lAccessFlags |= WIA_PROP_LIST;
  303. m_pCurrent[index].vt = VT_I4;
  304. m_pCurrent[index].lVal = currentValue;
  305. }
  306. return hr;
  307. }
  308. //
  309. // Polymorphic function for setting the type and current, default, and valid values of a
  310. // property. This function handles VT_BSTR list.
  311. //
  312. // Input:
  313. // index -- the index into the arrays, pass in value returned from DefineProperty
  314. // defaultValue -- default setting of this property on the device
  315. // currentValue -- current setting of this property on the device
  316. // numValues -- number of values in the list
  317. // pValues -- pointer to the value list
  318. //
  319. HRESULT
  320. CWiauPropertyList::SetValidValues(INT index, BSTR defaultValue, BSTR currentValue,
  321. INT numValues, BSTR *pValues)
  322. {
  323. HRESULT hr = S_OK;
  324. if ((m_pAttrib == NULL) ||
  325. (m_pCurrent == NULL))
  326. {
  327. hr = E_POINTER;
  328. }
  329. else if (index >= m_NumAlloc)
  330. {
  331. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  332. }
  333. if (hr == S_OK)
  334. {
  335. m_pAttrib[index].vt = VT_BSTR;
  336. m_pAttrib[index].ValidVal.ListBStr.Nom = defaultValue;
  337. m_pAttrib[index].ValidVal.ListBStr.cNumList = numValues;
  338. m_pAttrib[index].ValidVal.ListBStr.pList = pValues;
  339. m_pAttrib[index].lAccessFlags |= WIA_PROP_LIST;
  340. m_pCurrent[index].vt = VT_BSTR;
  341. m_pCurrent[index].bstrVal = currentValue;
  342. }
  343. return hr;
  344. }
  345. //
  346. // Polymorphic function for setting the type and current, default, and valid values of a
  347. // property. This function handles VT_R4 range.
  348. //
  349. // Input:
  350. // index -- the index into the arrays, pass in value returned from DefineProperty
  351. // defaultValue -- default setting of this property on the device
  352. // currentValue -- current setting of this property on the device
  353. // minValue -- minimum value for the range
  354. // maxValue -- maximum value for the range
  355. // stepValue -- step value for the range
  356. //
  357. HRESULT
  358. CWiauPropertyList::SetValidValues(INT index, FLOAT defaultValue, FLOAT currentValue,
  359. FLOAT minValue, FLOAT maxValue, FLOAT stepValue)
  360. {
  361. HRESULT hr = S_OK;
  362. if ((m_pAttrib == NULL) ||
  363. (m_pCurrent == NULL))
  364. {
  365. hr = E_POINTER;
  366. }
  367. else if (index >= m_NumAlloc)
  368. {
  369. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  370. }
  371. if (hr == S_OK)
  372. {
  373. m_pAttrib[index].vt = VT_R4;
  374. m_pAttrib[index].ValidVal.RangeFloat.Nom = defaultValue;
  375. m_pAttrib[index].ValidVal.RangeFloat.Min = minValue;
  376. m_pAttrib[index].ValidVal.RangeFloat.Max = maxValue;
  377. m_pAttrib[index].ValidVal.RangeFloat.Inc = stepValue;
  378. m_pAttrib[index].lAccessFlags |= WIA_PROP_RANGE;
  379. m_pCurrent[index].vt = VT_R4;
  380. m_pCurrent[index].fltVal = currentValue;
  381. }
  382. return hr;
  383. }
  384. //
  385. // Polymorphic function for setting the type and current, default, and valid values of a
  386. // property. This function handles VT_R4 list.
  387. //
  388. // Input:
  389. // index -- the index into the arrays, pass in value returned from DefineProperty
  390. // defaultValue -- default setting of this property on the device
  391. // currentValue -- current setting of this property on the device
  392. // numValues -- number of values in the list
  393. // pValues -- pointer to the value list
  394. //
  395. HRESULT
  396. CWiauPropertyList::SetValidValues(INT index, FLOAT defaultValue, FLOAT currentValue,
  397. INT numValues, PFLOAT pValues)
  398. {
  399. HRESULT hr = S_OK;
  400. if ((m_pAttrib == NULL) ||
  401. (m_pCurrent == NULL))
  402. {
  403. hr = E_POINTER;
  404. }
  405. else if (index >= m_NumAlloc)
  406. {
  407. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  408. }
  409. if (hr == S_OK)
  410. {
  411. m_pAttrib[index].vt = VT_R4;
  412. m_pAttrib[index].ValidVal.ListFloat.Nom = defaultValue;
  413. m_pAttrib[index].ValidVal.ListFloat.cNumList = numValues;
  414. m_pAttrib[index].ValidVal.ListFloat.pList = (BYTE*)pValues;
  415. m_pAttrib[index].lAccessFlags |= WIA_PROP_LIST;
  416. m_pCurrent[index].vt = VT_R4;
  417. m_pCurrent[index].fltVal = currentValue;
  418. }
  419. return hr;
  420. }
  421. //
  422. // Polymorphic function for setting the type and current, default, and valid values of a
  423. // property. This function handles VT_CLSID list.
  424. //
  425. // Input:
  426. // index -- the index into the arrays, pass in value returned from DefineProperty
  427. // defaultValue -- default setting of this property on the device
  428. // currentValue -- current setting of this property on the device
  429. // numValues -- number of values in the list
  430. // pValues -- pointer to the value list
  431. //
  432. HRESULT
  433. CWiauPropertyList::SetValidValues(INT index, CLSID *defaultValue, CLSID *currentValue,
  434. INT numValues, CLSID **pValues)
  435. {
  436. HRESULT hr = S_OK;
  437. if ((m_pAttrib == NULL) ||
  438. (m_pCurrent == NULL) ||
  439. (defaultValue == NULL) ||
  440. (pValues == NULL))
  441. {
  442. hr = E_POINTER;
  443. }
  444. else if (index >= m_NumAlloc)
  445. {
  446. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  447. }
  448. if (hr == S_OK)
  449. {
  450. m_pAttrib[index].vt = VT_CLSID;
  451. m_pAttrib[index].ValidVal.ListGuid.Nom = *defaultValue;
  452. m_pAttrib[index].ValidVal.ListGuid.cNumList = numValues;
  453. m_pAttrib[index].ValidVal.ListGuid.pList = *pValues;
  454. m_pAttrib[index].lAccessFlags |= WIA_PROP_LIST;
  455. m_pCurrent[index].vt = VT_CLSID;
  456. m_pCurrent[index].puuid = currentValue;
  457. }
  458. return hr;
  459. }
  460. //
  461. // Polymorphic function for setting the type and current value for a VT_I4
  462. //
  463. // Input:
  464. // index -- the index into the arrays, pass in value returned from DefineProperty
  465. // value -- value to use for the current value
  466. //
  467. HRESULT
  468. CWiauPropertyList::SetCurrentValue(INT index, LONG value)
  469. {
  470. HRESULT hr = S_OK;
  471. if ((m_pAttrib == NULL) ||
  472. (m_pCurrent == NULL))
  473. {
  474. hr = E_POINTER;
  475. }
  476. else if (index >= m_NumAlloc)
  477. {
  478. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  479. }
  480. if (hr == S_OK)
  481. {
  482. m_pCurrent[index].vt = VT_I4;
  483. m_pAttrib[index].vt = VT_I4;
  484. m_pCurrent[index].lVal = value;
  485. }
  486. return hr;
  487. }
  488. //
  489. // Polymorphic function for setting the type and current value for a VT_BSTR
  490. //
  491. // Input:
  492. // index -- the index into the arrays, pass in value returned from DefineProperty
  493. // value -- value to use for the current value
  494. //
  495. HRESULT
  496. CWiauPropertyList::SetCurrentValue(INT index, BSTR value)
  497. {
  498. HRESULT hr = S_OK;
  499. if ((m_pAttrib == NULL) ||
  500. (m_pCurrent == NULL))
  501. {
  502. hr = E_POINTER;
  503. }
  504. else if (index >= m_NumAlloc)
  505. {
  506. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  507. }
  508. if (hr == S_OK)
  509. {
  510. m_pCurrent[index].vt = VT_BSTR;
  511. m_pAttrib[index].vt = VT_BSTR;
  512. m_pCurrent[index].bstrVal = value;
  513. }
  514. return hr;
  515. }
  516. //
  517. // Polymorphic function for setting the type and current value for a VT_R4
  518. //
  519. // Input:
  520. // index -- the index into the arrays, pass in value returned from DefineProperty
  521. // value -- value to use for the current value
  522. //
  523. HRESULT
  524. CWiauPropertyList::SetCurrentValue(INT index, FLOAT value)
  525. {
  526. HRESULT hr = S_OK;
  527. if ((m_pAttrib == NULL) ||
  528. (m_pCurrent == NULL))
  529. {
  530. hr = E_POINTER;
  531. }
  532. else if (index >= m_NumAlloc)
  533. {
  534. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  535. }
  536. if (hr == S_OK)
  537. {
  538. m_pCurrent[index].vt = VT_R4;
  539. m_pAttrib[index].vt = VT_R4;
  540. m_pCurrent[index].fltVal = value;
  541. }
  542. return hr;
  543. }
  544. //
  545. // Polymorphic function for setting the type and current value for a VT_CLSID
  546. //
  547. // Input:
  548. // index -- the index into the arrays, pass in value returned from DefineProperty
  549. // value -- value to use for the current value
  550. //
  551. HRESULT
  552. CWiauPropertyList::SetCurrentValue(INT index, CLSID *pValue)
  553. {
  554. HRESULT hr = S_OK;
  555. if ((m_pAttrib == NULL) ||
  556. (m_pCurrent == NULL))
  557. {
  558. hr = E_POINTER;
  559. }
  560. else if (index >= m_NumAlloc)
  561. {
  562. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  563. }
  564. if (hr == S_OK)
  565. {
  566. m_pCurrent[index].vt = VT_CLSID;
  567. m_pAttrib[index].vt = VT_CLSID;
  568. m_pCurrent[index].puuid = pValue;
  569. }
  570. return hr;
  571. }
  572. //
  573. // Polymorphic function for setting the type and current value for a property which holds a SYSTEMTIME
  574. //
  575. // Input:
  576. // index -- the index into the arrays, pass in value returned from DefineProperty
  577. // value -- value to use for the current value
  578. //
  579. HRESULT
  580. CWiauPropertyList::SetCurrentValue(INT index, PSYSTEMTIME value)
  581. {
  582. HRESULT hr = S_OK;
  583. if ((m_pAttrib == NULL) ||
  584. (m_pCurrent == NULL))
  585. {
  586. hr = E_POINTER;
  587. }
  588. else if (index >= m_NumAlloc)
  589. {
  590. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  591. }
  592. if (hr == S_OK)
  593. {
  594. m_pCurrent[index].vt = VT_UI2 | VT_VECTOR;
  595. m_pAttrib[index].vt = VT_UI2 | VT_VECTOR;
  596. m_pAttrib[index].lAccessFlags |= WIA_PROP_NONE;
  597. m_pCurrent[index].caui.cElems = sizeof(SYSTEMTIME)/sizeof(WORD);
  598. m_pCurrent[index].caui.pElems = (USHORT *) value;
  599. }
  600. return hr;
  601. }
  602. //
  603. // Polymorphic function for setting the type and current value for a property which holds a VT_UI1 vector
  604. //
  605. // Input:
  606. // index -- the index into the arrays, pass in value returned from DefineProperty
  607. // value -- value to use for the current value
  608. // size -- number of elements in the vector
  609. //
  610. HRESULT
  611. CWiauPropertyList::SetCurrentValue(INT index, BYTE *value, INT size)
  612. {
  613. HRESULT hr = S_OK;
  614. if ((m_pAttrib == NULL) ||
  615. (m_pCurrent == NULL))
  616. {
  617. hr = E_POINTER;
  618. }
  619. else if (index >= m_NumAlloc)
  620. {
  621. hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX);
  622. }
  623. if (hr == S_OK)
  624. {
  625. m_pCurrent[index].vt = VT_UI1 | VT_VECTOR;
  626. m_pAttrib[index].vt = VT_UI1 | VT_VECTOR;
  627. m_pCurrent[index].caub.cElems = size;
  628. m_pCurrent[index].caub.pElems = value;
  629. }
  630. return hr;
  631. }
  632. //
  633. // Finds the index given a property ID
  634. //
  635. INT
  636. CWiauPropertyList::LookupPropId(PROPID PropId)
  637. {
  638. for (int count = 0; count < m_NumProps; count++)
  639. {
  640. if (m_pId[count] == PropId)
  641. return count;
  642. }
  643. //
  644. // Value not found
  645. //
  646. return -1;
  647. }