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.

139 lines
4.8 KiB

  1. //
  2. // MODULE: APGTSHTX.H
  3. //
  4. // PURPOSE: HTX File Support header
  5. //
  6. // PROJECT: Generic Troubleshooter DLL for Microsoft AnswerPoint
  7. //
  8. // COMPANY: Saltmine Creative, Inc. (206)-633-4743 [email protected]
  9. //
  10. // AUTHOR: Roman Mach
  11. // further work by Roman Mach (RM), Richard Meadows (RWM), Joe Mabel, Oleg Kalosha
  12. //
  13. // ORIGINAL DATE: 8-2-96
  14. //
  15. // NOTES:
  16. // 1. Based on Print Troubleshooter DLL
  17. //
  18. // Version Date By Comments
  19. //--------------------------------------------------------------------
  20. // V0.1 - RM Original
  21. // V0.2 8/15/96 VM New htx format
  22. // V0.3 6/4/97 RWM Local Version for Memphis
  23. // V0.4 3/24/98 JM Local Version for NT5
  24. //
  25. #define HTX_FILENAME _T("gtstemp.hti")
  26. #define HTX_MAXSTORE 4096
  27. #define HTX_COMMAND_START _T("<!GTS")
  28. #define HTX_COMMAND_END _T(">")
  29. #define HTX_IFSTR _T("if")
  30. #define HTX_ELSESTR _T("else")
  31. #define HTX_ENDIFSTR _T("endif")
  32. #define HTX_FORANYSTR _T("forany")
  33. #define HTX_ENDFORSTR _T("endfor")
  34. #define HTX_DISPLAYSTR _T("display")
  35. #define HTX_RESOURCESTR _T("resource") // For adding include files from the resource directory.
  36. // these are types detected
  37. #define HTX_TYPEBEGIN 0 // apparently never used (12/97)
  38. #define HTX_TYPEINSERT 1 // apparently never used (12/97)
  39. #define HTX_TYPEREPEAT 2 // apparently never used (12/97)
  40. #define HTX_TYPEEND 3 // apparently never used (12/97)
  41. #define HTX_TYPEIF 4
  42. #define HTX_TYPEELSE 5
  43. #define HTX_TYPEENDIF 6
  44. #define HTX_TYPEFORANY 7
  45. #define HTX_TYPEENDFOR 8
  46. #define HTX_TYPEDISPLAY 9
  47. #define HTX_TYPESTART 10
  48. #define HTX_TYPERESOURCE 11
  49. //
  50. #define HTX_OFFSETMAX 10
  51. #define DATA_PROBLEM_ASK _T("$ProblemAsk")
  52. #define DATA_RECOMMENDATIONS _T("$Recommendations")
  53. #define DATA_STATE _T("$States")
  54. #define DATA_QUESTIONS _T("$Questions")
  55. #define DATA_BACK _T("$Back")
  56. #define DATA_TROUBLE_SHOOTERS _T("$TroubleShooters") // Used to display the list of available trouble shooters.
  57. // >>> code would be easier to follow if these related constants had a common prefix.
  58. #define PROBLEM_ASK_INDEX 1
  59. #define RECOMMENDATIONS_INDEX 2
  60. #define STATE_INDEX 3
  61. #define QUESTIONS_INDEX 4
  62. #define BACK_INDEX 5
  63. #define TROUBLE_SHOOTER_INDEX 6
  64. #define RESOURCE_INDEX 7
  65. // Gets data from htx file and builds html sections in memory
  66. // This is only called once in dllmain
  67. //
  68. class CHTMLInputTemplate
  69. {
  70. public:
  71. CHTMLInputTemplate(const TCHAR *);
  72. ~CHTMLInputTemplate();
  73. DWORD Reload();
  74. UINT GetCount();
  75. UINT GetStatus();
  76. Print(UINT nargs, CString *cstr);
  77. VOID SetInfer(CInfer *infer, TCHAR *vroot);
  78. HTXCommand *GetFirstCommand();
  79. void SetType(LPCTSTR type);
  80. void DumpContentsToStdout();
  81. DWORD Initialize(LPCTSTR szResPath, CString strFile);
  82. protected:
  83. void ScanFile();
  84. UINT BuildInMem();
  85. UINT CheckVariable(TCHAR *var_name);
  86. VOID Destroy();
  87. HTXCommand *Pop();
  88. Push(HTXCommand *command);
  89. bool IsFileName(TCHAR *name);
  90. protected:
  91. CString m_strResPath; // path to HTI (CHM) file
  92. CString m_strFile; // filename of HTI file if m_filename is pointing to CHM file
  93. int m_cHeaderItems; // (JM 10/25/97 not sure of this but looks like:)
  94. // number of resource files we've copied into memory
  95. // & which we dump into the header of HTML file
  96. DWORD m_dwErr;
  97. TCHAR *m_startstr; // pointer to the text of the whole HTI file
  98. TCHAR *m_chopstr; // used only during initialization of this object. Initially,
  99. // a copy of the whole HTI file, which gets chopped apart as we
  100. // look for various commands.
  101. DWORD m_dwSize; // size of HTI file (so we know how big an array it needs in memory)
  102. HTXCommand *m_cur_command; // as we build a singly linked list of commands (representing
  103. // a parse of the HTI file) this points
  104. // to the latest command added at the tail of the list.
  105. HTXCommand *m_command_start; // points to first command in linked list of commands.
  106. // this basically corresponds to the first thing in the
  107. // HTI file.
  108. TCHAR m_filename[256]; // (path)name of HTI (or CHM) file
  109. // These next 2 members are for a stack which really ought to be an object
  110. // in its own right
  111. HTXCommand *m_command_stack[10]; // a stack to keep track of things like an
  112. // "if" waiting for an "else"/"endif" or a "for"
  113. // waiting for an "endfor"
  114. UINT m_cur_stack_count; // top-of-stack index
  115. CInfer *m_infer; // access to inference object so we can drive use of
  116. // inference object by this particular template.
  117. UINT m_problemAsk; // apparently unused 10/97
  118. TCHAR m_tstype[30]; // This is the symbolic name XXX of the troubleshooter.
  119. // In the FORM in the resulting HTML this is used
  120. // in the context:
  121. // <INPUT TYPE=HIDDEN NAME="type" VALUE=XXX>
  122. TCHAR m_vroot[MAXBUF]; // >>> ??
  123. };