Avoid division by 0 by initializing the item size in on creation.
[wine] / dlls / ole32 / compobj_private.h
1 /*
2  * Copyright 1995 Martin von Loewis
3  * Copyright 1998 Justin Bradford
4  * Copyright 1999 Francis Beaudet
5  * Copyright 1999 Sylvain St-Germain
6  * Copyright 2002 Marcus Meissner
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
22
23 #ifndef __WINE_OLE_COMPOBJ_H
24 #define __WINE_OLE_COMPOBJ_H
25
26 /* All private prototype functions used by OLE will be added to this header file */
27
28 #include "wtypes.h"
29
30 extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr);
31 extern HRESULT create_marshalled_proxy(REFCLSID rclsid, REFIID iid, LPVOID *ppv);
32
33 inline static HRESULT
34 get_facbuf_for_iid(REFIID riid,IPSFactoryBuffer **facbuf) {
35     HRESULT       hres;
36     CLSID         pxclsid;
37
38     if ((hres = CoGetPSClsid(riid,&pxclsid)))
39         return hres;
40     return CoGetClassObject(&pxclsid,CLSCTX_INPROC_SERVER,NULL,&IID_IPSFactoryBuffer,(LPVOID*)facbuf);
41 }
42
43 #define PIPEPREF "\\\\.\\pipe\\"
44 #define OLESTUBMGR PIPEPREF"WINE_OLE_StubMgr"
45 /* Standard Marshaling definitions */
46 typedef struct _wine_marshal_id {
47     DWORD       processid;
48     DWORD       objectid;       /* unique value corresp. IUnknown of object */
49     IID         iid;
50 } wine_marshal_id;
51
52 inline static BOOL
53 MARSHAL_Compare_Mids(wine_marshal_id *mid1,wine_marshal_id *mid2) {
54     return
55         (mid1->processid == mid2->processid)    &&
56         (mid1->objectid == mid2->objectid)      &&
57         IsEqualIID(&(mid1->iid),&(mid2->iid))
58     ;
59 }
60
61 /* compare without interface compare */
62 inline static BOOL
63 MARSHAL_Compare_Mids_NoInterface(wine_marshal_id *mid1, wine_marshal_id *mid2) {
64     return
65         (mid1->processid == mid2->processid)    &&
66         (mid1->objectid == mid2->objectid)
67     ;
68 }
69
70 HRESULT MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub);
71 HRESULT MARSHAL_Find_Stub_Server(wine_marshal_id *mid,LPUNKNOWN *punk);
72 HRESULT MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN punk, IRpcStubBuffer *stub);
73
74 HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
75
76 typedef struct _wine_marshal_data {
77     DWORD       dwDestContext;
78     DWORD       mshlflags;
79 } wine_marshal_data;
80
81
82 #define REQTYPE_REQUEST         0
83 typedef struct _wine_rpc_request_header {
84     DWORD               reqid;
85     wine_marshal_id     mid;
86     DWORD               iMethod;
87     DWORD               cbBuffer;
88 } wine_rpc_request_header;
89
90 #define REQTYPE_RESPONSE        1
91 typedef struct _wine_rpc_response_header {
92     DWORD               reqid;
93     DWORD               cbBuffer;
94     DWORD               retval;
95 } wine_rpc_response_header;
96
97 #define REQSTATE_START                  0
98 #define REQSTATE_REQ_QUEUED             1
99 #define REQSTATE_REQ_WAITING_FOR_REPLY  2
100 #define REQSTATE_REQ_GOT                3
101 #define REQSTATE_INVOKING               4
102 #define REQSTATE_RESP_QUEUED            5
103 #define REQSTATE_RESP_GOT               6
104 #define REQSTATE_DONE                   6
105
106 void STUBMGR_Start();
107
108 extern HRESULT PIPE_GetNewPipeBuf(wine_marshal_id *mid, IRpcChannelBuffer **pipebuf);
109
110 /* This function initialize the Running Object Table */
111 HRESULT WINAPI RunningObjectTableImpl_Initialize();
112
113 /* This function uninitialize the Running Object Table */
114 HRESULT WINAPI RunningObjectTableImpl_UnInitialize();
115
116 /* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */
117 int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable);
118
119 HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id);
120
121 #endif /* __WINE_OLE_COMPOBJ_H */