1999-11-04 03:17:03 +01:00
|
|
|
/*
|
|
|
|
* DPLAYX.DLL LibMain
|
|
|
|
*
|
2000-07-10 15:19:28 +02:00
|
|
|
* Copyright 1999,2000 - Peter Hunnisett
|
1999-11-04 03:17:03 +01:00
|
|
|
*
|
|
|
|
* contact <hunnise@nortelnetworks.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "debugtools.h"
|
2000-08-03 06:22:35 +02:00
|
|
|
|
|
|
|
#include "initguid.h"
|
|
|
|
#include "dplay.h"
|
|
|
|
#include "dplobby.h"
|
1999-11-04 03:17:03 +01:00
|
|
|
#include "dplayx_global.h"
|
|
|
|
|
2000-08-03 06:22:35 +02:00
|
|
|
DEFAULT_DEBUG_CHANNEL(dplay);
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
static DWORD DPLAYX_dwProcessesAttached = 0;
|
|
|
|
|
|
|
|
BOOL WINAPI DPLAYX_LibMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
|
|
|
|
{
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
TRACE( "(%u,0x%08lx,%p) & 0x%08lx\n", hinstDLL, fdwReason, lpvReserved, DPLAYX_dwProcessesAttached );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
switch ( fdwReason )
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
{
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if ( DPLAYX_dwProcessesAttached++ == 0 )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
/* First instance perform construction of global processor data */
|
2000-07-10 15:19:28 +02:00
|
|
|
return DPLAYX_ConstructData();
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case DLL_PROCESS_DETACH:
|
|
|
|
{
|
|
|
|
|
2000-07-10 15:19:28 +02:00
|
|
|
if ( --DPLAYX_dwProcessesAttached == 0 )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Last instance performs destruction of global processor data */
|
|
|
|
return DPLAYX_DestructData();
|
1999-11-04 03:17:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case DLL_THREAD_ATTACH: /* Do nothing */
|
|
|
|
case DLL_THREAD_DETACH: /* Do nothing */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|