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.

130 lines
2.3 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997
  5. //
  6. // File: cprov.cxx
  7. //
  8. // Contents: Provider Object Code
  9. //
  10. // History: 01-30-95 krishnag Created.
  11. //
  12. //----------------------------------------------------------------------------
  13. #include "iis.hxx"
  14. #pragma hdrstop
  15. // Class CIISProvider
  16. CIISProvider::CIISProvider()
  17. {
  18. }
  19. HRESULT
  20. CIISProvider::Create(CIISProvider FAR * FAR * ppProvider)
  21. {
  22. CIISProvider FAR * pProvider = NULL;
  23. HRESULT hr = S_OK;
  24. //Create the Provider Object
  25. pProvider = new CIISProvider();
  26. if (pProvider == NULL) {
  27. RRETURN(ResultFromScode(E_OUTOFMEMORY));
  28. }
  29. if (FAILED(hr)) {
  30. delete pProvider;
  31. RRETURN(hr);
  32. }
  33. *ppProvider = pProvider;
  34. RRETURN(hr);
  35. }
  36. CIISProvider::~CIISProvider( )
  37. {
  38. ENLIST_TRACKING(CIISProvider);
  39. }
  40. STDMETHODIMP
  41. CIISProvider::QueryInterface(REFIID iid, LPVOID FAR* ppv)
  42. {
  43. if (IsEqualIID(iid, IID_IUnknown))
  44. {
  45. *ppv = this;
  46. }
  47. else if (IsEqualIID(iid, IID_IParseDisplayName))
  48. {
  49. *ppv = (IParseDisplayName FAR *) this;
  50. }
  51. else
  52. {
  53. *ppv = NULL;
  54. return E_NOINTERFACE;
  55. }
  56. AddRef();
  57. return NOERROR;
  58. }
  59. STDMETHODIMP
  60. CIISProvider::ParseDisplayName(
  61. IBindCtx* pbc,
  62. WCHAR* szDisplayName,
  63. ULONG* pchEaten,
  64. IMoniker** ppmk
  65. )
  66. {
  67. HRESULT hr;
  68. *ppmk = NULL;
  69. if (pchEaten != NULL){
  70. *pchEaten = 0;
  71. }
  72. hr = ResolvePathName(
  73. pbc,
  74. szDisplayName,
  75. pchEaten,
  76. ppmk
  77. );
  78. RRETURN(hr);
  79. }
  80. HRESULT
  81. CIISProvider::ResolvePathName(
  82. IBindCtx* pbc,
  83. WCHAR* szDisplayName,
  84. ULONG* pchEaten,
  85. IMoniker** ppmk
  86. )
  87. {
  88. HRESULT hr;
  89. LPUNKNOWN pUnknown = NULL;
  90. CCredentials Credentials;
  91. *pchEaten = 0;
  92. hr = GetObject(
  93. szDisplayName,
  94. Credentials,
  95. (LPVOID *)&pUnknown
  96. );
  97. BAIL_IF_ERROR(hr);
  98. hr = CreatePointerMoniker(pUnknown, ppmk);
  99. BAIL_IF_ERROR(hr);
  100. *pchEaten += (ULONG)wcslen(szDisplayName);
  101. cleanup:
  102. if (pUnknown) {
  103. pUnknown->Release();
  104. }
  105. RRETURN (hr);
  106. }