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.

852 lines
30 KiB

  1. /*************************************************************************
  2. **
  3. ** OLE 2.0 Standard Utilities
  4. **
  5. ** olestd.h
  6. **
  7. ** This file contains file contains data structure defintions,
  8. ** function prototypes, constants, etc. for the common OLE 2.0
  9. ** utilities.
  10. ** These utilities include the following:
  11. ** Debuging Assert/Verify macros
  12. ** HIMETRIC conversion routines
  13. ** reference counting debug support
  14. ** OleStd API's for common compound-document app support
  15. **
  16. ** (c) Copyright Microsoft Corp. 1990 - 1992 All Rights Reserved
  17. **
  18. *************************************************************************/
  19. #if !defined( _OLESTD_H_ )
  20. #define _OLESTD_H_
  21. #ifndef RC_INVOKED
  22. #pragma message ("INCLUDING OLESTD.H from " __FILE__)
  23. #endif /* RC_INVOKED */
  24. #if defined( __TURBOC__ ) || defined( WIN32 )
  25. #define _based(a)
  26. #endif
  27. #ifndef RC_INVOKED
  28. #include <dos.h> // needed for filetime
  29. #endif /* RC_INVOKED */
  30. #include <commdlg.h> // needed for LPPRINTDLG
  31. #include <shellapi.h> // needed for HKEY
  32. // String table defines...
  33. #define IDS_OLESTDNOCREATEFILE 700
  34. #define IDS_OLESTDNOOPENFILE 701
  35. #define IDS_OLESTDDISKFULL 702
  36. /*
  37. * Some C interface declaration stuff
  38. */
  39. #if ! defined(__cplusplus)
  40. typedef struct tagINTERFACEIMPL {
  41. IUnknownVtbl FAR* lpVtbl;
  42. LPVOID lpBack;
  43. int cRef; // interface specific ref count.
  44. } INTERFACEIMPL, FAR* LPINTERFACEIMPL;
  45. #define INIT_INTERFACEIMPL(lpIFace, pVtbl, pBack) \
  46. ((lpIFace)->lpVtbl = pVtbl, \
  47. ((LPINTERFACEIMPL)(lpIFace))->lpBack = (LPVOID)pBack, \
  48. ((LPINTERFACEIMPL)(lpIFace))->cRef = 0 \
  49. )
  50. #if defined( _DEBUG )
  51. #define OleDbgQueryInterfaceMethod(lpUnk) \
  52. ((lpUnk) != NULL ? ((LPINTERFACEIMPL)(lpUnk))->cRef++ : 0)
  53. #define OleDbgAddRefMethod(lpThis, iface) \
  54. ((LPINTERFACEIMPL)(lpThis))->cRef++
  55. #if _DEBUGLEVEL >= 2
  56. #define OleDbgReleaseMethod(lpThis, iface) \
  57. (--((LPINTERFACEIMPL)(lpThis))->cRef == 0 ? \
  58. OleDbgOut("\t" iface "* RELEASED (cRef == 0)\r\n"),1 : \
  59. (((LPINTERFACEIMPL)(lpThis))->cRef < 0) ? \
  60. ( \
  61. DebugBreak(), \
  62. OleDbgOut( \
  63. "\tERROR: " iface "* RELEASED TOO MANY TIMES\r\n") \
  64. ),1 : \
  65. 1)
  66. #else // if _DEBUGLEVEL < 2
  67. #define OleDbgReleaseMethod(lpThis, iface) \
  68. (--((LPINTERFACEIMPL)(lpThis))->cRef == 0 ? \
  69. 1 : \
  70. (((LPINTERFACEIMPL)(lpThis))->cRef < 0) ? \
  71. ( \
  72. OleDbgOut( \
  73. "\tERROR: " iface "* RELEASED TOO MANY TIMES\r\n") \
  74. ),1 : \
  75. 1)
  76. #endif // if _DEBUGLEVEL < 2
  77. #else // ! defined (_DEBUG)
  78. #define OleDbgQueryInterfaceMethod(lpUnk)
  79. #define OleDbgAddRefMethod(lpThis, iface)
  80. #define OleDbgReleaseMethod(lpThis, iface)
  81. #endif // if defined( _DEBUG )
  82. #endif // ! defined(__cplusplus)
  83. /*
  84. * Some docfiles stuff
  85. */
  86. #define STGM_DFRALL (STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_DENY_WRITE)
  87. #define STGM_DFALL (STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE)
  88. #define STGM_SALL (STGM_READWRITE | STGM_SHARE_EXCLUSIVE)
  89. /*
  90. * Some moniker stuff
  91. */
  92. // Delimeter used to separate ItemMoniker pieces of a composite moniker
  93. #if defined( _MAC )
  94. #define OLESTDDELIM ":"
  95. #else
  96. #define OLESTDDELIM TEXT("\\")
  97. #endif
  98. /*
  99. * Some Concurrency stuff
  100. */
  101. /* standard Delay (in msec) to wait before retrying an LRPC call.
  102. ** this value is returned from IMessageFilter::RetryRejectedCall
  103. */
  104. #define OLESTDRETRYDELAY (DWORD)5000
  105. /* Cancel the pending outgoing LRPC call.
  106. ** this value is returned from IMessageFilter::RetryRejectedCall
  107. */
  108. #define OLESTDCANCELRETRY (DWORD)-1
  109. /*
  110. * Some Icon support stuff.
  111. *
  112. * The following API's are now OBSOLETE because equivalent API's have been
  113. * added to the OLE2.DLL library
  114. * GetIconOfFile superceeded by OleGetIconOfFile
  115. * GetIconOfClass superceeded by OleGetIconOfClass
  116. * OleUIMetafilePictFromIconAndLabel
  117. * superceeded by OleMetafilePictFromIconAndLabel
  118. *
  119. * The following macros are defined for backward compatibility with previous
  120. * versions of the OLE2UI library. It is recommended that the new Ole* API's
  121. * should be used instead.
  122. */
  123. #define GetIconOfFile(hInst, lpszFileName, fUseFileAsLabel) \
  124. OleGetIconOfFileA(lpszFileName, fUseFileAsLabel)
  125. #define GetIconOfClass(hInst, rclsid, lpszLabel, fUseTypeAsLabel) \
  126. OleGetIconOfClassA(rclsid, lpszLabel, fUseTypeAsLabel)
  127. #define OleUIMetafilePictFromIconAndLabel(hIcon,pszLabel,pszSourceFile,iIcon)\
  128. OleMetafilePictFromIconAndLabelA(hIcon, pszLabel, pszSourceFile, iIcon)
  129. /*
  130. * Some Clipboard Copy/Paste & Drag/Drop support stuff
  131. */
  132. //Macro to set all FormatEtc fields
  133. #define SETFORMATETC(fe, cf, asp, td, med, li) \
  134. ((fe).cfFormat=cf, \
  135. (fe).dwAspect=asp, \
  136. (fe).ptd=td, \
  137. (fe).tymed=med, \
  138. (fe).lindex=li)
  139. //Macro to set interesting FormatEtc fields defaulting the others.
  140. #define SETDEFAULTFORMATETC(fe, cf, med) \
  141. ((fe).cfFormat=cf, \
  142. (fe).dwAspect=DVASPECT_CONTENT, \
  143. (fe).ptd=NULL, \
  144. (fe).tymed=med, \
  145. (fe).lindex=-1)
  146. // Macro to test if two FormatEtc structures are an exact match
  147. #define IsEqualFORMATETC(fe1, fe2) \
  148. (OleStdCompareFormatEtc(&(fe1), &(fe2))==0)
  149. // Clipboard format strings
  150. #define CF_EMBEDSOURCE TEXT("Embed Source")
  151. #define CF_EMBEDDEDOBJECT TEXT("Embedded Object")
  152. #define CF_LINKSOURCE TEXT("Link Source")
  153. #define CF_CUSTOMLINKSOURCE TEXT("Custom Link Source")
  154. #define CF_OBJECTDESCRIPTOR TEXT("Object Descriptor")
  155. #define CF_LINKSRCDESCRIPTOR TEXT("Link Source Descriptor")
  156. #define CF_OWNERLINK TEXT("OwnerLink")
  157. #define CF_FILENAME TEXT("FileName")
  158. #define OleStdQueryOleObjectData(lpformatetc) \
  159. (((lpformatetc)->tymed & TYMED_ISTORAGE) ? \
  160. NOERROR : ResultFromScode(DV_E_FORMATETC))
  161. #define OleStdQueryLinkSourceData(lpformatetc) \
  162. (((lpformatetc)->tymed & TYMED_ISTREAM) ? \
  163. NOERROR : ResultFromScode(DV_E_FORMATETC))
  164. #define OleStdQueryObjectDescriptorData(lpformatetc) \
  165. (((lpformatetc)->tymed & TYMED_HGLOBAL) ? \
  166. NOERROR : ResultFromScode(DV_E_FORMATETC))
  167. #define OleStdQueryFormatMedium(lpformatetc, tymd) \
  168. (((lpformatetc)->tymed & tymd) ? \
  169. NOERROR : ResultFromScode(DV_E_FORMATETC))
  170. // Make an independent copy of a MetafilePict
  171. #define OleStdCopyMetafilePict(hpictin, phpictout) \
  172. (*(phpictout) = OleDuplicateData(hpictin,CF_METAFILEPICT,GHND|GMEM_SHARE))
  173. // REVIEW: these need to be added to OLE2.H
  174. #if !defined( DD_DEFSCROLLINTERVAL )
  175. #define DD_DEFSCROLLINTERVAL 50
  176. #endif
  177. #if !defined( DD_DEFDRAGDELAY )
  178. #define DD_DEFDRAGDELAY 200
  179. #endif
  180. #if !defined( DD_DEFDRAGMINDIST )
  181. #define DD_DEFDRAGMINDIST 2
  182. #endif
  183. /* OleStdGetDropEffect
  184. ** -------------------
  185. **
  186. ** Convert a keyboard state into a DROPEFFECT.
  187. **
  188. ** returns the DROPEFFECT value derived from the key state.
  189. ** the following is the standard interpretation:
  190. ** no modifier -- Default Drop (NULL is returned)
  191. ** CTRL -- DROPEFFECT_COPY
  192. ** SHIFT -- DROPEFFECT_MOVE
  193. ** CTRL-SHIFT -- DROPEFFECT_LINK
  194. **
  195. ** Default Drop: this depends on the type of the target application.
  196. ** this is re-interpretable by each target application. a typical
  197. ** interpretation is if the drag is local to the same document
  198. ** (which is source of the drag) then a MOVE operation is
  199. ** performed. if the drag is not local, then a COPY operation is
  200. ** performed.
  201. */
  202. #define OleStdGetDropEffect(grfKeyState) \
  203. ( (grfKeyState & MK_CONTROL) ? \
  204. ( (grfKeyState & MK_SHIFT) ? DROPEFFECT_LINK : DROPEFFECT_COPY ) : \
  205. ( (grfKeyState & MK_SHIFT) ? DROPEFFECT_MOVE : 0 ) )
  206. /* The OLEUIPASTEFLAG enumeration is used by the OLEUIPASTEENTRY structure.
  207. *
  208. * OLEUIPASTE_ENABLEICON If the container does not specify this flag for the entry in the
  209. * OLEUIPASTEENTRY array passed as input to OleUIPasteSpecial, the DisplayAsIcon button will be
  210. * unchecked and disabled when the the user selects the format that corresponds to the entry.
  211. *
  212. * OLEUIPASTE_PASTEONLY Indicates that the entry in the OLEUIPASTEENTRY array is valid for pasting only.
  213. * OLEUIPASTE_PASTE Indicates that the entry in the OLEUIPASTEENTRY array is valid for pasting. It
  214. * may also be valid for linking if any of the following linking flags are specified.
  215. *
  216. * If the entry in the OLEUIPASTEENTRY array is valid for linking, the following flags indicate which link
  217. * types are acceptable by OR'ing together the appropriate OLEUIPASTE_LINKTYPE<#> values.
  218. * These values correspond as follows to the array of link types passed to OleUIPasteSpecial:
  219. * OLEUIPASTE_LINKTYPE1=arrLinkTypes[0]
  220. * OLEUIPASTE_LINKTYPE2=arrLinkTypes[1]
  221. * OLEUIPASTE_LINKTYPE3=arrLinkTypes[2]
  222. * OLEUIPASTE_LINKTYPE4=arrLinkTypes[3]
  223. * OLEUIPASTE_LINKTYPE5=arrLinkTypes[4]
  224. * OLEUIPASTE_LINKTYPE6=arrLinkTypes[5]
  225. * OLEUIPASTE_LINKTYPE7=arrLinkTypes[6]
  226. * OLEUIPASTE_LINKTYPE8=arrLinkTypes[7]
  227. *
  228. * where,
  229. * UINT arrLinkTypes[8] is an array of registered clipboard formats for linking. A maximium of 8 link
  230. * types are allowed.
  231. */
  232. typedef enum tagOLEUIPASTEFLAG
  233. {
  234. OLEUIPASTE_ENABLEICON = 2048, // enable display as icon
  235. OLEUIPASTE_PASTEONLY = 0,
  236. OLEUIPASTE_PASTE = 512,
  237. OLEUIPASTE_LINKANYTYPE = 1024,
  238. OLEUIPASTE_LINKTYPE1 = 1,
  239. OLEUIPASTE_LINKTYPE2 = 2,
  240. OLEUIPASTE_LINKTYPE3 = 4,
  241. OLEUIPASTE_LINKTYPE4 = 8,
  242. OLEUIPASTE_LINKTYPE5 = 16,
  243. OLEUIPASTE_LINKTYPE6 = 32,
  244. OLEUIPASTE_LINKTYPE7 = 64,
  245. OLEUIPASTE_LINKTYPE8 = 128
  246. } OLEUIPASTEFLAG;
  247. /*
  248. * PasteEntry structure
  249. * --------------------
  250. * An array of OLEUIPASTEENTRY entries is specified for the PasteSpecial dialog
  251. * box. Each entry includes a FORMATETC which specifies the formats that are
  252. * acceptable, a string that is to represent the format in the dialog's list
  253. * box, a string to customize the result text of the dialog and a set of flags
  254. * from the OLEUIPASTEFLAG enumeration. The flags indicate if the entry is
  255. * valid for pasting only, linking only or both pasting and linking. If the
  256. * entry is valid for linking, the flags indicate which link types are
  257. * acceptable by OR'ing together the appropriate OLEUIPASTE_LINKTYPE<#> values.
  258. * These values correspond to the array of link types as follows:
  259. * OLEUIPASTE_LINKTYPE1=arrLinkTypes[0]
  260. * OLEUIPASTE_LINKTYPE2=arrLinkTypes[1]
  261. * OLEUIPASTE_LINKTYPE3=arrLinkTypes[2]
  262. * OLEUIPASTE_LINKTYPE4=arrLinkTypes[3]
  263. * OLEUIPASTE_LINKTYPE5=arrLinkTypes[4]
  264. * OLEUIPASTE_LINKTYPE6=arrLinkTypes[5]
  265. * OLEUIPASTE_LINKTYPE7=arrLinkTypes[6]
  266. * OLEUIPASTE_LINKTYPE8=arrLinkTypes[7]
  267. * UINT arrLinkTypes[8]; is an array of registered clipboard formats
  268. * for linking. A maximium of 8 link types are allowed.
  269. */
  270. typedef struct tagOLEUIPASTEENTRY
  271. {
  272. FORMATETC fmtetc; // Format that is acceptable. The paste
  273. // dialog checks if this format is
  274. // offered by the object on the
  275. // clipboard and if so offers it for
  276. // selection to the user.
  277. LPCTSTR lpstrFormatName; // String that represents the format to the user. Any %s
  278. // in this string is replaced by the FullUserTypeName
  279. // of the object on the clipboard and the resulting string
  280. // is placed in the list box of the dialog. Atmost
  281. // one %s is allowed. The presence or absence of %s indicates
  282. // if the result text is to indicate that data is
  283. // being pasted or that an object that can be activated by
  284. // an application is being pasted. If %s is
  285. // present, the result-text says that an object is being pasted.
  286. // Otherwise it says that data is being pasted.
  287. LPCTSTR lpstrResultText; // String to customize the result text of the dialog when
  288. // the user selects the format correspoding to this
  289. // entry. Any %s in this string is replaced by the the application
  290. // name or FullUserTypeName of the object on
  291. // the clipboard. Atmost one %s is allowed.
  292. DWORD dwFlags; // Values from OLEUIPASTEFLAG enum
  293. DWORD dwScratchSpace; // Scratch space available to be used
  294. // by routines which loop through an
  295. // IEnumFORMATETC* to mark if the
  296. // PasteEntry format is available.
  297. // this field CAN be left uninitialized.
  298. } OLEUIPASTEENTRY, *POLEUIPASTEENTRY, FAR *LPOLEUIPASTEENTRY;
  299. #define OLESTDDROP_NONE 0
  300. #define OLESTDDROP_DEFAULT 1
  301. #define OLESTDDROP_NONDEFAULT 2
  302. /*
  303. * Some misc stuff
  304. */
  305. #define EMBEDDINGFLAG "Embedding" // Cmd line switch for launching a srvr
  306. #define HIMETRIC_PER_INCH 2540 // number HIMETRIC units per inch
  307. #define PTS_PER_INCH 72 // number points (font size) per inch
  308. #define MAP_PIX_TO_LOGHIM(x,ppli) MulDiv(HIMETRIC_PER_INCH, (x), (ppli))
  309. #define MAP_LOGHIM_TO_PIX(x,ppli) MulDiv((ppli), (x), HIMETRIC_PER_INCH)
  310. // Returns TRUE if all fields of the two Rect's are equal, else FALSE.
  311. #define AreRectsEqual(lprc1, lprc2) \
  312. (((lprc1->top == lprc2->top) && \
  313. (lprc1->left == lprc2->left) && \
  314. (lprc1->right == lprc2->right) && \
  315. (lprc1->bottom == lprc2->bottom)) ? TRUE : FALSE)
  316. /* lstrcpyn is defined to be able to handle UNICODE string
  317. * The third parameter here is the number of CHARACTERS that are
  318. * to be copied.
  319. */
  320. #define LSTRCPYN(lpdst, lpsrc, cch) \
  321. (\
  322. (lpdst)[(cch)-1] = '\0', \
  323. (cch>1 ? lstrcpyn(lpdst, lpsrc, (cch)-1) : 0)\
  324. )
  325. /****** DEBUG Stuff *****************************************************/
  326. #ifdef _DEBUG
  327. #if !defined( _DBGTRACE )
  328. #define _DEBUGLEVEL 2
  329. #else
  330. #define _DEBUGLEVEL _DBGTRACE
  331. #endif
  332. #if defined( NOASSERT )
  333. #define OLEDBGASSERTDATA
  334. #define OleDbgAssert(a)
  335. #define OleDbgAssertSz(a, b)
  336. #define OleDbgVerify(a)
  337. #define OleDbgVerifySz(a, b)
  338. #else // ! NOASSERT
  339. STDAPI FnAssert(LPSTR lpstrExpr, LPSTR lpstrMsg, LPSTR lpstrFileName, UINT iLine);
  340. #define OLEDBGASSERTDATA \
  341. static char _based(_segname("_CODE")) _szAssertFile[]= TEXT(__FILE__);
  342. #define OleDbgAssert(a) \
  343. (!(a) ? FnAssert(#a, NULL, _szAssertFile, __LINE__) : (HRESULT)1)
  344. #define OleDbgAssertSz(a, b) \
  345. (!(a) ? FnAssert(#a, b, _szAssertFile, __LINE__) : (HRESULT)1)
  346. #define OleDbgVerify(a) \
  347. OleDbgAssert(a)
  348. #define OleDbgVerifySz(a, b) \
  349. OleDbgAssertSz(a, b)
  350. #endif // ! NOASSERT
  351. #ifdef DLL_VER
  352. #define OLEDBGDATA_MAIN(szPrefix) \
  353. TCHAR NEAR g_szDbgPrefix[] = szPrefix; \
  354. OLEDBGASSERTDATA
  355. #define OLEDBGDATA \
  356. extern TCHAR NEAR g_szDbgPrefix[]; \
  357. OLEDBGASSERTDATA
  358. #else
  359. #define OLEDBGDATA_MAIN(szPrefix) \
  360. TCHAR g_szDbgPrefix[] = szPrefix; \
  361. OLEDBGASSERTDATA
  362. #define OLEDBGDATA \
  363. extern TCHAR g_szDbgPrefix[]; \
  364. OLEDBGASSERTDATA
  365. #endif
  366. #define OLEDBG_BEGIN(lpsz) \
  367. OleDbgPrintAlways(g_szDbgPrefix,lpsz,1);
  368. #define OLEDBG_END \
  369. OleDbgPrintAlways(g_szDbgPrefix,TEXT("End\r\n"),-1);
  370. #define OleDbgOut(lpsz) \
  371. OleDbgPrintAlways(g_szDbgPrefix,lpsz,0)
  372. #define OleDbgOutNoPrefix(lpsz) \
  373. OleDbgPrintAlways(TEXT(""),lpsz,0)
  374. #define OleDbgOutRefCnt(lpsz,lpObj,refcnt) \
  375. OleDbgPrintRefCntAlways(g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  376. #define OleDbgOutRect(lpsz,lpRect) \
  377. OleDbgPrintRectAlways(g_szDbgPrefix,lpsz,lpRect)
  378. #define OleDbgOutHResult(lpsz,hr) \
  379. OleDbgPrintScodeAlways(g_szDbgPrefix,lpsz,GetScode(hr))
  380. #define OleDbgOutScode(lpsz,sc) \
  381. OleDbgPrintScodeAlways(g_szDbgPrefix,lpsz,sc)
  382. #define OleDbgOut1(lpsz) \
  383. OleDbgPrint(1,g_szDbgPrefix,lpsz,0)
  384. #define OleDbgOutNoPrefix1(lpsz) \
  385. OleDbgPrint(1,TEXT(""),lpsz,0)
  386. #define OLEDBG_BEGIN1(lpsz) \
  387. OleDbgPrint(1,g_szDbgPrefix,lpsz,1);
  388. #define OLEDBG_END1 \
  389. OleDbgPrint(1,g_szDbgPrefix,TEXT("End\r\n"),-1);
  390. #define OleDbgOutRefCnt1(lpsz,lpObj,refcnt) \
  391. OleDbgPrintRefCnt(1,g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  392. #define OleDbgOutRect1(lpsz,lpRect) \
  393. OleDbgPrintRect(1,g_szDbgPrefix,lpsz,lpRect)
  394. #define OleDbgOut2(lpsz) \
  395. OleDbgPrint(2,g_szDbgPrefix,lpsz,0)
  396. #define OleDbgOutNoPrefix2(lpsz) \
  397. OleDbgPrint(2,TEXT(""),lpsz,0)
  398. #define OLEDBG_BEGIN2(lpsz) \
  399. OleDbgPrint(2,g_szDbgPrefix,lpsz,1);
  400. #define OLEDBG_END2 \
  401. OleDbgPrint(2,g_szDbgPrefix, TEXT("End\r\n"),-1);
  402. #define OleDbgOutRefCnt2(lpsz,lpObj,refcnt) \
  403. OleDbgPrintRefCnt(2,g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  404. #define OleDbgOutRect2(lpsz,lpRect) \
  405. OleDbgPrintRect(2,g_szDbgPrefix,lpsz,lpRect)
  406. #define OleDbgOut3(lpsz) \
  407. OleDbgPrint(3,g_szDbgPrefix,lpsz,0)
  408. #define OleDbgOutNoPrefix3(lpsz) \
  409. OleDbgPrint(3,TEXT(""),lpsz,0)
  410. #define OLEDBG_BEGIN3(lpsz) \
  411. OleDbgPrint(3,g_szDbgPrefix,lpsz,1);
  412. #define OLEDBG_END3 \
  413. OleDbgPrint(3,g_szDbgPrefix,TEXT("End\r\n"),-1);
  414. #define OleDbgOutRefCnt3(lpsz,lpObj,refcnt) \
  415. OleDbgPrintRefCnt(3,g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  416. #define OleDbgOutRect3(lpsz,lpRect) \
  417. OleDbgPrintRect(3,g_szDbgPrefix,lpsz,lpRect)
  418. #define OleDbgOut4(lpsz) \
  419. OleDbgPrint(4,g_szDbgPrefix,lpsz,0)
  420. #define OleDbgOutNoPrefix4(lpsz) \
  421. OleDbgPrint(4,TEXT(""),lpsz,0)
  422. #define OLEDBG_BEGIN4(lpsz) \
  423. OleDbgPrint(4,g_szDbgPrefix,lpsz,1);
  424. #define OLEDBG_END4 \
  425. OleDbgPrint(4,g_szDbgPrefix,TEXT("End\r\n"),-1);
  426. #define OleDbgOutRefCnt4(lpsz,lpObj,refcnt) \
  427. OleDbgPrintRefCnt(4,g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  428. #define OleDbgOutRect4(lpsz,lpRect) \
  429. OleDbgPrintRect(4,g_szDbgPrefix,lpsz,lpRect)
  430. #else // !_DEBUG
  431. #define OLEDBGDATA_MAIN(szPrefix)
  432. #define OLEDBGDATA
  433. #define OleDbgAssert(a)
  434. #define OleDbgAssertSz(a, b)
  435. #define OleDbgVerify(a) (a)
  436. #define OleDbgVerifySz(a, b) (a)
  437. #define OleDbgOutHResult(lpsz,hr)
  438. #define OleDbgOutScode(lpsz,sc)
  439. #define OLEDBG_BEGIN(lpsz)
  440. #define OLEDBG_END
  441. #define OleDbgOut(lpsz)
  442. #define OleDbgOut1(lpsz)
  443. #define OleDbgOut2(lpsz)
  444. #define OleDbgOut3(lpsz)
  445. #define OleDbgOut4(lpsz)
  446. #define OleDbgOutNoPrefix(lpsz)
  447. #define OleDbgOutNoPrefix1(lpsz)
  448. #define OleDbgOutNoPrefix2(lpsz)
  449. #define OleDbgOutNoPrefix3(lpsz)
  450. #define OleDbgOutNoPrefix4(lpsz)
  451. #define OLEDBG_BEGIN1(lpsz)
  452. #define OLEDBG_BEGIN2(lpsz)
  453. #define OLEDBG_BEGIN3(lpsz)
  454. #define OLEDBG_BEGIN4(lpsz)
  455. #define OLEDBG_END1
  456. #define OLEDBG_END2
  457. #define OLEDBG_END3
  458. #define OLEDBG_END4
  459. #define OleDbgOutRefCnt(lpsz,lpObj,refcnt)
  460. #define OleDbgOutRefCnt1(lpsz,lpObj,refcnt)
  461. #define OleDbgOutRefCnt2(lpsz,lpObj,refcnt)
  462. #define OleDbgOutRefCnt3(lpsz,lpObj,refcnt)
  463. #define OleDbgOutRefCnt4(lpsz,lpObj,refcnt)
  464. #define OleDbgOutRect(lpsz,lpRect)
  465. #define OleDbgOutRect1(lpsz,lpRect)
  466. #define OleDbgOutRect2(lpsz,lpRect)
  467. #define OleDbgOutRect3(lpsz,lpRect)
  468. #define OleDbgOutRect4(lpsz,lpRect)
  469. #endif // _DEBUG
  470. /*************************************************************************
  471. ** Function prototypes
  472. *************************************************************************/
  473. //OLESTD.C
  474. STDAPI_(int) SetDCToAnisotropic(HDC hDC, LPRECT lprcPhysical, LPRECT lprcLogical, LPRECT lprcWindowOld, LPRECT lprcViewportOld);
  475. STDAPI_(int) SetDCToDrawInHimetricRect(HDC, LPRECT, LPRECT, LPRECT, LPRECT);
  476. STDAPI_(int) ResetOrigDC(HDC, int, LPRECT, LPRECT);
  477. STDAPI_(int) XformWidthInHimetricToPixels(HDC, int);
  478. STDAPI_(int) XformWidthInPixelsToHimetric(HDC, int);
  479. STDAPI_(int) XformHeightInHimetricToPixels(HDC, int);
  480. STDAPI_(int) XformHeightInPixelsToHimetric(HDC, int);
  481. STDAPI_(void) XformRectInPixelsToHimetric(HDC, LPRECT, LPRECT);
  482. STDAPI_(void) XformRectInHimetricToPixels(HDC, LPRECT, LPRECT);
  483. STDAPI_(void) XformSizeInPixelsToHimetric(HDC, LPSIZEL, LPSIZEL);
  484. STDAPI_(void) XformSizeInHimetricToPixels(HDC, LPSIZEL, LPSIZEL);
  485. STDAPI_(int) XformWidthInHimetricToPixels(HDC, int);
  486. STDAPI_(int) XformWidthInPixelsToHimetric(HDC, int);
  487. STDAPI_(int) XformHeightInHimetricToPixels(HDC, int);
  488. STDAPI_(int) XformHeightInPixelsToHimetric(HDC, int);
  489. STDAPI_(void) ParseCmdLine(LPSTR, BOOL FAR *, LPSTR);
  490. STDAPI_(BOOL) OleStdIsOleLink(LPUNKNOWN lpUnk);
  491. STDAPI_(LPUNKNOWN) OleStdQueryInterface(LPUNKNOWN lpUnk, REFIID riid);
  492. STDAPI_(LPSTORAGE) OleStdCreateRootStorage(LPTSTR lpszStgName, DWORD grfMode);
  493. STDAPI_(LPSTORAGE) OleStdOpenRootStorage(LPTSTR lpszStgName, DWORD grfMode);
  494. STDAPI_(LPSTORAGE) OleStdOpenOrCreateRootStorage(LPTSTR lpszStgName, DWORD grfMode);
  495. STDAPI_(LPSTORAGE) OleStdCreateChildStorage(LPSTORAGE lpStg, LPTSTR lpszStgName);
  496. STDAPI_(LPSTORAGE) OleStdOpenChildStorage(LPSTORAGE lpStg, LPTSTR lpszStgName, DWORD grfMode);
  497. STDAPI_(BOOL) OleStdCommitStorage(LPSTORAGE lpStg);
  498. STDAPI OleStdDestroyAllElements(LPSTORAGE lpStg);
  499. STDAPI_(LPSTORAGE) OleStdCreateStorageOnHGlobal(
  500. HANDLE hGlobal,
  501. BOOL fDeleteOnRelease,
  502. DWORD dwgrfMode
  503. );
  504. STDAPI_(LPSTORAGE) OleStdCreateTempStorage(BOOL fUseMemory, DWORD grfMode);
  505. STDAPI OleStdDoConvert(LPSTORAGE lpStg, REFCLSID rClsidNew);
  506. STDAPI_(BOOL) OleStdGetTreatAsFmtUserType(
  507. REFCLSID rClsidApp,
  508. LPSTORAGE lpStg,
  509. CLSID FAR* lpclsid,
  510. CLIPFORMAT FAR* lpcfFmt,
  511. LPTSTR FAR* lplpszType
  512. );
  513. STDAPI OleStdDoTreatAsClass(LPTSTR lpszUserType, REFCLSID rclsid, REFCLSID rclsidNew);
  514. STDAPI_(BOOL) OleStdSetupAdvises(LPOLEOBJECT lpOleObject, DWORD dwDrawAspect,
  515. LPTSTR lpszContainerApp, LPTSTR lpszContainerObj,
  516. LPADVISESINK lpAdviseSink, BOOL fCreate);
  517. STDAPI OleStdSwitchDisplayAspect(
  518. LPOLEOBJECT lpOleObj,
  519. LPDWORD lpdwCurAspect,
  520. DWORD dwNewAspect,
  521. HGLOBAL hMetaPict,
  522. BOOL fDeleteOldAspect,
  523. BOOL fSetupViewAdvise,
  524. LPADVISESINK lpAdviseSink,
  525. BOOL FAR* lpfMustUpdate
  526. );
  527. STDAPI OleStdSetIconInCache(LPOLEOBJECT lpOleObj, HGLOBAL hMetaPict);
  528. STDAPI_(HGLOBAL) OleStdGetData(
  529. LPDATAOBJECT lpDataObj,
  530. CLIPFORMAT cfFormat,
  531. DVTARGETDEVICE FAR* lpTargetDevice,
  532. DWORD dwAspect,
  533. LPSTGMEDIUM lpMedium
  534. );
  535. STDAPI_(void) OleStdMarkPasteEntryList(
  536. LPDATAOBJECT lpSrcDataObj,
  537. LPOLEUIPASTEENTRY lpPriorityList,
  538. int cEntries
  539. );
  540. STDAPI_(int) OleStdGetPriorityClipboardFormat(
  541. LPDATAOBJECT lpSrcDataObj,
  542. LPOLEUIPASTEENTRY lpPriorityList,
  543. int cEntries
  544. );
  545. STDAPI_(BOOL) OleStdIsDuplicateFormat(
  546. LPFORMATETC lpFmtEtc,
  547. LPFORMATETC arrFmtEtc,
  548. int nFmtEtc
  549. );
  550. STDAPI_(void) OleStdRegisterAsRunning(LPUNKNOWN lpUnk, LPMONIKER lpmkFull, DWORD FAR* lpdwRegister);
  551. STDAPI_(void) OleStdRevokeAsRunning(DWORD FAR* lpdwRegister);
  552. STDAPI_(void) OleStdNoteFileChangeTime(LPTSTR lpszFileName, DWORD dwRegister);
  553. STDAPI_(void) OleStdNoteObjectChangeTime(DWORD dwRegister);
  554. STDAPI OleStdGetOleObjectData(
  555. LPPERSISTSTORAGE lpPStg,
  556. LPFORMATETC lpformatetc,
  557. LPSTGMEDIUM lpMedium,
  558. BOOL fUseMemory
  559. );
  560. STDAPI OleStdGetLinkSourceData(
  561. LPMONIKER lpmk,
  562. LPCLSID lpClsID,
  563. LPFORMATETC lpformatetc,
  564. LPSTGMEDIUM lpMedium
  565. );
  566. STDAPI_(HGLOBAL) OleStdGetObjectDescriptorData(
  567. CLSID clsid,
  568. DWORD dwAspect,
  569. SIZEL sizel,
  570. POINTL pointl,
  571. DWORD dwStatus,
  572. LPTSTR lpszFullUserTypeName,
  573. LPTSTR lpszSrcOfCopy
  574. );
  575. STDAPI_(HGLOBAL) OleStdGetObjectDescriptorDataFromOleObject(
  576. LPOLEOBJECT lpOleObj,
  577. LPTSTR lpszSrcOfCopy,
  578. DWORD dwAspect,
  579. POINTL pointl,
  580. LPSIZEL lpSizelHim
  581. );
  582. STDAPI_(HGLOBAL) OleStdFillObjectDescriptorFromData(
  583. LPDATAOBJECT lpDataObject,
  584. LPSTGMEDIUM lpmedium,
  585. CLIPFORMAT FAR* lpcfFmt
  586. );
  587. STDAPI_(HANDLE) OleStdGetMetafilePictFromOleObject(
  588. LPOLEOBJECT lpOleObj,
  589. DWORD dwDrawAspect,
  590. LPSIZEL lpSizelHim,
  591. DVTARGETDEVICE FAR* ptd
  592. );
  593. STDAPI_(void) OleStdCreateTempFileMoniker(LPTSTR lpszPrefixString, UINT FAR* lpuUnique, LPTSTR lpszName, LPMONIKER FAR* lplpmk);
  594. STDAPI_(LPMONIKER) OleStdGetFirstMoniker(LPMONIKER lpmk);
  595. STDAPI_(ULONG) OleStdGetLenFilePrefixOfMoniker(LPMONIKER lpmk);
  596. STDAPI OleStdMkParseDisplayName(
  597. REFCLSID rClsid,
  598. LPBC lpbc,
  599. LPTSTR lpszUserName,
  600. ULONG FAR* lpchEaten,
  601. LPMONIKER FAR* lplpmk
  602. );
  603. STDAPI_(LPVOID) OleStdMalloc(ULONG ulSize);
  604. STDAPI_(LPVOID) OleStdRealloc(LPVOID pmem, ULONG ulSize);
  605. STDAPI_(void) OleStdFree(LPVOID pmem);
  606. STDAPI_(ULONG) OleStdGetSize(LPVOID pmem);
  607. STDAPI_(void) OleStdFreeString(LPTSTR lpsz, LPMALLOC lpMalloc);
  608. STDAPI_(LPTSTR) OleStdCopyString(LPTSTR lpszSrc, LPMALLOC lpMalloc);
  609. STDAPI_(ULONG) OleStdGetItemToken(LPTSTR lpszSrc, LPTSTR lpszDst,int nMaxChars);
  610. STDAPI_(UINT) OleStdIconLabelTextOut(HDC hDC,
  611. HFONT hFont,
  612. int nXStart,
  613. int nYStart,
  614. UINT fuOptions,
  615. RECT FAR * lpRect,
  616. LPTSTR lpszString,
  617. UINT cchString,
  618. int FAR * lpDX);
  619. // registration database query functions
  620. STDAPI_(UINT) OleStdGetAuxUserType(REFCLSID rclsid,
  621. WORD wAuxUserType,
  622. LPTSTR lpszAuxUserType,
  623. int cch,
  624. HKEY hKey);
  625. STDAPI_(UINT) OleStdGetUserTypeOfClass(REFCLSID rclsid,
  626. LPTSTR lpszUserType,
  627. UINT cch,
  628. HKEY hKey);
  629. STDAPI_(BOOL) OleStdGetMiscStatusOfClass(REFCLSID, HKEY, DWORD FAR *);
  630. STDAPI_(CLIPFORMAT) OleStdGetDefaultFileFormatOfClass(
  631. REFCLSID rclsid,
  632. HKEY hKey
  633. );
  634. STDAPI_(void) OleStdInitVtbl(LPVOID lpVtbl, UINT nSizeOfVtbl);
  635. STDMETHODIMP OleStdNullMethod(LPUNKNOWN lpThis);
  636. STDAPI_(BOOL) OleStdCheckVtbl(LPVOID lpVtbl, UINT nSizeOfVtbl, LPTSTR lpszIface);
  637. STDAPI_(ULONG) OleStdVerifyRelease(LPUNKNOWN lpUnk, LPTSTR lpszMsg);
  638. STDAPI_(ULONG) OleStdRelease(LPUNKNOWN lpUnk);
  639. STDAPI_(HDC) OleStdCreateDC(DVTARGETDEVICE FAR* ptd);
  640. STDAPI_(HDC) OleStdCreateIC(DVTARGETDEVICE FAR* ptd);
  641. STDAPI_(DVTARGETDEVICE FAR*) OleStdCreateTargetDevice(LPPRINTDLG lpPrintDlg);
  642. STDAPI_(BOOL) OleStdDeleteTargetDevice(DVTARGETDEVICE FAR* ptd);
  643. STDAPI_(DVTARGETDEVICE FAR*) OleStdCopyTargetDevice(DVTARGETDEVICE FAR* ptdSrc);
  644. STDAPI_(BOOL) OleStdCopyFormatEtc(LPFORMATETC petcDest, LPFORMATETC petcSrc);
  645. STDAPI_(int) OleStdCompareFormatEtc(FORMATETC FAR* pFetcLeft, FORMATETC FAR* pFetcRight);
  646. STDAPI_(BOOL) OleStdCompareTargetDevice
  647. (DVTARGETDEVICE FAR* ptdLeft, DVTARGETDEVICE FAR* ptdRight);
  648. STDAPI_(void) OleDbgPrint(
  649. int nDbgLvl,
  650. LPTSTR lpszPrefix,
  651. LPTSTR lpszMsg,
  652. int nIndent
  653. );
  654. STDAPI_(void) OleDbgPrintAlways(LPTSTR lpszPrefix, LPTSTR lpszMsg, int nIndent);
  655. STDAPI_(void) OleDbgSetDbgLevel(int nDbgLvl);
  656. STDAPI_(int) OleDbgGetDbgLevel( void );
  657. STDAPI_(void) OleDbgIndent(int n);
  658. STDAPI_(void) OleDbgPrintRefCnt(
  659. int nDbgLvl,
  660. LPTSTR lpszPrefix,
  661. LPTSTR lpszMsg,
  662. LPVOID lpObj,
  663. ULONG refcnt
  664. );
  665. STDAPI_(void) OleDbgPrintRefCntAlways(
  666. LPTSTR lpszPrefix,
  667. LPTSTR lpszMsg,
  668. LPVOID lpObj,
  669. ULONG refcnt
  670. );
  671. STDAPI_(void) OleDbgPrintRect(
  672. int nDbgLvl,
  673. LPTSTR lpszPrefix,
  674. LPTSTR lpszMsg,
  675. LPRECT lpRect
  676. );
  677. STDAPI_(void) OleDbgPrintRectAlways(
  678. LPTSTR lpszPrefix,
  679. LPTSTR lpszMsg,
  680. LPRECT lpRect
  681. );
  682. STDAPI_(void) OleDbgPrintScodeAlways(LPTSTR lpszPrefix, LPTSTR lpszMsg, SCODE sc);
  683. // debug implementation of the IMalloc interface.
  684. STDAPI OleStdCreateDbAlloc(ULONG reserved, IMalloc FAR* FAR* ppmalloc);
  685. STDAPI_(LPENUMFORMATETC)
  686. OleStdEnumFmtEtc_Create(ULONG nCount, LPFORMATETC lpEtc);
  687. STDAPI_(LPENUMSTATDATA)
  688. OleStdEnumStatData_Create(ULONG nCount, LPSTATDATA lpStat);
  689. STDAPI_(BOOL)
  690. OleStdCopyStatData(LPSTATDATA pDest, LPSTATDATA pSrc);
  691. STDAPI_(HPALETTE)
  692. OleStdCreateStandardPalette(void);
  693. #if defined( OBSOLETE )
  694. /*************************************************************************
  695. ** The following API's have been converted into macros:
  696. ** OleStdQueryOleObjectData
  697. ** OleStdQueryLinkSourceData
  698. ** OleStdQueryObjectDescriptorData
  699. ** OleStdQueryFormatMedium
  700. ** OleStdCopyMetafilePict
  701. ** AreRectsEqual
  702. ** OleStdGetDropEffect
  703. **
  704. ** These macros are defined above
  705. *************************************************************************/
  706. STDAPI_(BOOL) AreRectsEqual(LPRECT lprc1, LPRECT lprc2);
  707. STDAPI_(BOOL) OleStdCopyMetafilePict(HANDLE hpictin, HANDLE FAR* phpictout);
  708. STDAPI OleStdQueryOleObjectData(LPFORMATETC lpformatetc);
  709. STDAPI OleStdQueryLinkSourceData(LPFORMATETC lpformatetc);
  710. STDAPI OleStdQueryObjectDescriptorData(LPFORMATETC lpformatetc);
  711. STDAPI OleStdQueryFormatMedium(LPFORMATETC lpformatetc, TYMED tymed);
  712. STDAPI_(DWORD) OleStdGetDropEffect ( DWORD grfKeyState );
  713. #endif // OBSOLETE
  714. #endif // _OLESTD_H_
  715.