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.

184 lines
4.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: certif.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include "stdafx.h"
  11. #include "csprop.h"
  12. #include "ciinit.h"
  13. #define __dwFILE__ __dwFILE_CERTMMC_CERTIF_CPP__
  14. FNCIGETPROPERTY PropCIGetProperty;
  15. FNCISETPROPERTY PropCISetProperty;
  16. FNCIGETEXTENSION PropCIGetExtension;
  17. FNCISETPROPERTY PropCISetExtension;
  18. FNCIENUMSETUP PropCIEnumSetup;
  19. FNCIENUMNEXT PropCIEnumNext;
  20. FNCIENUMCLOSE PropCIEnumClose;
  21. SERVERCALLBACKS ThunkedCallbacks =
  22. {
  23. PropCIGetProperty, // FNCIGETPROPERTY *pfnGetProperty;
  24. PropCISetProperty, // FNCISETPROPERTY *pfnSetProperty;
  25. PropCIGetExtension, // FNCIGETEXTENSION *pfnGetExtension;
  26. PropCISetExtension, // FNCISETEXTENSION *pfnSetExtension;
  27. PropCIEnumSetup, // FNCIENUMSETUP *pfnEnumSetup;
  28. PropCIEnumNext, // FNCIENUMNEXT *pfnEnumNext;
  29. PropCIEnumClose, // FNCIENUMCLOSE *pfnEnumClose;
  30. };
  31. CertSvrCA* g_pCA = NULL;
  32. HRESULT ThunkServerCallbacks(CertSvrCA* pCA)
  33. {
  34. HRESULT hr = S_OK;
  35. static BOOL fInitialized = FALSE;
  36. if (!fInitialized)
  37. {
  38. fInitialized = TRUE;
  39. // initialize certif.dll
  40. hr = CertificateInterfaceInit(
  41. &ThunkedCallbacks,
  42. sizeof(ThunkedCallbacks));
  43. }
  44. g_pCA = pCA;
  45. return hr;
  46. }
  47. HRESULT
  48. PropCIGetProperty(
  49. IN LONG, // Context
  50. IN DWORD Flags,
  51. IN WCHAR const *pwszPropertyName,
  52. OUT VARIANT *pvarPropertyValue)
  53. {
  54. HRESULT hr;
  55. if (NULL != pvarPropertyValue)
  56. {
  57. VariantInit(pvarPropertyValue);
  58. }
  59. if (NULL == pwszPropertyName || NULL == pvarPropertyValue)
  60. {
  61. hr = E_POINTER;
  62. _JumpError(hr, error, "NULL parm");
  63. }
  64. hr = E_INVALIDARG;
  65. if ((PROPCALLER_MASK & Flags) != PROPCALLER_POLICY &&
  66. (PROPCALLER_MASK & Flags) != PROPCALLER_EXIT)
  67. {
  68. _JumpError(hr, error, "Flags: Invalid caller");
  69. }
  70. // Special, hard-coded properties we need to support
  71. if (0 == LSTRCMPIS(pwszPropertyName, wszPROPCATYPE))
  72. {
  73. ENUM_CATYPES caType = g_pCA->GetCAType();
  74. hr = myUnmarshalVariant(
  75. Flags,
  76. sizeof(DWORD),
  77. (PBYTE)&caType,
  78. pvarPropertyValue);
  79. _JumpIfError(hr, error, "myUnmarshalVariant");
  80. }
  81. else if (0 == LSTRCMPIS(pwszPropertyName, wszPROPUSEDS))
  82. {
  83. BOOL fUseDS = g_pCA->FIsUsingDS();
  84. hr = myUnmarshalVariant(
  85. Flags,
  86. sizeof(BOOL),
  87. (PBYTE)&fUseDS,
  88. pvarPropertyValue);
  89. _JumpIfError(hr, error, "myUnmarshalVariant");
  90. }
  91. else
  92. {
  93. hr = CERTSRV_E_PROPERTY_EMPTY;
  94. }
  95. error:
  96. return(myHError(hr));
  97. }
  98. HRESULT
  99. PropCISetProperty(
  100. IN LONG, // Context
  101. IN DWORD, // Flags
  102. IN WCHAR const *, // pwszPropertyName
  103. IN VARIANT const * /* pvarPropertyValue */ )
  104. {
  105. return E_NOTIMPL;
  106. }
  107. HRESULT
  108. PropCIGetExtension(
  109. IN LONG, // Context
  110. IN DWORD, // Flags
  111. IN WCHAR const *, // pwszExtensionName
  112. OUT DWORD *, // pdwExtFlags
  113. OUT VARIANT * /* pvarValue */ )
  114. {
  115. return E_NOTIMPL;
  116. }
  117. HRESULT
  118. PropCISetExtension(
  119. IN LONG, // Context
  120. IN DWORD, // Flags
  121. IN WCHAR const *, // pwszExtensionName
  122. IN DWORD, // ExtFlags
  123. IN VARIANT const * /* pvarValue */ )
  124. {
  125. return E_NOTIMPL;
  126. }
  127. HRESULT
  128. PropCIEnumSetup(
  129. IN LONG, // Context
  130. IN LONG, // Flags
  131. IN OUT CIENUM * /* pciEnum */ )
  132. {
  133. return E_NOTIMPL;
  134. }
  135. HRESULT PropCIEnumNext(
  136. IN OUT CIENUM *, // pciEnum
  137. OUT BSTR * /* pstrPropertyName */ )
  138. {
  139. return E_NOTIMPL;
  140. }
  141. HRESULT
  142. PropCIEnumClose(
  143. IN OUT CIENUM * /* pciEnum */ )
  144. {
  145. return E_NOTIMPL;
  146. }