Implemented _ultow() and export [Nt/Zw]QueryVolumeInformationFile().
[wine] / dlls / dplayx / dplayx_main.c
1 /* 
2  * DPLAYX.DLL LibMain
3  *
4  * Copyright 1999,2000 - Peter Hunnisett 
5  *
6  * contact <hunnise@nortelnetworks.com>
7  */
8 #include "winerror.h"
9 #include "winbase.h"
10 #include "debugtools.h"
11 #include "dplayx_global.h"
12
13 DEFAULT_DEBUG_CHANNEL(dplay);
14
15 static DWORD DPLAYX_dwProcessesAttached = 0;
16
17 /* This is a globally exported variable at ordinal 6 of DPLAYX.DLL */
18 DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */
19
20
21 BOOL WINAPI DPLAYX_LibMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
22 {
23
24   TRACE( "(%u,0x%08lx,%p) & 0x%08lx\n", hinstDLL, fdwReason, lpvReserved, DPLAYX_dwProcessesAttached );
25
26   switch ( fdwReason ) 
27   {
28     case DLL_PROCESS_ATTACH:
29     {
30
31       if ( DPLAYX_dwProcessesAttached++ == 0 )
32       {
33         /* First instance perform construction of global processor data */ 
34         return DPLAYX_ConstructData();
35       } 
36
37       break;
38     }
39
40     case DLL_PROCESS_DETACH:
41     {
42
43       if ( --DPLAYX_dwProcessesAttached == 0 )
44       {
45         /* Last instance performs destruction of global processor data */
46         return DPLAYX_DestructData(); 
47       }
48  
49       break;
50     }
51
52     case DLL_THREAD_ATTACH: /* Do nothing */
53     case DLL_THREAD_DETACH: /* Do nothing */
54       break;
55     default:                
56       break;
57
58   }
59
60   return TRUE;
61 }
62
63 /***********************************************************************
64  *              DllCanUnloadNow (DPLAYX.10)
65  */
66 HRESULT WINAPI DPLAYX_DllCanUnloadNow(void)
67 {
68   HRESULT hr = ( gdwDPlaySPRefCount > 0 ) ? S_FALSE : S_OK;
69
70   /* FIXME: Should I be putting a check in for class factory objects 
71    *        as well
72    */
73
74   TRACE( ": returning 0x%08lx\n", hr );
75  
76   return hr;
77 }
78