Reimplemented SHRegGetPathA/W, SHGetValueA/W, SHRegGetPathA/W.
[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  * 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 #include "winerror.h"
23 #include "winbase.h"
24 #include "wine/debug.h"
25 #include "dplayx_global.h"
26
27 WINE_DEFAULT_DEBUG_CHANNEL(dplay);
28
29 /* This is a globally exported variable at ordinal 6 of DPLAYX.DLL */
30 DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */
31
32
33 BOOL WINAPI DPLAYX_LibMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
34 {
35
36   TRACE( "(%u,0x%08lx,%p)\n", hinstDLL, fdwReason, lpvReserved );
37
38   switch ( fdwReason ) 
39   {
40     case DLL_PROCESS_ATTACH:
41         /* First instance perform construction of global processor data */ 
42         return DPLAYX_ConstructData();
43
44     case DLL_PROCESS_DETACH:
45         /* Last instance performs destruction of global processor data */
46         return DPLAYX_DestructData(); 
47
48     case DLL_THREAD_ATTACH: /* Do nothing */
49     case DLL_THREAD_DETACH: /* Do nothing */
50       break;
51     default:                
52       break;
53
54   }
55
56   return TRUE;
57 }
58
59 /***********************************************************************
60  *              DllCanUnloadNow (DPLAYX.10)
61  */
62 HRESULT WINAPI DPLAYX_DllCanUnloadNow(void)
63 {
64   HRESULT hr = ( gdwDPlaySPRefCount > 0 ) ? S_FALSE : S_OK;
65
66   /* FIXME: Should I be putting a check in for class factory objects 
67    *        as well
68    */
69
70   TRACE( ": returning 0x%08lx\n", hr );
71  
72   return hr;
73 }
74