blob: 8eb8e7daa23af547b270d60b91ed9e2b3361a735 [file] [log] [blame]
Peter Hunnisett88d89f91999-11-04 02:17:03 +00001/*
2 * DPLAYX.DLL LibMain
3 *
Peter Hunnisett4da59ea2000-07-10 13:19:28 +00004 * Copyright 1999,2000 - Peter Hunnisett
Peter Hunnisett88d89f91999-11-04 02:17:03 +00005 *
6 * contact <hunnise@nortelnetworks.com>
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00007 *
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
Peter Hunnisett88d89f91999-11-04 02:17:03 +000021 */
Peter Hunnisettef6dca52000-08-25 21:58:05 +000022#include "winerror.h"
Peter Hunnisett88d89f91999-11-04 02:17:03 +000023#include "winbase.h"
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000024#include "wine/debug.h"
Peter Hunnisett88d89f91999-11-04 02:17:03 +000025#include "dplayx_global.h"
26
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000027WINE_DEFAULT_DEBUG_CHANNEL(dplay);
Peter Hunnisett88d89f91999-11-04 02:17:03 +000028
Peter Hunnisettef6dca52000-08-25 21:58:05 +000029/* This is a globally exported variable at ordinal 6 of DPLAYX.DLL */
30DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */
31
32
Peter Hunnisett88d89f91999-11-04 02:17:03 +000033BOOL WINAPI DPLAYX_LibMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
34{
Peter Hunnisett3951ff22000-05-30 20:08:32 +000035
Alexandre Julliard06187462001-01-17 22:03:18 +000036 TRACE( "(%u,0x%08lx,%p)\n", hinstDLL, fdwReason, lpvReserved );
Peter Hunnisett3951ff22000-05-30 20:08:32 +000037
Peter Hunnisett88d89f91999-11-04 02:17:03 +000038 switch ( fdwReason )
39 {
40 case DLL_PROCESS_ATTACH:
Peter Hunnisett88d89f91999-11-04 02:17:03 +000041 /* First instance perform construction of global processor data */
Peter Hunnisett4da59ea2000-07-10 13:19:28 +000042 return DPLAYX_ConstructData();
Peter Hunnisett88d89f91999-11-04 02:17:03 +000043
44 case DLL_PROCESS_DETACH:
Peter Hunnisett4da59ea2000-07-10 13:19:28 +000045 /* Last instance performs destruction of global processor data */
46 return DPLAYX_DestructData();
Peter Hunnisett88d89f91999-11-04 02:17:03 +000047
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}
Peter Hunnisettef6dca52000-08-25 21:58:05 +000058
59/***********************************************************************
Patrik Stridvall3ca98232001-06-20 23:03:14 +000060 * DllCanUnloadNow (DPLAYX.10)
Peter Hunnisettef6dca52000-08-25 21:58:05 +000061 */
62HRESULT 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