Moved server.h to include/wine.
[wine] / dlls / dplayx / dplayx_main.c
1 /* 
2  * DPLAYX.DLL LibMain
3  *
4  * Copyright 1999,2000 - Peter Hunnisett 
5  *
6  * contact <hunnise@nortelnetworks.com>
7  */
8 #include "winerror.h"
9 #include "winbase.h"
10 #include "debugtools.h"
11 #include "dplayx_global.h"
12
13 DEFAULT_DEBUG_CHANNEL(dplay);
14
15 /* This is a globally exported variable at ordinal 6 of DPLAYX.DLL */
16 DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */
17
18
19 BOOL WINAPI DPLAYX_LibMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
20 {
21
22   TRACE( "(%u,0x%08lx,%p)\n", hinstDLL, fdwReason, lpvReserved );
23
24   switch ( fdwReason ) 
25   {
26     case DLL_PROCESS_ATTACH:
27         /* First instance perform construction of global processor data */ 
28         return DPLAYX_ConstructData();
29
30     case DLL_PROCESS_DETACH:
31         /* Last instance performs destruction of global processor data */
32         return DPLAYX_DestructData(); 
33
34     case DLL_THREAD_ATTACH: /* Do nothing */
35     case DLL_THREAD_DETACH: /* Do nothing */
36       break;
37     default:                
38       break;
39
40   }
41
42   return TRUE;
43 }
44
45 /***********************************************************************
46  *              DllCanUnloadNow (DPLAYX.10)
47  */
48 HRESULT WINAPI DPLAYX_DllCanUnloadNow(void)
49 {
50   HRESULT hr = ( gdwDPlaySPRefCount > 0 ) ? S_FALSE : S_OK;
51
52   /* FIXME: Should I be putting a check in for class factory objects 
53    *        as well
54    */
55
56   TRACE( ": returning 0x%08lx\n", hr );
57  
58   return hr;
59 }
60