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.

98 lines
2.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: HTTPCLS.CXX
  7. //
  8. // Contents: Implements the HTTPMoniker class, which is derived from
  9. // the CAsyncMoniker class.
  10. //
  11. // Classes: HTTPMoniker
  12. //
  13. // Functions:
  14. //
  15. // History: 11-02-95 JoeS (Joe Souza) Created
  16. //
  17. //----------------------------------------------------------------------------
  18. #include <urlint.h>
  19. #include "urlapi.hxx"
  20. #include "casyncmk.hxx"
  21. #include "httpcls.hxx"
  22. STDMETHODIMP_(ULONG) HTTPMoniker::Release(void)
  23. {
  24. // Decrement refcount, destroy object if refcount goes to zero.
  25. // Return the new refcount.
  26. if (!(--m_refs))
  27. {
  28. delete this;
  29. return(0);
  30. }
  31. return(m_refs);
  32. }
  33. STDMETHODIMP HTTPMoniker::GetClassID(CLSID *pClassID)
  34. {
  35. VDATEPTRIN(pClassID, CLSID);
  36. *pClassID = CLSID_StdURLMoniker;
  37. return(NOERROR);
  38. }
  39. STDMETHODIMP HTTPMoniker::BindToStorage (THIS_ LPBC pbc, LPMONIKER pmkToLeft,
  40. REFIID riid, LPVOID FAR* ppvObj)
  41. {
  42. VDATEPTROUT(ppvObj, LPVOID);
  43. *ppvObj = NULL;
  44. VDATEIFACE(pbc);
  45. if (pmkToLeft)
  46. VDATEIFACE(pmkToLeft);
  47. HRESULT hresult = NOERROR;
  48. //if (!::CreateURLBinding(pbc, this, m_pwzURL))
  49. //if (!CreateURLBinding(pbc, this, m_pwzURL))
  50. // hresult = E_OUTOFMEMORY; // BUGBUG: Should we use a better error code?
  51. // BUGBUG: Must attach riid interface to new storage, and return storage
  52. // object in ppvObj. (I.e. get temp file name and call StgOpenStorage, etc.
  53. return(hresult);
  54. }
  55. STDMETHODIMP HTTPMoniker::ParseDisplayName (THIS_ LPBC pbc, LPMONIKER pmkToLeft,
  56. LPWSTR lpszDisplayName, ULONG FAR* pchEaten,
  57. LPMONIKER FAR* ppmkOut)
  58. {
  59. VDATEPTROUT(ppmkOut, LPMONIKER);
  60. *ppmkOut = NULL;
  61. VDATEIFACE(pbc);
  62. if (pmkToLeft)
  63. VDATEIFACE(pmkToLeft);
  64. VDATEPTRIN(lpszDisplayName, char);
  65. VDATEPTROUT(pchEaten, ULONG);
  66. HRESULT hresult = NOERROR;
  67. int len;
  68. if (m_pwzURL)
  69. delete [] m_pwzURL;
  70. len = wcslen(lpszDisplayName);
  71. m_pwzURL = new WCHAR [len + 1];
  72. if (!m_pwzURL)
  73. return(E_OUTOFMEMORY);
  74. wcscpy(m_pwzURL, lpszDisplayName);
  75. *pchEaten = len;
  76. *ppmkOut = this;
  77. AddRef();
  78. return(hresult);
  79. }