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.

116 lines
4.6 KiB

  1. /*
  2. ** s e c l a b e l. h
  3. **
  4. ** Purpose: Security labels interface
  5. **
  6. ** Ported from O2K fed release by YST
  7. **
  8. ** Copyright (C) Microsoft Corp. 1996-1999
  9. */
  10. #ifndef __SECLABEL_H
  11. #define __SECLABEL_H
  12. #ifdef SMIME_V3
  13. #include "SMimePol.h"
  14. #include "safepnt.h"
  15. #ifdef YST
  16. extern const CHAR c_szDefaultPolicyOid[];
  17. extern const WCHAR c_wszEmpty[];
  18. extern const WCHAR c_wszPolicyNone[];
  19. #endif // YST
  20. extern CRYPT_DECODE_PARA SecLabelDecode;
  21. extern CRYPT_ENCODE_PARA SecLabelEncode;
  22. #define MAX_SECURITY_POLICIES_CACHED 4
  23. typedef struct _SMIME_SECURITY_POLICY {
  24. BOOL fDefault; // TRUE if this is the default ssp.
  25. BOOL fValid; // True if this struct contains valid data.
  26. CHAR szPolicyOid[MAX_OID_LENGTH]; // Oid for policy module.
  27. WCHAR wszPolicyName[MAX_POLICY_NAME]; // Display Name for policy.
  28. CHAR szDllPath[MAX_PATH]; // security policy Dll name & path.
  29. CHAR szFuncName[MAX_FUNC_NAME]; // Entry func name.
  30. DWORD dwOtherInfo; // other policy info.
  31. DWORD dwUsage; // just count of # of accesses.
  32. HINSTANCE hinstDll; // handle to module(if loaded) or NULL.
  33. PFNGetSMimePolicy pfnGetSMimePolicy; // valid fn ptr or NULL.
  34. IUnknown *punk; // valid interface pointer to the policy object.
  35. } SMIME_SECURITY_POLICY, *PSMIME_SECURITY_POLICY;
  36. // Useful Macros
  37. #define DimensionOf(_array) (sizeof(_array) / sizeof((_array)[0]))
  38. // #define fFalse FALSE
  39. // #define fTrue TRUE
  40. // Useful safe pointers
  41. SAFE_INTERFACE_PTR(ISMimePolicySimpleEdit);
  42. SAFE_INTERFACE_PTR(ISMimePolicyFullEdit);
  43. SAFE_INTERFACE_PTR(ISMimePolicyCheckAccess);
  44. SAFE_INTERFACE_PTR(ISMimePolicyLabelInfo);
  45. SAFE_INTERFACE_PTR(ISMimePolicyValidateSend);
  46. // Function prototypes.
  47. // Is Policy RegInfo Loaded, Load/Unload it.
  48. BOOL FLoadedPolicyRegInfo();
  49. BOOL FPresentPolicyRegInfo();
  50. HRESULT HrLoadPolicyRegInfo(DWORD dwFlags);
  51. HRESULT HrUnloadPolicyRegInfo(DWORD dwFlags);
  52. HRESULT HrReloadPolicyRegInfo(DWORD dwFlags);
  53. // Find policy, is policy loaded, load/unload policy, ensure policy loaded.
  54. BOOL FFindPolicy(LPSTR szPolicyOid, PSMIME_SECURITY_POLICY *ppSsp);
  55. BOOL FIsPolicyLoaded(PSMIME_SECURITY_POLICY pSsp);
  56. HRESULT HrUnloadPolicy(PSMIME_SECURITY_POLICY pSsp);
  57. HRESULT HrLoadPolicy(PSMIME_SECURITY_POLICY pSsp);
  58. HRESULT HrEnsurePolicyLoaded(PSMIME_SECURITY_POLICY pSsp);
  59. HRESULT HrGetPolicy(LPSTR szPolicyOid, PSMIME_SECURITY_POLICY *ppSsp);
  60. HRESULT HrGetPolicyFlags(LPSTR szPolicyOid, LPDWORD pdwFlags) ;
  61. HRESULT HrQueryPolicyInterface(DWORD dwFlags, LPCSTR szPolicyOid, REFIID riid, LPVOID * ppv);
  62. //
  63. // Security label dlgproc, utility fns etc.
  64. //
  65. HRESULT HrGetLabelFromData(PSMIME_SECURITY_LABEL *pplabel, LPCSTR szPolicyOid,
  66. DWORD fHasClassification, DWORD dwClassification, LPCWSTR wszPrivacyMark,
  67. DWORD cCategories, CRYPT_ATTRIBUTE_TYPE_VALUE *rgCategories);
  68. HRESULT HrSetLabel(HWND hwndDlg, INT idcPolicyModule, INT idcClassification,
  69. INT idcPrivacyMark, INT idcConfigure,
  70. PSMIME_SECURITY_POLICY pSsp, PSMIME_SECURITY_LABEL pssl);
  71. BOOL SecurityLabelsOnInitDialog(HWND hwndDlg, PSMIME_SECURITY_LABEL plabel,
  72. INT idcPolicyModule, INT idcClassification,
  73. INT idcPrivacyMark, INT idcConfigure);
  74. HRESULT HrUpdateLabel(HWND hwndDlg, INT idcPolicyModule,
  75. INT idcClassification, INT idcPrivacyMark,
  76. INT idcConfigure, PSMIME_SECURITY_LABEL *pplabel);
  77. BOOL OnChangePolicy(HWND hwndDlg, LONG_PTR iEntry, INT idcPolicyModule,
  78. INT idcClassification, INT idcPrivacyMark,
  79. INT idcConfigure, PSMIME_SECURITY_LABEL *pplabel);
  80. INT_PTR CALLBACK SecurityLabelsDlgProc(HWND hwndDlg, UINT msg,
  81. WPARAM wParam, LPARAM lParam);
  82. HRESULT HrValidateLabelOnSend(PSMIME_SECURITY_LABEL plabel, HWND hwndParent,
  83. PCCERT_CONTEXT pccertSign,
  84. ULONG ccertRecip, PCCERT_CONTEXT *rgccertRecip);
  85. HRESULT HrValidateLabelRecipCert(PSMIME_SECURITY_LABEL plabel, HWND hwndParent,
  86. PCCERT_CONTEXT pccertRecip);
  87. DWORD DetermineCertUsageWithLabel(PCCERT_CONTEXT pccert,
  88. PSMIME_SECURITY_LABEL pLabel);
  89. BOOL FCompareLabels(PSMIME_SECURITY_LABEL plabel1, PSMIME_SECURITY_LABEL plabel2);
  90. HRESULT HrGetDefaultLabel(PSMIME_SECURITY_LABEL *pplabel);
  91. HRESULT HrGetOELabel(PSMIME_SECURITY_LABEL *pplabel);
  92. HRESULT HrSetOELabel(PSMIME_SECURITY_LABEL plabel);
  93. #endif // SMIME_V3
  94. #endif // __SECLABEL_H