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>
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-11-04 03:17:03 +01:00
|
|
|
*/
|
2000-08-25 23:58:05 +02:00
|
|
|
#include "winerror.h"
|
1999-11-04 03:17:03 +01:00
|
|
|
#include "winbase.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-11-04 03:17:03 +01:00
|
|
|
#include "dplayx_global.h"
|
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dplay);
|
1999-11-04 03:17:03 +01:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
/* This is a globally exported variable at ordinal 6 of DPLAYX.DLL */
|
|
|
|
DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */
|
|
|
|
|
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
BOOL WINAPI DPLAYX_LibMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
|
|
|
|
{
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2001-01-17 23:03:18 +01:00
|
|
|
TRACE( "(%u,0x%08lx,%p)\n", hinstDLL, fdwReason, lpvReserved );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
1999-11-04 03:17:03 +01:00
|
|
|
switch ( fdwReason )
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
/* 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
|
|
|
|
|
|
|
case DLL_PROCESS_DETACH:
|
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
|
|
|
|
|
|
|
case DLL_THREAD_ATTACH: /* Do nothing */
|
|
|
|
case DLL_THREAD_DETACH: /* Do nothing */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2000-08-25 23:58:05 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* DllCanUnloadNow (DPLAYX.10)
|
2000-08-25 23:58:05 +02:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI DPLAYX_DllCanUnloadNow(void)
|
|
|
|
{
|
|
|
|
HRESULT hr = ( gdwDPlaySPRefCount > 0 ) ? S_FALSE : S_OK;
|
|
|
|
|
|
|
|
/* FIXME: Should I be putting a check in for class factory objects
|
|
|
|
* as well
|
|
|
|
*/
|
|
|
|
|
|
|
|
TRACE( ": returning 0x%08lx\n", hr );
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|