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.

92 lines
3.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: sipobjcb.hxx (CAB)
  8. //
  9. // Contents: Microsoft SIP Provider
  10. //
  11. // History: 14-Feb-1997 pberkman created
  12. //
  13. //--------------------------------------------------------------------------
  14. #ifndef SIPOBJCB_HXX
  15. #define SIPOBJCB_HXX
  16. #include "sipobj.hxx"
  17. extern "C"
  18. {
  19. # include "cabinet.h"
  20. };
  21. #define RESERVE_LEN_ALIGN(Len) ((Len + 3) & ~3) // all abReserve is alligned @ 4
  22. #define RESERVE_CNT_HDR_LEN (sizeof(USHORT) * 2) // cbJund & cbSig
  23. #define RESERVE_CAB_FLAG 0x00000001
  24. #define VERIFY_CAB_FLAG 0x00000002
  25. typedef struct _CAB_HDR_PARA
  26. {
  27. CFHEADER cfheader;
  28. CFRESERVE cfres;
  29. USHORT cbcfres; // 0 or sizeof(CFRESERVE)
  30. BYTE *pbReserve;
  31. BYTE *pbStrings;
  32. DWORD cbStrings;
  33. USHORT cbJunk;
  34. USHORT cbSig;
  35. CABSignatureStruct_ *pCabSigStruct;
  36. DWORD cbTotalHdr;
  37. } CAB_HDR_PARA;
  38. typedef struct _CAB_PARA
  39. {
  40. DWORD dwFlags;
  41. CAB_HDR_PARA Hdr;
  42. } CAB_PARA, *PCAB_PARA;
  43. class SIPObjectCAB_ : public SIPObject_
  44. {
  45. public:
  46. SIPObjectCAB_(DWORD id);
  47. virtual ~SIPObjectCAB_(void);
  48. BOOL CreateIndirectData(SIP_SUBJECTINFO *pSI,DWORD *pdwDLen,
  49. SIP_INDIRECT_DATA *psData);
  50. virtual BOOL RemoveSignedDataMsg(SIP_SUBJECTINFO *pSI,DWORD dwIdx);
  51. virtual char *GetDataObjectID(void) { return(SPC_CAB_DATA_OBJID); }
  52. virtual char *GetDataOIDHint(void) { return((char *)SPC_CAB_DATA_STRUCT); }
  53. protected:
  54. virtual BOOL PutMessageInFile(SIP_SUBJECTINFO *pSI,WIN_CERTIFICATE *pWinCert,
  55. DWORD *pdwIndex);
  56. virtual BOOL GetMessageFromFile(SIP_SUBJECTINFO *pSI,WIN_CERTIFICATE *pWinCert,
  57. DWORD dwIndex,DWORD *pcbCert);
  58. virtual BOOL GetDigestStream(DIGEST_DATA *pDigestData,
  59. DIGEST_FUNCTION pfnCallBack, DWORD dwFlags);
  60. private:
  61. CAB_PARA Para;
  62. BOOL fUseV1Sig;
  63. BOOL ReadHeader(void);
  64. BOOL ReadSignedData(BYTE *pbRet);
  65. BOOL WriteSignedData(BYTE *pbSig, DWORD cbSig);
  66. BOOL WriteSignedDataV1(BYTE *pbSignedData, DWORD cbSignedData);
  67. BOOL WriteHeader(void);
  68. void FreeHeader(void);
  69. BOOL RemoveCertificate(DWORD Index);
  70. BOOL ShiftFileBytes(LONG lbShift); // this may be needed in SIPObject_ (base)
  71. BOOL ReserveSignedData(DWORD cbSignedData);
  72. BOOL DigestHeader(DIGEST_FUNCTION pfnDigestData, DIGEST_HANDLE hDigestData);
  73. void ChecksumHeader(void);
  74. };
  75. #endif // SIPOBJCB_HXX