Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * DPLAYX.DLL LibMain |
| 3 | * |
Peter Hunnisett | 4da59ea | 2000-07-10 13:19:28 +0000 | [diff] [blame] | 4 | * Copyright 1999,2000 - Peter Hunnisett |
Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 5 | * |
| 6 | * contact <hunnise@nortelnetworks.com> |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 7 | * |
| 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 Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 21 | */ |
Peter Hunnisett | ef6dca5 | 2000-08-25 21:58:05 +0000 | [diff] [blame] | 22 | #include "winerror.h" |
Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 23 | #include "winbase.h" |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 24 | #include "wine/debug.h" |
Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 25 | #include "dplayx_global.h" |
| 26 | |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 27 | WINE_DEFAULT_DEBUG_CHANNEL(dplay); |
Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 28 | |
Peter Hunnisett | ef6dca5 | 2000-08-25 21:58:05 +0000 | [diff] [blame] | 29 | /* This is a globally exported variable at ordinal 6 of DPLAYX.DLL */ |
| 30 | DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */ |
| 31 | |
| 32 | |
Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 33 | BOOL WINAPI DPLAYX_LibMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) |
| 34 | { |
Peter Hunnisett | 3951ff2 | 2000-05-30 20:08:32 +0000 | [diff] [blame] | 35 | |
Alexandre Julliard | 0618746 | 2001-01-17 22:03:18 +0000 | [diff] [blame] | 36 | TRACE( "(%u,0x%08lx,%p)\n", hinstDLL, fdwReason, lpvReserved ); |
Peter Hunnisett | 3951ff2 | 2000-05-30 20:08:32 +0000 | [diff] [blame] | 37 | |
Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 38 | switch ( fdwReason ) |
| 39 | { |
| 40 | case DLL_PROCESS_ATTACH: |
Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 41 | /* First instance perform construction of global processor data */ |
Peter Hunnisett | 4da59ea | 2000-07-10 13:19:28 +0000 | [diff] [blame] | 42 | return DPLAYX_ConstructData(); |
Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 43 | |
| 44 | case DLL_PROCESS_DETACH: |
Peter Hunnisett | 4da59ea | 2000-07-10 13:19:28 +0000 | [diff] [blame] | 45 | /* Last instance performs destruction of global processor data */ |
| 46 | return DPLAYX_DestructData(); |
Peter Hunnisett | 88d89f9 | 1999-11-04 02:17:03 +0000 | [diff] [blame] | 47 | |
| 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 Hunnisett | ef6dca5 | 2000-08-25 21:58:05 +0000 | [diff] [blame] | 58 | |
| 59 | /*********************************************************************** |
Patrik Stridvall | 3ca9823 | 2001-06-20 23:03:14 +0000 | [diff] [blame] | 60 | * DllCanUnloadNow (DPLAYX.10) |
Peter Hunnisett | ef6dca5 | 2000-08-25 21:58:05 +0000 | [diff] [blame] | 61 | */ |
| 62 | HRESULT 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 | |