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.

125 lines
3.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: misc.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __MISC_H_
  11. #define __MISC_H_
  12. // count the number of bytes needed to fully store the WSZ
  13. #define WSZ_BYTECOUNT(__z__) \
  14. ( (__z__ == NULL) ? 0 : (wcslen(__z__)+1)*sizeof(WCHAR) )
  15. #define IDM_NEW_CERTTYPE 1
  16. #define IDM_EDIT_GLOBAL_CERTTYPE 2
  17. #define IDM_MANAGE 3
  18. LPCWSTR GetNullMachineName(CString* pcstr);
  19. BOOL StringFromDurationUnit(DWORD dwExpirationUnits, CString* pcstr, BOOL fLocalized);
  20. STDMETHODIMP CStringLoad(CString& cstr, IStream *pStm);
  21. STDMETHODIMP CStringSave(CString& cstr, IStream *pStm, BOOL fClearDirty);
  22. void DisplayGenericCertSrvError(LPCONSOLE2 pConsole, DWORD dwErr);
  23. LPWSTR BuildErrorMessage(DWORD dwErr);
  24. BOOL FileTimeToLocalTimeString(FILETIME* pftGMT, LPWSTR* ppszTmp);
  25. BOOL MyGetEnhancedKeyUsages(HCERTTYPE hCertType, CString **aszUsages, DWORD *cUsages, BOOL *pfCritical, BOOL fGetOIDSNotNames);
  26. BOOL GetIntendedUsagesString(HCERTTYPE hCertType, CString *pUsageString);
  27. BOOL MyGetKeyUsages(HCERTTYPE hCertType, CRYPT_BIT_BLOB **ppBitBlob, BOOL *pfPublicKeyUsageCritical);
  28. BOOL MyGetBasicConstraintInfo(HCERTTYPE hCertType, BOOL *pfCA, BOOL *pfPathLenConstraint, DWORD *pdwPathLenConstraint);
  29. LPSTR MyMkMBStr(LPCWSTR pwsz);
  30. LPWSTR MyMkWStr(LPCSTR psz);
  31. void MyErrorBox(HWND hwndParent, UINT nIDText, UINT nIDCaption, DWORD dwErrorCode = 0);
  32. LPSTR AllocAndCopyStr(LPCSTR psz);
  33. LPWSTR AllocAndCopyStr(LPCWSTR pwsz);
  34. BOOL MyGetOIDInfo(LPWSTR string, DWORD stringSize, LPSTR pszObjId);
  35. #define WIZ_DEFAULT_SD L"O:DAG:DAD:(A;;0x00000001;;;DA)"
  36. #define REGSZ_ENABLE_CERTTYPE_EDITING L"EnableCertTypeEditing"
  37. typedef struct _WIZARD_HELPER{
  38. // KeyUsage
  39. CRYPT_BIT_BLOB *pKeyUsage;
  40. BYTE KeyUsageBytes[2];
  41. BOOL fMarkKeyUsageCritical;
  42. // EnhancedKeyUsage
  43. CERT_ENHKEY_USAGE EnhancedKeyUsage;
  44. BOOL fMarkEKUCritical;
  45. // Basic Constraints
  46. CERT_BASIC_CONSTRAINTS2_INFO BasicConstraints2;
  47. // other cert type info
  48. CString* pcstrFriendlyName;
  49. BOOL fIncludeEmail;
  50. BOOL fAllowAutoEnroll;
  51. BOOL fAllowCAtoFillInInfo;
  52. BOOL fMachine;
  53. BOOL fPublishToDS;
  54. BOOL fAddTemplateName;
  55. BOOL fAddDirectoryPath;
  56. // CSP info
  57. BOOL fPrivateKeyExportable;
  58. BOOL fDigitalSignatureContainer;
  59. BOOL fKeyExchangeContainer;
  60. CString* rgszCSPList;
  61. DWORD cCSPs;
  62. // page control varaibles
  63. BOOL fShowAdvanced;
  64. BOOL fBaseCertTypeUsed;
  65. BOOL fInEditCertTypeMode;
  66. BOOL fCleanupOIDCheckBoxes;
  67. CString* pcstrBaseCertName;
  68. // fonts
  69. CFont BigBoldFont;
  70. CFont BoldFont;
  71. // ACL's
  72. PSECURITY_DESCRIPTOR pSD;
  73. BOOL fKeyUsageInitialized;
  74. } WIZARD_HELPER, *PWIZARD_HELPER;
  75. BOOL IsCerttypeEditingAllowed();
  76. HRESULT RetrieveCATemplateList(
  77. HCAINFO hCAInfo,
  78. CTemplateList& list);
  79. HRESULT UpdateCATemplateList(
  80. HCAINFO hCAInfo,
  81. const CTemplateList& list);
  82. HRESULT AddToCATemplateList(
  83. HCAINFO hCAInfo,
  84. CTemplateList& list,
  85. HCERTTYPE hCertType);
  86. HRESULT RemoveFromCATemplateList(
  87. HCAINFO hCAInfo,
  88. CTemplateList& list,
  89. HCERTTYPE hCertType);
  90. #endif //__MISC_H_