2002-06-01 01:06:46 +02:00
|
|
|
/*
|
1999-11-04 03:17:03 +01:00
|
|
|
* DPLAYX.DLL LibMain
|
|
|
|
*
|
2002-06-01 01:06:46 +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? */
|
|
|
|
|
|
|
|
|
2002-11-05 00:53:41 +01:00
|
|
|
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2002-10-24 00:20:46 +02:00
|
|
|
TRACE( "(%p,0x%08lx,%p)\n", hinstDLL, fdwReason, lpvReserved );
|
2000-05-30 22:08:32 +02:00
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
switch ( fdwReason )
|
1999-11-04 03:17:03 +01:00
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
2002-06-01 01:06:46 +02: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
|
|
|
|
|
|
|
case DLL_PROCESS_DETACH:
|
2000-07-10 15:19:28 +02:00
|
|
|
/* Last instance performs destruction of global processor data */
|
2002-06-01 01:06:46 +02:00
|
|
|
return DPLAYX_DestructData();
|
1999-11-04 03:17:03 +01:00
|
|
|
|
|
|
|
case DLL_THREAD_ATTACH: /* Do nothing */
|
|
|
|
case DLL_THREAD_DETACH: /* Do nothing */
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
default:
|
1999-11-04 03:17:03 +01:00
|
|
|
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;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
/* FIXME: Should I be putting a check in for class factory objects
|
2000-08-25 23:58:05 +02:00
|
|
|
* as well
|
|
|
|
*/
|
|
|
|
|
|
|
|
TRACE( ": returning 0x%08lx\n", hr );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-25 23:58:05 +02:00
|
|
|
return hr;
|
|
|
|
}
|