4 * Copyright 1999,2000 - Peter Hunnisett
6 * contact <hunnise@nortelnetworks.com>
10 #include "debugtools.h"
11 #include "dplayx_global.h"
13 DEFAULT_DEBUG_CHANNEL(dplay);
15 static DWORD DPLAYX_dwProcessesAttached = 0;
17 /* This is a globally exported variable at ordinal 6 of DPLAYX.DLL */
18 DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */
21 BOOL WINAPI DPLAYX_LibMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
24 TRACE( "(%u,0x%08lx,%p) & 0x%08lx\n", hinstDLL, fdwReason, lpvReserved, DPLAYX_dwProcessesAttached );
28 case DLL_PROCESS_ATTACH:
31 if ( DPLAYX_dwProcessesAttached++ == 0 )
33 /* First instance perform construction of global processor data */
34 return DPLAYX_ConstructData();
40 case DLL_PROCESS_DETACH:
43 if ( --DPLAYX_dwProcessesAttached == 0 )
45 /* Last instance performs destruction of global processor data */
46 return DPLAYX_DestructData();
52 case DLL_THREAD_ATTACH: /* Do nothing */
53 case DLL_THREAD_DETACH: /* Do nothing */
63 /***********************************************************************
64 * DllCanUnloadNow (DPLAYX.10)
66 HRESULT WINAPI DPLAYX_DllCanUnloadNow(void)
68 HRESULT hr = ( gdwDPlaySPRefCount > 0 ) ? S_FALSE : S_OK;
70 /* FIXME: Should I be putting a check in for class factory objects
74 TRACE( ": returning 0x%08lx\n", hr );