Added a framework for testing CreateProcess and a few tests.
[wine] / dlls / avifil32 / main.c
1 /*
2  * Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include <string.h>
20 #include <stdio.h>
21 #include <assert.h>
22
23 #include "winbase.h"
24 #include "winnls.h"
25 #include "mmsystem.h"
26 #include "winerror.h"
27 #include "vfw.h"
28 #include "wine/debug.h"
29 #include "avifile_private.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL(avifile);
32
33 WINE_AVIFILE_DATA AVIFILE_data;
34
35
36 /***********************************************************************
37  *              AVIFILE_InitProcess (internal)
38  */
39 static BOOL AVIFILE_InitProcess( void )
40 {
41         TRACE("()\n");
42
43         AVIFILE_data.dwAVIFileRef = 0;
44         AVIFILE_data.dwClassObjRef = 0;
45         AVIFILE_data.hHeap = (HANDLE)NULL;
46
47         AVIFILE_data.hHeap = HeapCreate( 0, 0x10000, 0 );
48         if ( AVIFILE_data.hHeap  == (HANDLE)NULL )
49         {
50                 ERR( "cannot allocate heap for AVIFILE.\n" );
51                 return FALSE;
52         }
53
54         return TRUE;
55 }
56
57 /***********************************************************************
58  *              AVIFILE_UninitProcess (internal)
59  */
60 static void AVIFILE_UninitProcess( void )
61 {
62         TRACE("()\n");
63
64         if ( AVIFILE_data.dwAVIFileRef != 0 )
65                 ERR( "you must call AVIFileExit()\n" );
66
67         if ( AVIFILE_data.dwClassObjRef != 0 )
68                 ERR( "you must release some objects allocated from AVIFile.\n" );
69
70         if ( AVIFILE_data.hHeap != (HANDLE)NULL )
71         {
72                 HeapDestroy( AVIFILE_data.hHeap );
73                 AVIFILE_data.hHeap = (HANDLE)NULL;
74         }
75 }
76
77 /***********************************************************************
78  *              AVIFILE_DllMain
79  */
80 BOOL WINAPI AVIFILE_DllMain(
81         HINSTANCE hInstDLL,
82         DWORD fdwReason,
83         LPVOID lpvReserved )
84 {
85         switch ( fdwReason )
86         {
87         case DLL_PROCESS_ATTACH:
88                 if ( !AVIFILE_InitProcess() )
89                         return FALSE;
90                 break;
91         case DLL_PROCESS_DETACH:
92                 AVIFILE_UninitProcess();
93                 break;
94         case DLL_THREAD_ATTACH:
95                 break;
96         case DLL_THREAD_DETACH:
97                 break;
98         }
99
100         return TRUE;
101 }
102
103