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.

106 lines
2.8 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows, Copyright (C) Microsoft Corporation, 2000
  3. File: Settings.h
  4. Content: Declaration of CSettings class.
  5. History: 11-15-99 dsie created
  6. ------------------------------------------------------------------------------*/
  7. #ifndef __SETTINGS_H_
  8. #define __SETTINGS_H_
  9. #include "Resource.h"
  10. #include "Error.h"
  11. #include "Lock.h"
  12. #include "Debug.h"
  13. ///////////////
  14. //
  15. // Global
  16. //
  17. #define PromptForCertificateEnabled() (g_bPromptCertificateUI)
  18. #define ActiveDirectorySearchLocation() (g_ADSearchLocation)
  19. extern VARIANT_BOOL g_bPromptCertificateUI;
  20. extern CAPICOM_ACTIVE_DIRECTORY_SEARCH_LOCATION g_ADSearchLocation;
  21. ////////////////////////////////////////////////////////////////////////////////
  22. //
  23. // CSettings
  24. //
  25. class ATL_NO_VTABLE CSettings :
  26. public CComObjectRootEx<CComMultiThreadModel>,
  27. public CComCoClass<CSettings, &CLSID_Settings>,
  28. public ICAPICOMError<CSettings, &IID_ISettings>,
  29. public IDispatchImpl<ISettings, &IID_ISettings, &LIBID_CAPICOM,
  30. CAPICOM_MAJOR_VERSION, CAPICOM_MINOR_VERSION>,
  31. public IObjectSafetyImpl<CSettings, INTERFACESAFE_FOR_UNTRUSTED_CALLER |
  32. INTERFACESAFE_FOR_UNTRUSTED_DATA>
  33. {
  34. public:
  35. CSettings()
  36. {
  37. }
  38. DECLARE_REGISTRY_RESOURCEID(IDR_SETTINGS)
  39. DECLARE_GET_CONTROLLING_UNKNOWN()
  40. DECLARE_PROTECT_FINAL_CONSTRUCT()
  41. BEGIN_COM_MAP(CSettings)
  42. COM_INTERFACE_ENTRY(ISettings)
  43. COM_INTERFACE_ENTRY(IDispatch)
  44. COM_INTERFACE_ENTRY(IObjectSafety)
  45. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  46. END_COM_MAP()
  47. BEGIN_CATEGORY_MAP(CSettings)
  48. IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
  49. IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
  50. END_CATEGORY_MAP()
  51. HRESULT FinalConstruct()
  52. {
  53. HRESULT hr;
  54. if (FAILED(hr = m_Lock.Initialized()))
  55. {
  56. DebugTrace("Error [%#x]: Critical section could not be created for Settings object.\n", hr);
  57. return hr;
  58. }
  59. return S_OK;
  60. }
  61. void FinalRelease()
  62. {
  63. }
  64. //
  65. // ISettings
  66. //
  67. public:
  68. STDMETHOD(get_EnablePromptForCertificateUI)
  69. (/*[out, retval]*/ VARIANT_BOOL * pVal);
  70. STDMETHOD(put_EnablePromptForCertificateUI)
  71. (/*[in, defaultvalue(0)]*/ VARIANT_BOOL newVal);
  72. STDMETHOD(get_ActiveDirectorySearchLocation)
  73. (/*[out, retval]*/ CAPICOM_ACTIVE_DIRECTORY_SEARCH_LOCATION * pVal);
  74. STDMETHOD(put_ActiveDirectorySearchLocation)
  75. (/*[in, defaultvalue(SEARCH_LOCATION_UNSPECIFIED)]*/ CAPICOM_ACTIVE_DIRECTORY_SEARCH_LOCATION Val);
  76. private:
  77. CLock m_Lock;
  78. };
  79. #endif //__SETTINGS_H_