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.

395 lines
7.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft OLE
  4. // Copyright (C) Microsoft Corporation, 1994 - 1995.
  5. //
  6. // File: tstclass.hxx
  7. //
  8. // Contents: These are the test classes that marina defines.
  9. // They should be used by tests dll's.
  10. //
  11. // Classes: CMApplication
  12. // CMDocument
  13. // CMOleObject
  14. //
  15. // Functions:
  16. //
  17. // History: 09-26-95 alexe Cleaned things up, added more
  18. // marina functions
  19. // 06-27-95 alexe Made everything WCHAR based
  20. // 12-05-94 kennethm Created
  21. //
  22. //--------------------------------------------------------------------------
  23. #ifndef __TSTCLASS_HXX__
  24. #define __TSTCLASS_HXX__
  25. //
  26. // The hack below is due to a risc compiler problem.
  27. // We have to specify DllExport or Import at definition
  28. // time.
  29. //
  30. #define DllExport __declspec(dllexport)
  31. #define DllImport __declspec(dllimport)
  32. #ifdef MARINADLL
  33. #define DllScope DllExport
  34. #else
  35. #define DllScope DllImport
  36. #endif
  37. //
  38. // Defines for the object types
  39. // Do not modify this value without matching changes in marina's idl file
  40. //
  41. typedef enum tagObjectType {
  42. eServer = 1,
  43. eContainer,
  44. eLink
  45. } OBJECTTYPE;
  46. //
  47. // Forward declarations
  48. //
  49. class DllScope CMObject;
  50. class DllScope CMDocument;
  51. class DllScope CMApplication;
  52. //+-------------------------------------------------------------------------
  53. //
  54. // Class: CMApplication
  55. //
  56. // Purpose:
  57. //
  58. // Interface: CreateAndLaunch
  59. // Close
  60. // CreateDoc
  61. // CreateDocEx
  62. // OpenDoc
  63. // CloseAllDocs
  64. // GetDocumentCount
  65. // CallFunction
  66. // IsEqual
  67. //
  68. // ~CMApplication
  69. // CMApplication
  70. //
  71. // History: 1-18-95 kennethm Created
  72. //
  73. // Notes:
  74. //
  75. //--------------------------------------------------------------------------
  76. class DllScope CMApplication
  77. {
  78. public:
  79. //
  80. // Static create function
  81. //
  82. static HRESULT CreateAndLaunch(
  83. CMApplication** ppNewApplication,
  84. LPTSTR pszAppName);
  85. //
  86. // Close the application
  87. //
  88. HRESULT Close(
  89. LPVOID pvArgs,
  90. size_t cbArgs) ;
  91. //
  92. // Makes a new document inside this application
  93. //
  94. HRESULT CreateDoc(
  95. CMDocument **ppNewDocument,
  96. LPVOID pvArgs,
  97. size_t cbArgs) ;
  98. HRESULT CreateDocEx(
  99. CMDocument **ppNewDocument,
  100. LPWSTR pszFunctionName,
  101. LPVOID pvArgs,
  102. size_t cbArgs) ;
  103. //
  104. // Open a document
  105. //
  106. HRESULT OpenDoc(
  107. CMDocument **ppNewDocument,
  108. LPVOID pvArgs,
  109. size_t cbArgs) ;
  110. //
  111. // Close all documents
  112. //
  113. HRESULT CloseAllDocs(
  114. LPVOID pvArgs,
  115. size_t cbArgs) ;
  116. //
  117. // Get the total number of documents
  118. //
  119. HRESULT GetDocumentCount(
  120. LPVOID pvArgs,
  121. size_t cbArgs,
  122. DWORD *pdwCount) ;
  123. //
  124. // Run a function on the application side
  125. //
  126. HRESULT CallFunction(
  127. LPWSTR pszFunctionName,
  128. PVOID pvParamIn,
  129. size_t stParamSizeIn,
  130. PLONG plResultOut,
  131. PVOID *ppvParamOut,
  132. size_t *pstParamSizeOut);
  133. //
  134. // Check to see if this is equal to another CMApplication object.
  135. //
  136. BOOL IsEqual(CMApplication* pOtherApp);
  137. ~CMApplication();
  138. CMApplication(HANDLE hMySelf, HANDLE hProcess);
  139. private:
  140. //
  141. // Constructor. Use the static createandlaunch function to
  142. // create an application
  143. //
  144. CMApplication();
  145. //
  146. // Global reference for this application
  147. //
  148. HANDLE m_hMySelf;
  149. //
  150. // This applications entry in the slip table
  151. //
  152. HANDLE m_hSlipEntry;
  153. //
  154. // This is the process handle of the application.
  155. // Used in the close method to wait for application to actually
  156. // close.
  157. //
  158. HANDLE m_hProcess ;
  159. };
  160. //+-------------------------------------------------------------------------
  161. //
  162. // Class: CMDocument
  163. //
  164. // Purpose:
  165. //
  166. // Interface: CMDocument(handle)
  167. // Save
  168. // Close
  169. // Copy
  170. // InsertObject
  171. // GetObject
  172. // GetApplication
  173. // IsEqual
  174. // CallFunction
  175. //
  176. // History: 1-18-95 kennethm Created
  177. //
  178. // Notes:
  179. //
  180. //--------------------------------------------------------------------------
  181. class DllScope CMDocument
  182. {
  183. public:
  184. //
  185. // Constructor. Called normally by CMApplication::CreateDoc
  186. //
  187. CMDocument(HANDLE hMySelf)
  188. {
  189. m_hMySelf = hMySelf;
  190. }
  191. //
  192. // Save the document
  193. //
  194. HRESULT Save(
  195. LPVOID pvArgs,
  196. size_t cbArgs) ;
  197. //
  198. // Close the document
  199. //
  200. HRESULT Close(
  201. LPVOID pvArgs,
  202. size_t cbArgs) ;
  203. //
  204. // Copies the document to the clipboard
  205. //
  206. HRESULT CopyDocument(LPVOID pvArgs, size_t cbArgs) ;
  207. //
  208. // Insert an object
  209. //
  210. HRESULT InsertObject(
  211. LPVOID pvArgs,
  212. size_t cbArgs,
  213. CMObject **ppMObject);
  214. //
  215. // Get child object of document
  216. //
  217. HRESULT GetObject(
  218. LPVOID pvArgs,
  219. size_t cbArgs,
  220. CMObject **ppMObject);
  221. //
  222. // Return pointer to parent CMAppliation class
  223. //
  224. HRESULT GetApplication(CMApplication** ppApplication);
  225. //
  226. // Check to see if this is equal to another CMDocument object.
  227. //
  228. BOOL IsEqual(CMDocument* pOtherDoc);
  229. //
  230. // Calls the named function on this document
  231. //
  232. HRESULT CallFunction(
  233. LPWSTR pszFunctionName,
  234. PVOID pvParamIn,
  235. size_t stParamSizeIn,
  236. PLONG plResultOut,
  237. PVOID *ppvParamOut,
  238. size_t *pstParamSizeOut);
  239. //
  240. // Get the total number of objects
  241. //
  242. HRESULT GetObjectCount(
  243. LPVOID pvArgs,
  244. size_t cbArgs,
  245. DWORD *pdwCount) ;
  246. private:
  247. //
  248. // This is not a slip table handle. This is the handle that
  249. // references this document on a system wide basis.
  250. //
  251. HANDLE m_hMySelf;
  252. };
  253. //+-------------------------------------------------------------------------
  254. //
  255. // Class: CMObject
  256. //
  257. // Purpose:
  258. //
  259. // Interface: CMObject(handle)
  260. // GetServerDocument
  261. // CopyObject
  262. // ActivateObject
  263. // CallFunction
  264. //
  265. // History: 12-18-95 kennethm Created
  266. //
  267. // Notes:
  268. //
  269. //--------------------------------------------------------------------------
  270. class DllScope CMObject
  271. {
  272. public:
  273. CMObject(HANDLE hSlipEntry);
  274. ~CMObject();
  275. //
  276. // Returns this objects representation on the server side
  277. //
  278. HRESULT GetServerDocument(
  279. LPCWSTR pszFileName,
  280. CMDocument** ppDocument);
  281. //
  282. // Copies an object
  283. //
  284. HRESULT CopyObject(LPVOID pvArgs, size_t cbArgs) ;
  285. //
  286. // Activates a site object
  287. //
  288. HRESULT ActivateObject(
  289. LPVOID pvArgs,
  290. size_t cbArgs,
  291. LPCWSTR pszDocumentName,
  292. CMDocument **ppSvrDoc);
  293. //
  294. // Performs a remote function call at the object level
  295. //
  296. HRESULT CMObject::CallFunction(
  297. LPWSTR pszFunctionName,
  298. PVOID pvParamIn,
  299. size_t stParamSizeIn,
  300. PLONG plResultOut,
  301. PVOID *ppvParamOut,
  302. size_t *pstParamSizeOut);
  303. private:
  304. //
  305. // This objects entry in the slip table
  306. //
  307. HANDLE m_hSlipEntry;
  308. };
  309. #endif // __TSTCLASS_HXX__