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.

90 lines
3.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: pcrack.h
  8. //
  9. // requires iads.h (IADsPathname) and atlbase.h (CComPtr)
  10. //
  11. //--------------------------------------------------------------------------
  12. // pcrack.h : include file for CPathCracker
  13. #ifndef __PCRACK_H__
  14. #define __PCRACK_H__
  15. class CPathCracker
  16. {
  17. public:
  18. CPathCracker()
  19. {
  20. m_hrCreate = Init();
  21. }
  22. private:
  23. HRESULT Init()
  24. {
  25. HRESULT hr = ::CoCreateInstance(CLSID_Pathname, NULL, CLSCTX_INPROC_SERVER,
  26. IID_IADsPathname, (PVOID *)&(m_spIADsPathname));
  27. return hr;
  28. }
  29. public:
  30. // IADsPathname methods
  31. virtual /* [id] */ HRESULT STDMETHODCALLTYPE Set(
  32. /* [in] */ const BSTR bstrADsPath,
  33. /* [in] */ long lnSetType)
  34. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->Set(bstrADsPath, lnSetType); }
  35. virtual /* [id] */ HRESULT STDMETHODCALLTYPE SetDisplayType(
  36. /* [in] */ long lnDisplayType)
  37. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->SetDisplayType(lnDisplayType); }
  38. virtual /* [id] */ HRESULT STDMETHODCALLTYPE Retrieve(
  39. /* [in] */ long lnFormatType,
  40. /* [retval][out] */ BSTR __RPC_FAR *pbstrADsPath)
  41. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->Retrieve(lnFormatType, pbstrADsPath); }
  42. virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetNumElements(
  43. /* [retval][out] */ long __RPC_FAR *plnNumPathElements)
  44. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->GetNumElements(plnNumPathElements); }
  45. virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetElement(
  46. /* [in] */ long lnElementIndex,
  47. /* [retval][out] */ BSTR __RPC_FAR *pbstrElement)
  48. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->GetElement(lnElementIndex, pbstrElement); }
  49. virtual /* [id] */ HRESULT STDMETHODCALLTYPE AddLeafElement(
  50. /* [in] */ BSTR bstrLeafElement)
  51. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->AddLeafElement(bstrLeafElement); }
  52. virtual /* [id] */ HRESULT STDMETHODCALLTYPE RemoveLeafElement( void)
  53. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->RemoveLeafElement(); }
  54. virtual /* [id] */ HRESULT STDMETHODCALLTYPE CopyPath(
  55. /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppAdsPath)
  56. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->CopyPath(ppAdsPath); }
  57. virtual /* [id] */ HRESULT STDMETHODCALLTYPE GetEscapedElement(
  58. /* [in] */ long lnReserved,
  59. /* [in] */ const BSTR bstrInStr,
  60. /* [retval][out] */ BSTR __RPC_FAR *pbstrOutStr)
  61. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->GetEscapedElement(lnReserved, bstrInStr, pbstrOutStr); }
  62. virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_EscapedMode(
  63. /* [retval][out] */ long __RPC_FAR *retval)
  64. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->get_EscapedMode(retval); }
  65. virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_EscapedMode(
  66. /* [in] */ long lnEscapedMode)
  67. { return (m_spIADsPathname == NULL) ? m_hrCreate : m_spIADsPathname->put_EscapedMode(lnEscapedMode); }
  68. private:
  69. CComPtr<IADsPathname> m_spIADsPathname;
  70. HRESULT m_hrCreate;
  71. };
  72. #endif _PCRACK_H_