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.

215 lines
7.0 KiB

  1. //+------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994.
  5. //
  6. // File: bmp_stg.hxx
  7. //
  8. // Contents: Generic Storage parser test
  9. //
  10. // Classes: CStorageParserTest, CStorageParser
  11. //
  12. // Functions:
  13. //
  14. // History: 15-June-94 t-vadims Created
  15. //
  16. //--------------------------------------------------------------------------
  17. #ifndef _BMP_STG_HXX_
  18. #define _BMP_STG_HXX_
  19. #include <bm_parse.hxx>
  20. class CStorageParserTest : public CTimerBase
  21. {
  22. public:
  23. virtual SCODE SetParserObject ();
  24. virtual SCODE DeleteParserObject ();
  25. virtual TCHAR *Name ();
  26. virtual TCHAR* SectionHeader ();
  27. };
  28. struct SInstrData;
  29. struct SInstrInfo;
  30. typedef SInstrData *LPINSTRDATA;
  31. class CStorageParser : public CParserBase
  32. {
  33. public:
  34. virtual SCODE Setup (CTestInput *pInput);
  35. virtual SCODE Cleanup ();
  36. virtual ULONG ParseNewInstruction (LPTSTR pszNewInstruction);
  37. virtual ULONG ExecuteInstruction (ULONG ulInstrID);
  38. virtual TCHAR* InstructionName (ULONG ulInstrID);
  39. private:
  40. BOOL IgnoreInstruction(LPTSTR pszInstr);
  41. ULONG AddInstruction (LPTSTR pszFirstPart, LPTSTR pszSecondPart);
  42. ULONG AddNewInstrData (LPINSTRDATA pInstrData);
  43. SCODE GetInstructionName (LPTSTR pszName, LPTSTR pszInstruction);
  44. ULONG FindStorageID (ULONG ulStgID);
  45. ULONG FindStreamID (ULONG ulStrmID);
  46. SCODE CheckThisStorageID (ULONG ulStgID);
  47. SCODE CheckThisStreamID (ULONG ulStgID);
  48. SCODE CheckForElementName(LPINSTRDATA pInstrData, DWORD dwType);
  49. ULONG Execute_StgIsStorageFile(LPINSTRDATA);
  50. SCODE Parse_StgIsStorageFile(LPINSTRDATA, LPTSTR, LPTSTR);
  51. ULONG Execute_StgOpenStorage(LPINSTRDATA);
  52. SCODE Parse_StgOpenStorage(LPINSTRDATA, LPTSTR, LPTSTR);
  53. ULONG Execute_StgCreateDocFile(LPINSTRDATA);
  54. SCODE Parse_StgCreateDocFile(LPINSTRDATA, LPTSTR, LPTSTR);
  55. ULONG Execute_IStorageAddRef(LPINSTRDATA);
  56. SCODE Parse_IStorageAddRef(LPINSTRDATA, LPTSTR, LPTSTR);
  57. ULONG Execute_IStorageRelease(LPINSTRDATA);
  58. SCODE Parse_IStorageRelease(LPINSTRDATA, LPTSTR, LPTSTR);
  59. ULONG Execute_IStorageSetClass(LPINSTRDATA);
  60. SCODE Parse_IStorageSetClass(LPINSTRDATA, LPTSTR, LPTSTR);
  61. ULONG Execute_IStorageSetElementTimes(LPINSTRDATA);
  62. SCODE Parse_IStorageSetElementTimes(LPINSTRDATA, LPTSTR, LPTSTR);
  63. ULONG Execute_IStorageCommit(LPINSTRDATA);
  64. SCODE Parse_IStorageCommit(LPINSTRDATA, LPTSTR, LPTSTR);
  65. ULONG Execute_IStorageRevert(LPINSTRDATA);
  66. SCODE Parse_IStorageRevert(LPINSTRDATA, LPTSTR, LPTSTR);
  67. ULONG Execute_IStorageStat(LPINSTRDATA);
  68. SCODE Parse_IStorageStat(LPINSTRDATA, LPTSTR, LPTSTR);
  69. ULONG Execute_IStorageSetStateBits(LPINSTRDATA);
  70. SCODE Parse_IStorageSetStateBits(LPINSTRDATA, LPTSTR, LPTSTR);
  71. ULONG Execute_IStorageCreateStorage(LPINSTRDATA);
  72. SCODE Parse_IStorageCreateStorage(LPINSTRDATA, LPTSTR, LPTSTR);
  73. ULONG Execute_IStorageOpenStorage(LPINSTRDATA);
  74. SCODE Parse_IStorageOpenStorage(LPINSTRDATA, LPTSTR, LPTSTR);
  75. ULONG Execute_IStorageCreateStream(LPINSTRDATA);
  76. SCODE Parse_IStorageCreateStream(LPINSTRDATA, LPTSTR, LPTSTR);
  77. ULONG Execute_IStorageOpenStream(LPINSTRDATA);
  78. SCODE Parse_IStorageOpenStream(LPINSTRDATA, LPTSTR, LPTSTR);
  79. ULONG Execute_IStorageDestroyElement(LPINSTRDATA);
  80. SCODE Parse_IStorageDestroyElement(LPINSTRDATA, LPTSTR, LPTSTR);
  81. ULONG Execute_IStorageRenameElement(LPINSTRDATA);
  82. SCODE Parse_IStorageRenameElement(LPINSTRDATA, LPTSTR, LPTSTR);
  83. ULONG Execute_IStreamAddRef(LPINSTRDATA);
  84. SCODE Parse_IStreamAddRef(LPINSTRDATA, LPTSTR, LPTSTR);
  85. ULONG Execute_IStreamRelease(LPINSTRDATA);
  86. SCODE Parse_IStreamRelease(LPINSTRDATA, LPTSTR, LPTSTR);
  87. ULONG Execute_IStreamCommit(LPINSTRDATA);
  88. SCODE Parse_IStreamCommit(LPINSTRDATA, LPTSTR, LPTSTR);
  89. ULONG Execute_IStreamClone(LPINSTRDATA);
  90. SCODE Parse_IStreamClone(LPINSTRDATA, LPTSTR, LPTSTR);
  91. ULONG Execute_IStreamRevert(LPINSTRDATA);
  92. SCODE Parse_IStreamRevert(LPINSTRDATA, LPTSTR, LPTSTR);
  93. ULONG Execute_IStreamSetSize(LPINSTRDATA);
  94. SCODE Parse_IStreamSetSize(LPINSTRDATA, LPTSTR, LPTSTR);
  95. ULONG Execute_IStreamRead(LPINSTRDATA);
  96. SCODE Parse_IStreamRead(LPINSTRDATA, LPTSTR, LPTSTR);
  97. TCHAR* GetName_IStreamRead(LPINSTRDATA);
  98. ULONG Execute_IStreamStat(LPINSTRDATA);
  99. SCODE Parse_IStreamStat(LPINSTRDATA, LPTSTR, LPTSTR);
  100. ULONG Execute_IStreamWrite(LPINSTRDATA);
  101. SCODE Parse_IStreamWrite(LPINSTRDATA, LPTSTR, LPTSTR);
  102. TCHAR* GetName_IStreamWrite(LPINSTRDATA);
  103. ULONG Execute_IStreamSeek(LPINSTRDATA);
  104. SCODE Parse_IStreamSeek(LPINSTRDATA, LPTSTR, LPTSTR);
  105. TCHAR* GetName_IStreamSeek(LPINSTRDATA);
  106. static SInstrInfo m_aInstructions[]; // All possible instructions
  107. static ULONG m_iMaxInstruction; // number of instructions in above array
  108. LPINSTRDATA *m_apInstrData; // Array of parameter data for each instruction
  109. ULONG m_iInstrArraySize; // size of array
  110. ULONG m_iInstrCount; // number of instructions
  111. ULONG *m_aulStorageID; // array of Storage ids. (addresses from log file)
  112. LPSTORAGE *m_apStorages; // array of Storages corresponding to above ids
  113. ULONG m_iStorageArraySize; // Size of 2 arrays above
  114. ULONG m_iStorageCount; // number of storages
  115. ULONG *m_aulStreamID; // array of Streams ids (address from log file)
  116. LPSTREAM *m_apStreams; // array of Streams corresponding to above ids
  117. ULONG m_iStreamArraySize; // Size of 2 arrays above
  118. ULONG m_iStreamCount; // number of storages
  119. BOOL m_bGotFirstPart; // flag if in the middle of 2-line instructions
  120. TCHAR m_szBuffer[120]; // Used as a temporary Buffer for either
  121. // Copy of first line in 2-line instructions or
  122. // instruction name.
  123. LPMALLOC m_piMalloc; // task specific allocator.
  124. };
  125. typedef SCODE (CStorageParser::*LPPARSE)(LPINSTRDATA, LPTSTR, LPTSTR);
  126. typedef ULONG (CStorageParser::*LPEXECUTE)(LPINSTRDATA);
  127. typedef TCHAR *(CStorageParser::*LPGETNAME)(LPINSTRDATA);
  128. //
  129. // Structure to hold parameters for particular instruction
  130. //
  131. struct SInstrData
  132. {
  133. ULONG ulInstrID;
  134. ULONG ThisID;
  135. ULONG OutID;
  136. DWORD dwParam1;
  137. DWORD dwParam2;
  138. DWORD dwParam3;
  139. OLECHAR *wszParam2;
  140. OLECHAR wszParam[MAX_PATH];
  141. };
  142. //
  143. // Structure to hold info about each possible instruction
  144. //
  145. struct SInstrInfo
  146. {
  147. TCHAR *szLogName; // name as found in log file
  148. TCHAR *szPrintName; // name to be outputed
  149. LPPARSE Parse; // pointer to function that would parse this instruction
  150. LPEXECUTE Execute; // pointer to function that would execute this instruction
  151. LPGETNAME GetName; // pointer to func returning name. Could be NULL.
  152. };
  153. #endif