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.

1807 lines
32 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. FaxPersonalProfile.cpp
  5. Abstract:
  6. Implementation of Fax Personal Profile
  7. Author:
  8. Iv Garber (IvG) Apr, 2000
  9. Revision History:
  10. --*/
  11. #include "stdafx.h"
  12. #include "FaxComEx.h"
  13. #include "FaxPersonalProfile.h"
  14. #include "..\..\inc\FaxUIConstants.h"
  15. //
  16. //===================== GET PROFILE DATA =====================================
  17. //
  18. STDMETHODIMP
  19. CFaxPersonalProfile::GetProfileData(
  20. FAX_PERSONAL_PROFILE *pProfileData
  21. )
  22. /*++
  23. Routine name : CFaxPersonalProfile::GetProfileData
  24. Routine description:
  25. Fills the pProfileData with the data of the object.
  26. Author:
  27. Iv Garber (IvG), May, 2000
  28. Arguments:
  29. pProfileData [out] - the FAX_PERSONAL_PROFILE struct to fill
  30. Return Value:
  31. Standard HRESULT code
  32. --*/
  33. {
  34. HRESULT hr = S_OK;
  35. DBG_ENTER (TEXT("CFaxPersonalProfile::GetProfileData"), hr);
  36. if (::IsBadWritePtr(pProfileData, sizeof(FAX_PERSONAL_PROFILE)))
  37. {
  38. //
  39. // Bad Return OR Interface Pointer
  40. //
  41. hr = E_POINTER;
  42. CALL_FAIL(GENERAL_ERR, _T("::IsBadWritePtr()"), hr);
  43. return hr;
  44. }
  45. pProfileData->dwSizeOfStruct = sizeof(FAX_PERSONAL_PROFILE);
  46. pProfileData->lptstrCity = m_bstrCity;
  47. pProfileData->lptstrCompany = m_bstrCompany;
  48. pProfileData->lptstrCountry = m_bstrCountry;
  49. pProfileData->lptstrEmail = m_bstrEmail;
  50. pProfileData->lptstrName = m_bstrName;
  51. pProfileData->lptstrState = m_bstrState;
  52. pProfileData->lptstrTitle = m_bstrTitle;
  53. pProfileData->lptstrTSID = m_bstrTSID;
  54. pProfileData->lptstrZip = m_bstrZipCode;
  55. pProfileData->lptstrFaxNumber = m_bstrFaxNumber;
  56. pProfileData->lptstrHomePhone = m_bstrHomePhone;
  57. pProfileData->lptstrDepartment = m_bstrDepartment;
  58. pProfileData->lptstrBillingCode = m_bstrBillingCode;
  59. pProfileData->lptstrOfficePhone = m_bstrOfficePhone;
  60. pProfileData->lptstrOfficeLocation = m_bstrOfficeLocation;
  61. pProfileData->lptstrStreetAddress = m_bstrStreetAddress;
  62. return hr;
  63. }
  64. //
  65. //============== PUT PROFILE DATA ============================================
  66. //
  67. STDMETHODIMP
  68. CFaxPersonalProfile::PutProfileData(
  69. FAX_PERSONAL_PROFILE *pProfileData
  70. )
  71. /*++
  72. Routine name : CFaxPersonalProfile::PutProfileData
  73. Routine description:
  74. Receives FAX_PERSONAL_PROFILE structure and fills the Object's fields.
  75. Author:
  76. Iv Garber (IvG), May, 2000
  77. Arguments:
  78. pProfileData [in] - the data to put into the object's variables
  79. Return Value:
  80. Standard HRESULT code
  81. --*/
  82. {
  83. HRESULT hr = S_OK;
  84. DBG_ENTER (TEXT("CFaxPersonalProfile::PutProfileData"), hr);
  85. m_bstrCity = pProfileData->lptstrCity;
  86. m_bstrCompany = pProfileData->lptstrCompany;
  87. m_bstrCountry = pProfileData->lptstrCountry;
  88. m_bstrEmail = pProfileData->lptstrEmail;
  89. m_bstrHomePhone = pProfileData->lptstrHomePhone;
  90. m_bstrFaxNumber = pProfileData->lptstrFaxNumber;
  91. m_bstrName = pProfileData->lptstrName;
  92. m_bstrState = pProfileData->lptstrState;
  93. m_bstrZipCode = pProfileData->lptstrZip;
  94. m_bstrTitle = pProfileData->lptstrTitle;
  95. m_bstrTSID = pProfileData->lptstrTSID;
  96. m_bstrBillingCode = pProfileData->lptstrBillingCode;
  97. m_bstrDepartment = pProfileData->lptstrDepartment;
  98. m_bstrStreetAddress = pProfileData->lptstrStreetAddress;
  99. m_bstrOfficePhone = pProfileData->lptstrOfficePhone;
  100. m_bstrOfficeLocation = pProfileData->lptstrOfficeLocation;
  101. if ((pProfileData->lptstrCity && !m_bstrCity) ||
  102. (pProfileData->lptstrCompany && !m_bstrCompany) ||
  103. (pProfileData->lptstrCountry && !m_bstrCountry) ||
  104. (pProfileData->lptstrEmail && !m_bstrEmail) ||
  105. (pProfileData->lptstrHomePhone && !m_bstrHomePhone) ||
  106. (pProfileData->lptstrFaxNumber && !m_bstrFaxNumber) ||
  107. (pProfileData->lptstrName && !m_bstrName) ||
  108. (pProfileData->lptstrState && !m_bstrState) ||
  109. (pProfileData->lptstrZip && !m_bstrZipCode) ||
  110. (pProfileData->lptstrTSID && !m_bstrTSID) ||
  111. (pProfileData->lptstrBillingCode && !m_bstrBillingCode) ||
  112. (pProfileData->lptstrDepartment && !m_bstrDepartment) ||
  113. (pProfileData->lptstrStreetAddress && !m_bstrStreetAddress) ||
  114. (pProfileData->lptstrOfficePhone && !m_bstrOfficePhone) ||
  115. (pProfileData->lptstrOfficeLocation && !m_bstrOfficeLocation))
  116. {
  117. //
  118. // Not enough memory
  119. //
  120. hr = E_OUTOFMEMORY;
  121. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator=()"), hr);
  122. }
  123. return hr;
  124. }
  125. //
  126. //==================== DEFAULT SENDER ===================================
  127. //
  128. STDMETHODIMP
  129. CFaxPersonalProfile::LoadDefaultSender (
  130. )
  131. /*++
  132. Routine name : CFaxPersonalProfile::LoadDefaultSender
  133. Routine description:
  134. Load Default Sender Information from the local Registry
  135. Author:
  136. Iv Garber (IvG), Apr, 2000
  137. Arguments:
  138. NONE
  139. Return Value:
  140. Standard HRESULT code
  141. --*/
  142. {
  143. FAX_PERSONAL_PROFILE DefaultSenderProfile;
  144. HRESULT hr;
  145. DBG_ENTER (TEXT("CFaxPersonalProfile::LoadDefaultSender"), hr);
  146. DefaultSenderProfile.dwSizeOfStruct = sizeof(FAX_PERSONAL_PROFILE);
  147. hr = FaxGetSenderInformation(&DefaultSenderProfile);
  148. if (FAILED(hr))
  149. {
  150. //
  151. // Failed to get Sender Information
  152. //
  153. AtlReportError(CLSID_FaxPersonalProfile,
  154. GetErrorMsgId(hr),
  155. IID_IFaxPersonalProfile,
  156. hr);
  157. CALL_FAIL(GENERAL_ERR, _T("FaxGetSenderInformation()"), hr);
  158. return hr;
  159. }
  160. hr = PutProfileData(&DefaultSenderProfile);
  161. if (FAILED(hr))
  162. {
  163. //
  164. // Not Enough Memory
  165. //
  166. AtlReportError(CLSID_FaxPersonalProfile,
  167. IDS_ERROR_OUTOFMEMORY,
  168. IID_IFaxPersonalProfile,
  169. hr);
  170. //
  171. // no return, we still need to free information
  172. //
  173. }
  174. HRESULT hr1 = FaxFreeSenderInformation(&DefaultSenderProfile);
  175. if (FAILED(hr1))
  176. {
  177. hr = hr1;
  178. CALL_FAIL(GENERAL_ERR, _T("FaxFreeSenderInformation()"), hr);
  179. return hr;
  180. }
  181. return hr;
  182. }
  183. //
  184. // SaveAs
  185. //
  186. STDMETHODIMP
  187. CFaxPersonalProfile::SaveDefaultSender (
  188. )
  189. /*++
  190. Routine name : CFaxPersonalProfile::SaveDefaultSender
  191. Routine description:
  192. Save current Profile as the Default in the Local Registry
  193. Author:
  194. Iv Garber (IvG), Apr, 2000
  195. Arguments:
  196. NONE
  197. Return Value:
  198. Standard HRESULT code
  199. --*/
  200. {
  201. FAX_PERSONAL_PROFILE DefaultSenderProfile;
  202. HRESULT hr;
  203. DBG_ENTER (TEXT("CFaxPersonalProfile::SaveDefaultSender"), hr);
  204. hr = GetProfileData(&DefaultSenderProfile);
  205. ATLASSERT(SUCCEEDED(hr));
  206. hr = FaxSetSenderInformation(&DefaultSenderProfile);
  207. if (FAILED(hr))
  208. {
  209. AtlReportError(CLSID_FaxPersonalProfile,
  210. GetErrorMsgId(hr),
  211. IID_IFaxPersonalProfile,
  212. hr);
  213. CALL_FAIL(GENERAL_ERR, _T("FaxSetSenderInformation()"), hr);
  214. return hr;
  215. }
  216. return hr;
  217. }
  218. //
  219. //==================== INTERFACE SUPPORT ERROR INFO =====================
  220. //
  221. STDMETHODIMP
  222. CFaxPersonalProfile::InterfaceSupportsErrorInfo (
  223. REFIID riid
  224. )
  225. /*++
  226. Routine name : CFaxPersonalProfile::InterfaceSupportsErrorInfo
  227. Routine description:
  228. ATL's implementation of Support Error Info
  229. Author:
  230. Iv Garber (IvG), Apr, 2000
  231. Arguments:
  232. riid [in] - Interface ID
  233. Return Value:
  234. Standard HRESULT code
  235. --*/
  236. {
  237. static const IID* arr[] =
  238. {
  239. &IID_IFaxPersonalProfile
  240. };
  241. for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
  242. {
  243. if (InlineIsEqualGUID(*arr[i],riid))
  244. return S_OK;
  245. }
  246. return S_FALSE;
  247. }
  248. //
  249. //==================== CREATE ========================================
  250. //
  251. HRESULT
  252. CFaxPersonalProfile::Create (
  253. IFaxPersonalProfile **ppPersonalProfile
  254. )
  255. /*++
  256. Routine name : CFaxPersonalProfile::Create
  257. Routine description:
  258. Static function to create the Fax Personal Profile Instance
  259. Author:
  260. Iv Garber (IvG), Apr, 2000
  261. Arguments:
  262. ppPersonalProfile [out] -- the new Fax Personal Profile Instance
  263. Return Value:
  264. Standard HRESULT code
  265. --*/
  266. {
  267. CComObject<CFaxPersonalProfile> *pClass;
  268. HRESULT hr = S_OK;
  269. DBG_ENTER (TEXT("CFaxPersonalProfile::Create"), hr);
  270. hr = CComObject<CFaxPersonalProfile>::CreateInstance(&pClass);
  271. if (FAILED(hr))
  272. {
  273. //
  274. // Failed to create Instance
  275. //
  276. CALL_FAIL(GENERAL_ERR, _T("CComObject<CFaxPersonalProfile>::CreateInstance()"), hr);
  277. return hr;
  278. }
  279. hr = pClass->QueryInterface(__uuidof(IFaxPersonalProfile), (void **) ppPersonalProfile);
  280. if (FAILED(hr))
  281. {
  282. //
  283. // Failed to Query Personal Profile Interface
  284. //
  285. CALL_FAIL(GENERAL_ERR, _T("QueryInterface()"), hr);
  286. return hr;
  287. }
  288. return hr;
  289. }
  290. //
  291. //==================== BILLING CODE ========================================
  292. //
  293. STDMETHODIMP
  294. CFaxPersonalProfile::get_BillingCode(
  295. BSTR *pbstrBillingCode
  296. )
  297. /*++
  298. Routine name : CFaxPersonalProfile::get_BillingCode
  299. Routine description:
  300. return Billing Code
  301. Author:
  302. Iv Garber (IvG), Apr, 2000
  303. Arguments:
  304. pbstrBillingCode [out] - the Billing Code
  305. Return Value:
  306. Standard HRESULT code
  307. --*/
  308. {
  309. HRESULT hr = S_OK;
  310. DBG_ENTER (TEXT("CFaxPersonalProfile::get_BillingCode"), hr);
  311. hr = GetBstr(pbstrBillingCode, m_bstrBillingCode);
  312. if (FAILED(hr))
  313. {
  314. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  315. return hr;
  316. }
  317. return hr;
  318. }
  319. STDMETHODIMP
  320. CFaxPersonalProfile::put_BillingCode (
  321. BSTR bstrBillingCode
  322. )
  323. /*++
  324. Routine name : CFaxPersonalProfile::put_BillingCode
  325. Routine description:
  326. Set Billing Code
  327. Author:
  328. Iv Garber (IvG), Apr, 2000
  329. Arguments:
  330. bstrBillingCode [in] - new Billing Code value
  331. Return Value:
  332. Standard HRESULT code
  333. --*/
  334. {
  335. HRESULT hr = S_OK;
  336. DBG_ENTER (_T("CFaxPersonalProfile::put_BillingCode"),
  337. hr,
  338. _T("%s"),
  339. bstrBillingCode);
  340. m_bstrBillingCode = bstrBillingCode;
  341. if (bstrBillingCode && !m_bstrBillingCode)
  342. {
  343. //
  344. // Not enough memory
  345. //
  346. hr = E_OUTOFMEMORY;
  347. AtlReportError(CLSID_FaxPersonalProfile,
  348. IDS_ERROR_OUTOFMEMORY,
  349. IID_IFaxPersonalProfile,
  350. hr);
  351. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  352. return hr;
  353. }
  354. return hr;
  355. }
  356. //
  357. //==================== CITY ========================================
  358. //
  359. STDMETHODIMP
  360. CFaxPersonalProfile::get_City(
  361. BSTR *pbstrCity
  362. )
  363. /*++
  364. Routine name : CFaxPersonalProfile::get_City
  365. Routine description:
  366. return City
  367. Author:
  368. Iv Garber (IvG), Apr, 2000
  369. Arguments:
  370. pbstrCity [out] - the City
  371. Return Value:
  372. Standard HRESULT code
  373. --*/
  374. {
  375. HRESULT hr = S_OK;
  376. DBG_ENTER (TEXT("CFaxPersonalProfile::get_City"), hr);
  377. hr = GetBstr(pbstrCity, m_bstrCity);
  378. if (FAILED(hr))
  379. {
  380. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  381. return hr;
  382. }
  383. return hr;
  384. }
  385. STDMETHODIMP
  386. CFaxPersonalProfile::put_City (
  387. BSTR bstrCity
  388. )
  389. /*++
  390. Routine name : CFaxPersonalProfile::put_City
  391. Routine description:
  392. Set City
  393. Author:
  394. Iv Garber (IvG), Apr, 2000
  395. Arguments:
  396. bstrCity [in] - new City value
  397. Return Value:
  398. Standard HRESULT code
  399. --*/
  400. {
  401. HRESULT hr = S_OK;
  402. DBG_ENTER (_T("CFaxPersonalProfile::put_City"), hr, _T("%s"), bstrCity);
  403. m_bstrCity = bstrCity;
  404. if (!m_bstrCity && bstrCity)
  405. {
  406. //
  407. // Not enough memory
  408. //
  409. hr = E_OUTOFMEMORY;
  410. AtlReportError(CLSID_FaxPersonalProfile,
  411. IDS_ERROR_OUTOFMEMORY,
  412. IID_IFaxPersonalProfile,
  413. hr);
  414. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  415. return hr;
  416. }
  417. return hr;
  418. }
  419. //
  420. //==================== COMPANY ========================================
  421. //
  422. STDMETHODIMP
  423. CFaxPersonalProfile::get_Company(
  424. BSTR *pbstrCompany
  425. )
  426. /*++
  427. Routine name : CFaxPersonalProfile::get_Company
  428. Routine description:
  429. return Company
  430. Author:
  431. Iv Garber (IvG), Apr, 2000
  432. Arguments:
  433. pbstrCompany [out] - the Company
  434. Return Value:
  435. Standard HRESULT code
  436. --*/
  437. {
  438. HRESULT hr = S_OK;
  439. DBG_ENTER (TEXT("CFaxPersonalProfile::get_Company"), hr);
  440. hr = GetBstr(pbstrCompany, m_bstrCompany);
  441. if (FAILED(hr))
  442. {
  443. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  444. return hr;
  445. }
  446. return hr;
  447. }
  448. STDMETHODIMP
  449. CFaxPersonalProfile::put_Company (
  450. BSTR bstrCompany
  451. )
  452. /*++
  453. Routine name : CFaxPersonalProfile::put_Company
  454. Routine description:
  455. Set Company
  456. Author:
  457. Iv Garber (IvG), Apr, 2000
  458. Arguments:
  459. bstrCompany [in] - new Company value
  460. Return Value:
  461. Standard HRESULT code
  462. --*/
  463. {
  464. HRESULT hr = S_OK;
  465. DBG_ENTER (_T("CFaxPersonalProfile::put_Company"), hr, _T("%s"), bstrCompany);
  466. m_bstrCompany = bstrCompany;
  467. if (!m_bstrCompany && bstrCompany)
  468. {
  469. //
  470. // Not enough memory
  471. //
  472. hr = E_OUTOFMEMORY;
  473. AtlReportError(CLSID_FaxPersonalProfile, IDS_ERROR_OUTOFMEMORY, IID_IFaxPersonalProfile, hr);
  474. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  475. return hr;
  476. }
  477. return hr;
  478. }
  479. //
  480. //==================== COUNTRY ========================================
  481. //
  482. STDMETHODIMP
  483. CFaxPersonalProfile::get_Country(
  484. BSTR *pbstrCountry
  485. )
  486. /*++
  487. Routine name : CFaxPersonalProfile::get_Country
  488. Routine description:
  489. return Country
  490. Author:
  491. Iv Garber (IvG), Apr, 2000
  492. Arguments:
  493. pbstrCountry [out] - the Country
  494. Return Value:
  495. Standard HRESULT code
  496. --*/
  497. {
  498. HRESULT hr = S_OK;
  499. DBG_ENTER (TEXT("CFaxPersonalProfile::get_Country"), hr);
  500. hr = GetBstr(pbstrCountry, m_bstrCountry);
  501. if (FAILED(hr))
  502. {
  503. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  504. return hr;
  505. }
  506. return hr;
  507. }
  508. STDMETHODIMP
  509. CFaxPersonalProfile::put_Country (
  510. BSTR bstrCountry
  511. )
  512. /*++
  513. Routine name : CFaxPersonalProfile::put_Country
  514. Routine description:
  515. Set Country
  516. Author:
  517. Iv Garber (IvG), Apr, 2000
  518. Arguments:
  519. bstrCountry [in] - new Country value
  520. Return Value:
  521. Standard HRESULT code
  522. --*/
  523. {
  524. HRESULT hr = S_OK;
  525. DBG_ENTER (_T("CFaxPersonalProfile::put_Country"), hr, _T("%s"), bstrCountry);
  526. m_bstrCountry = bstrCountry;
  527. if (!m_bstrCountry && bstrCountry)
  528. {
  529. //
  530. // Not enough memory
  531. //
  532. hr = E_OUTOFMEMORY;
  533. AtlReportError(CLSID_FaxPersonalProfile,
  534. IDS_ERROR_OUTOFMEMORY,
  535. IID_IFaxPersonalProfile,
  536. hr);
  537. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  538. return hr;
  539. }
  540. return hr;
  541. }
  542. //
  543. //==================== DEPARTMENT ========================================
  544. //
  545. STDMETHODIMP
  546. CFaxPersonalProfile::get_Department(
  547. BSTR *pbstrDepartment
  548. )
  549. /*++
  550. Routine name : CFaxPersonalProfile::get_Department
  551. Routine description:
  552. return Department
  553. Author:
  554. Iv Garber (IvG), Apr, 2000
  555. Arguments:
  556. pbstrDepartment [out] - the Department
  557. Return Value:
  558. Standard HRESULT code
  559. --*/
  560. {
  561. HRESULT hr = S_OK;
  562. DBG_ENTER (TEXT("CFaxPersonalProfile::get_Department"), hr);
  563. hr = GetBstr(pbstrDepartment, m_bstrDepartment);
  564. if (FAILED(hr))
  565. {
  566. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  567. return hr;
  568. }
  569. return hr;
  570. }
  571. STDMETHODIMP
  572. CFaxPersonalProfile::put_Department (
  573. BSTR bstrDepartment
  574. )
  575. /*++
  576. Routine name : CFaxPersonalProfile::put_Department
  577. Routine description:
  578. Set Department
  579. Author:
  580. Iv Garber (IvG), Apr, 2000
  581. Arguments:
  582. bstrDepartment [in] - new Department value
  583. Return Value:
  584. Standard HRESULT code
  585. --*/
  586. {
  587. HRESULT hr = S_OK;
  588. DBG_ENTER (_T("CFaxPersonalProfile::put_Department"), hr, _T("%s"), bstrDepartment);
  589. m_bstrDepartment = bstrDepartment;
  590. if (!m_bstrDepartment && bstrDepartment)
  591. {
  592. //
  593. // Not enough memory
  594. //
  595. hr = E_OUTOFMEMORY;
  596. AtlReportError(CLSID_FaxPersonalProfile,
  597. IDS_ERROR_OUTOFMEMORY,
  598. IID_IFaxPersonalProfile,
  599. hr);
  600. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  601. return hr;
  602. }
  603. return hr;
  604. }
  605. //
  606. //==================== EMAIL ========================================
  607. //
  608. STDMETHODIMP
  609. CFaxPersonalProfile::get_Email(
  610. BSTR *pbstrEmail
  611. )
  612. /*++
  613. Routine name : CFaxPersonalProfile::get_Email
  614. Routine description:
  615. return Email
  616. Author:
  617. Iv Garber (IvG), Apr, 2000
  618. Arguments:
  619. pbstrEmail [out] - the Email
  620. Return Value:
  621. Standard HRESULT code
  622. --*/
  623. {
  624. HRESULT hr = S_OK;
  625. DBG_ENTER (TEXT("CFaxPersonalProfile::get_Email"), hr);
  626. hr = GetBstr(pbstrEmail, m_bstrEmail);
  627. if (FAILED(hr))
  628. {
  629. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  630. return hr;
  631. }
  632. return hr;
  633. }
  634. STDMETHODIMP
  635. CFaxPersonalProfile::put_Email (
  636. BSTR bstrEmail
  637. )
  638. /*++
  639. Routine name : CFaxPersonalProfile::put_Email
  640. Routine description:
  641. Set Email
  642. Author:
  643. Iv Garber (IvG), Apr, 2000
  644. Arguments:
  645. bstrEmail [in] - new Email value
  646. Return Value:
  647. Standard HRESULT code
  648. --*/
  649. {
  650. HRESULT hr = S_OK;
  651. DBG_ENTER (_T("CFaxPersonalProfile::put_Email"), hr, _T("%s"), bstrEmail);
  652. m_bstrEmail = bstrEmail;
  653. if (!m_bstrEmail && bstrEmail)
  654. {
  655. //
  656. // Not enough memory
  657. //
  658. hr = E_OUTOFMEMORY;
  659. AtlReportError(CLSID_FaxPersonalProfile,
  660. IDS_ERROR_OUTOFMEMORY,
  661. IID_IFaxPersonalProfile,
  662. hr);
  663. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  664. return hr;
  665. }
  666. return hr;
  667. }
  668. //
  669. //==================== FAX NUMBER ========================================
  670. //
  671. STDMETHODIMP
  672. CFaxPersonalProfile::get_FaxNumber(
  673. BSTR *pbstrFaxNumber
  674. )
  675. /*++
  676. Routine name : CFaxPersonalProfile::get_FaxNumber
  677. Routine description:
  678. return FaxNumber
  679. Author:
  680. Iv Garber (IvG), Apr, 2000
  681. Arguments:
  682. pbstrFaxNumber [out] - the FaxNumber
  683. Return Value:
  684. Standard HRESULT code
  685. --*/
  686. {
  687. HRESULT hr = S_OK;
  688. DBG_ENTER (TEXT("CFaxPersonalProfile::get_FaxNumber"), hr);
  689. hr = GetBstr(pbstrFaxNumber, m_bstrFaxNumber);
  690. if (FAILED(hr))
  691. {
  692. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  693. return hr;
  694. }
  695. return hr;
  696. }
  697. STDMETHODIMP
  698. CFaxPersonalProfile::put_FaxNumber (
  699. BSTR bstrFaxNumber
  700. )
  701. /*++
  702. Routine name : CFaxPersonalProfile::put_FaxNumber
  703. Routine description:
  704. Set FaxNumber
  705. Author:
  706. Iv Garber (IvG), Apr, 2000
  707. Arguments:
  708. bstrFaxNumber [in] - new Fax Number
  709. Return Value:
  710. Standard HRESULT code
  711. --*/
  712. {
  713. HRESULT hr = S_OK;
  714. DBG_ENTER (_T("CFaxPersonalProfile::put_FaxNumber"), hr, _T("%s"), bstrFaxNumber);
  715. m_bstrFaxNumber = bstrFaxNumber;
  716. if (!m_bstrFaxNumber && bstrFaxNumber)
  717. {
  718. //
  719. // Not enough memory
  720. //
  721. hr = E_OUTOFMEMORY;
  722. AtlReportError(CLSID_FaxPersonalProfile,
  723. IDS_ERROR_OUTOFMEMORY,
  724. IID_IFaxPersonalProfile,
  725. hr);
  726. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  727. return hr;
  728. }
  729. return hr;
  730. }
  731. //
  732. //==================== HOME PHONE ========================================
  733. //
  734. STDMETHODIMP
  735. CFaxPersonalProfile::get_HomePhone(
  736. BSTR *pbstrHomePhone
  737. )
  738. /*++
  739. Routine name : CFaxPersonalProfile::get_HomePhone
  740. Routine description:
  741. return HomePhone
  742. Author:
  743. Iv Garber (IvG), Apr, 2000
  744. Arguments:
  745. pbstrHomePhone [out] - the HomePhone
  746. Return Value:
  747. Standard HRESULT code
  748. --*/
  749. {
  750. HRESULT hr = S_OK;
  751. DBG_ENTER (TEXT("CFaxPersonalProfile::get_HomePhone"), hr);
  752. hr = GetBstr(pbstrHomePhone, m_bstrHomePhone);
  753. if (FAILED(hr))
  754. {
  755. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  756. return hr;
  757. }
  758. return hr;
  759. }
  760. STDMETHODIMP
  761. CFaxPersonalProfile::put_HomePhone (
  762. BSTR bstrHomePhone
  763. )
  764. /*++
  765. Routine name : CFaxPersonalProfile::put_HomePhone
  766. Routine description:
  767. Set HomePhone
  768. Author:
  769. Iv Garber (IvG), Apr, 2000
  770. Arguments:
  771. bstrHomePhone [in] - new HomePhone
  772. Return Value:
  773. Standard HRESULT code
  774. --*/
  775. {
  776. HRESULT hr = S_OK;
  777. DBG_ENTER (_T("CFaxPersonalProfile::put_HomePhone"), hr, _T("%s"), bstrHomePhone);
  778. m_bstrHomePhone = bstrHomePhone;
  779. if (!m_bstrHomePhone && bstrHomePhone)
  780. {
  781. //
  782. // Not enough memory
  783. //
  784. hr = E_OUTOFMEMORY;
  785. AtlReportError(CLSID_FaxPersonalProfile,
  786. IDS_ERROR_OUTOFMEMORY,
  787. IID_IFaxPersonalProfile,
  788. hr);
  789. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  790. return hr;
  791. }
  792. return hr;
  793. }
  794. //
  795. //==================== NAME ========================================
  796. //
  797. STDMETHODIMP
  798. CFaxPersonalProfile::get_Name(
  799. BSTR *pbstrName
  800. )
  801. /*++
  802. Routine name : CFaxPersonalProfile::get_Name
  803. Routine description:
  804. return Name
  805. Author:
  806. Iv Garber (IvG), Apr, 2000
  807. Arguments:
  808. pbstrName [out] - the Name
  809. Return Value:
  810. Standard HRESULT code
  811. --*/
  812. {
  813. HRESULT hr = S_OK;
  814. DBG_ENTER (TEXT("CFaxPersonalProfile::get_Name"), hr);
  815. hr = GetBstr(pbstrName, m_bstrName);
  816. if (FAILED(hr))
  817. {
  818. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  819. return hr;
  820. }
  821. return hr;
  822. }
  823. STDMETHODIMP
  824. CFaxPersonalProfile::put_Name (
  825. BSTR bstrName
  826. )
  827. /*++
  828. Routine name : CFaxPersonalProfile::put_Name
  829. Routine description:
  830. Set Name
  831. Author:
  832. Iv Garber (IvG), Apr, 2000
  833. Arguments:
  834. bstrName [in] - new Name
  835. Return Value:
  836. Standard HRESULT code
  837. --*/
  838. {
  839. HRESULT hr = S_OK;
  840. DBG_ENTER (_T("CFaxPersonalProfile::put_Name"), hr, _T("%s"), bstrName);
  841. m_bstrName = bstrName;
  842. if (!m_bstrName && bstrName)
  843. {
  844. //
  845. // Not enough memory
  846. //
  847. hr = E_OUTOFMEMORY;
  848. AtlReportError(CLSID_FaxPersonalProfile,
  849. IDS_ERROR_OUTOFMEMORY,
  850. IID_IFaxPersonalProfile,
  851. hr);
  852. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  853. return hr;
  854. }
  855. return hr;
  856. }
  857. //
  858. //==================== TSID ========================================
  859. //
  860. STDMETHODIMP
  861. CFaxPersonalProfile::get_TSID(
  862. BSTR *pbstrTSID
  863. )
  864. /*++
  865. Routine name : CFaxPersonalProfile::get_TSID
  866. Routine description:
  867. return TSID
  868. Author:
  869. Iv Garber (IvG), Apr, 2000
  870. Arguments:
  871. pbstrTSID [out] - the TSID
  872. Return Value:
  873. Standard HRESULT code
  874. --*/
  875. {
  876. HRESULT hr = S_OK;
  877. DBG_ENTER (TEXT("CFaxPersonalProfile::get_TSID"), hr);
  878. hr = GetBstr(pbstrTSID, m_bstrTSID);
  879. if (FAILED(hr))
  880. {
  881. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  882. return hr;
  883. }
  884. return hr;
  885. }
  886. STDMETHODIMP
  887. CFaxPersonalProfile::put_TSID (
  888. BSTR bstrTSID
  889. )
  890. /*++
  891. Routine name : CFaxPersonalProfile::put_TSID
  892. Routine description:
  893. Set TSID
  894. Author:
  895. Iv Garber (IvG), Apr, 2000
  896. Arguments:
  897. bstrTSID [in] - new TSID
  898. Return Value:
  899. Standard HRESULT code
  900. --*/
  901. {
  902. HRESULT hr = S_OK;
  903. DBG_ENTER (_T("CFaxPersonalProfile::put_TSID"), hr, _T("%s"), bstrTSID);
  904. if (SysStringLen(bstrTSID) > FXS_TSID_CSID_MAX_LENGTH)
  905. {
  906. //
  907. // Out of the Range
  908. //
  909. hr = E_INVALIDARG;
  910. AtlReportError(CLSID_FaxPersonalProfile, IDS_ERROR_OUTOFRANGE, IID_IFaxPersonalProfile, hr);
  911. CALL_FAIL(GENERAL_ERR, _T("TSID is too long"), hr);
  912. return hr;
  913. }
  914. m_bstrTSID = bstrTSID;
  915. if (!m_bstrTSID && bstrTSID)
  916. {
  917. //
  918. // Not enough memory
  919. //
  920. hr = E_OUTOFMEMORY;
  921. AtlReportError(CLSID_FaxPersonalProfile,
  922. IDS_ERROR_OUTOFMEMORY,
  923. IID_IFaxPersonalProfile,
  924. hr);
  925. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  926. return hr;
  927. }
  928. return hr;
  929. }
  930. //
  931. //==================== OFFICE PHONE ========================================
  932. //
  933. STDMETHODIMP
  934. CFaxPersonalProfile::get_OfficePhone(
  935. BSTR *pbstrOfficePhone
  936. )
  937. /*++
  938. Routine name : CFaxPersonalProfile::get_OfficePhone
  939. Routine description:
  940. return OfficePhone
  941. Author:
  942. Iv Garber (IvG), Apr, 2000
  943. Arguments:
  944. pbstrOfficePhone [out] - the OfficePhone
  945. Return Value:
  946. Standard HRESULT code
  947. --*/
  948. {
  949. HRESULT hr = S_OK;
  950. DBG_ENTER (TEXT("CFaxPersonalProfile::get_OfficePhone"), hr);
  951. hr = GetBstr(pbstrOfficePhone, m_bstrOfficePhone);
  952. if (FAILED(hr))
  953. {
  954. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  955. return hr;
  956. }
  957. return hr;
  958. }
  959. STDMETHODIMP
  960. CFaxPersonalProfile::put_OfficePhone (
  961. BSTR bstrOfficePhone
  962. )
  963. /*++
  964. Routine name : CFaxPersonalProfile::put_OfficePhone
  965. Routine description:
  966. Set OfficePhone
  967. Author:
  968. Iv Garber (IvG), Apr, 2000
  969. Arguments:
  970. bstrOfficePhone [in] - new OfficePhone
  971. Return Value:
  972. Standard HRESULT code
  973. --*/
  974. {
  975. HRESULT hr = S_OK;
  976. DBG_ENTER (_T("CFaxPersonalProfile::put_OfficePhone"), hr, _T("%s"), bstrOfficePhone);
  977. m_bstrOfficePhone = bstrOfficePhone;
  978. if (!m_bstrOfficePhone && bstrOfficePhone)
  979. {
  980. //
  981. // Not enough memory
  982. //
  983. hr = E_OUTOFMEMORY;
  984. AtlReportError(CLSID_FaxPersonalProfile,
  985. IDS_ERROR_OUTOFMEMORY,
  986. IID_IFaxPersonalProfile,
  987. hr);
  988. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  989. return hr;
  990. }
  991. return hr;
  992. }
  993. //
  994. //==================== OFFICE LOCATION ========================================
  995. //
  996. STDMETHODIMP
  997. CFaxPersonalProfile::get_OfficeLocation(
  998. BSTR *pbstrOfficeLocation
  999. )
  1000. /*++
  1001. Routine name : CFaxPersonalProfile::get_OfficeLocation
  1002. Routine description:
  1003. return OfficeLocation
  1004. Author:
  1005. Iv Garber (IvG), Apr, 2000
  1006. Arguments:
  1007. pbstrOfficeLocation [out] - the OfficeLocation
  1008. Return Value:
  1009. Standard HRESULT code
  1010. --*/
  1011. {
  1012. HRESULT hr = S_OK;
  1013. DBG_ENTER (TEXT("CFaxPersonalProfile::get_OfficeLocation"), hr);
  1014. hr = GetBstr(pbstrOfficeLocation, m_bstrOfficeLocation);
  1015. if (FAILED(hr))
  1016. {
  1017. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  1018. return hr;
  1019. }
  1020. return hr;
  1021. }
  1022. STDMETHODIMP
  1023. CFaxPersonalProfile::put_OfficeLocation (
  1024. BSTR bstrOfficeLocation
  1025. )
  1026. /*++
  1027. Routine name : CFaxPersonalProfile::put_OfficeLocation
  1028. Routine description:
  1029. Set OfficeLocation
  1030. Author:
  1031. Iv Garber (IvG), Apr, 2000
  1032. Arguments:
  1033. bstrOfficeLocation [in] - new OfficeLocation
  1034. Return Value:
  1035. Standard HRESULT code
  1036. --*/
  1037. {
  1038. HRESULT hr = S_OK;
  1039. DBG_ENTER (_T("CFaxPersonalProfile::put_OfficeLocation"), hr, _T("%s"), bstrOfficeLocation);
  1040. m_bstrOfficeLocation = bstrOfficeLocation;
  1041. if (!m_bstrOfficeLocation && bstrOfficeLocation)
  1042. {
  1043. //
  1044. // Not enough memory
  1045. //
  1046. hr = E_OUTOFMEMORY;
  1047. AtlReportError(CLSID_FaxPersonalProfile,
  1048. IDS_ERROR_OUTOFMEMORY,
  1049. IID_IFaxPersonalProfile,
  1050. hr);
  1051. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  1052. return hr;
  1053. }
  1054. return hr;
  1055. }
  1056. //
  1057. //==================== STATE ========================================
  1058. //
  1059. STDMETHODIMP
  1060. CFaxPersonalProfile::get_State(
  1061. BSTR *pbstrState
  1062. )
  1063. /*++
  1064. Routine name : CFaxPersonalProfile::get_State
  1065. Routine description:
  1066. return State
  1067. Author:
  1068. Iv Garber (IvG), Apr, 2000
  1069. Arguments:
  1070. pbstrState [out] - the State
  1071. Return Value:
  1072. Standard HRESULT code
  1073. --*/
  1074. {
  1075. HRESULT hr = S_OK;
  1076. DBG_ENTER (TEXT("CFaxPersonalProfile::get_State"), hr);
  1077. hr = GetBstr(pbstrState, m_bstrState);
  1078. if (FAILED(hr))
  1079. {
  1080. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  1081. return hr;
  1082. }
  1083. return hr;
  1084. }
  1085. STDMETHODIMP
  1086. CFaxPersonalProfile::put_State (
  1087. BSTR bstrState
  1088. )
  1089. /*++
  1090. Routine name : CFaxPersonalProfile::put_State
  1091. Routine description:
  1092. Set State
  1093. Author:
  1094. Iv Garber (IvG), Apr, 2000
  1095. Arguments:
  1096. bstrState [in] - new State
  1097. Return Value:
  1098. Standard HRESULT code
  1099. --*/
  1100. {
  1101. HRESULT hr = S_OK;
  1102. DBG_ENTER (_T("CFaxPersonalProfile::put_State"), hr, _T("%s"), bstrState);
  1103. m_bstrState = bstrState;
  1104. if (!m_bstrState && bstrState)
  1105. {
  1106. //
  1107. // Not enough memory
  1108. //
  1109. hr = E_OUTOFMEMORY;
  1110. AtlReportError(CLSID_FaxPersonalProfile,
  1111. IDS_ERROR_OUTOFMEMORY,
  1112. IID_IFaxPersonalProfile,
  1113. hr);
  1114. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  1115. return hr;
  1116. }
  1117. return hr;
  1118. }
  1119. //
  1120. //==================== STREET ADDRESS ========================================
  1121. //
  1122. STDMETHODIMP
  1123. CFaxPersonalProfile::get_StreetAddress (
  1124. BSTR *pbstrStreetAddress
  1125. )
  1126. /*++
  1127. Routine name : CFaxPersonalProfile::get_StreetAddress
  1128. Routine description:
  1129. return StreetAddress
  1130. Author:
  1131. Iv Garber (IvG), Apr, 2000
  1132. Arguments:
  1133. pbstrStreetAddress [out] - the StreetAddress
  1134. Return Value:
  1135. Standard HRESULT code
  1136. --*/
  1137. {
  1138. HRESULT hr = S_OK;
  1139. DBG_ENTER (TEXT("CFaxPersonalProfile::get_StreetAddress"), hr);
  1140. hr = GetBstr(pbstrStreetAddress, m_bstrStreetAddress);
  1141. if (FAILED(hr))
  1142. {
  1143. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  1144. return hr;
  1145. }
  1146. return hr;
  1147. }
  1148. STDMETHODIMP
  1149. CFaxPersonalProfile::put_StreetAddress (
  1150. BSTR bstrStreetAddress
  1151. )
  1152. /*++
  1153. Routine name : CFaxPersonalProfile::put_StreetAddress
  1154. Routine description:
  1155. Set StreetAddress
  1156. Author:
  1157. Iv Garber (IvG), Apr, 2000
  1158. Arguments:
  1159. bstrStreetAddress [in] - new StreetAddress
  1160. Return Value:
  1161. Standard HRESULT code
  1162. --*/
  1163. {
  1164. HRESULT hr = S_OK;
  1165. DBG_ENTER (_T("CFaxPersonalProfile::put_StreetAddress"), hr, _T("%s"), bstrStreetAddress);
  1166. m_bstrStreetAddress = bstrStreetAddress;
  1167. if (!m_bstrStreetAddress && bstrStreetAddress)
  1168. {
  1169. //
  1170. // Not enough memory
  1171. //
  1172. hr = E_OUTOFMEMORY;
  1173. AtlReportError(CLSID_FaxPersonalProfile,
  1174. IDS_ERROR_OUTOFMEMORY,
  1175. IID_IFaxPersonalProfile,
  1176. hr);
  1177. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  1178. return hr;
  1179. }
  1180. return hr;
  1181. }
  1182. //
  1183. //==================== TITLE ========================================
  1184. //
  1185. STDMETHODIMP
  1186. CFaxPersonalProfile::get_Title (
  1187. BSTR *pbstrTitle
  1188. )
  1189. /*++
  1190. Routine name : CFaxPersonalProfile::get_Title
  1191. Routine description:
  1192. return Title
  1193. Author:
  1194. Iv Garber (IvG), Apr, 2000
  1195. Arguments:
  1196. pbstrTitle [out] - the Title
  1197. Return Value:
  1198. Standard HRESULT code
  1199. --*/
  1200. {
  1201. HRESULT hr = S_OK;
  1202. DBG_ENTER (TEXT("CFaxPersonalProfile::get_Title"), hr);
  1203. hr = GetBstr(pbstrTitle, m_bstrTitle);
  1204. if (FAILED(hr))
  1205. {
  1206. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  1207. return hr;
  1208. }
  1209. return hr;
  1210. }
  1211. STDMETHODIMP
  1212. CFaxPersonalProfile::put_Title (
  1213. BSTR bstrTitle
  1214. )
  1215. /*++
  1216. Routine name : CFaxPersonalProfile::put_Title
  1217. Routine description:
  1218. Set Title
  1219. Author:
  1220. Iv Garber (IvG), Apr, 2000
  1221. Arguments:
  1222. bstrTitle [in] - new Title
  1223. Return Value:
  1224. Standard HRESULT code
  1225. --*/
  1226. {
  1227. HRESULT hr = S_OK;
  1228. DBG_ENTER (_T("CFaxPersonalProfile::put_Title"), hr, _T("%s"), bstrTitle);
  1229. m_bstrTitle = bstrTitle;
  1230. if (!m_bstrTitle && bstrTitle)
  1231. {
  1232. //
  1233. // Not enough memory
  1234. //
  1235. hr = E_OUTOFMEMORY;
  1236. AtlReportError(CLSID_FaxPersonalProfile,
  1237. IDS_ERROR_OUTOFMEMORY,
  1238. IID_IFaxPersonalProfile,
  1239. hr);
  1240. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  1241. return hr;
  1242. }
  1243. return hr;
  1244. }
  1245. //
  1246. //==================== ZIP CODE ========================================
  1247. //
  1248. STDMETHODIMP
  1249. CFaxPersonalProfile::get_ZipCode (
  1250. BSTR *pbstrZipCode
  1251. )
  1252. /*++
  1253. Routine name : CFaxPersonalProfile::get_ZipCode
  1254. Routine description:
  1255. return ZipCode
  1256. Author:
  1257. Iv Garber (IvG), Apr, 2000
  1258. Arguments:
  1259. pbstrZipCode [out] - the ZipCode
  1260. Return Value:
  1261. Standard HRESULT code
  1262. --*/
  1263. {
  1264. HRESULT hr = S_OK;
  1265. DBG_ENTER (TEXT("CFaxPersonalProfile::get_ZipCode"), hr);
  1266. hr = GetBstr(pbstrZipCode, m_bstrZipCode);
  1267. if (FAILED(hr))
  1268. {
  1269. AtlReportError(CLSID_FaxPersonalProfile, GetErrorMsgId(hr), IID_IFaxPersonalProfile, hr);
  1270. return hr;
  1271. }
  1272. return hr;
  1273. }
  1274. STDMETHODIMP
  1275. CFaxPersonalProfile::put_ZipCode (
  1276. BSTR bstrZipCode
  1277. )
  1278. /*++
  1279. Routine name : CFaxPersonalProfile::put_ZipCode
  1280. Routine description:
  1281. Set ZipCode
  1282. Author:
  1283. Iv Garber (IvG), Apr, 2000
  1284. Arguments:
  1285. bstrZipCode [in] - new ZipCode
  1286. Return Value:
  1287. Standard HRESULT code
  1288. --*/
  1289. {
  1290. HRESULT hr = S_OK;
  1291. DBG_ENTER (_T("CFaxPersonalProfile::put_ZipCode"), hr, _T("%s"), bstrZipCode);
  1292. m_bstrZipCode = bstrZipCode;
  1293. if (!m_bstrZipCode && bstrZipCode)
  1294. {
  1295. //
  1296. // Not enough memory
  1297. //
  1298. hr = E_OUTOFMEMORY;
  1299. AtlReportError(CLSID_FaxPersonalProfile,
  1300. IDS_ERROR_OUTOFMEMORY,
  1301. IID_IFaxPersonalProfile,
  1302. hr);
  1303. CALL_FAIL(MEM_ERR, _T("CComBSTR::operator="), hr);
  1304. return hr;
  1305. }
  1306. return hr;
  1307. }