Fixed a race condition on RPC worker thread creation, and a typo.
[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 void* StdGlobalInterfaceTable_Construct();
31 extern void  StdGlobalInterfaceTable_Destroy(void* self);
32
33 extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr);
34 extern HRESULT create_marshalled_proxy(REFCLSID rclsid, REFIID iid, LPVOID *ppv);
35
36 inline static HRESULT
37 get_facbuf_for_iid(REFIID riid,IPSFactoryBuffer **facbuf) {
38     HRESULT       hres;
39     CLSID         pxclsid;
40
41     if ((hres = CoGetPSClsid(riid,&pxclsid)))
42         return hres;
43     return CoGetClassObject(&pxclsid,CLSCTX_INPROC_SERVER,NULL,&IID_IPSFactoryBuffer,(LPVOID*)facbuf);
44 }
45
46 #define PIPEPREF "\\\\.\\pipe\\"
47 #define OLESTUBMGR PIPEPREF"WINE_OLE_StubMgr"
48 /* Standard Marshaling definitions */
49 typedef struct _wine_marshal_id {
50     DWORD       processid;
51     DWORD       objectid;       /* unique value corresp. IUnknown of object */
52     IID         iid;
53 } wine_marshal_id;
54
55 inline static BOOL
56 MARSHAL_Compare_Mids(wine_marshal_id *mid1,wine_marshal_id *mid2) {
57     return
58         (mid1->processid == mid2->processid)    &&
59         (mid1->objectid == mid2->objectid)      &&
60         IsEqualIID(&(mid1->iid),&(mid2->iid))
61     ;
62 }
63
64 /* compare without interface compare */
65 inline static BOOL
66 MARSHAL_Compare_Mids_NoInterface(wine_marshal_id *mid1, wine_marshal_id *mid2) {
67     return
68         (mid1->processid == mid2->processid)    &&
69         (mid1->objectid == mid2->objectid)
70     ;
71 }
72
73 HRESULT MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub);
74 HRESULT MARSHAL_Find_Stub_Server(wine_marshal_id *mid,LPUNKNOWN *punk);
75 HRESULT MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN punk, IRpcStubBuffer *stub);
76
77 HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv);
78
79 typedef struct _wine_marshal_data {
80     DWORD       dwDestContext;
81     DWORD       mshlflags;
82 } wine_marshal_data;
83
84
85 #define REQTYPE_REQUEST         0
86 typedef struct _wine_rpc_request_header {
87     DWORD               reqid;
88     wine_marshal_id     mid;
89     DWORD               iMethod;
90     DWORD               cbBuffer;
91 } wine_rpc_request_header;
92
93 #define REQTYPE_RESPONSE        1
94 typedef struct _wine_rpc_response_header {
95     DWORD               reqid;
96     DWORD               cbBuffer;
97     DWORD               retval;
98 } wine_rpc_response_header;
99
100 #define REQSTATE_START                  0
101 #define REQSTATE_REQ_QUEUED             1
102 #define REQSTATE_REQ_WAITING_FOR_REPLY  2
103 #define REQSTATE_REQ_GOT                3
104 #define REQSTATE_INVOKING               4
105 #define REQSTATE_RESP_QUEUED            5
106 #define REQSTATE_RESP_GOT               6
107 #define REQSTATE_DONE                   6
108
109 void STUBMGR_Start();
110
111 extern HRESULT PIPE_GetNewPipeBuf(wine_marshal_id *mid, IRpcChannelBuffer **pipebuf);
112
113 /* This function initialize the Running Object Table */
114 HRESULT WINAPI RunningObjectTableImpl_Initialize();
115
116 /* This function uninitialize the Running Object Table */
117 HRESULT WINAPI RunningObjectTableImpl_UnInitialize();
118
119 /* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */
120 int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable);
121
122 HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id);
123
124 #endif /* __WINE_OLE_COMPOBJ_H */