advapi32: Make rpcrt4 a delayed import to work around circular dependencies with...
[wine/testsucceed.git] / dlls / dpwsockx / dpwsockx_main.c
blobff6f5b54fa00b0ca417093d418b0c54f86e20ea0
1 /* Internet TCP/IP and IPX Connection For DirectPlay
3 * Copyright 2008 Ismael Barros Barros
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "config.h"
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winsock2.h"
27 #include "dpwsockx_dll.h"
28 #include "wine/debug.h"
29 #include "dplay.h"
30 #include "wine/dplaysp.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(dplay);
35 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
37 TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
39 switch (fdwReason)
41 case DLL_WINE_PREATTACH:
42 return FALSE; /* prefer native version */
43 case DLL_PROCESS_ATTACH:
44 /* TODO: Initialization */
45 DisableThreadLibraryCalls(hinstDLL);
46 break;
47 case DLL_PROCESS_DETACH:
48 break;
49 default:
50 break;
53 return TRUE;
57 static HRESULT WINAPI DPWSCB_EnumSessions( LPDPSP_ENUMSESSIONSDATA data )
59 FIXME( "(%p,%d,%p,%u) stub\n",
60 data->lpMessage, data->dwMessageSize,
61 data->lpISP, data->bReturnStatus );
62 return DPERR_UNSUPPORTED;
65 static HRESULT WINAPI DPWSCB_Reply( LPDPSP_REPLYDATA data )
67 FIXME( "(%p,%p,%d,%d,%p) stub\n",
68 data->lpSPMessageHeader, data->lpMessage, data->dwMessageSize,
69 data->idNameServer, data->lpISP );
70 return DPERR_UNSUPPORTED;
73 static HRESULT WINAPI DPWSCB_Send( LPDPSP_SENDDATA data )
75 FIXME( "(0x%08x,%d,%d,%p,%d,%u,%p) stub\n",
76 data->dwFlags, data->idPlayerTo, data->idPlayerFrom,
77 data->lpMessage, data->dwMessageSize,
78 data->bSystemMessage, data->lpISP );
79 return DPERR_UNSUPPORTED;
82 static HRESULT WINAPI DPWSCB_CreatePlayer( LPDPSP_CREATEPLAYERDATA data )
84 FIXME( "(%d,0x%08x,%p,%p) stub\n",
85 data->idPlayer, data->dwFlags,
86 data->lpSPMessageHeader, data->lpISP );
87 return DPERR_UNSUPPORTED;
90 static HRESULT WINAPI DPWSCB_DeletePlayer( LPDPSP_DELETEPLAYERDATA data )
92 FIXME( "(%d,0x%08x,%p) stub\n",
93 data->idPlayer, data->dwFlags, data->lpISP );
94 return DPERR_UNSUPPORTED;
97 static HRESULT WINAPI DPWSCB_GetAddress( LPDPSP_GETADDRESSDATA data )
99 FIXME( "(%d,0x%08x,%p,%p,%p) stub\n",
100 data->idPlayer, data->dwFlags, data->lpAddress,
101 data->lpdwAddressSize, data->lpISP );
102 return DPERR_UNSUPPORTED;
105 static HRESULT WINAPI DPWSCB_GetCaps( LPDPSP_GETCAPSDATA data )
107 FIXME( "(%d,%p,0x%08x,%p)\n",
108 data->idPlayer, data->lpCaps, data->dwFlags, data->lpISP );
109 return DPERR_UNSUPPORTED;
112 static HRESULT WINAPI DPWSCB_Open( LPDPSP_OPENDATA data )
114 FIXME( "(%u,%p,%p,%u,0x%08x,0x%08x) stub\n",
115 data->bCreate, data->lpSPMessageHeader, data->lpISP,
116 data->bReturnStatus, data->dwOpenFlags, data->dwSessionFlags );
117 return DPERR_UNSUPPORTED;
120 static HRESULT WINAPI DPWSCB_CloseEx( LPDPSP_CLOSEDATA data )
122 FIXME( "(%p) stub\n", data->lpISP );
123 return DPERR_UNSUPPORTED;
126 static HRESULT WINAPI DPWSCB_ShutdownEx( LPDPSP_SHUTDOWNDATA data )
128 FIXME( "(%p) stub\n", data->lpISP );
129 return DPERR_UNSUPPORTED;
132 static HRESULT WINAPI DPWSCB_GetAddressChoices( LPDPSP_GETADDRESSCHOICESDATA data )
134 FIXME( "(%p,%p,%p) stub\n",
135 data->lpAddress, data->lpdwAddressSize, data->lpISP );
136 return DPERR_UNSUPPORTED;
139 static HRESULT WINAPI DPWSCB_SendEx( LPDPSP_SENDEXDATA data )
141 FIXME( "(%p,0x%08x,%d,%d,%p,%d,%d,%d,%d,%p,%p,%u) stub\n",
142 data->lpISP, data->dwFlags, data->idPlayerTo, data->idPlayerFrom,
143 data->lpSendBuffers, data->cBuffers, data->dwMessageSize,
144 data->dwPriority, data->dwTimeout, data->lpDPContext,
145 data->lpdwSPMsgID, data->bSystemMessage );
146 return DPERR_UNSUPPORTED;
149 static HRESULT WINAPI DPWSCB_SendToGroupEx( LPDPSP_SENDTOGROUPEXDATA data )
151 FIXME( "(%p,0x%08x,%d,%d,%p,%d,%d,%d,%d,%p,%p) stub\n",
152 data->lpISP, data->dwFlags, data->idGroupTo, data->idPlayerFrom,
153 data->lpSendBuffers, data->cBuffers, data->dwMessageSize,
154 data->dwPriority, data->dwTimeout, data->lpDPContext,
155 data->lpdwSPMsgID );
156 return DPERR_UNSUPPORTED;
159 static HRESULT WINAPI DPWSCB_Cancel( LPDPSP_CANCELDATA data )
161 FIXME( "(%p,0x%08x,%p,%d,0x%08x,0x%08x) stub\n",
162 data->lpISP, data->dwFlags, data->lprglpvSPMsgID, data->cSPMsgID,
163 data->dwMinPriority, data->dwMaxPriority );
164 return DPERR_UNSUPPORTED;
167 static HRESULT WINAPI DPWSCB_GetMessageQueue( LPDPSP_GETMESSAGEQUEUEDATA data )
169 FIXME( "(%p,0x%08x,%d,%d,%p,%p) stub\n",
170 data->lpISP, data->dwFlags, data->idFrom, data->idTo,
171 data->lpdwNumMsgs, data->lpdwNumBytes );
172 return DPERR_UNSUPPORTED;
175 static void setup_callbacks( LPDPSP_SPCALLBACKS lpCB )
177 lpCB->EnumSessions = DPWSCB_EnumSessions;
178 lpCB->Reply = DPWSCB_Reply;
179 lpCB->Send = DPWSCB_Send;
180 lpCB->CreatePlayer = DPWSCB_CreatePlayer;
181 lpCB->DeletePlayer = DPWSCB_DeletePlayer;
182 lpCB->GetAddress = DPWSCB_GetAddress;
183 lpCB->GetCaps = DPWSCB_GetCaps;
184 lpCB->Open = DPWSCB_Open;
185 lpCB->CloseEx = DPWSCB_CloseEx;
186 lpCB->ShutdownEx = DPWSCB_ShutdownEx;
187 lpCB->GetAddressChoices = DPWSCB_GetAddressChoices;
188 lpCB->SendEx = DPWSCB_SendEx;
189 lpCB->SendToGroupEx = DPWSCB_SendToGroupEx;
190 lpCB->Cancel = DPWSCB_Cancel;
191 lpCB->GetMessageQueue = DPWSCB_GetMessageQueue;
193 lpCB->AddPlayerToGroup = NULL;
194 lpCB->Close = NULL;
195 lpCB->CreateGroup = NULL;
196 lpCB->DeleteGroup = NULL;
197 lpCB->RemovePlayerFromGroup = NULL;
198 lpCB->SendToGroup = NULL;
199 lpCB->Shutdown = NULL;
204 /******************************************************************
205 * SPInit (DPWSOCKX.1)
207 HRESULT WINAPI SPInit( LPSPINITDATA lpspData )
209 WSADATA wsaData;
210 DPWS_DATA dpwsData;
212 TRACE( "Initializing library for %s (%s)\n",
213 wine_dbgstr_guid(lpspData->lpGuid), debugstr_w(lpspData->lpszName) );
215 /* We only support TCP/IP service */
216 if ( !IsEqualGUID(lpspData->lpGuid, &DPSPGUID_TCPIP) )
218 return DPERR_UNAVAILABLE;
221 /* Assign callback functions */
222 setup_callbacks( lpspData->lpCB );
224 /* Load Winsock 2.0 DLL */
225 if ( WSAStartup( MAKEWORD(2, 0), &wsaData ) != 0 )
227 ERR( "WSAStartup() failed\n" );
228 return DPERR_UNAVAILABLE;
231 /* Initialize internal data */
232 memset( &dpwsData, 0, sizeof(DPWS_DATA) );
233 dpwsData.lpISP = lpspData->lpISP;
234 IDirectPlaySP_SetSPData( lpspData->lpISP, &dpwsData, sizeof(DPWS_DATA),
235 DPSET_LOCAL );
237 /* dplay needs to know the size of the header */
238 lpspData->dwSPHeaderSize = sizeof(DPSP_MSG_HEADER);
240 return DP_OK;