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.

77 lines
2.5 KiB

  1. #include <windows.h>
  2. #include <certca.h>
  3. #include "xenroll.h"
  4. typedef HRESULT (WINAPI * PFNCAGetCertTypeFlagsEx)
  5. (IN HCERTTYPE hCertType,
  6. IN DWORD dwOption,
  7. OUT DWORD * pdwFlags);
  8. typedef HRESULT (WINAPI * PFNCAGetCertTypePropertyEx)
  9. (IN HCERTTYPE hCertType,
  10. IN LPCWSTR wszPropertyName,
  11. OUT LPVOID pPropertyValue);
  12. typedef IEnroll4 * (WINAPI * PFNPIEnroll4GetNoCOM)();
  13. PFNCAGetCertTypeFlagsEx g_pfnCAGetCertTypeFlagsEx = NULL;
  14. PFNCAGetCertTypePropertyEx g_pfnCAGetCertTypePropertyEx = NULL;
  15. PFNPIEnroll4GetNoCOM g_pfnPIEnroll4GetNoCOM = NULL;
  16. //////////////////////////////////////////////////////////////////////
  17. //
  18. // Initializes the thunked procedures. Should be called before calling
  19. // any other function in this file.
  20. //
  21. //////////////////////////////////////////////////////////////////////
  22. void InitializeThunks()
  23. {
  24. HINSTANCE hCertCliDll = NULL;
  25. HINSTANCE hXenroll = NULL;
  26. hCertCliDll = LoadLibraryW(L"certcli.dll");
  27. if (NULL != hCertCliDll) {
  28. g_pfnCAGetCertTypeFlagsEx = (PFNCAGetCertTypeFlagsEx)GetProcAddress(hCertCliDll, "CAGetCertTypeFlagsEx");
  29. g_pfnCAGetCertTypePropertyEx = (PFNCAGetCertTypePropertyEx)GetProcAddress(hCertCliDll, "CAGetCertTypePropertyEx");
  30. }
  31. hXenroll = LoadLibraryW(L"xenroll.dll");
  32. if (NULL != hXenroll) {
  33. g_pfnPIEnroll4GetNoCOM = (PFNPIEnroll4GetNoCOM)GetProcAddress(hXenroll, "PIEnroll4GetNoCOM");
  34. }
  35. }
  36. HRESULT WINAPI MyCAGetCertTypeFlagsEx
  37. (IN HCERTTYPE hCertType,
  38. IN DWORD dwOption,
  39. OUT DWORD * pdwFlags)
  40. {
  41. if (NULL != g_pfnCAGetCertTypeFlagsEx) {
  42. return g_pfnCAGetCertTypeFlagsEx(hCertType, dwOption, pdwFlags);
  43. } else {
  44. return HRESULT_FROM_WIN32(ERROR_CALL_NOT_IMPLEMENTED);
  45. }
  46. }
  47. HRESULT WINAPI MyCAGetCertTypePropertyEx
  48. (IN HCERTTYPE hCertType,
  49. IN LPCWSTR wszPropertyName,
  50. OUT LPVOID pPropertyValue)
  51. {
  52. if (NULL != g_pfnCAGetCertTypePropertyEx) {
  53. return g_pfnCAGetCertTypePropertyEx(hCertType, wszPropertyName, pPropertyValue);
  54. } else {
  55. return HRESULT_FROM_WIN32(ERROR_CALL_NOT_IMPLEMENTED);
  56. }
  57. }
  58. IEnroll4 * WINAPI MyPIEnroll4GetNoCOM()
  59. {
  60. if (NULL != g_pfnPIEnroll4GetNoCOM) {
  61. return g_pfnPIEnroll4GetNoCOM();
  62. } else {
  63. SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
  64. return NULL;
  65. }
  66. }