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.

115 lines
2.8 KiB

  1. #ifndef _DEFINED_CDF_H_
  2. #define _DEFINED_CDF_H_
  3. #define MAX_NODE_NAME 32
  4. #define MAX_NODE_CLASS 64
  5. // pack definition structures on a DWORD boundary to match VB Type definition aligment
  6. #pragma pack(4)
  7. typedef enum tagCONV_NODE_TYPE
  8. {
  9. NODE_TYPE_PAGE,
  10. NODE_TYPE_CONVERSATION
  11. } CONV_NODE_TYPE;
  12. typedef struct tagCONV_HEADER
  13. {
  14. DWORD dwVersion;
  15. DWORD cNodes;
  16. DWORD dwFirstNodeID;
  17. DWORD dwReserved1;
  18. DWORD dwReserved2;
  19. } CONV_HEADER;
  20. typedef struct tagCONV_NODE
  21. {
  22. DWORD dwNodeID; // Not saved in file. NodeID = offset into file. Set on return from API
  23. char szName[MAX_NODE_NAME];
  24. char szClass[MAX_NODE_CLASS]; // TODO: Can we limit names and classes as such?
  25. DWORD dwReserved1;
  26. DWORD dwReserved2;
  27. DWORD dwReserved3;
  28. DWORD dwLinkCount;
  29. // DWORD dwLink1;
  30. // DWORD dwLink2;
  31. // ...
  32. // DWORD dwLinkN;
  33. // etc.
  34. } CONV_NODE;
  35. //
  36. // CDF File Format
  37. //
  38. // Header
  39. //
  40. // Name Len
  41. // Name
  42. // Class Len
  43. // Class
  44. // Link Count
  45. // Link1
  46. // Link2
  47. // ...
  48. // LinkN
  49. #pragma pack()
  50. // resource type name used for CDFs
  51. #define CDF_RESOURCE_TYPE "__ICDF__"
  52. // current version of CDF
  53. #define CDF_VERSION 0
  54. // File layout:
  55. //
  56. // header
  57. // constructor node (no links)
  58. // destructor node (no links)
  59. // termination node (no links)
  60. // OnError node
  61. // first link of OnError node
  62. // second link of OnError node
  63. // ...
  64. // nth link of OnError node
  65. // first conversation node
  66. // first link of first node
  67. // second link of first node
  68. // ...
  69. // nth link of first node
  70. // second conversation node
  71. // first link of second node
  72. // etc.
  73. //
  74. // File is always read and written sequentially
  75. ///////////////////////////////////////////////////////////////////
  76. //////////////////////////// CDF API //////////////////////////////
  77. ///////////////////////////////////////////////////////////////////
  78. // Functions for reading a CDF
  79. extern "C" HRESULT WINAPI CDF_Open(LPTSTR pszFileName, HANDLE *phCDF);
  80. extern "C" HRESULT WINAPI CDF_OpenFromResource(HANDLE hModule, LPCSTR pszResourceName, HANDLE *phCDF);
  81. extern "C" HRESULT WINAPI CDF_GetVersion(HANDLE hCDF, DWORD *pdwVersion);
  82. extern "C" HRESULT WINAPI CDF_GetNodeCount(HANDLE hCDF, DWORD *pdwNodeCount);
  83. extern "C" HRESULT WINAPI CDF_GetFirstNode(HANDLE hCDF, CONV_NODE *pConvNode);
  84. extern "C" HRESULT WINAPI CDF_GetNode(HANDLE hCDF, DWORD dwNodeID, CONV_NODE *pConvNode);
  85. extern "C" HRESULT WINAPI CDF_GetLink(HANDLE hCDF, DWORD dwNodeID, DWORD dwIndex, CONV_NODE *pDestConvNode);
  86. // Functions for writing a CDF
  87. extern "C" HRESULT WINAPI CDF_Create(LPCTSTR pszFileName, HANDLE *phCDF);
  88. extern "C" HRESULT WINAPI CDF_AddNode(HANDLE hCDF, LPSTR pszName, LPSTR pszClass);
  89. extern "C" HRESULT WINAPI CDF_AddLink(HANDLE hCDF, LPSTR pszDestNode);
  90. // Always close the CDF when finished reading or writing
  91. extern "C" HRESULT WINAPI CDF_Close(HANDLE hCDF);
  92. #endif // _DEFINED_CDF_H_