Source code of Windows XP (NT5)
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.

177 lines
4.3 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: module.cpp
  7. //
  8. // Contents: LEGACY Policy Manage Module implementation
  9. // Contents: LEGACY Exit Manage Module implementation
  10. //
  11. //---------------------------------------------------------------------------
  12. #include "pch.cpp"
  13. #pragma hdrstop
  14. #include "manage.h"
  15. extern HINSTANCE g_hInstance;
  16. // LEGACY Policy module
  17. STDMETHODIMP
  18. CCertManagePolicyModule::GetProperty(
  19. /* [in] */ const BSTR strConfig,
  20. /* [in] */ BSTR strStorageLocation,
  21. /* [in] */ BSTR strPropertyName,
  22. /* [in] */ LONG dwFlags,
  23. /* [retval][out] */ VARIANT __RPC_FAR *pvarProperty)
  24. {
  25. UINT uiStr = 0;
  26. HRESULT hr;
  27. WCHAR *pwszStr = NULL;
  28. if (NULL == strPropertyName)
  29. {
  30. hr = S_FALSE;
  31. _JumpError(hr, error, "NULL in parm");
  32. }
  33. if (NULL == pvarProperty)
  34. {
  35. hr = E_POINTER;
  36. _JumpError(hr, error, "NULL parm");
  37. }
  38. if (0 == wcscmp(strPropertyName, wszCMM_PROP_NAME))
  39. uiStr = IDS_LEGACYPOLICYMODULE_NAME;
  40. else
  41. {
  42. hr = S_FALSE;
  43. _JumpError(hr, error, "invalid property name");
  44. }
  45. // load string from resource
  46. hr = myLoadRCString(g_hInstance, uiStr, &pwszStr);
  47. _JumpIfError(hr, error, "myLoadRCString");
  48. pvarProperty->bstrVal = SysAllocString(pwszStr);
  49. if (NULL == pvarProperty->bstrVal)
  50. {
  51. hr = E_OUTOFMEMORY;
  52. _JumpError(hr, error, "out of memory");
  53. }
  54. myRegisterMemFree(pvarProperty->bstrVal, CSM_SYSALLOC); // this mem owned by caller
  55. pvarProperty->vt = VT_BSTR;
  56. hr = S_OK;
  57. error:
  58. if (NULL != pwszStr)
  59. {
  60. LocalFree(pwszStr);
  61. }
  62. return hr;
  63. }
  64. STDMETHODIMP
  65. CCertManagePolicyModule::SetProperty(
  66. /* [in] */ const BSTR strConfig,
  67. /* [in] */ BSTR strStorageLocation,
  68. /* [in] */ BSTR strPropertyName,
  69. /* [in] */ LONG dwFlags,
  70. /* [in] */ VARIANT const __RPC_FAR *pvalProperty)
  71. {
  72. // no settable properties supported
  73. return S_FALSE;
  74. }
  75. STDMETHODIMP
  76. CCertManagePolicyModule::Configure(
  77. /* [in] */ const BSTR strConfig,
  78. /* [in] */ BSTR strStorageLocation,
  79. /* [in] */ LONG dwFlags)
  80. {
  81. // no settable properties supported
  82. return S_FALSE;
  83. }
  84. // LEGACY Exit module
  85. STDMETHODIMP
  86. CCertManageExitModule::GetProperty(
  87. /* [in] */ const BSTR strConfig,
  88. /* [in] */ BSTR strStorageLocation,
  89. /* [in] */ BSTR strPropertyName,
  90. /* [in] */ LONG dwFlags,
  91. /* [retval][out] */ VARIANT __RPC_FAR *pvarProperty)
  92. {
  93. UINT uiStr = 0;
  94. HRESULT hr;
  95. WCHAR *pwszStr = NULL;
  96. if (NULL == strPropertyName)
  97. {
  98. hr = S_FALSE;
  99. _JumpError(hr, error, "NULL in parm");
  100. }
  101. if (NULL == pvarProperty)
  102. {
  103. hr = E_POINTER;
  104. _JumpError(hr, error, "NULL parm");
  105. }
  106. if (0 == wcscmp(strPropertyName, wszCMM_PROP_NAME))
  107. uiStr = IDS_LEGACYEXITMODULE_NAME;
  108. else
  109. {
  110. hr = S_FALSE;
  111. _JumpError(hr, error, "invalid property name");
  112. }
  113. // load string from resource
  114. hr = myLoadRCString(g_hInstance, uiStr, &pwszStr);
  115. _JumpIfError(hr, error, "myLoadRCString");
  116. pvarProperty->bstrVal = SysAllocString(pwszStr);
  117. if (NULL == pvarProperty->bstrVal)
  118. {
  119. hr = E_OUTOFMEMORY;
  120. _JumpError(hr, error, "out of memory");
  121. }
  122. myRegisterMemFree(pvarProperty->bstrVal, CSM_SYSALLOC); // this mem owned by caller
  123. pvarProperty->vt = VT_BSTR;
  124. hr = S_OK;
  125. error:
  126. if (NULL != pwszStr)
  127. {
  128. LocalFree(pwszStr);
  129. }
  130. return hr;
  131. }
  132. STDMETHODIMP
  133. CCertManageExitModule::SetProperty(
  134. /* [in] */ const BSTR strConfig,
  135. /* [in] */ BSTR strStorageLocation,
  136. /* [in] */ BSTR strPropertyName,
  137. /* [in] */ LONG dwFlags,
  138. /* [in] */ VARIANT const __RPC_FAR *pvalProperty)
  139. {
  140. // no settable properties supported
  141. return S_FALSE;
  142. }
  143. STDMETHODIMP
  144. CCertManageExitModule::Configure(
  145. /* [in] */ const BSTR strConfig,
  146. /* [in] */ BSTR strStorageLocation,
  147. /* [in] */ LONG dwFlags)
  148. {
  149. // no settable properties supported
  150. return S_FALSE;
  151. }