dplayx: Adjusted timers to the values in the documentation
[wine/gsoc_dplay.git] / dlls / dplayx / dplayx_main.c
blob0b9b829b7fbfc55f1d6136f5a806ce2473a8bd50
1 /*
2 * DPLAYX.DLL LibMain
4 * Copyright 1999,2000 - Peter Hunnisett
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 * NOTES
22 * o A small issue will be the fact that DirectX 6.1(ie. DirectPlay4)
23 * introduces a layer of functionality inside the DP objects which
24 * provide guaranteed protocol delivery. This is even if the native
25 * protocol, IPX or modem for instance, doesn't guarantee it. I'm going
26 * to leave this kind of implementation to as close to the end as
27 * possible. However, I will implement an abstraction layer, where
28 * possible, for this functionality. It will do nothing to start, but
29 * will require only the implementation of the guarantee to give
30 * final implementation.
32 * TODO:
33 * - Implement mutual exclusion on object data for existing functions
34 * - Ensure that all dll stubs are present and the ordinals are correct
35 * - Addition of DirectX 7.0 functionality for direct play
36 * - Implement some WineLib test programs using sdk programs as a skeleton
37 * - Change RegEnumKeyEx enumeration pattern to allow error handling and to
38 * share registry implementation (or at least simplify).
39 * - Add in appropriate RegCloseKey calls for all the opening we're doing...
40 * - Fix all the buffer sizes for registry calls. They're off by one -
41 * but in a safe direction.
42 * - Fix race condition on interface destruction
43 * - Handles need to be correctly reference counted
44 * - Check if we need to deallocate any list objects when destroying
45 * a dplay interface
46 * - RunApplication process spawning needs to have correct syncronization.
47 * - Need to get inter lobby messages working.
48 * - Decypher dplay messages between applications and implement...
49 * - Need to implement lobby session spawning.
50 * - Improve footprint and realtime blocking by setting up a separate data share
51 * between lobby application and client since there can be multiple apps per
52 * client. Also get rid of offset dependency by making data offset independent
53 * somehow.
55 #include <stdarg.h>
57 #include "winerror.h"
58 #include "windef.h"
59 #include "winbase.h"
60 #include "wine/debug.h"
61 #include "dplayx_global.h"
63 WINE_DEFAULT_DEBUG_CHANNEL(dplay);
65 /* This is a globally exported variable at ordinal 6 of DPLAYX.DLL */
66 DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */
69 BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
72 TRACE( "(%p,%d,%p)\n", hinstDLL, fdwReason, lpvReserved );
74 switch ( fdwReason )
76 case DLL_PROCESS_ATTACH:
77 DisableThreadLibraryCalls(hinstDLL);
78 /* First instance perform construction of global processor data */
79 return DPLAYX_ConstructData();
81 case DLL_PROCESS_DETACH:
82 /* Last instance performs destruction of global processor data */
83 return DPLAYX_DestructData();
85 default:
86 break;
90 return TRUE;
93 /***********************************************************************
94 * DllCanUnloadNow (DPLAYX.@)
96 HRESULT WINAPI DllCanUnloadNow(void)
98 HRESULT hr = ( gdwDPlaySPRefCount > 0 ) ? S_FALSE : S_OK;
100 /* FIXME: Should I be putting a check in for class factory objects
101 * as well?
104 TRACE( ": returning 0x%08x\n", hr );
106 return hr;