annotate loader/ext.c @ 9100:971ed787054f

fixed ./configure --cc="ccache gcc"
author arpi
date Sun, 26 Jan 2003 15:42:11 +0000
parents 174e2a58b4cd
children 2571b2e0c0b4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /********************************************************
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
2 *
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 * Stub functions for Wine module
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 ********************************************************/
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
8 #include "config.h"
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
9 #include <stdio.h>
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
10 #include <stdlib.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 #ifdef HAVE_MALLOC_H
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 #include <malloc.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 #include <sys/mman.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 #include <errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 #include <stdarg.h>
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
20 #include <ctype.h>
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
21
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
22 #include "wine/windef.h"
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
23 #include "wine/winbase.h"
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
24 #include "wine/debugtools.h"
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
25 #include "wine/heap.h"
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
26 #include "ext.h"
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
27
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
28 #if 0
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
29 //REMOVE SIMPLIFY
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
30 static void* mymalloc(unsigned int size)
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
31 {
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
32 printf("malloc %d\n", size);
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
33 return malloc(size);
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
34 }
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
35
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
36 #undef malloc
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
37 #define malloc mymalloc
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
38 #endif
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
39
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 int dbg_header_err( const char *dbg_channel, const char *func )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 {
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
42 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 int dbg_header_warn( const char *dbg_channel, const char *func )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 {
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
46 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 int dbg_header_fixme( const char *dbg_channel, const char *func )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 {
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
50 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 int dbg_header_trace( const char *dbg_channel, const char *func )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 {
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
54 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
56 int dbg_vprintf( const char *format, va_list args )
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 {
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
58 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 int __vprintf( const char *format, ... )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 #ifdef DETAILED_OUT
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 va_list va;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 va_start(va, format);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 vprintf(format, va);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 va_end(va);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 #endif
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
68 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 }
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
70
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
71 HANDLE WINAPI GetProcessHeap(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
76 LPVOID WINAPI HeapAlloc(HANDLE heap, DWORD flags, DWORD size)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 {
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
78 static int i = 5;
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
79 void* m = (flags & 0x8) ? calloc(size, 1) : malloc(size);
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
80 //printf("HeapAlloc %p %d (%d)\n", m, size, flags);
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
81 //if (--i == 0)
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
82 // abort();
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
83 return m;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
86 WIN_BOOL WINAPI HeapFree(HANDLE heap, DWORD flags, LPVOID mem)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
88 if (mem) free(mem);
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
89 //printf("HeapFree %p\n", mem);
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
90 //if (!mem)
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
91 // abort();
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 return 1;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
93 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 static int last_error;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
97 DWORD WINAPI GetLastError(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 return last_error;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
102 VOID WINAPI SetLastError(DWORD error)
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
103 {
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
104 last_error=error;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
105 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
107 WIN_BOOL WINAPI ReadFile(HANDLE handle, LPVOID mem, DWORD size, LPDWORD result, LPOVERLAPPED flags)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 *result=read(handle, mem, size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 return *result;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
111 }
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
112 INT WINAPI lstrcmpiA(LPCSTR c1, LPCSTR c2)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 return strcasecmp(c1,c2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
116 LPSTR WINAPI lstrcpynA(LPSTR dest, LPCSTR src, INT num)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 {
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
118 return strncpy(dest,src,num);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 }
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
120 INT WINAPI lstrlenA(LPCSTR s)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 return strlen(s);
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
123 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
124 INT WINAPI lstrlenW(LPCWSTR s)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 int l;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 if(!s)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 l=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 while(s[l])
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 l++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 return l;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
134 LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135 {
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
136 LPSTR result = dest;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 int moved=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 if((dest==0) || (src==0))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 while(moved<count)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 *dest=*src;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 moved++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 if(*src==0)
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
145 break;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 src++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 dest++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 }
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
149 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 }
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
151 /* i stands here for ignore case! */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 {
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
154 /*
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 if(s1==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 if(s2==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 return;
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
159 */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 while(n>0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 {
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
162 if (((*s1 | *s2) & 0xff00) || toupper((char)*s1) != toupper((char)*s2))
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
163 {
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
164
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
165 if(*s1<*s2)
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
166 return -1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 else
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
168 if(*s1>*s2)
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
169 return 1;
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
170 else
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
171 if(*s1==0)
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
172 return 0;
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
173 }
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
174 s1++;
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
175 s2++;
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3134
diff changeset
176 n--;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 return 0;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
179 }
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
180
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
181 WIN_BOOL WINAPI IsBadReadPtr(LPCVOID data, UINT size)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 if(size==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 if(data==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 return 0;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
188 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
189 LPSTR HEAP_strdupA(HANDLE heap, DWORD flags, LPCSTR string)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 // return strdup(string);
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
192 char* answ = (char*) malloc(strlen(string) + 1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 strcpy(answ, string);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 return answ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
196 LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 int size, i;
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
199 WCHAR* answer;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 if(string==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 size=strlen(string);
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
203 answer = (WCHAR*) malloc(sizeof(WCHAR) * (size + 1));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 for(i=0; i<=size; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 answer[i]=(short)string[i];
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
206 return answer;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
208 LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 int size, i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 char* answer;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 if(string==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 size=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 while(string[size])
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 size++;
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
217 answer = (char*) malloc(size + 2);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 for(i=0; i<=size; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 answer[i]=(char)string[i];
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
220 return answer;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 /***********************************************************************
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 * FILE_dommap
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 //#define MAP_PRIVATE
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 //#define MAP_SHARED
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 #undef MAP_ANON
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 LPVOID FILE_dommap( int unix_handle, LPVOID start,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 DWORD size_high, DWORD size_low,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 DWORD offset_high, DWORD offset_low,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 int prot, int flags )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 int fd = -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 int pos;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 LPVOID ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 if (size_high || offset_high)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 printf("offsets larger than 4Gb not supported\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 if (unix_handle == -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 #ifdef MAP_ANON
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 // printf("Anonymous\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 flags |= MAP_ANON;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 static int fdzero = -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 if (fdzero == -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 if ((fdzero = open( "/dev/zero", O_RDONLY )) == -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 {
3775
aa1491f8167b /dev/zero bad permissions error message
arpi
parents: 3465
diff changeset
254 perror( "Cannot open /dev/zero for READ. Check permissions! error: " );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 exit(1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 fd = fdzero;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 #endif /* MAP_ANON */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 /* Linux EINVAL's on us if we don't pass MAP_PRIVATE to an anon mmap */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 #ifdef MAP_SHARED
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 flags &= ~MAP_SHARED;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 #ifdef MAP_PRIVATE
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 flags |= MAP_PRIVATE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 else fd = unix_handle;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 // printf("fd %x, start %x, size %x, pos %x, prot %x\n",fd,start,size_low, offset_low, prot);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 // if ((ret = mmap( start, size_low, prot,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 // flags, fd, offset_low )) != (LPVOID)-1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 if ((ret = mmap( start, size_low, prot,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 MAP_PRIVATE | MAP_FIXED, fd, offset_low )) != (LPVOID)-1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 // printf("address %08x\n", *(int*)ret);
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
276 // printf("%x\n", ret);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277 return ret;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
278 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 // printf("mmap %d\n", errno);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282 /* mmap() failed; if this is because the file offset is not */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 /* page-aligned (EINVAL), or because the underlying filesystem */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 /* does not support mmap() (ENOEXEC), we do it by hand. */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 if (unix_handle == -1) return ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 if ((errno != ENOEXEC) && (errno != EINVAL)) return ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 if (prot & PROT_WRITE)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 /* We cannot fake shared write mappings */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 #ifdef MAP_SHARED
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 if (flags & MAP_SHARED) return ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 #ifdef MAP_PRIVATE
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 if (!(flags & MAP_PRIVATE)) return ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 /* printf( "FILE_mmap: mmap failed (%d), faking it\n", errno );*/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 /* Reserve the memory with an anonymous mmap */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 ret = FILE_dommap( -1, start, size_high, size_low, 0, 0,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 PROT_READ | PROT_WRITE, flags );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 if (ret == (LPVOID)-1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303 // {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 // perror(
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305 return ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 /* Now read in the file */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 if ((pos = lseek( fd, offset_low, SEEK_SET )) == -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 FILE_munmap( ret, size_high, size_low );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310 // printf("lseek\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 return (LPVOID)-1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 read( fd, ret, size_low );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 lseek( fd, pos, SEEK_SET ); /* Restore the file pointer */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 mprotect( ret, size_low, prot ); /* Set the right protection */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 // printf("address %08x\n", *(int*)ret);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317 return ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 /***********************************************************************
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 * FILE_munmap
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 if (size_high)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 printf("offsets larger than 4Gb not supported\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 return munmap( start, size_low );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 static int mapping_size=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 struct file_mapping_s;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 typedef struct file_mapping_s
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 int mapping_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 char* name;
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
337 LPVOID handle;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338 struct file_mapping_s* next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 struct file_mapping_s* prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 }file_mapping;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 static file_mapping* fm=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345 #define PAGE_NOACCESS 0x01
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 #define PAGE_READONLY 0x02
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 #define PAGE_READWRITE 0x04
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348 #define PAGE_WRITECOPY 0x08
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349 #define PAGE_EXECUTE 0x10
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 #define PAGE_EXECUTE_READ 0x20
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 #define PAGE_EXECUTE_READWRITE 0x40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 #define PAGE_EXECUTE_WRITECOPY 0x80
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353 #define PAGE_GUARD 0x100
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 #define PAGE_NOCACHE 0x200
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
356 HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
357 DWORD flProtect,
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
358 DWORD dwMaxHigh, DWORD dwMaxLow,
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
359 LPCSTR name)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360 {
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
361 int hFile = (int)handle;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362 unsigned int len;
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
363 LPVOID answer;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 int anon=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 int mmap_access=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
366 if(hFile<0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368 anon=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 hFile=open("/dev/zero", O_RDWR);
3775
aa1491f8167b /dev/zero bad permissions error message
arpi
parents: 3465
diff changeset
370 if(hFile<0){
aa1491f8167b /dev/zero bad permissions error message
arpi
parents: 3465
diff changeset
371 perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: " );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 return 0;
3775
aa1491f8167b /dev/zero bad permissions error message
arpi
parents: 3465
diff changeset
373 }
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
374 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 if(!anon)
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
376 {
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 len=lseek(hFile, 0, SEEK_END);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 lseek(hFile, 0, SEEK_SET);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380 else len=dwMaxLow;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 if(flProtect & PAGE_READONLY)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 mmap_access |=PROT_READ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 mmap_access |=PROT_READ|PROT_WRITE;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
386
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
387 answer=mmap(NULL, len, mmap_access, MAP_PRIVATE, hFile, 0);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 if(anon)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389 close(hFile);
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
390 if(answer!=(LPVOID)-1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 if(fm==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
394 fm = (file_mapping*) malloc(sizeof(file_mapping));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 fm->prev=NULL;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
396 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
399 fm->next = (file_mapping*) malloc(sizeof(file_mapping));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400 fm->next->prev=fm;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401 fm=fm->next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 }
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
403 fm->next=NULL;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
404 fm->handle=answer;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 if(name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
407 fm->name = (char*) malloc(strlen(name)+1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 strcpy(fm->name, name);
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
409 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411 fm->name=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412 fm->mapping_size=len;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
413
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414 if(anon)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415 close(hFile);
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
416 return (HANDLE)answer;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418 return (HANDLE)0;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
419 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
420 WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422 file_mapping* p;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 int result;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424 if(fm==0)
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
425 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426 for(p=fm; p; p=p->next)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427 {
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
428 if(p->handle==handle)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 result=munmap((void*)handle, p->mapping_size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431 if(p->next)p->next->prev=p->prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432 if(p->prev)p->prev->next=p->next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
433 if(p->name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
434 free(p->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
435 if(p==fm)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
436 fm=p->prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
437 free(p);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
438 return result;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
439 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
440 }
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
441 return 0;
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
442 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
443 //static int va_size=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
444 struct virt_alloc_s;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445 typedef struct virt_alloc_s
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
446 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447 int mapping_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
448 char* address;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449 struct virt_alloc_s* next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450 struct virt_alloc_s* prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451 int state;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452 }virt_alloc;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 static virt_alloc* vm=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
454 #define MEM_COMMIT 0x00001000
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455 #define MEM_RESERVE 0x00002000
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
457 LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protection)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
458 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459 void* answer;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
460 int fd=open("/dev/zero", O_RDWR);
3775
aa1491f8167b /dev/zero bad permissions error message
arpi
parents: 3465
diff changeset
461 if(fd<0){
aa1491f8167b /dev/zero bad permissions error message
arpi
parents: 3465
diff changeset
462 perror( "Cannot open /dev/zero for READ+WRITE. Check permissions! error: " );
aa1491f8167b /dev/zero bad permissions error message
arpi
parents: 3465
diff changeset
463 return NULL;
aa1491f8167b /dev/zero bad permissions error message
arpi
parents: 3465
diff changeset
464 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
465 size=(size+0xffff)&(~0xffff);
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
466 //printf("VirtualAlloc(0x%08X, %d)\n", address, size);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
467 if(address!=0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
468 {
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
469 //check whether we can allow to allocate this
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470 virt_alloc* str=vm;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
471 while(str)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
472 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
473 if((unsigned)address>=(unsigned)str->address+str->mapping_size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
474 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
475 str=str->prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
476 continue;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
477 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
478 if((unsigned)address+size<(unsigned)str->address)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
479 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
480 str=str->prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
481 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
482 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
483 if(str->state==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
484 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
485 #warning FIXME
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
486 if(((unsigned)address+size<(unsigned)str->address+str->mapping_size) && (type & MEM_COMMIT))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
487 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
488 close(fd);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
489 return address; //returning previously reserved memory
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
490 }
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
491 return NULL;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
492 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
493 close(fd);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
494 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
495 }
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
496 answer=mmap(address, size, PROT_READ | PROT_WRITE | PROT_EXEC,
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
497 MAP_FIXED | MAP_PRIVATE, fd, 0);
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
498 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
499 else
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
500 answer=mmap(address, size, PROT_READ | PROT_WRITE | PROT_EXEC,
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
501 MAP_PRIVATE, fd, 0);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
502 // answer=FILE_dommap(-1, address, 0, size, 0, 0,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
503 // PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE);
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
504 close(fd);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
505 if(answer==(void*)-1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
506 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
507 printf("Error no %d\n", errno);
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
508 printf("VirtualAlloc(0x%p, %ld) failed\n", address, size);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
509 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
510 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
511 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
512 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
513 virt_alloc *new_vm = (virt_alloc*) malloc(sizeof(virt_alloc));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
514 new_vm->mapping_size=size;
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3775
diff changeset
515 new_vm->address=(char*)answer;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
516 new_vm->prev=vm;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
517 if(type == MEM_RESERVE)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
518 new_vm->state=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
519 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
520 new_vm->state=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
521 if(vm)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
522 vm->next=new_vm;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
523 vm=new_vm;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
524 vm->next=0;
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
525 //if(va_size!=0)
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
526 // printf("Multiple VirtualAlloc!\n");
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
527 //printf("answer=0x%08x\n", answer);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
528 return answer;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
529 }
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
530 }
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
531 WIN_BOOL WINAPI VirtualFree(LPVOID address, SIZE_T dwSize, DWORD dwFreeType)//not sure
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
532 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
533 virt_alloc* str=vm;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
534 int answer;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
535 while(str)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
536 {
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
537 if(address!=str->address)
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 str=str->prev;
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
540 continue;
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
541 }
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
542 //printf("VirtualFree(0x%08X, %d - %d)\n", str->address, dwSize, str->mapping_size);
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
543 answer=munmap(str->address, str->mapping_size);
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
544 if(str->next)str->next->prev=str->prev;
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
545 if(str->prev)str->prev->next=str->next;
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 2651
diff changeset
546 if(vm==str)vm=str->prev;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
547 free(str);
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
548 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
549 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
550 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
551 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
552
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
553 INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags, LPCWSTR src,
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
554 INT srclen,LPSTR dest, INT destlen, LPCSTR defch, WIN_BOOL* used_defch)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
555 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
556 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
557 if(src==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
558 return 0;
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
559 if ((srclen==-1)&&(dest==0)) return 0;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
560 if(srclen==-1){srclen=0; while(src[srclen++]);}
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
561 // for(i=0; i<srclen; i++)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
562 // printf("%c", src[i]);
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
563 // printf("\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
564 if(dest==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
565 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
566 for(i=0; i<srclen; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
567 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
568 src++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
569 if(*src==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
570 return i+1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
571 }
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
572 return srclen+1;
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
573 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
574 if(used_defch)
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
575 *used_defch=0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
576 for(i=0; i<min(srclen, destlen); i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
577 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
578 *dest=(char)*src;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
579 dest++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
580 src++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
581 if(*src==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
582 return i+1;
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
583 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
584 return min(srclen, destlen);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
585 }
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
586 INT WINAPI MultiByteToWideChar(UINT codepage,DWORD flags, LPCSTR src, INT srclen,
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
587 LPWSTR dest, INT destlen)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
588 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
589 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
590 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 128
diff changeset
591 HANDLE WINAPI OpenFileMappingA(DWORD access, WIN_BOOL prot, LPCSTR name)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
592 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
593 file_mapping* p;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
594 if(fm==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
595 return (HANDLE)0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
596 if(name==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
597 return (HANDLE)0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
598 for(p=fm; p; p=p->prev)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
599 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
600 if(p->name==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
601 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
602 if(strcmp(p->name, name)==0)
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1307
diff changeset
603 return (HANDLE)p->handle;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
604 }
2651
958d10763c34 partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents: 2069
diff changeset
605 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
606 }