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.

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