Removed a few dependencies on kernel32 functions.
[wine] / dlls / dplayx / dplay_global.h
1 #ifndef __WINE_DPLAY_GLOBAL_INCLUDED
2 #define __WINE_DPLAY_GLOBAL_INCLUDED
3
4 #include "dplaysp.h"
5 #include "dplayx_queue.h"
6
7 extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, 
8                                 LPCVOID lpAddress, DWORD dwAddressSize, 
9                                 LPVOID lpContext );
10
11 extern DWORD DP_CalcSessionDescSize( LPCDPSESSIONDESC2 lpSessDesc, BOOL bAnsi );
12
13 /*****************************************************************************
14  * Predeclare the interface implementation structures
15  */
16 typedef struct IDirectPlay2Impl IDirectPlay2AImpl;
17 typedef struct IDirectPlay2Impl IDirectPlay2Impl;
18 typedef struct IDirectPlay3Impl IDirectPlay3AImpl;
19 typedef struct IDirectPlay3Impl IDirectPlay3Impl;
20 typedef struct IDirectPlay4Impl IDirectPlay4AImpl;
21 typedef struct IDirectPlay4Impl IDirectPlay4Impl;
22
23 typedef struct tagDirectPlayIUnknownData
24 {
25   ULONG             ulObjRef;
26   CRITICAL_SECTION  DP_lock;
27 } DirectPlayIUnknownData;
28
29 typedef struct tagEnumSessionAsyncCallbackData
30 {
31   LPSPINITDATA lpSpData;
32   GUID         requestGuid;
33   DWORD        dwEnumSessionFlags;
34   DWORD        dwTimeout;
35   HANDLE       hSuicideRequest;
36 } EnumSessionAsyncCallbackData;
37
38 struct PlayerData
39 {
40   /* Individual player information */
41   DPID dpid;
42
43   DPNAME name;
44   HANDLE hEvent;
45
46   ULONG  uRef;  /* What is the reference count on this data? */
47
48   /* View of local data */
49   LPVOID lpLocalData;
50   DWORD  dwLocalDataSize;
51
52   /* View of remote data */
53   LPVOID lpRemoteData;
54   DWORD  dwRemoteDataSize;
55
56   DWORD  dwFlags; /* Special remarks about the type of player */
57 };
58 typedef struct PlayerData* lpPlayerData;
59
60 struct PlayerList
61 {
62   DPQ_ENTRY(PlayerList) players;
63
64   lpPlayerData lpPData;
65 };
66 typedef struct PlayerList* lpPlayerList;
67
68 struct GroupData
69 {
70   /* Internal information */
71   DPID parent; /* If parent == 0 it's a top level group */
72
73   ULONG uRef; /* Reference count */
74
75   DPQ_HEAD(GroupList)  groups;  /* A group has [0..n] groups */
76   DPQ_HEAD(PlayerList) players; /* A group has [0..n] players */
77
78   DPID idGroupOwner; /* ID of player who owns the group */
79
80   DWORD dwFlags; /* Flags describing anything special about the group */
81
82   DPID   dpid;
83   DPNAME name;
84
85   /* View of local data */
86   LPVOID lpLocalData;
87   DWORD  dwLocalDataSize;
88
89   /* View of remote data */
90   LPVOID lpRemoteData;
91   DWORD  dwRemoteDataSize;
92 };
93 typedef struct GroupData  GroupData;
94 typedef struct GroupData* lpGroupData;
95
96 struct GroupList
97 {
98   DPQ_ENTRY(GroupList) groups;
99
100   lpGroupData lpGData;
101 };
102 typedef struct GroupList* lpGroupList;
103
104 struct DPMSG
105 {
106   DPQ_ENTRY( DPMSG ) msgs;
107   DPMSG_GENERIC* msg;
108 };
109 typedef struct DPMSG* LPDPMSG;
110
111 /* Contains all dp1 and dp2 data members */
112 typedef struct tagDirectPlay2Data
113 {
114   BOOL   bConnectionOpen;
115
116   /* For async EnumSessions requests */
117   HANDLE hEnumSessionThread;
118   HANDLE hKillEnumSessionThreadEvent;
119
120   LPVOID lpNameServerData; /* DPlay interface doesn't know contents */
121
122   BOOL bHostInterface; /* Did this interface create the session */
123
124   lpGroupData lpSysGroup; /* System group with _everything_ in it */
125
126   LPDPSESSIONDESC2 lpSessionDesc;
127
128   /* I/O Msg queues */
129   DPQ_HEAD( DPMSG ) receiveMsgs; /* Msg receive queue */
130   DPQ_HEAD( DPMSG ) sendMsgs;    /* Msg send pending queue */
131
132   /* Information about the service provider active on this connection */
133   SPINITDATA spData;
134
135   /* Our service provider */
136   HMODULE hServiceProvider;
137
138   BOOL bConnectionInitialized;
139
140
141   /* proof of concept for message reception */
142   HANDLE hMsgReceipt;
143   LPVOID lpMsgReceived;
144 } DirectPlay2Data;
145
146 typedef struct tagDirectPlay3Data
147 {
148   BOOL dummy;
149 } DirectPlay3Data;
150 typedef struct tagDirectPlay4Data
151 {
152   BOOL dummy;
153 } DirectPlay4Data;
154
155 #define DP_IMPL_FIELDS \
156   ULONG ulInterfaceRef; \
157   DirectPlayIUnknownData*  unk; \
158   DirectPlay2Data*         dp2; \
159   DirectPlay3Data*         dp3; \
160   DirectPlay4Data*         dp4;
161
162 struct IDirectPlay2Impl
163 {
164   ICOM_VFIELD(IDirectPlay2);
165   DP_IMPL_FIELDS
166 };
167
168 struct IDirectPlay3Impl
169 {
170   ICOM_VFIELD(IDirectPlay3);
171   DP_IMPL_FIELDS
172 };
173
174 struct IDirectPlay4Impl
175 {
176   ICOM_VFIELD(IDirectPlay4);
177   DP_IMPL_FIELDS
178 };
179
180 /* Forward declarations of virtual tables */
181 extern ICOM_VTABLE(IDirectPlay2) directPlay2AVT;
182 extern ICOM_VTABLE(IDirectPlay3) directPlay3AVT;
183 extern ICOM_VTABLE(IDirectPlay4) directPlay4AVT;
184
185 extern ICOM_VTABLE(IDirectPlay2) directPlay2WVT;
186 extern ICOM_VTABLE(IDirectPlay3) directPlay3WVT;
187 extern ICOM_VTABLE(IDirectPlay4) directPlay4WVT;
188
189
190 HRESULT DP_HandleMessage( IDirectPlay2Impl* This, LPCVOID lpMessageBody,
191                           DWORD  dwMessageBodySize, LPCVOID lpMessageHeader,
192                           WORD wCommandId, WORD wVersion, 
193                           LPVOID* lplpReply, LPDWORD lpdwMsgSize );
194
195
196 #endif /* __WINE_DPLAY_GLOBAL_INCLUDED */