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