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.

1142 lines
21 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. FaxOutgoingQueue.cpp
  5. Abstract:
  6. Implementation of CFaxOutgoingQueue
  7. Author:
  8. Iv Garber (IvG) Apr, 2000
  9. Revision History:
  10. --*/
  11. #include "stdafx.h"
  12. #include "FaxComEx.h"
  13. #include "FaxOutgoingQueue.h"
  14. #include "..\..\inc\FaxUIConstants.h"
  15. //
  16. //==================== GET DATE ===================================================
  17. //
  18. STDMETHODIMP
  19. CFaxOutgoingQueue::GetDate(
  20. FAX_TIME faxTime,
  21. DATE *pDate
  22. )
  23. /*++
  24. Routine name : CFaxOutgoingQueue::GetDate
  25. Routine description:
  26. Return the date
  27. Author:
  28. Iv Garber (IvG), June, 2000
  29. Arguments:
  30. faxTime [in] - time to convert from
  31. pDate [out] - Ptr to the Place to put the Date
  32. Return Value:
  33. Standard HRESULT code
  34. --*/
  35. {
  36. HRESULT hr = S_OK;
  37. DBG_ENTER (TEXT("CFaxOutgoingQueue::GetDate"), hr);
  38. //
  39. // Check that we can write to the given pointer
  40. //
  41. if (!pDate)
  42. {
  43. //
  44. // Got Bad Return Pointer
  45. //
  46. hr = E_POINTER;
  47. AtlReportError(CLSID_FaxOutgoingQueue, GetErrorMsgId(hr), IID_IFaxOutgoingQueue, hr);
  48. CALL_FAIL(GENERAL_ERR, _T("!pDate"), hr);
  49. return hr;
  50. }
  51. SYSTEMTIME sysTime = {0};
  52. sysTime.wHour = faxTime.Hour;
  53. sysTime.wMinute = faxTime.Minute;
  54. DATE dtResult = 0;
  55. if (sysTime.wHour == 0 && sysTime.wMinute == 0)
  56. {
  57. *pDate = dtResult;
  58. return hr;
  59. }
  60. if (!SystemTimeToVariantTime(&sysTime, &dtResult))
  61. {
  62. hr = E_FAIL;
  63. AtlReportError(CLSID_FaxOutgoingQueue,
  64. IDS_ERROR_OPERATION_FAILED,
  65. IID_IFaxOutgoingQueue,
  66. hr);
  67. CALL_FAIL(GENERAL_ERR, _T("SystemTimeToVariantTime"), hr);
  68. return hr;
  69. }
  70. *pDate = dtResult;
  71. return hr;
  72. }
  73. //
  74. //==================== SET DATE ==========================================
  75. //
  76. STDMETHODIMP
  77. CFaxOutgoingQueue::SetDate(
  78. DATE date,
  79. FAX_TIME *pfaxTime
  80. )
  81. /*++
  82. Routine name : CFaxOutgoingQueue::SetDate
  83. Routine description:
  84. Set new value for the given Time
  85. Author:
  86. Iv Garber (IvG), June, 2000
  87. Arguments:
  88. date [in] - the new Value for the date
  89. pfaxTime [in] - where to put the value
  90. Return Value:
  91. Standard HRESULT code
  92. --*/
  93. {
  94. HRESULT hr = S_OK;
  95. SYSTEMTIME sysTime;
  96. DBG_ENTER (_T("CFaxOutgoingQueue::SetDate"), hr);
  97. if (!VariantTimeToSystemTime(date, &sysTime))
  98. {
  99. hr = E_FAIL;
  100. AtlReportError(CLSID_FaxOutgoingQueue,
  101. IDS_ERROR_OPERATION_FAILED,
  102. IID_IFaxOutgoingQueue,
  103. hr);
  104. CALL_FAIL(GENERAL_ERR, _T("VariantTimeToSystemTime"), hr);
  105. return hr;
  106. }
  107. pfaxTime->Hour = sysTime.wHour;
  108. pfaxTime->Minute = sysTime.wMinute;
  109. return hr;
  110. }
  111. //
  112. //==================== DISCOUNT RATE END ==========================================
  113. //
  114. STDMETHODIMP
  115. CFaxOutgoingQueue::get_DiscountRateEnd(
  116. DATE *pdateDiscountRateEnd
  117. )
  118. /*++
  119. Routine name : CFaxOutgoingQueue::get_DiscountRateEnd
  120. Routine description:
  121. Return date when the Discount period begins
  122. Author:
  123. Iv Garber (IvG), May, 2000
  124. Arguments:
  125. pdateDiscountRateEnd [out] - Ptr to the Place to put the DiscountRateEnd
  126. Return Value:
  127. Standard HRESULT code
  128. --*/
  129. {
  130. HRESULT hr = S_OK;
  131. DBG_ENTER (TEXT("CFaxOutgoingQueue::get_DiscountRateEnd"), hr);
  132. //
  133. // sync first
  134. //
  135. if (!m_bInited)
  136. {
  137. hr = Refresh();
  138. if (FAILED(hr))
  139. {
  140. return hr;
  141. }
  142. }
  143. hr = GetDate(m_pConfig->dtDiscountEnd, pdateDiscountRateEnd);
  144. return hr;
  145. }
  146. STDMETHODIMP
  147. CFaxOutgoingQueue::put_DiscountRateEnd(
  148. DATE dateDiscountRateEnd
  149. )
  150. /*++
  151. Routine name : CFaxOutgoingQueue::put_DiscountRateEnd
  152. Routine description:
  153. Set new value Discount Rate End
  154. Author:
  155. Iv Garber (IvG), June, 2000
  156. Arguments:
  157. dateDiscountRateEnd [in] - the new Value for DiscountRateEnd
  158. Return Value:
  159. Standard HRESULT code
  160. --*/
  161. {
  162. HRESULT hr = S_OK;
  163. DBG_ENTER (_T("CFaxOutgoingQueue::put_DiscountRateEnd"), hr);
  164. //
  165. // sync first
  166. //
  167. if (!m_bInited)
  168. {
  169. hr = Refresh();
  170. if (FAILED(hr))
  171. {
  172. return hr;
  173. }
  174. }
  175. hr = SetDate(dateDiscountRateEnd, &(m_pConfig->dtDiscountEnd));
  176. return hr;
  177. }
  178. //
  179. //==================== DISCOUNT RATE START ==========================================
  180. //
  181. STDMETHODIMP
  182. CFaxOutgoingQueue::get_DiscountRateStart(
  183. DATE *pdateDiscountRateStart
  184. )
  185. /*++
  186. Routine name : CFaxOutgoingQueue::get_DiscountRateStart
  187. Routine description:
  188. Return date when the Discount period begins
  189. Author:
  190. Iv Garber (IvG), May, 2000
  191. Arguments:
  192. pdateDiscountRateStart [out] - Ptr to the Place to put the DiscountRateStart
  193. Return Value:
  194. Standard HRESULT code
  195. --*/
  196. {
  197. HRESULT hr = S_OK;
  198. DBG_ENTER (TEXT("CFaxOutgoingQueue::get_DiscountRateStart"), hr);
  199. //
  200. // sync first
  201. //
  202. if (!m_bInited)
  203. {
  204. hr = Refresh();
  205. if (FAILED(hr))
  206. {
  207. return hr;
  208. }
  209. }
  210. hr = GetDate(m_pConfig->dtDiscountStart, pdateDiscountRateStart);
  211. return hr;
  212. }
  213. STDMETHODIMP
  214. CFaxOutgoingQueue::put_DiscountRateStart(
  215. DATE dateDiscountRateStart
  216. )
  217. /*++
  218. Routine name : CFaxOutgoingQueue::put_DiscountRateStart
  219. Routine description:
  220. Set new value Discount Rate Start
  221. Author:
  222. Iv Garber (IvG), May, 2000
  223. Arguments:
  224. dateDiscountRateStart [in] - the new Value for DiscountRateStart
  225. Return Value:
  226. Standard HRESULT code
  227. --*/
  228. {
  229. HRESULT hr = S_OK;
  230. DBG_ENTER (_T("CFaxOutgoingQueue::put_DiscountRateStart"), hr);
  231. //
  232. // sync first
  233. //
  234. if (!m_bInited)
  235. {
  236. hr = Refresh();
  237. if (FAILED(hr))
  238. {
  239. return hr;
  240. }
  241. }
  242. hr = SetDate(dateDiscountRateStart, &(m_pConfig->dtDiscountStart));
  243. return hr;
  244. }
  245. //
  246. //==================== RETRY DELAY ==========================================
  247. //
  248. STDMETHODIMP
  249. CFaxOutgoingQueue::get_RetryDelay(
  250. long *plRetryDelay
  251. )
  252. /*++
  253. Routine name : CFaxOutgoingQueue::get_RetryDelay
  254. Routine description:
  255. Return number of RetryDelay
  256. Author:
  257. Iv Garber (IvG), May, 2000
  258. Arguments:
  259. plRetryDelay [out] - Ptr to the Place to put the number of RetryDelay
  260. Return Value:
  261. Standard HRESULT code
  262. --*/
  263. {
  264. HRESULT hr = S_OK;
  265. DBG_ENTER (TEXT("CFaxOutgoingQueue::get_RetryDelay"), hr);
  266. //
  267. // sync first
  268. //
  269. if (!m_bInited)
  270. {
  271. hr = Refresh();
  272. if (FAILED(hr))
  273. {
  274. return hr;
  275. }
  276. }
  277. hr = GetLong(plRetryDelay, m_pConfig->dwRetryDelay);
  278. if (FAILED(hr))
  279. {
  280. AtlReportError(CLSID_FaxOutgoingQueue,GetErrorMsgId(hr), IID_IFaxOutgoingQueue, hr);
  281. return hr;
  282. }
  283. return hr;
  284. }
  285. STDMETHODIMP
  286. CFaxOutgoingQueue::put_RetryDelay(
  287. long lRetryDelay
  288. )
  289. /*++
  290. Routine name : CFaxOutgoingQueue::put_RetryDelay
  291. Routine description:
  292. Set new value for this flag
  293. Author:
  294. Iv Garber (IvG), May, 2000
  295. Arguments:
  296. lRetryDelay [in] - the new Value of number of RetryDelay
  297. Return Value:
  298. Standard HRESULT code
  299. --*/
  300. {
  301. HRESULT hr = S_OK;
  302. DBG_ENTER (_T("CFaxOutgoingQueue::put_RetryDelay"), hr, _T("%ld"), lRetryDelay);
  303. //
  304. // sync first
  305. //
  306. if (!m_bInited)
  307. {
  308. hr = Refresh();
  309. if (FAILED(hr))
  310. {
  311. return hr;
  312. }
  313. }
  314. if (lRetryDelay > FXS_RETRYDELAY_UPPER || lRetryDelay < FXS_RETRYDELAY_LOWER)
  315. {
  316. //
  317. // Out of the Range
  318. //
  319. hr = E_INVALIDARG;
  320. AtlReportError(CLSID_FaxOutgoingQueue, IDS_ERROR_OUTOFRANGE, IID_IFaxOutgoingQueue, hr);
  321. CALL_FAIL(GENERAL_ERR, _T("Type is out of the Range"), hr);
  322. return hr;
  323. }
  324. m_pConfig->dwRetryDelay = lRetryDelay;
  325. return hr;
  326. }
  327. //
  328. //==================== AGE LIMIT ==========================================
  329. //
  330. STDMETHODIMP
  331. CFaxOutgoingQueue::get_AgeLimit(
  332. long *plAgeLimit
  333. )
  334. /*++
  335. Routine name : CFaxOutgoingQueue::get_AgeLimit
  336. Routine description:
  337. Return number of AgeLimit
  338. Author:
  339. Iv Garber (IvG), May, 2000
  340. Arguments:
  341. plAgeLimit [out] - Ptr to the Place to put the number of AgeLimit
  342. Return Value:
  343. Standard HRESULT code
  344. --*/
  345. {
  346. HRESULT hr = S_OK;
  347. DBG_ENTER (TEXT("CFaxOutgoingQueue::get_AgeLimit"), hr);
  348. //
  349. // sync first
  350. //
  351. if (!m_bInited)
  352. {
  353. hr = Refresh();
  354. if (FAILED(hr))
  355. {
  356. return hr;
  357. }
  358. }
  359. hr = GetLong(plAgeLimit, m_pConfig->dwAgeLimit);
  360. if (FAILED(hr))
  361. {
  362. AtlReportError(CLSID_FaxOutgoingQueue,GetErrorMsgId(hr), IID_IFaxOutgoingQueue, hr);
  363. return hr;
  364. }
  365. return hr;
  366. }
  367. STDMETHODIMP
  368. CFaxOutgoingQueue::put_AgeLimit(
  369. long lAgeLimit
  370. )
  371. /*++
  372. Routine name : CFaxOutgoingQueue::put_AgeLimit
  373. Routine description:
  374. Set new value for this flag
  375. Author:
  376. Iv Garber (IvG), May, 2000
  377. Arguments:
  378. lAgeLimit [in] - the new Value of number of AgeLimit
  379. Return Value:
  380. Standard HRESULT code
  381. --*/
  382. {
  383. HRESULT hr = S_OK;
  384. DBG_ENTER (_T("CFaxOutgoingQueue::put_AgeLimit"), hr, _T("%ld"), lAgeLimit);
  385. //
  386. // sync first
  387. //
  388. if (!m_bInited)
  389. {
  390. hr = Refresh();
  391. if (FAILED(hr))
  392. {
  393. return hr;
  394. }
  395. }
  396. m_pConfig->dwAgeLimit = lAgeLimit;
  397. return hr;
  398. }
  399. //
  400. //==================== RETRIES ==========================================
  401. //
  402. STDMETHODIMP
  403. CFaxOutgoingQueue::get_Retries(
  404. long *plRetries
  405. )
  406. /*++
  407. Routine name : CFaxOutgoingQueue::get_Retries
  408. Routine description:
  409. Return number of Retries
  410. Author:
  411. Iv Garber (IvG), May, 2000
  412. Arguments:
  413. plRetries [out] - Ptr to the Place to put the number of retries
  414. Return Value:
  415. Standard HRESULT code
  416. --*/
  417. {
  418. HRESULT hr = S_OK;
  419. DBG_ENTER (TEXT("CFaxOutgoingQueue::get_Retries"), hr);
  420. //
  421. // sync first
  422. //
  423. if (!m_bInited)
  424. {
  425. hr = Refresh();
  426. if (FAILED(hr))
  427. {
  428. return hr;
  429. }
  430. }
  431. hr = GetLong(plRetries, m_pConfig->dwRetries);
  432. if (FAILED(hr))
  433. {
  434. AtlReportError(CLSID_FaxOutgoingQueue,GetErrorMsgId(hr), IID_IFaxOutgoingQueue, hr);
  435. return hr;
  436. }
  437. return hr;
  438. }
  439. STDMETHODIMP
  440. CFaxOutgoingQueue::put_Retries(
  441. long lRetries
  442. )
  443. /*++
  444. Routine name : CFaxOutgoingQueue::put_Retries
  445. Routine description:
  446. Set new value for this flag
  447. Author:
  448. Iv Garber (IvG), May, 2000
  449. Arguments:
  450. lRetries [in] - the new Value of number of retries
  451. Return Value:
  452. Standard HRESULT code
  453. --*/
  454. {
  455. HRESULT hr = S_OK;
  456. DBG_ENTER (_T("CFaxOutgoingQueue::put_Retries"), hr, _T("%ld"), lRetries);
  457. //
  458. // sync first
  459. //
  460. if (!m_bInited)
  461. {
  462. hr = Refresh();
  463. if (FAILED(hr))
  464. {
  465. return hr;
  466. }
  467. }
  468. if (lRetries > FXS_RETRIES_UPPER || lRetries < FXS_RETRIES_LOWER)
  469. {
  470. //
  471. // Out of the Range
  472. //
  473. hr = E_INVALIDARG;
  474. AtlReportError(CLSID_FaxOutgoingQueue, IDS_ERROR_OUTOFRANGE, IID_IFaxOutgoingQueue, hr);
  475. CALL_FAIL(GENERAL_ERR, _T("Type is out of the Range"), hr);
  476. return hr;
  477. }
  478. m_pConfig->dwRetries = lRetries;
  479. return hr;
  480. }
  481. //
  482. //==================== BRANDING ==========================================
  483. //
  484. STDMETHODIMP
  485. CFaxOutgoingQueue::get_Branding(
  486. VARIANT_BOOL *pbBranding
  487. )
  488. /*++
  489. Routine name : CFaxOutgoingQueue::get_Branding
  490. Routine description:
  491. Return Flag indicating whether Branding exists
  492. Author:
  493. Iv Garber (IvG), May, 2000
  494. Arguments:
  495. pbBranding [out] - Ptr to the Place to put Current value of the Flag
  496. Return Value:
  497. Standard HRESULT code
  498. --*/
  499. {
  500. HRESULT hr = S_OK;
  501. DBG_ENTER (TEXT("CFaxOutgoingQueue::get_Branding"), hr);
  502. //
  503. // sync first
  504. //
  505. if (!m_bInited)
  506. {
  507. hr = Refresh();
  508. if (FAILED(hr))
  509. {
  510. return hr;
  511. }
  512. }
  513. hr = GetVariantBool(pbBranding, bool2VARIANT_BOOL(m_pConfig->bBranding));
  514. if (FAILED(hr))
  515. {
  516. AtlReportError(CLSID_FaxOutgoingQueue,GetErrorMsgId(hr), IID_IFaxOutgoingQueue, hr);
  517. return hr;
  518. }
  519. return hr;
  520. }
  521. STDMETHODIMP
  522. CFaxOutgoingQueue::put_Branding(
  523. VARIANT_BOOL bBranding
  524. )
  525. /*++
  526. Routine name : CFaxOutgoingQueue::put_Branding
  527. Routine description:
  528. Set new value for this flag
  529. Author:
  530. Iv Garber (IvG), May, 2000
  531. Arguments:
  532. bBranding [in] - the new Value for the Flag
  533. Return Value:
  534. Standard HRESULT code
  535. --*/
  536. {
  537. HRESULT hr = S_OK;
  538. DBG_ENTER (_T("CFaxOutgoingQueue::put_Branding"), hr, _T("%d"), bBranding);
  539. //
  540. // sync first
  541. //
  542. if (!m_bInited)
  543. {
  544. hr = Refresh();
  545. if (FAILED(hr))
  546. {
  547. return hr;
  548. }
  549. }
  550. m_pConfig->bBranding = VARIANT_BOOL2bool(bBranding);
  551. return hr;
  552. }
  553. //
  554. //==================== USE DEVICE TSID ==========================================
  555. //
  556. STDMETHODIMP
  557. CFaxOutgoingQueue::get_UseDeviceTSID(
  558. VARIANT_BOOL *pbUseDeviceTSID
  559. )
  560. /*++
  561. Routine name : CFaxOutgoingQueue::get_UseDeviceTSID
  562. Routine description:
  563. Return Flag indicating whether to use device TSID
  564. Author:
  565. Iv Garber (IvG), May, 2000
  566. Arguments:
  567. pbUseDeviceTSID [out] - Ptr to the Place to put Current value of the Flag
  568. Return Value:
  569. Standard HRESULT code
  570. --*/
  571. {
  572. HRESULT hr = S_OK;
  573. DBG_ENTER (TEXT("CFaxOutgoingQueue::get_UseDeviceTSID"), hr);
  574. //
  575. // sync first
  576. //
  577. if (!m_bInited)
  578. {
  579. hr = Refresh();
  580. if (FAILED(hr))
  581. {
  582. return hr;
  583. }
  584. }
  585. hr = GetVariantBool(pbUseDeviceTSID, bool2VARIANT_BOOL(m_pConfig->bUseDeviceTSID));
  586. if (FAILED(hr))
  587. {
  588. AtlReportError(CLSID_FaxOutgoingQueue,GetErrorMsgId(hr), IID_IFaxOutgoingQueue, hr);
  589. return hr;
  590. }
  591. return hr;
  592. }
  593. STDMETHODIMP
  594. CFaxOutgoingQueue::put_UseDeviceTSID(
  595. VARIANT_BOOL bUseDeviceTSID
  596. )
  597. /*++
  598. Routine name : CFaxOutgoingQueue::put_UseDeviceTSID
  599. Routine description:
  600. Set new value for this flag
  601. Author:
  602. Iv Garber (IvG), May, 2000
  603. Arguments:
  604. bUseDeviceTSID [in] - the new Value for the Flag
  605. Return Value:
  606. Standard HRESULT code
  607. --*/
  608. {
  609. HRESULT hr = S_OK;
  610. DBG_ENTER (_T("CFaxOutgoingQueue::put_UseDeviceTSID"), hr, _T("%d"), bUseDeviceTSID);
  611. //
  612. // sync first
  613. //
  614. if (!m_bInited)
  615. {
  616. hr = Refresh();
  617. if (FAILED(hr))
  618. {
  619. return hr;
  620. }
  621. }
  622. m_pConfig->bUseDeviceTSID = VARIANT_BOOL2bool(bUseDeviceTSID);
  623. return hr;
  624. }
  625. //
  626. //==================== ALLOW PERSONAL COVER PAGES ==========================================
  627. //
  628. STDMETHODIMP
  629. CFaxOutgoingQueue::get_AllowPersonalCoverPages(
  630. VARIANT_BOOL *pbAllowPersonalCoverPages
  631. )
  632. /*++
  633. Routine name : CFaxOutgoingQueue::get_AllowPersonalCoverPages
  634. Routine description:
  635. Return Flag indicating whether Personal Cover Pages are allowed
  636. Author:
  637. Iv Garber (IvG), May, 2000
  638. Arguments:
  639. pbAllowPersonalCoverPages [out] - Ptr to the Place to put Current value of the Flag
  640. Return Value:
  641. Standard HRESULT code
  642. --*/
  643. {
  644. HRESULT hr = S_OK;
  645. DBG_ENTER (TEXT("CFaxOutgoingQueue::get_AllowPersonalCoverPages"), hr);
  646. //
  647. // sync first
  648. //
  649. if (!m_bInited)
  650. {
  651. hr = Refresh();
  652. if (FAILED(hr))
  653. {
  654. return hr;
  655. }
  656. }
  657. hr = GetVariantBool(pbAllowPersonalCoverPages, bool2VARIANT_BOOL(m_pConfig->bAllowPersonalCP));
  658. if (FAILED(hr))
  659. {
  660. AtlReportError(CLSID_FaxOutgoingQueue,GetErrorMsgId(hr), IID_IFaxOutgoingQueue, hr);
  661. return hr;
  662. }
  663. return hr;
  664. }
  665. STDMETHODIMP
  666. CFaxOutgoingQueue::put_AllowPersonalCoverPages(
  667. VARIANT_BOOL bAllowPersonalCoverPages
  668. )
  669. /*++
  670. Routine name : CFaxOutgoingQueue::put_AllowPersonalCoverPages
  671. Routine description:
  672. Set new value for this flag
  673. Author:
  674. Iv Garber (IvG), May, 2000
  675. Arguments:
  676. bAllowPersonalCoverPages [in] - the new Value for the Flag
  677. Return Value:
  678. Standard HRESULT code
  679. --*/
  680. {
  681. HRESULT hr = S_OK;
  682. DBG_ENTER (_T("CFaxOutgoingQueue::put_AllowPersonalCoverPages"), hr, _T("%d"), bAllowPersonalCoverPages);
  683. //
  684. // sync first
  685. //
  686. if (!m_bInited)
  687. {
  688. hr = Refresh();
  689. if (FAILED(hr))
  690. {
  691. return hr;
  692. }
  693. }
  694. m_pConfig->bAllowPersonalCP = VARIANT_BOOL2bool(bAllowPersonalCoverPages);
  695. return hr;
  696. }
  697. //
  698. //==================== SAVE ==============================================
  699. //
  700. STDMETHODIMP
  701. CFaxOutgoingQueue::Save(
  702. )
  703. /*++
  704. Routine name : CFaxOutgoingQueue::Save
  705. Routine description:
  706. Save current Outgoing Queue Configuration to the Server.
  707. Author:
  708. Iv Garber (IvG), May, 2000
  709. Return Value:
  710. Standard HRESULT code
  711. --*/
  712. {
  713. HRESULT hr = S_OK;
  714. DBG_ENTER (TEXT("CFaxOutgoingQueue::Save"), hr);
  715. //
  716. // Get Fax Handle
  717. //
  718. HANDLE hFaxHandle = NULL;
  719. hr = GetFaxHandle(&hFaxHandle);
  720. if (FAILED(hr))
  721. {
  722. AtlReportError(CLSID_FaxOutgoingQueue,
  723. GetErrorMsgId(hr),
  724. IID_IFaxOutgoingQueue,
  725. hr);
  726. return hr;
  727. }
  728. //
  729. // Save Outgoing Queue Configuration
  730. //
  731. if (!FaxSetOutboxConfiguration(hFaxHandle, m_pConfig))
  732. {
  733. hr = Fax_HRESULT_FROM_WIN32(GetLastError());
  734. CALL_FAIL(GENERAL_ERR, _T("FaxSetOutboxConfiguration"), hr);
  735. AtlReportError(CLSID_FaxOutgoingQueue,
  736. GetErrorMsgId(hr),
  737. IID_IFaxOutgoingQueue,
  738. hr);
  739. return hr;
  740. }
  741. //
  742. // Save Paused and Blocked as well
  743. //
  744. hr = CFaxQueueInner<IFaxOutgoingQueue, &IID_IFaxOutgoingQueue, &CLSID_FaxOutgoingQueue, false,
  745. IFaxOutgoingJob, CFaxOutgoingJob, IFaxOutgoingJobs, CFaxOutgoingJobs>::Save();
  746. return hr;
  747. }
  748. //
  749. //==================== REFRESH ==============================================
  750. //
  751. STDMETHODIMP
  752. CFaxOutgoingQueue::Refresh(
  753. )
  754. /*++
  755. Routine name : CFaxOutgoingQueue::Refresh
  756. Routine description:
  757. Bring Outgoing Queue Configuration from the Server.
  758. Author:
  759. Iv Garber (IvG), May, 2000
  760. Return Value:
  761. Standard HRESULT code
  762. --*/
  763. {
  764. HRESULT hr = S_OK;
  765. DBG_ENTER (TEXT("CFaxOutgoingQueue::Refresh"), hr);
  766. //
  767. // Get Fax Handle
  768. //
  769. HANDLE hFaxHandle = NULL;
  770. hr = GetFaxHandle(&hFaxHandle);
  771. if (FAILED(hr))
  772. {
  773. AtlReportError(CLSID_FaxOutgoingQueue,
  774. GetErrorMsgId(hr),
  775. IID_IFaxOutgoingQueue,
  776. hr);
  777. return hr;
  778. }
  779. //
  780. // Get Outgoing Queue Configuration
  781. //
  782. if (!FaxGetOutboxConfiguration(hFaxHandle, &m_pConfig))
  783. {
  784. hr = Fax_HRESULT_FROM_WIN32(GetLastError());
  785. CALL_FAIL(GENERAL_ERR, _T("FaxGetOutboxConfiguration"), hr);
  786. AtlReportError(CLSID_FaxOutgoingQueue,
  787. GetErrorMsgId(hr),
  788. IID_IFaxOutgoingQueue,
  789. hr);
  790. return hr;
  791. }
  792. if (!m_pConfig || m_pConfig->dwSizeOfStruct != sizeof(FAX_OUTBOX_CONFIG))
  793. {
  794. //
  795. // Failed to Get Outgoing Queue Configuration
  796. //
  797. hr = E_FAIL;
  798. AtlReportError(CLSID_FaxOutgoingQueue,
  799. IDS_ERROR_OPERATION_FAILED,
  800. IID_IFaxOutgoingQueue,
  801. hr);
  802. CALL_FAIL(GENERAL_ERR, _T("Invalid m_pConfig"), hr);
  803. return hr;
  804. }
  805. //
  806. // Refresh Paused and Blocked as well
  807. //
  808. hr = CFaxQueueInner<IFaxOutgoingQueue, &IID_IFaxOutgoingQueue, &CLSID_FaxOutgoingQueue, false,
  809. IFaxOutgoingJob, CFaxOutgoingJob, IFaxOutgoingJobs, CFaxOutgoingJobs>::Refresh();
  810. if (SUCCEEDED(hr))
  811. {
  812. //
  813. // We are synced now
  814. //
  815. m_bInited = true;
  816. }
  817. return hr;
  818. }
  819. //
  820. //==================== INTERFACE SUPPORT ERROR INFO =====================
  821. //
  822. STDMETHODIMP
  823. CFaxOutgoingQueue::InterfaceSupportsErrorInfo(
  824. REFIID riid
  825. )
  826. /*++
  827. Routine name : CFaxOutgoingQueue::InterfaceSupportsErrorInfo
  828. Routine description:
  829. ATL's implementation of Interface Support Error Info
  830. Author:
  831. Iv Garber (IvG), Apr, 2000
  832. Arguments:
  833. riid [in] - Reference of the Interface
  834. Return Value:
  835. Standard HRESULT code
  836. --*/
  837. {
  838. static const IID* arr[] =
  839. {
  840. &IID_IFaxOutgoingQueue
  841. };
  842. for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  843. {
  844. if (InlineIsEqualGUID(*arr[i],riid))
  845. return S_OK;
  846. }
  847. return S_FALSE;
  848. }