1 //   ----------------------------------------------------------------------------
2 //  MODULE      : OLECommun.h
3 //  LANGAGE     : C++
4 //  AUTHOR      : Nicolas Romantzoff
5 //  DATE        : July 7th 1995
6 //  DESCRIPTION :
7 //  COMMENT     : Most of the definitions are copied from Windows headers
8 //  SCCSID      : @(#)olecomm.h 1.2 14:47:37 06 Jan 1997
9 //  ----------------------------------------------------------------------------
10 //  Copyright (c) 1999 Digital Imaging Group, Inc.
11 //  For conditions of distribution and use, see copyright notice
12 //  in Flashpix.h
13 //  ----------------------------------------------------------------------------
14 #ifndef OLECommun_h
15 # define OLECommun_h
16 # ifndef FITypes_h
17 #  include "b_types.h"
18 # endif
19 //  ----------------------------------------------------------------------------
20 
21 
22 # ifdef macintosh
23 #  define _MAC 1
24 #  define MAC  1
25 #  define _DEBUG 1
26 #  define DEBUG  1
27 // The following has to be used with CW7 or better...
28 #  define NO_NULL_VTABLE_ENTRY 1
29 # endif
30 
31 //  Includes
32 //  --------
33 
34 # ifdef _WINDOWS
35 #  include  <ole2.h>
36 #  include  <ole2ver.h>
37 #  include  <oleauto.h>
38 #  include "str8_16.h"
39 # endif
40 
41 # ifdef macintosh
42 #  include  <ole2.h>
43 #  include  <ole2ver.h>
44 #  include  <dispatch.h>
45 # endif
46 
47 # if defined(_UNIX)
48 // use the reference implementation header files
49 #  include "exphead.cxx"
50 #  include "msfhead.cxx"
51 #  include "dfhead.cxx"
52 #  include "props.h" // for VARIANT defenition
53 # endif // _UNIX
54 
55 //  Constants
56 //  ---------
57 
58 // Storage Access Mode Flags used in the most common opening cases
59 // As stupid as it can seem, STGM_SHARE_EXCLUSIVE is required by OLE to open a stream, otherwise, OLE
60 // raises a STG_E_INVALIDFUNCTION error (see OLE2 Programmer's Reference p.572). Consequently, THERE IS
61 // NO WAY TO OPEN A FILE TWICE EVEN IN READ ONLY... clever...
62 # define OLE_READ_ONLY_MODE  (STGM_READ      | STGM_SHARE_EXCLUSIVE  | STGM_DIRECT)
63 # define OLE_READWRITE_MODE  (STGM_READWRITE | STGM_SHARE_EXCLUSIVE  | STGM_DIRECT)
64 # define OLE_CREATE_MODE   (STGM_READWRITE | STGM_SHARE_EXCLUSIVE  | STGM_DIRECT | STGM_CREATE)
65 
66 // value to define if the file is to be read/written in Intel mode or not
67 # if defined(_UNIX)
68 #  ifdef __linux__
69 #   include <endian.h>
70 #  elif defined(__sun)
71 #   include <solaris.h>
72 #  else
73 #   include <machine/endian.h>
74 #  endif
75 #  if BYTE_ORDER == BIG_ENDIAN
76 #   define IN_BIG_ENDIAN short(-257)
77 #  else
78 #   define IN_LITTLE_ENDIAN    short(-2) // 0xFFFE
79 #  endif
80 # elif defined(macintosh)
81 #  define IN_BIG_ENDIAN     short(-257) // 0xFEFF
82 # else
83 #  define IN_LITTLE_ENDIAN    short(-2) // 0xFFFE
84 # endif
85 
86   // Define OLE_STR and V_UI1REF
87 # if defined(_UNIX) || defined(macintosh)
88 #  define OLE_STR (char*)
89 #  undef V_UI1REF
90 #  define V_UI1REF(X) V_BSTR(X)
91 # endif
92 
93 # define MAKE_DWORD(a,b)   (DWORD)((DWORD(a)<<16) + DWORD(b))
94 
95 // This is the structure used to define read/writable arrays (vectors).
96 typedef struct
97 {
98   DWORD cElements;
99   union
100   {
101     BYTE  *prgb;      // Pointer to unsigned char
102     WORD  *prgw;      // Pointer to unsigned short
103     DWORD *prgdw;     // Pointer to unsigned long
104     float *prgflt;    // Pointer to float
105     double  *prgdbl;  // Pointer to double
106     char  **prgpsz;   // Pointer to char*
107     WCHAR **prgpwz;   // Pointer to WCHAR*
108     BLOB  **prgblob;  // Pointer to BLOB*
109     VARIANT *pvar;    // Pointer to VARIANT
110     CLIPDATA  **pcd;  // Pointer to CLIPDATA*
111     CLSID *pclsid;    // Pointer to CLSID
112   };
113 } VECTOR;
114 
115 // ComObj structure
116 typedef struct tagCOMPOBJHEADER {
117   DWORD dwVersionAndByteOrder;
118   DWORD dwFormat;
119   DWORD unused;
120   CLSID clsidClass;
121 } COMPOBJHEADER;
122 
123 //  Classes declarations
124 //  --------------------
125 
126 //  Classes definitions
127 //  --------------------
128 
129 //  Functions 'inline'
130 //  ------------------
131 
132 //  Functions 'extern'
133 //  ------------------
134 
135 //  Variables 'extern'
136 //  ------------------
137 
138 //   ----------------------------------------------------------------------------
139   #endif // OLECommun_h
140 //   ----------------------------------------------------------------------------
141