Mercurial > mplayer.hg
annotate loader/module.c @ 6768:4b0dd1ff6a20
Warnings fix by Sylvain Petreolle <spetreolle@yahoo.fr>, fixed by me.
author | atmos4 |
---|---|
date | Tue, 23 Jul 2002 12:03:05 +0000 |
parents | 523014df7d32 |
children | 174e2a58b4cd |
rev | line source |
---|---|
1 | 1 /* |
2 * Modules | |
3 * | |
4 * Copyright 1995 Alexandre Julliard | |
5 */ | |
3465 | 6 #include "config.h" |
1 | 7 |
8 #include <assert.h> | |
9 #include <errno.h> | |
10 #include <fcntl.h> | |
11 #include <stdio.h> | |
12 #include <stdlib.h> | |
13 #include <string.h> | |
14 #include <unistd.h> | |
15 #include <sys/mman.h> | |
16 #include <sys/types.h> | |
17 | |
18 | |
19 #include <wine/windef.h> | |
20 #include <wine/winerror.h> | |
21 #include <wine/heap.h> | |
22 #include <wine/module.h> | |
23 #include <wine/pe_image.h> | |
24 #include <wine/debugtools.h> | |
2069 | 25 #ifdef HAVE_LIBDL |
26 #include <dlfcn.h> | |
27 #include <wine/elfdll.h> | |
28 #endif | |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
128
diff
changeset
|
29 #include "win32.h" |
6768
4b0dd1ff6a20
Warnings fix by Sylvain Petreolle <spetreolle@yahoo.fr>, fixed by me.
atmos4
parents:
6138
diff
changeset
|
30 #include "module.h" |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
31 //#include "driver.h" |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
32 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
33 //#undef TRACE |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
34 //#define TRACE printf |
1 | 35 |
36 struct modref_list_t; | |
37 | |
38 typedef struct modref_list_t | |
39 { | |
40 WINE_MODREF* wm; | |
41 struct modref_list_t *next; | |
2069 | 42 struct modref_list_t *prev; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
43 } modref_list; |
1 | 44 |
45 //WINE_MODREF *local_wm=NULL; | |
46 modref_list* local_wm=NULL; | |
47 | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
48 HANDLE SegptrHeap; |
2069 | 49 |
3465 | 50 WINE_MODREF* MODULE_FindModule(LPCSTR m) |
1 | 51 { |
52 modref_list* list=local_wm; | |
53 TRACE("Module %s request\n", m); | |
54 if(list==NULL) | |
55 return NULL; | |
56 while(strcmp(m, list->wm->filename)) | |
57 { | |
128 | 58 TRACE("%s: %x\n", list->wm->filename, list->wm->module); |
1 | 59 list=list->prev; |
60 if(list==NULL) | |
61 return NULL; | |
2069 | 62 } |
1 | 63 TRACE("Resolved to %s\n", list->wm->filename); |
64 return list->wm; | |
2069 | 65 } |
1 | 66 |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
128
diff
changeset
|
67 static void MODULE_RemoveFromList(WINE_MODREF *mod) |
1 | 68 { |
69 modref_list* list=local_wm; | |
70 if(list==0) | |
71 return; | |
72 if(mod==0) | |
73 return; | |
74 if((list->prev==NULL)&&(list->next==NULL)) | |
75 { | |
76 free(list); | |
77 local_wm=NULL; | |
78 // uninstall_fs(); | |
79 return; | |
80 } | |
81 for(;list;list=list->prev) | |
82 { | |
83 if(list->wm==mod) | |
84 { | |
85 if(list->prev) | |
86 list->prev->next=list->next; | |
87 if(list->next) | |
88 list->next->prev=list->prev; | |
89 if(list==local_wm) | |
90 local_wm=list->prev; | |
91 free(list); | |
92 return; | |
93 } | |
94 } | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
95 |
2069 | 96 } |
97 | |
1 | 98 WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m) |
99 { | |
100 modref_list* list=local_wm; | |
101 TRACE("Module %X request\n", m); | |
102 if(list==NULL) | |
103 return NULL; | |
104 while(m!=list->wm->module) | |
105 { | |
106 // printf("Checking list %X wm %X module %X\n", | |
107 // list, list->wm, list->wm->module); | |
108 list=list->prev; | |
109 if(list==NULL) | |
110 return NULL; | |
2069 | 111 } |
112 TRACE("LookupHMODULE hit %p\n", list->wm); | |
1 | 113 return list->wm; |
2069 | 114 } |
1 | 115 |
116 /************************************************************************* | |
117 * MODULE_InitDll | |
118 */ | |
119 static WIN_BOOL MODULE_InitDll( WINE_MODREF *wm, DWORD type, LPVOID lpReserved ) | |
120 { | |
121 WIN_BOOL retv = TRUE; | |
122 | |
2069 | 123 static LPCSTR typeName[] = { "PROCESS_DETACH", "PROCESS_ATTACH", |
1 | 124 "THREAD_ATTACH", "THREAD_DETACH" }; |
125 assert( wm ); | |
126 | |
127 | |
128 /* Skip calls for modules loaded with special load flags */ | |
129 | |
130 if ( ( wm->flags & WINE_MODREF_DONT_RESOLVE_REFS ) | |
131 || ( wm->flags & WINE_MODREF_LOAD_AS_DATAFILE ) ) | |
132 return TRUE; | |
133 | |
134 | |
135 TRACE("(%s,%s,%p) - CALL\n", wm->modname, typeName[type], lpReserved ); | |
136 | |
137 /* Call the initialization routine */ | |
138 switch ( wm->type ) | |
139 { | |
140 case MODULE32_PE: | |
141 retv = PE_InitDLL( wm, type, lpReserved ); | |
142 break; | |
143 | |
144 case MODULE32_ELF: | |
145 /* no need to do that, dlopen() already does */ | |
146 break; | |
147 | |
148 default: | |
149 ERR("wine_modref type %d not handled.\n", wm->type ); | |
150 retv = FALSE; | |
151 break; | |
152 } | |
153 | |
154 /* The state of the module list may have changed due to the call | |
155 to PE_InitDLL. We cannot assume that this module has not been | |
156 deleted. */ | |
157 TRACE("(%p,%s,%p) - RETURN %d\n", wm, typeName[type], lpReserved, retv ); | |
158 | |
159 return retv; | |
160 } | |
161 | |
162 /************************************************************************* | |
163 * MODULE_DllProcessAttach | |
2069 | 164 * |
1 | 165 * Send the process attach notification to all DLLs the given module |
166 * depends on (recursively). This is somewhat complicated due to the fact that | |
167 * | |
168 * - we have to respect the module dependencies, i.e. modules implicitly | |
169 * referenced by another module have to be initialized before the module | |
170 * itself can be initialized | |
2069 | 171 * |
1 | 172 * - the initialization routine of a DLL can itself call LoadLibrary, |
173 * thereby introducing a whole new set of dependencies (even involving | |
174 * the 'old' modules) at any time during the whole process | |
175 * | |
176 * (Note that this routine can be recursively entered not only directly | |
177 * from itself, but also via LoadLibrary from one of the called initialization | |
178 * routines.) | |
179 * | |
180 * Furthermore, we need to rearrange the main WINE_MODREF list to allow | |
181 * the process *detach* notifications to be sent in the correct order. | |
2069 | 182 * This must not only take into account module dependencies, but also |
1 | 183 * 'hidden' dependencies created by modules calling LoadLibrary in their |
184 * attach notification routine. | |
185 * | |
186 * The strategy is rather simple: we move a WINE_MODREF to the head of the | |
187 * list after the attach notification has returned. This implies that the | |
188 * detach notifications are called in the reverse of the sequence the attach | |
189 * notifications *returned*. | |
190 * | |
191 * NOTE: Assumes that the process critical section is held! | |
192 * | |
193 */ | |
3465 | 194 static WIN_BOOL MODULE_DllProcessAttach( WINE_MODREF *wm, LPVOID lpReserved ) |
1 | 195 { |
196 WIN_BOOL retv = TRUE; | |
197 int i; | |
198 assert( wm ); | |
199 | |
200 /* prevent infinite recursion in case of cyclical dependencies */ | |
201 if ( ( wm->flags & WINE_MODREF_MARKER ) | |
202 || ( wm->flags & WINE_MODREF_PROCESS_ATTACHED ) ) | |
203 return retv; | |
204 | |
205 TRACE("(%s,%p) - START\n", wm->modname, lpReserved ); | |
206 | |
207 /* Tag current MODREF to prevent recursive loop */ | |
208 wm->flags |= WINE_MODREF_MARKER; | |
209 | |
210 /* Recursively attach all DLLs this one depends on */ | |
211 /* for ( i = 0; retv && i < wm->nDeps; i++ ) | |
212 if ( wm->deps[i] ) | |
213 retv = MODULE_DllProcessAttach( wm->deps[i], lpReserved ); | |
214 */ | |
215 /* Call DLL entry point */ | |
216 | |
217 //local_wm=wm; | |
218 if(local_wm) | |
219 { | |
220 local_wm->next=malloc(sizeof(modref_list)); | |
221 local_wm->next->prev=local_wm; | |
222 local_wm->next->next=NULL; | |
223 local_wm->next->wm=wm; | |
224 local_wm=local_wm->next; | |
225 } | |
226 else | |
227 { | |
228 local_wm=malloc(sizeof(modref_list)); | |
229 local_wm->next=local_wm->prev=NULL; | |
230 local_wm->wm=wm; | |
2069 | 231 } |
1 | 232 /* Remove recursion flag */ |
233 wm->flags &= ~WINE_MODREF_MARKER; | |
2069 | 234 |
1 | 235 if ( retv ) |
236 { | |
237 retv = MODULE_InitDll( wm, DLL_PROCESS_ATTACH, lpReserved ); | |
238 if ( retv ) | |
239 wm->flags |= WINE_MODREF_PROCESS_ATTACHED; | |
240 } | |
241 | |
242 | |
243 TRACE("(%s,%p) - END\n", wm->modname, lpReserved ); | |
244 | |
245 return retv; | |
246 } | |
247 | |
248 /************************************************************************* | |
249 * MODULE_DllProcessDetach | |
2069 | 250 * |
251 * Send DLL process detach notifications. See the comment about calling | |
1 | 252 * sequence at MODULE_DllProcessAttach. Unless the bForceDetach flag |
253 * is set, only DLLs with zero refcount are notified. | |
254 */ | |
3465 | 255 static void MODULE_DllProcessDetach( WINE_MODREF* wm, WIN_BOOL bForceDetach, LPVOID lpReserved ) |
1 | 256 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
257 // WINE_MODREF *wm=local_wm; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
258 modref_list* l = local_wm; |
1 | 259 wm->flags &= ~WINE_MODREF_PROCESS_ATTACHED; |
260 MODULE_InitDll( wm, DLL_PROCESS_DETACH, lpReserved ); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
261 /* while (l) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
262 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
263 modref_list* f = l; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
264 l = l->next; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
265 free(f); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
266 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
267 local_wm = 0;*/ |
1 | 268 } |
269 | |
3465 | 270 /*********************************************************************** |
271 * MODULE_LoadLibraryExA (internal) | |
272 * | |
273 * Load a PE style module according to the load order. | |
274 * | |
275 * The HFILE parameter is not used and marked reserved in the SDK. I can | |
276 * only guess that it should force a file to be mapped, but I rather | |
277 * ignore the parameter because it would be extremely difficult to | |
278 * integrate this with different types of module represenations. | |
279 * | |
280 */ | |
281 static WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD flags ) | |
282 { | |
283 DWORD err = GetLastError(); | |
284 WINE_MODREF *pwm; | |
285 int i; | |
286 // module_loadorder_t *plo; | |
287 | |
288 SetLastError( ERROR_FILE_NOT_FOUND ); | |
289 TRACE("Trying native dll '%s'\n", libname); | |
290 pwm = PE_LoadLibraryExA(libname, flags); | |
291 #ifdef HAVE_LIBDL | |
292 if(!pwm) | |
293 { | |
294 TRACE("Trying ELF dll '%s'\n", libname); | |
295 pwm=(WINE_MODREF*)ELFDLL_LoadLibraryExA(libname, flags); | |
296 } | |
297 #endif | |
298 // printf("0x%08x\n", pwm); | |
299 // break; | |
300 if(pwm) | |
301 { | |
302 /* Initialize DLL just loaded */ | |
303 TRACE("Loaded module '%s' at 0x%08x, \n", libname, pwm->module); | |
304 /* Set the refCount here so that an attach failure will */ | |
305 /* decrement the dependencies through the MODULE_FreeLibrary call. */ | |
306 pwm->refCount++; | |
307 | |
308 SetLastError( err ); /* restore last error */ | |
309 return pwm; | |
310 } | |
311 | |
312 | |
313 WARN("Failed to load module '%s'; error=0x%08lx, \n", libname, GetLastError()); | |
314 return NULL; | |
315 } | |
316 | |
317 /*********************************************************************** | |
318 * MODULE_FreeLibrary | |
319 * | |
320 * NOTE: Assumes that the process critical section is held! | |
321 */ | |
322 static WIN_BOOL MODULE_FreeLibrary( WINE_MODREF *wm ) | |
323 { | |
324 TRACE("(%s) - START\n", wm->modname ); | |
325 | |
326 /* Recursively decrement reference counts */ | |
327 //MODULE_DecRefCount( wm ); | |
328 | |
329 /* Call process detach notifications */ | |
330 MODULE_DllProcessDetach( wm, FALSE, NULL ); | |
331 | |
332 PE_UnloadLibrary(wm); | |
333 | |
334 TRACE("END\n"); | |
335 | |
336 return TRUE; | |
337 } | |
1 | 338 |
339 /*********************************************************************** | |
340 * LoadLibraryExA (KERNEL32) | |
341 */ | |
342 HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) | |
343 { | |
2069 | 344 WINE_MODREF *wm = 0; |
345 char* listpath[] = { "", "", "/usr/lib/win32", "/usr/local/lib/win32", 0 }; | |
346 extern char* def_path; | |
347 char path[512]; | |
348 char checked[2000]; | |
349 int i = -1; | |
1 | 350 |
2069 | 351 checked[0] = 0; |
1 | 352 if(!libname) |
353 { | |
354 SetLastError(ERROR_INVALID_PARAMETER); | |
355 return 0; | |
356 } | |
2069 | 357 printf("Loading DLL: '%s'\n", libname); |
3465 | 358 // if(fs_installed==0) |
359 // install_fs(); | |
2069 | 360 |
361 while (wm == 0 && listpath[++i]) | |
362 { | |
363 if (i < 2) | |
364 { | |
365 if (i == 0) | |
366 /* check just original file name */ | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
367 strncpy(path, libname, 511); |
2069 | 368 else |
369 /* check default user path */ | |
370 strncpy(path, def_path, 300); | |
371 } | |
372 else if (strcmp(def_path, listpath[i])) | |
373 /* path from the list */ | |
374 strncpy(path, listpath[i], 300); | |
375 else | |
376 continue; | |
1 | 377 |
2069 | 378 if (i > 0) |
379 { | |
380 strcat(path, "/"); | |
381 strncat(path, libname, 100); | |
382 } | |
383 path[511] = 0; | |
384 wm = MODULE_LoadLibraryExA( path, hfile, flags ); | |
385 | |
386 if (!wm) | |
387 { | |
388 if (checked[0]) | |
389 strcat(checked, ", "); | |
390 strcat(checked, path); | |
391 checked[1500] = 0; | |
392 | |
393 } | |
394 } | |
1 | 395 if ( wm ) |
396 { | |
397 if ( !MODULE_DllProcessAttach( wm, NULL ) ) | |
398 { | |
399 WARN_(module)("Attach failed for module '%s', \n", libname); | |
400 MODULE_FreeLibrary(wm); | |
401 SetLastError(ERROR_DLL_INIT_FAILED); | |
402 MODULE_RemoveFromList(wm); | |
403 wm = NULL; | |
404 } | |
405 } | |
406 | |
2069 | 407 if (!wm) |
408 printf("Win32 LoadLibrary failed to load: %s\n", checked); | |
5768 | 409 else |
410 { | |
411 extern char *win32_codec_name; | |
6138
523014df7d32
big cosmetics patch, cleanup of messages printed by mplayer and libs.
arpi
parents:
5768
diff
changeset
|
412 // printf("Loaded %s to address %p\n", libname, wm->module); |
5768 | 413 /* XXX: FIXME, _VERY_ UGLY HACK */ |
414 if (!strcmp(libname, "m3jpegdec.ax")) | |
415 win32_codec_name = strdup("m3jpeg32.dll"); | |
416 } | |
2069 | 417 |
1 | 418 return wm ? wm->module : 0; |
419 } | |
420 | |
421 | |
422 /*********************************************************************** | |
423 * LoadLibraryA (KERNEL32) | |
424 */ | |
425 HMODULE WINAPI LoadLibraryA(LPCSTR libname) { | |
426 return LoadLibraryExA(libname,0,0); | |
427 } | |
428 | |
429 /*********************************************************************** | |
430 * FreeLibrary | |
431 */ | |
432 WIN_BOOL WINAPI FreeLibrary(HINSTANCE hLibModule) | |
433 { | |
434 WIN_BOOL retv = FALSE; | |
435 WINE_MODREF *wm; | |
436 | |
437 wm=MODULE32_LookupHMODULE(hLibModule); | |
438 | |
439 if ( !wm || !hLibModule ) | |
440 { | |
441 SetLastError( ERROR_INVALID_HANDLE ); | |
442 return 0; | |
2069 | 443 } |
1 | 444 else |
445 retv = MODULE_FreeLibrary( wm ); | |
2069 | 446 |
1 | 447 MODULE_RemoveFromList(wm); |
448 | |
128 | 449 /* garbage... */ |
450 if (local_wm == NULL) my_garbagecollection(); | |
451 | |
1 | 452 return retv; |
453 } | |
454 | |
455 /*********************************************************************** | |
456 * MODULE_DecRefCount | |
457 * | |
458 * NOTE: Assumes that the process critical section is held! | |
459 */ | |
460 static void MODULE_DecRefCount( WINE_MODREF *wm ) | |
461 { | |
462 int i; | |
463 | |
464 if ( wm->flags & WINE_MODREF_MARKER ) | |
465 return; | |
466 | |
467 if ( wm->refCount <= 0 ) | |
468 return; | |
469 | |
470 --wm->refCount; | |
471 TRACE("(%s) refCount: %d\n", wm->modname, wm->refCount ); | |
472 | |
473 if ( wm->refCount == 0 ) | |
474 { | |
475 wm->flags |= WINE_MODREF_MARKER; | |
476 | |
477 for ( i = 0; i < wm->nDeps; i++ ) | |
478 if ( wm->deps[i] ) | |
479 MODULE_DecRefCount( wm->deps[i] ); | |
480 | |
481 wm->flags &= ~WINE_MODREF_MARKER; | |
482 } | |
483 } | |
484 | |
485 /*********************************************************************** | |
486 * GetProcAddress (KERNEL32.257) | |
487 */ | |
488 FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function ) | |
489 { | |
490 return MODULE_GetProcAddress( hModule, function, TRUE ); | |
491 } | |
492 | |
493 /*********************************************************************** | |
494 * MODULE_GetProcAddress (internal) | |
495 */ | |
2069 | 496 FARPROC MODULE_GetProcAddress( |
1 | 497 HMODULE hModule, /* [in] current module handle */ |
498 LPCSTR function, /* [in] function to be looked up */ | |
499 WIN_BOOL snoop ) | |
500 { | |
501 WINE_MODREF *wm = MODULE32_LookupHMODULE( hModule ); | |
2069 | 502 // WINE_MODREF *wm=local_wm; |
1 | 503 FARPROC retproc; |
504 | |
505 if (HIWORD(function)) | |
506 TRACE_(win32)("(%08lx,%s)\n",(DWORD)hModule,function); | |
507 else | |
508 TRACE_(win32)("(%08lx,%p)\n",(DWORD)hModule,function); | |
509 if (!wm) { | |
510 SetLastError(ERROR_INVALID_HANDLE); | |
511 return (FARPROC)0; | |
512 } | |
513 switch (wm->type) | |
514 { | |
515 case MODULE32_PE: | |
516 retproc = PE_FindExportedFunction( wm, function, snoop ); | |
517 if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); | |
518 return retproc; | |
2069 | 519 #ifdef HAVE_LIBDL |
1 | 520 case MODULE32_ELF: |
2069 | 521 retproc = (FARPROC) dlsym( (void*) wm->module, function); |
1 | 522 if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND); |
523 return retproc; | |
524 #endif | |
525 default: | |
526 ERR("wine_modref type %d not handled.\n",wm->type); | |
527 SetLastError(ERROR_INVALID_HANDLE); | |
528 return (FARPROC)0; | |
529 } | |
530 } | |
531 | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
532 static int acounter = 0; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
533 void CodecAlloc(void) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
534 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
535 acounter++; |
3465 | 536 //printf("**************CODEC ALLOC %d\n", acounter); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
537 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
538 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
539 void CodecRelease(void) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
540 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
541 acounter--; |
3465 | 542 //printf("**************CODEC RELEASE %d\n", acounter); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
543 if (acounter == 0) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
544 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
545 for (;;) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
546 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
547 modref_list* list = local_wm; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
548 if (!local_wm) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
549 break; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
550 //printf("CODECRELEASE %p\n", list); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
551 MODULE_FreeLibrary(list->wm); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
552 MODULE_RemoveFromList(list->wm); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
553 if (local_wm == NULL) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
554 my_garbagecollection(); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
555 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
556 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2069
diff
changeset
|
557 } |