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.

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