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.

124 lines
4.0 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // File: smarshal.hxx
  4. //
  5. // Synopsis: definitions for interface marshaling stress test
  6. // main driver code.
  7. //
  8. // History: 21-Aug-95 Rickhi Created
  9. //
  10. //--------------------------------------------------------------------
  11. #include <windows.h>
  12. #include <ole2.h>
  13. #include <stdio.h>
  14. #include <tunk.h> // IUnknown interface
  15. #include <stream.hxx> // CStreamOnFile
  16. //+-------------------------------------------------------------------
  17. //
  18. // Defintions:
  19. //
  20. //--------------------------------------------------------------------
  21. typedef struct INTERFACEPARAMS
  22. {
  23. IID iid; // IID of interface punk
  24. IUnknown *punk; // interface pointer
  25. IStream *pStm; // stream pointer
  26. HANDLE hEventStart; // start event
  27. HANDLE hEventDone; // done event
  28. } INTERFACEPARAMS;
  29. typedef struct tagEXECPARAMS
  30. {
  31. DWORD dwFlags; // execution flags
  32. HANDLE hEventThreadStart;// wait event before starting thread
  33. HANDLE hEventThreadDone; // signal event when done thread
  34. HANDLE hEventThreadExit; // wait event before exiting thread
  35. ULONG cReps; // test reps
  36. HANDLE hEventRepStart; // wait event before starting next rep
  37. HANDLE hEventRepDone; // signal event when done next rep
  38. ULONG cIPs; // count of interfaces that follow
  39. INTERFACEPARAMS aIP[1]; // interface parameter blocks
  40. } EXECPARAMS;
  41. typedef enum tagOPFLAGS
  42. {
  43. OPF_MARSHAL = 1, // marshal interface
  44. OPF_UNMARSHAL = 2, // unmarshal interface
  45. OPF_DISCONNECT = 4, // disconnect interface
  46. OPF_RELEASEMARSHALDATA = 8, // release the marshal data
  47. OPF_RELEASE = 16, // release interface
  48. OPF_INITAPARTMENT = 32, // initialize apartment model
  49. OPF_INITFREE = 64 // initialize freethreaded model
  50. } OPFLAGS;
  51. //+-------------------------------------------------------------------
  52. //
  53. // Globals:
  54. //
  55. //--------------------------------------------------------------------
  56. extern BOOL gfVerbose; // print execution messages
  57. extern BOOL gfDebug; // print debug messages
  58. extern int gicReps; // number of repetitions of each test
  59. extern int gicThreads; // number of threads to use on each test
  60. extern DWORD giThreadModel; // threading model to use on each test
  61. //+-------------------------------------------------------------------
  62. //
  63. // Macros:
  64. //
  65. //--------------------------------------------------------------------
  66. #define MSGOUT if (gfVerbose) printf
  67. #define DBGOUT if (gfDebug) printf
  68. #define ERROUT printf
  69. //+-------------------------------------------------------------------
  70. //
  71. // Function ProtoTypes:
  72. //
  73. //--------------------------------------------------------------------
  74. void CHKRESULT(HRESULT hr, CHAR *pszOperation);
  75. void CHKTESTRESULT(BOOL fRes, CHAR *pszMsg);
  76. HANDLE GetEvent(void);
  77. void ReleaseEvent(HANDLE hEvent);
  78. BOOL WaitForEvent(HANDLE hEvent);
  79. void SignalEvent(HANDLE hEvent);
  80. IStream * GetStream(void);
  81. void ReleaseStream(IStream *pStm);
  82. HRESULT ResetStream(IStream *pStm);
  83. IUnknown * GetInterface(void);
  84. void ReleaseInterface(IUnknown *punk);
  85. EXECPARAMS * CreateExecParam(ULONG cIP);
  86. void FillExecParam(EXECPARAMS *pEP, DWORD dwFlags, ULONG cReps,
  87. HANDLE hEventRepStart, HANDLE hEventRepDone,
  88. HANDLE hEventThreadStart, HANDLE hEventThreadDone);
  89. void ReleaseExecParam(EXECPARAMS *pEP);
  90. void FillInterfaceParam(INTERFACEPARAMS *pIP, REFIID riid,
  91. IUnknown *punk, IStream *pStm,
  92. HANDLE hEventStart, HANDLE hEventDone);
  93. void ReleaseInterfaceParam(INTERFACEPARAMS *pIP);
  94. DWORD _stdcall WorkerThread(void *params);
  95. BOOL GenericExecute(ULONG cEPs, EXECPARAMS *pEP[]);
  96. void GenericCleanup(ULONG cEPs, EXECPARAMS *pEP[]);
  97. //+-------------------------------------------------------------------
  98. //
  99. // Test Variation ProtoTypes:
  100. //
  101. //--------------------------------------------------------------------
  102. BOOL TestVar1(void);
  103. BOOL TestVar2(void);