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.

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