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.

837 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 "\\"
  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. OleGetIconOfFile(lpszFileName, fUseFileAsLabel)
  125. #define GetIconOfClass(hInst, rclsid, lpszLabel, fUseTypeAsLabel) \
  126. OleGetIconOfClass(rclsid, lpszLabel, fUseTypeAsLabel)
  127. #define OleUIMetafilePictFromIconAndLabel(hIcon,pszLabel,pszSourceFile,iIcon)\
  128. OleMetafilePictFromIconAndLabel(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 "Embed Source"
  151. #define CF_EMBEDDEDOBJECT "Embedded Object"
  152. #define CF_LINKSOURCE "Link Source"
  153. #define CF_CUSTOMLINKSOURCE "Custom Link Source"
  154. #define CF_OBJECTDESCRIPTOR "Object Descriptor"
  155. #define CF_LINKSRCDESCRIPTOR "Link Source Descriptor"
  156. #define CF_OWNERLINK "OwnerLink"
  157. #define CF_FILENAME "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. LPCSTR 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. LPCSTR 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. #define LSTRCPYN(lpdst, lpsrc, cch) \
  317. (\
  318. (lpdst)[(cch)-1] = '\0', \
  319. (cch>1 ? lstrcpyn(lpdst, lpsrc, (cch)-1) : 0)\
  320. )
  321. /****** DEBUG Stuff *****************************************************/
  322. #ifdef _DEBUG
  323. #if !defined( _DBGTRACE )
  324. #define _DEBUGLEVEL 2
  325. #else
  326. #define _DEBUGLEVEL _DBGTRACE
  327. #endif
  328. #if defined( NOASSERT )
  329. #define OLEDBGASSERTDATA
  330. #define OleDbgAssert(a)
  331. #define OleDbgAssertSz(a, b)
  332. #define OleDbgVerify(a)
  333. #define OleDbgVerifySz(a, b)
  334. #else // ! NOASSERT
  335. #define OLEDBGASSERTDATA \
  336. static char _based(_segname("_CODE")) _szAssertFile[]= __FILE__;
  337. #define OleDbgAssert(a) \
  338. (!(a) ? FnAssert(#a, NULL, _szAssertFile, __LINE__) : (HRESULT)1)
  339. #define OleDbgAssertSz(a, b) \
  340. (!(a) ? FnAssert(#a, b, _szAssertFile, __LINE__) : (HRESULT)1)
  341. #define OleDbgVerify(a) \
  342. OleDbgAssert(a)
  343. #define OleDbgVerifySz(a, b) \
  344. OleDbgAssertSz(a, b)
  345. #endif // ! NOASSERT
  346. #define OLEDBGDATA_MAIN(szPrefix) \
  347. char near g_szDbgPrefix[] = szPrefix; \
  348. OLEDBGASSERTDATA
  349. #define OLEDBGDATA \
  350. extern char near g_szDbgPrefix[]; \
  351. OLEDBGASSERTDATA
  352. #define OLEDBG_BEGIN(lpsz) \
  353. OleDbgPrintAlways(g_szDbgPrefix,lpsz,1);
  354. #define OLEDBG_END \
  355. OleDbgPrintAlways(g_szDbgPrefix,"End\r\n",-1);
  356. #define OleDbgOut(lpsz) \
  357. OleDbgPrintAlways(g_szDbgPrefix,lpsz,0)
  358. #define OleDbgOutNoPrefix(lpsz) \
  359. OleDbgPrintAlways("",lpsz,0)
  360. #define OleDbgOutRefCnt(lpsz,lpObj,refcnt) \
  361. OleDbgPrintRefCntAlways(g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  362. #define OleDbgOutRect(lpsz,lpRect) \
  363. OleDbgPrintRectAlways(g_szDbgPrefix,lpsz,lpRect)
  364. #define OleDbgOutHResult(lpsz,hr) \
  365. OleDbgPrintScodeAlways(g_szDbgPrefix,lpsz,GetScode(hr))
  366. #define OleDbgOutScode(lpsz,sc) \
  367. OleDbgPrintScodeAlways(g_szDbgPrefix,lpsz,sc)
  368. #define OleDbgOut1(lpsz) \
  369. OleDbgPrint(1,g_szDbgPrefix,lpsz,0)
  370. #define OleDbgOutNoPrefix1(lpsz) \
  371. OleDbgPrint(1,"",lpsz,0)
  372. #define OLEDBG_BEGIN1(lpsz) \
  373. OleDbgPrint(1,g_szDbgPrefix,lpsz,1);
  374. #define OLEDBG_END1 \
  375. OleDbgPrint(1,g_szDbgPrefix,"End\r\n",-1);
  376. #define OleDbgOutRefCnt1(lpsz,lpObj,refcnt) \
  377. OleDbgPrintRefCnt(1,g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  378. #define OleDbgOutRect1(lpsz,lpRect) \
  379. OleDbgPrintRect(1,g_szDbgPrefix,lpsz,lpRect)
  380. #define OleDbgOut2(lpsz) \
  381. OleDbgPrint(2,g_szDbgPrefix,lpsz,0)
  382. #define OleDbgOutNoPrefix2(lpsz) \
  383. OleDbgPrint(2,"",lpsz,0)
  384. #define OLEDBG_BEGIN2(lpsz) \
  385. OleDbgPrint(2,g_szDbgPrefix,lpsz,1);
  386. #define OLEDBG_END2 \
  387. OleDbgPrint(2,g_szDbgPrefix,"End\r\n",-1);
  388. #define OleDbgOutRefCnt2(lpsz,lpObj,refcnt) \
  389. OleDbgPrintRefCnt(2,g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  390. #define OleDbgOutRect2(lpsz,lpRect) \
  391. OleDbgPrintRect(2,g_szDbgPrefix,lpsz,lpRect)
  392. #define OleDbgOut3(lpsz) \
  393. OleDbgPrint(3,g_szDbgPrefix,lpsz,0)
  394. #define OleDbgOutNoPrefix3(lpsz) \
  395. OleDbgPrint(3,"",lpsz,0)
  396. #define OLEDBG_BEGIN3(lpsz) \
  397. OleDbgPrint(3,g_szDbgPrefix,lpsz,1);
  398. #define OLEDBG_END3 \
  399. OleDbgPrint(3,g_szDbgPrefix,"End\r\n",-1);
  400. #define OleDbgOutRefCnt3(lpsz,lpObj,refcnt) \
  401. OleDbgPrintRefCnt(3,g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  402. #define OleDbgOutRect3(lpsz,lpRect) \
  403. OleDbgPrintRect(3,g_szDbgPrefix,lpsz,lpRect)
  404. #define OleDbgOut4(lpsz) \
  405. OleDbgPrint(4,g_szDbgPrefix,lpsz,0)
  406. #define OleDbgOutNoPrefix4(lpsz) \
  407. OleDbgPrint(4,"",lpsz,0)
  408. #define OLEDBG_BEGIN4(lpsz) \
  409. OleDbgPrint(4,g_szDbgPrefix,lpsz,1);
  410. #define OLEDBG_END4 \
  411. OleDbgPrint(4,g_szDbgPrefix,"End\r\n",-1);
  412. #define OleDbgOutRefCnt4(lpsz,lpObj,refcnt) \
  413. OleDbgPrintRefCnt(4,g_szDbgPrefix,lpsz,lpObj,(ULONG)refcnt)
  414. #define OleDbgOutRect4(lpsz,lpRect) \
  415. OleDbgPrintRect(4,g_szDbgPrefix,lpsz,lpRect)
  416. #else // !_DEBUG
  417. #define OLEDBGDATA_MAIN(szPrefix)
  418. #define OLEDBGDATA
  419. #define OleDbgAssert(a)
  420. #define OleDbgAssertSz(a, b)
  421. #define OleDbgVerify(a) (a)
  422. #define OleDbgVerifySz(a, b) (a)
  423. #define OleDbgOutHResult(lpsz,hr)
  424. #define OleDbgOutScode(lpsz,sc)
  425. #define OLEDBG_BEGIN(lpsz)
  426. #define OLEDBG_END
  427. #define OleDbgOut(lpsz)
  428. #define OleDbgOut1(lpsz)
  429. #define OleDbgOut2(lpsz)
  430. #define OleDbgOut3(lpsz)
  431. #define OleDbgOut4(lpsz)
  432. #define OleDbgOutNoPrefix(lpsz)
  433. #define OleDbgOutNoPrefix1(lpsz)
  434. #define OleDbgOutNoPrefix2(lpsz)
  435. #define OleDbgOutNoPrefix3(lpsz)
  436. #define OleDbgOutNoPrefix4(lpsz)
  437. #define OLEDBG_BEGIN1(lpsz)
  438. #define OLEDBG_BEGIN2(lpsz)
  439. #define OLEDBG_BEGIN3(lpsz)
  440. #define OLEDBG_BEGIN4(lpsz)
  441. #define OLEDBG_END1
  442. #define OLEDBG_END2
  443. #define OLEDBG_END3
  444. #define OLEDBG_END4
  445. #define OleDbgOutRefCnt(lpsz,lpObj,refcnt)
  446. #define OleDbgOutRefCnt1(lpsz,lpObj,refcnt)
  447. #define OleDbgOutRefCnt2(lpsz,lpObj,refcnt)
  448. #define OleDbgOutRefCnt3(lpsz,lpObj,refcnt)
  449. #define OleDbgOutRefCnt4(lpsz,lpObj,refcnt)
  450. #define OleDbgOutRect(lpsz,lpRect)
  451. #define OleDbgOutRect1(lpsz,lpRect)
  452. #define OleDbgOutRect2(lpsz,lpRect)
  453. #define OleDbgOutRect3(lpsz,lpRect)
  454. #define OleDbgOutRect4(lpsz,lpRect)
  455. #endif // _DEBUG
  456. /*************************************************************************
  457. ** Function prototypes
  458. *************************************************************************/
  459. //OLESTD.C
  460. STDAPI_(int) SetDCToAnisotropic(HDC hDC, LPRECT lprcPhysical, LPRECT lprcLogical, LPRECT lprcWindowOld, LPRECT lprcViewportOld);
  461. STDAPI_(int) SetDCToDrawInHimetricRect(HDC, LPRECT, LPRECT, LPRECT, LPRECT);
  462. STDAPI_(int) ResetOrigDC(HDC, int, LPRECT, LPRECT);
  463. STDAPI_(int) XformWidthInHimetricToPixels(HDC, int);
  464. STDAPI_(int) XformWidthInPixelsToHimetric(HDC, int);
  465. STDAPI_(int) XformHeightInHimetricToPixels(HDC, int);
  466. STDAPI_(int) XformHeightInPixelsToHimetric(HDC, int);
  467. STDAPI_(void) XformRectInPixelsToHimetric(HDC, LPRECT, LPRECT);
  468. STDAPI_(void) XformRectInHimetricToPixels(HDC, LPRECT, LPRECT);
  469. STDAPI_(void) XformSizeInPixelsToHimetric(HDC, LPSIZEL, LPSIZEL);
  470. STDAPI_(void) XformSizeInHimetricToPixels(HDC, LPSIZEL, LPSIZEL);
  471. STDAPI_(int) XformWidthInHimetricToPixels(HDC, int);
  472. STDAPI_(int) XformWidthInPixelsToHimetric(HDC, int);
  473. STDAPI_(int) XformHeightInHimetricToPixels(HDC, int);
  474. STDAPI_(int) XformHeightInPixelsToHimetric(HDC, int);
  475. STDAPI_(void) ParseCmdLine(LPSTR, BOOL FAR *, LPSTR);
  476. STDAPI_(BOOL) OleStdIsOleLink(LPUNKNOWN lpUnk);
  477. STDAPI_(LPUNKNOWN) OleStdQueryInterface(LPUNKNOWN lpUnk, REFIID riid);
  478. STDAPI_(LPSTORAGE) OleStdCreateRootStorage(LPSTR lpszStgName, DWORD grfMode);
  479. STDAPI_(LPSTORAGE) OleStdOpenRootStorage(LPSTR lpszStgName, DWORD grfMode);
  480. STDAPI_(LPSTORAGE) OleStdOpenOrCreateRootStorage(LPSTR lpszStgName, DWORD grfMode);
  481. STDAPI_(LPSTORAGE) OleStdCreateChildStorage(LPSTORAGE lpStg, LPSTR lpszStgName);
  482. STDAPI_(LPSTORAGE) OleStdOpenChildStorage(LPSTORAGE lpStg, LPSTR lpszStgName, DWORD grfMode);
  483. STDAPI_(BOOL) OleStdCommitStorage(LPSTORAGE lpStg);
  484. STDAPI OleStdDestroyAllElements(LPSTORAGE lpStg);
  485. STDAPI_(LPSTORAGE) OleStdCreateStorageOnHGlobal(
  486. HANDLE hGlobal,
  487. BOOL fDeleteOnRelease,
  488. DWORD dwgrfMode
  489. );
  490. STDAPI_(LPSTORAGE) OleStdCreateTempStorage(BOOL fUseMemory, DWORD grfMode);
  491. STDAPI OleStdDoConvert(LPSTORAGE lpStg, REFCLSID rClsidNew);
  492. STDAPI_(BOOL) OleStdGetTreatAsFmtUserType(
  493. REFCLSID rClsidApp,
  494. LPSTORAGE lpStg,
  495. CLSID FAR* lpclsid,
  496. CLIPFORMAT FAR* lpcfFmt,
  497. LPSTR FAR* lplpszType
  498. );
  499. STDAPI OleStdDoTreatAsClass(LPSTR lpszUserType, REFCLSID rclsid, REFCLSID rclsidNew);
  500. STDAPI_(BOOL) OleStdSetupAdvises(LPOLEOBJECT lpOleObject, DWORD dwDrawAspect,
  501. LPSTR lpszContainerApp, LPSTR lpszContainerObj,
  502. LPADVISESINK lpAdviseSink, BOOL fCreate);
  503. STDAPI OleStdSwitchDisplayAspect(
  504. LPOLEOBJECT lpOleObj,
  505. LPDWORD lpdwCurAspect,
  506. DWORD dwNewAspect,
  507. HGLOBAL hMetaPict,
  508. BOOL fDeleteOldAspect,
  509. BOOL fSetupViewAdvise,
  510. LPADVISESINK lpAdviseSink,
  511. BOOL FAR* lpfMustUpdate
  512. );
  513. STDAPI OleStdSetIconInCache(LPOLEOBJECT lpOleObj, HGLOBAL hMetaPict);
  514. STDAPI_(HGLOBAL) OleStdGetData(
  515. LPDATAOBJECT lpDataObj,
  516. CLIPFORMAT cfFormat,
  517. DVTARGETDEVICE FAR* lpTargetDevice,
  518. DWORD dwAspect,
  519. LPSTGMEDIUM lpMedium
  520. );
  521. STDAPI_(void) OleStdMarkPasteEntryList(
  522. LPDATAOBJECT lpSrcDataObj,
  523. LPOLEUIPASTEENTRY lpPriorityList,
  524. int cEntries
  525. );
  526. STDAPI_(int) OleStdGetPriorityClipboardFormat(
  527. LPDATAOBJECT lpSrcDataObj,
  528. LPOLEUIPASTEENTRY lpPriorityList,
  529. int cEntries
  530. );
  531. STDAPI_(BOOL) OleStdIsDuplicateFormat(
  532. LPFORMATETC lpFmtEtc,
  533. LPFORMATETC arrFmtEtc,
  534. int nFmtEtc
  535. );
  536. STDAPI_(void) OleStdRegisterAsRunning(LPUNKNOWN lpUnk, LPMONIKER lpmkFull, DWORD FAR* lpdwRegister);
  537. STDAPI_(void) OleStdRevokeAsRunning(DWORD FAR* lpdwRegister);
  538. STDAPI_(void) OleStdNoteFileChangeTime(LPSTR lpszFileName, DWORD dwRegister);
  539. STDAPI_(void) OleStdNoteObjectChangeTime(DWORD dwRegister);
  540. STDAPI OleStdGetOleObjectData(
  541. LPPERSISTSTORAGE lpPStg,
  542. LPFORMATETC lpformatetc,
  543. LPSTGMEDIUM lpMedium,
  544. BOOL fUseMemory
  545. );
  546. STDAPI OleStdGetLinkSourceData(
  547. LPMONIKER lpmk,
  548. LPCLSID lpClsID,
  549. LPFORMATETC lpformatetc,
  550. LPSTGMEDIUM lpMedium
  551. );
  552. STDAPI_(HGLOBAL) OleStdGetObjectDescriptorData(
  553. CLSID clsid,
  554. DWORD dwAspect,
  555. SIZEL sizel,
  556. POINTL pointl,
  557. DWORD dwStatus,
  558. LPSTR lpszFullUserTypeName,
  559. LPSTR lpszSrcOfCopy
  560. );
  561. STDAPI_(HGLOBAL) OleStdGetObjectDescriptorDataFromOleObject(
  562. LPOLEOBJECT lpOleObj,
  563. LPSTR lpszSrcOfCopy,
  564. DWORD dwAspect,
  565. POINTL pointl,
  566. LPSIZEL lpSizelHim
  567. );
  568. STDAPI_(HGLOBAL) OleStdFillObjectDescriptorFromData(
  569. LPDATAOBJECT lpDataObject,
  570. LPSTGMEDIUM lpmedium,
  571. CLIPFORMAT FAR* lpcfFmt
  572. );
  573. STDAPI_(HANDLE) OleStdGetMetafilePictFromOleObject(
  574. LPOLEOBJECT lpOleObj,
  575. DWORD dwDrawAspect,
  576. LPSIZEL lpSizelHim,
  577. DVTARGETDEVICE FAR* ptd
  578. );
  579. STDAPI_(void) OleStdCreateTempFileMoniker(LPSTR lpszPrefixString, UINT FAR* lpuUnique, LPSTR lpszName, LPMONIKER FAR* lplpmk);
  580. STDAPI_(LPMONIKER) OleStdGetFirstMoniker(LPMONIKER lpmk);
  581. STDAPI_(ULONG) OleStdGetLenFilePrefixOfMoniker(LPMONIKER lpmk);
  582. STDAPI OleStdMkParseDisplayName(
  583. REFCLSID rClsid,
  584. LPBC lpbc,
  585. LPSTR lpszUserName,
  586. ULONG FAR* lpchEaten,
  587. LPMONIKER FAR* lplpmk
  588. );
  589. STDAPI_(LPVOID) OleStdMalloc(ULONG ulSize);
  590. STDAPI_(LPVOID) OleStdRealloc(LPVOID pmem, ULONG ulSize);
  591. STDAPI_(void) OleStdFree(LPVOID pmem);
  592. STDAPI_(ULONG) OleStdGetSize(LPVOID pmem);
  593. STDAPI_(void) OleStdFreeString(LPSTR lpsz, LPMALLOC lpMalloc);
  594. STDAPI_(LPSTR) OleStdCopyString(LPSTR lpszSrc, LPMALLOC lpMalloc);
  595. STDAPI_(ULONG) OleStdGetItemToken(LPSTR lpszSrc, LPSTR lpszDst,int nMaxChars);
  596. STDAPI_(UINT) OleStdIconLabelTextOut(HDC hDC,
  597. HFONT hFont,
  598. int nXStart,
  599. int nYStart,
  600. UINT fuOptions,
  601. RECT FAR * lpRect,
  602. LPSTR lpszString,
  603. UINT cchString,
  604. int FAR * lpDX);
  605. // registration database query functions
  606. STDAPI_(UINT) OleStdGetAuxUserType(REFCLSID rclsid,
  607. WORD wAuxUserType,
  608. LPSTR lpszAuxUserType,
  609. int cch,
  610. HKEY hKey);
  611. STDAPI_(UINT) OleStdGetUserTypeOfClass(REFCLSID rclsid,
  612. LPSTR lpszUserType,
  613. UINT cch,
  614. HKEY hKey);
  615. STDAPI_(BOOL) OleStdGetMiscStatusOfClass(REFCLSID, HKEY, DWORD FAR *);
  616. STDAPI_(CLIPFORMAT) OleStdGetDefaultFileFormatOfClass(
  617. REFCLSID rclsid,
  618. HKEY hKey
  619. );
  620. STDAPI_(void) OleStdInitVtbl(LPVOID lpVtbl, UINT nSizeOfVtbl);
  621. STDMETHODIMP OleStdNullMethod(LPUNKNOWN lpThis);
  622. STDAPI_(BOOL) OleStdCheckVtbl(LPVOID lpVtbl, UINT nSizeOfVtbl, LPSTR lpszIface);
  623. STDAPI_(ULONG) OleStdVerifyRelease(LPUNKNOWN lpUnk, LPSTR lpszMsg);
  624. STDAPI_(ULONG) OleStdRelease(LPUNKNOWN lpUnk);
  625. STDAPI_(HDC) OleStdCreateDC(DVTARGETDEVICE FAR* ptd);
  626. STDAPI_(HDC) OleStdCreateIC(DVTARGETDEVICE FAR* ptd);
  627. STDAPI_(DVTARGETDEVICE FAR*) OleStdCreateTargetDevice(LPPRINTDLG lpPrintDlg);
  628. STDAPI_(BOOL) OleStdDeleteTargetDevice(DVTARGETDEVICE FAR* ptd);
  629. STDAPI_(DVTARGETDEVICE FAR*) OleStdCopyTargetDevice(DVTARGETDEVICE FAR* ptdSrc);
  630. STDAPI_(BOOL) OleStdCopyFormatEtc(LPFORMATETC petcDest, LPFORMATETC petcSrc);
  631. STDAPI_(int) OleStdCompareFormatEtc(FORMATETC FAR* pFetcLeft, FORMATETC FAR* pFetcRight);
  632. STDAPI_(BOOL) OleStdCompareTargetDevice
  633. (DVTARGETDEVICE FAR* ptdLeft, DVTARGETDEVICE FAR* ptdRight);
  634. STDAPI_(void) OleDbgPrint(
  635. int nDbgLvl,
  636. LPSTR lpszPrefix,
  637. LPSTR lpszMsg,
  638. int nIndent
  639. );
  640. STDAPI_(void) OleDbgPrintAlways(LPSTR lpszPrefix, LPSTR lpszMsg, int nIndent);
  641. STDAPI_(void) OleDbgSetDbgLevel(int nDbgLvl);
  642. STDAPI_(int) OleDbgGetDbgLevel( void );
  643. STDAPI_(void) OleDbgIndent(int n);
  644. STDAPI_(void) OleDbgPrintRefCnt(
  645. int nDbgLvl,
  646. LPSTR lpszPrefix,
  647. LPSTR lpszMsg,
  648. LPVOID lpObj,
  649. ULONG refcnt
  650. );
  651. STDAPI_(void) OleDbgPrintRefCntAlways(
  652. LPSTR lpszPrefix,
  653. LPSTR lpszMsg,
  654. LPVOID lpObj,
  655. ULONG refcnt
  656. );
  657. STDAPI_(void) OleDbgPrintRect(
  658. int nDbgLvl,
  659. LPSTR lpszPrefix,
  660. LPSTR lpszMsg,
  661. LPRECT lpRect
  662. );
  663. STDAPI_(void) OleDbgPrintRectAlways(
  664. LPSTR lpszPrefix,
  665. LPSTR lpszMsg,
  666. LPRECT lpRect
  667. );
  668. STDAPI_(void) OleDbgPrintScodeAlways(LPSTR lpszPrefix, LPSTR lpszMsg, SCODE sc);
  669. // debug implementation of the IMalloc interface.
  670. STDAPI OleStdCreateDbAlloc(ULONG reserved, IMalloc FAR* FAR* ppmalloc);
  671. STDAPI_(LPENUMFORMATETC)
  672. OleStdEnumFmtEtc_Create(ULONG nCount, LPFORMATETC lpEtc);
  673. STDAPI_(LPENUMSTATDATA)
  674. OleStdEnumStatData_Create(ULONG nCount, LPSTATDATA lpStat);
  675. STDAPI_(BOOL)
  676. OleStdCopyStatData(LPSTATDATA pDest, LPSTATDATA pSrc);
  677. STDAPI_(HPALETTE)
  678. OleStdCreateStandardPalette(void);
  679. #if defined( OBSOLETE )
  680. /*************************************************************************
  681. ** The following API's have been converted into macros:
  682. ** OleStdQueryOleObjectData
  683. ** OleStdQueryLinkSourceData
  684. ** OleStdQueryObjectDescriptorData
  685. ** OleStdQueryFormatMedium
  686. ** OleStdCopyMetafilePict
  687. ** AreRectsEqual
  688. ** OleStdGetDropEffect
  689. **
  690. ** These macros are defined above
  691. *************************************************************************/
  692. STDAPI_(BOOL) AreRectsEqual(LPRECT lprc1, LPRECT lprc2);
  693. STDAPI_(BOOL) OleStdCopyMetafilePict(HANDLE hpictin, HANDLE FAR* phpictout);
  694. STDAPI OleStdQueryOleObjectData(LPFORMATETC lpformatetc);
  695. STDAPI OleStdQueryLinkSourceData(LPFORMATETC lpformatetc);
  696. STDAPI OleStdQueryObjectDescriptorData(LPFORMATETC lpformatetc);
  697. STDAPI OleStdQueryFormatMedium(LPFORMATETC lpformatetc, TYMED tymed);
  698. STDAPI_(DWORD) OleStdGetDropEffect ( DWORD grfKeyState );
  699. #endif // OBSOLETE
  700. #endif // _OLESTD_H_