Mercurial > mplayer.hg
annotate loader/win32.c @ 21461:71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
author | reimar |
---|---|
date | Sun, 03 Dec 2006 19:49:39 +0000 |
parents | 06a0a4dbf1a0 |
children | bd6a451d2588 |
rev | line source |
---|---|
1 | 1 /*********************************************************** |
2 | |
3465 | 3 Win32 emulation code. Functions that emulate |
4 responses from corresponding Win32 API calls. | |
5 Since we are not going to be able to load | |
6 virtually any DLL, we can only implement this | |
7 much, adding needed functions with each new codec. | |
8 | |
9 Basic principle of implementation: it's not good | |
10 for DLL to know too much about its environment. | |
1 | 11 |
12 ************************************************************/ | |
13 | |
15166
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
14212
diff
changeset
|
14 /* |
18783 | 15 * Modified for use with MPlayer, detailed changelog at |
16 * http://svn.mplayerhq.hu/mplayer/trunk/ | |
15166
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
14212
diff
changeset
|
17 * $Id$ |
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
14212
diff
changeset
|
18 */ |
f5537cc95b02
Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents:
14212
diff
changeset
|
19 |
2069 | 20 #include "config.h" |
21368 | 21 #include "mangle.h" |
1 | 22 |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
23 #ifdef MPLAYER |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
24 #ifdef USE_QTX_CODECS |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
25 #define QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
26 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
27 #define REALPLAYER |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
28 //#define LOADLIB_TRY_NATIVE |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
29 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
30 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
31 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
32 #define PSEUDO_SCREEN_WIDTH /*640*/800 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
33 #define PSEUDO_SCREEN_HEIGHT /*480*/600 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
34 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
35 |
2069 | 36 #include "wine/winbase.h" |
37 #include "wine/winreg.h" | |
38 #include "wine/winnt.h" | |
39 #include "wine/winerror.h" | |
40 #include "wine/debugtools.h" | |
41 #include "wine/module.h" | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
42 #include "wine/winuser.h" |
2139 | 43 |
44 #include <stdio.h> | |
1 | 45 #include "win32.h" |
2069 | 46 |
2139 | 47 #include "registry.h" |
48 #include "loader.h" | |
49 #include "com.h" | |
8451 | 50 #include "ext.h" |
2139 | 51 |
2069 | 52 #include <stdlib.h> |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
53 #include <assert.h> |
2139 | 54 #include <stdarg.h> |
2069 | 55 #include <ctype.h> |
1 | 56 #include <pthread.h> |
128 | 57 #include <errno.h> |
1 | 58 #ifdef HAVE_MALLOC_H |
59 #include <malloc.h> | |
60 #endif | |
61 #include <time.h> | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
62 #include <math.h> |
128 | 63 #include <unistd.h> |
64 #include <fcntl.h> | |
1 | 65 #include <sys/types.h> |
8391
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
66 #include <dirent.h> |
1 | 67 #include <sys/time.h> |
68 #include <sys/timeb.h> | |
2069 | 69 #ifdef HAVE_KSTAT |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
70 #include <kstat.h> |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
71 #endif |
1 | 72 |
2906
2ec3ec904cd4
Try to provide a vsscanf() implementation, if the system does not have
jkeil
parents:
2780
diff
changeset
|
73 #if HAVE_VSSCANF |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
74 int vsscanf( const char *str, const char *format, va_list ap); |
2906
2ec3ec904cd4
Try to provide a vsscanf() implementation, if the system does not have
jkeil
parents:
2780
diff
changeset
|
75 #else |
2ec3ec904cd4
Try to provide a vsscanf() implementation, if the system does not have
jkeil
parents:
2780
diff
changeset
|
76 /* system has no vsscanf. try to provide one */ |
2ec3ec904cd4
Try to provide a vsscanf() implementation, if the system does not have
jkeil
parents:
2780
diff
changeset
|
77 static int vsscanf( const char *str, const char *format, va_list ap) |
2ec3ec904cd4
Try to provide a vsscanf() implementation, if the system does not have
jkeil
parents:
2780
diff
changeset
|
78 { |
3465 | 79 long p1 = va_arg(ap, long); |
80 long p2 = va_arg(ap, long); | |
81 long p3 = va_arg(ap, long); | |
82 long p4 = va_arg(ap, long); | |
83 long p5 = va_arg(ap, long); | |
84 return sscanf(str, format, p1, p2, p3, p4, p5); | |
2906
2ec3ec904cd4
Try to provide a vsscanf() implementation, if the system does not have
jkeil
parents:
2780
diff
changeset
|
85 } |
2ec3ec904cd4
Try to provide a vsscanf() implementation, if the system does not have
jkeil
parents:
2780
diff
changeset
|
86 #endif |
1416 | 87 |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
88 char* def_path = WIN32_PATH; |
128 | 89 |
1923
40084ad62591
do_cpuid stored the results of the cpuid instruction in the wrong place
jkeil
parents:
1679
diff
changeset
|
90 static void do_cpuid(unsigned int ax, unsigned int *regs) |
128 | 91 { |
3465 | 92 __asm__ __volatile__ |
93 ( | |
94 "pushl %%ebx; pushl %%ecx; pushl %%edx;" | |
95 ".byte 0x0f, 0xa2;" | |
96 "movl %%eax, (%2);" | |
97 "movl %%ebx, 4(%2);" | |
98 "movl %%ecx, 8(%2);" | |
99 "movl %%edx, 12(%2);" | |
100 "popl %%edx; popl %%ecx; popl %%ebx;" | |
101 : "=a" (ax) | |
102 : "0" (ax), "S" (regs) | |
2069 | 103 ); |
128 | 104 } |
105 static unsigned int c_localcount_tsc() | |
1 | 106 { |
107 int a; | |
3465 | 108 __asm__ __volatile__ |
109 ( | |
110 "rdtsc\n\t" | |
111 :"=a"(a) | |
112 : | |
113 :"edx" | |
114 ); | |
1 | 115 return a; |
116 } | |
128 | 117 static void c_longcount_tsc(long long* z) |
1 | 118 { |
3465 | 119 __asm__ __volatile__ |
120 ( | |
121 "pushl %%ebx\n\t" | |
122 "movl %%eax, %%ebx\n\t" | |
123 "rdtsc\n\t" | |
124 "movl %%eax, 0(%%ebx)\n\t" | |
125 "movl %%edx, 4(%%ebx)\n\t" | |
126 "popl %%ebx\n\t" | |
127 ::"a"(z) | |
14212
540903a59fc0
add missing registers in clobber list, fixes bug #169
reimar
parents:
13751
diff
changeset
|
128 :"edx" |
3465 | 129 ); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
130 } |
128 | 131 static unsigned int c_localcount_notsc() |
1 | 132 { |
133 struct timeval tv; | |
134 unsigned limit=~0; | |
135 limit/=1000000; | |
136 gettimeofday(&tv, 0); | |
137 return limit*tv.tv_usec; | |
138 } | |
128 | 139 static void c_longcount_notsc(long long* z) |
1 | 140 { |
141 struct timeval tv; | |
142 unsigned long long result; | |
143 unsigned limit=~0; | |
144 if(!z)return; | |
145 limit/=1000000; | |
146 gettimeofday(&tv, 0); | |
147 result=tv.tv_sec; | |
148 result<<=32; | |
149 result+=limit*tv.tv_usec; | |
150 *z=result; | |
151 } | |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
152 static unsigned int localcount_stub(void); |
2069 | 153 static void longcount_stub(long long*); |
128 | 154 static unsigned int (*localcount)()=localcount_stub; |
155 static void (*longcount)(long long*)=longcount_stub; | |
1 | 156 |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
157 static pthread_mutex_t memmut; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
158 |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
159 static unsigned int localcount_stub(void) |
128 | 160 { |
161 unsigned int regs[4]; | |
1923
40084ad62591
do_cpuid stored the results of the cpuid instruction in the wrong place
jkeil
parents:
1679
diff
changeset
|
162 do_cpuid(1, regs); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
163 if ((regs[3] & 0x00000010) != 0) |
128 | 164 { |
165 localcount=c_localcount_tsc; | |
166 longcount=c_longcount_tsc; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
167 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
168 else |
128 | 169 { |
3465 | 170 localcount=c_localcount_notsc; |
128 | 171 longcount=c_longcount_notsc; |
172 } | |
173 return localcount(); | |
174 } | |
175 static void longcount_stub(long long* z) | |
1 | 176 { |
128 | 177 unsigned int regs[4]; |
1923
40084ad62591
do_cpuid stored the results of the cpuid instruction in the wrong place
jkeil
parents:
1679
diff
changeset
|
178 do_cpuid(1, regs); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
179 if ((regs[3] & 0x00000010) != 0) |
128 | 180 { |
181 localcount=c_localcount_tsc; | |
182 longcount=c_longcount_tsc; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
183 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
184 else |
128 | 185 { |
3465 | 186 localcount=c_localcount_notsc; |
128 | 187 longcount=c_longcount_notsc; |
188 } | |
189 longcount(z); | |
190 } | |
2780 | 191 |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
192 #ifdef MPLAYER |
17020 | 193 #include "mp_msg.h" |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
194 #endif |
2069 | 195 int LOADER_DEBUG=1; // active only if compiled with -DDETAILED_OUT |
3128 | 196 //#define DETAILED_OUT |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
197 static inline void dbgprintf(char* fmt, ...) |
128 | 198 { |
235 | 199 #ifdef DETAILED_OUT |
128 | 200 if(LOADER_DEBUG) |
201 { | |
202 FILE* f; | |
203 va_list va; | |
3465 | 204 va_start(va, fmt); |
128 | 205 f=fopen("./log", "a"); |
3134 | 206 vprintf(fmt, va); |
3465 | 207 fflush(stdout); |
208 if(f) | |
128 | 209 { |
210 vfprintf(f, fmt, va); | |
211 fsync(fileno(f)); | |
3465 | 212 fclose(f); |
128 | 213 } |
214 va_end(va); | |
215 } | |
235 | 216 #endif |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
217 #ifdef MPLAYER |
17932 | 218 if ( mp_msg_test(MSGT_WIN32,MSGL_DBG3) ) |
5740 | 219 { |
220 va_list va; | |
221 | |
222 va_start(va, fmt); | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
223 vprintf(fmt, va); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
224 // mp_dbg(MSGT_WIN32, MSGL_DBG3, fmt, va); |
5740 | 225 va_end(va); |
226 } | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
227 fflush(stdout); |
3435 | 228 #endif |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
229 } |
3128 | 230 |
231 | |
3465 | 232 char export_names[300][32]={ |
233 "name1", | |
234 //"name2", | |
235 //"name3" | |
1 | 236 }; |
237 //#define min(x,y) ((x)<(y)?(x):(y)) | |
238 | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
239 void destroy_event(void* event); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
240 |
3134 | 241 struct th_list_t; |
242 typedef struct th_list_t{ | |
243 int id; | |
244 void* thread; | |
245 struct th_list_t* next; | |
246 struct th_list_t* prev; | |
247 } th_list; | |
248 | |
249 | |
250 // have to be cleared by GARBAGE COLLECTOR | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
251 static unsigned char* heap=NULL; |
1 | 252 static int heap_counter=0; |
3134 | 253 static tls_t* g_tls=NULL; |
254 static th_list* list=NULL; | |
255 | |
2069 | 256 static void test_heap(void) |
1 | 257 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
258 int offset=0; |
1 | 259 if(heap==0) |
260 return; | |
261 while(offset<heap_counter) | |
262 { | |
263 if(*(int*)(heap+offset)!=0x433476) | |
264 { | |
265 printf("Heap corruption at address %d\n", offset); | |
266 return; | |
267 } | |
268 offset+=8+*(int*)(heap+offset+4); | |
269 } | |
270 for(;offset<min(offset+1000, 20000000); offset++) | |
271 if(heap[offset]!=0xCC) | |
3465 | 272 { |
273 printf("Free heap corruption at address %d\n", offset); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
274 } |
1 | 275 } |
276 #undef MEMORY_DEBUG | |
277 | |
278 #ifdef MEMORY_DEBUG | |
279 | |
7386 | 280 static void* my_mreq(int size, int to_zero) |
1 | 281 { |
282 static int test=0; | |
283 test++; | |
284 if(test%10==0)printf("Memory: %d bytes allocated\n", heap_counter); | |
3465 | 285 // test_heap(); |
1 | 286 if(heap==NULL) |
287 { | |
288 heap=malloc(20000000); | |
289 memset(heap, 0xCC,20000000); | |
290 } | |
291 if(heap==0) | |
292 { | |
293 printf("No enough memory\n"); | |
294 return 0; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
295 } |
1 | 296 if(heap_counter+size>20000000) |
297 { | |
298 printf("No enough memory\n"); | |
299 return 0; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
300 } |
1 | 301 *(int*)(heap+heap_counter)=0x433476; |
302 heap_counter+=4; | |
303 *(int*)(heap+heap_counter)=size; | |
304 heap_counter+=4; | |
305 printf("Allocated %d bytes of memory: sys %d, user %d-%d\n", size, heap_counter-8, heap_counter, heap_counter+size); | |
306 if(to_zero) | |
3465 | 307 memset(heap+heap_counter, 0, size); |
1543 | 308 else |
2139 | 309 memset(heap+heap_counter, 0xcc, size); // make crash reproducable |
1 | 310 heap_counter+=size; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
311 return heap+heap_counter-size; |
1 | 312 } |
7386 | 313 static int my_release(char* memory) |
1 | 314 { |
3465 | 315 // test_heap(); |
1 | 316 if(memory==NULL) |
317 { | |
318 printf("ERROR: free(0)\n"); | |
319 return 0; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
320 } |
1 | 321 if(*(int*)(memory-8)!=0x433476) |
322 { | |
323 printf("MEMORY CORRUPTION !!!!!!!!!!!!!!!!!!!\n"); | |
324 return 0; | |
325 } | |
326 printf("Freed %d bytes of memory\n", *(int*)(memory-4)); | |
3465 | 327 // memset(memory-8, *(int*)(memory-4), 0xCC); |
1 | 328 return 0; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
329 } |
1 | 330 |
331 #else | |
128 | 332 #define GARBAGE |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
333 typedef struct alloc_header_t alloc_header; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
334 struct alloc_header_t |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
335 { |
3465 | 336 // let's keep allocated data 16 byte aligned |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
337 alloc_header* prev; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
338 alloc_header* next; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
339 long deadbeef; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
340 long size; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
341 long type; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
342 long reserved1; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
343 long reserved2; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
344 long reserved3; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
345 }; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
346 |
128 | 347 #ifdef GARBAGE |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
348 static alloc_header* last_alloc = NULL; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
349 static int alccnt = 0; |
128 | 350 #endif |
351 | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
352 #define AREATYPE_CLIENT 0 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
353 #define AREATYPE_EVENT 1 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
354 #define AREATYPE_MUTEX 2 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
355 #define AREATYPE_COND 3 |
3134 | 356 #define AREATYPE_CRITSECT 4 |
357 | |
358 /* -- critical sections -- */ | |
359 struct CRITSECT | |
360 { | |
361 pthread_t id; | |
362 pthread_mutex_t mutex; | |
363 int locked; | |
6321
c254cb1c26ef
new (cleaner, nore robust) critsect code by Zdenek Kabelac <kabi@informatics.muni.cz>
arpi
parents:
5872
diff
changeset
|
364 long deadbeef; |
3134 | 365 }; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
366 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
367 void* mreq_private(int size, int to_zero, int type); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
368 void* mreq_private(int size, int to_zero, int type) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
369 { |
3465 | 370 int nsize = size + sizeof(alloc_header); |
7386 | 371 alloc_header* header = (alloc_header* ) malloc(nsize); |
3465 | 372 if (!header) |
373 return 0; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
374 if (to_zero) |
3465 | 375 memset(header, 0, nsize); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
376 #ifdef GARBAGE |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
377 if (!last_alloc) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
378 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
379 pthread_mutex_init(&memmut, NULL); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
380 pthread_mutex_lock(&memmut); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
381 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
382 else |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
383 { |
3465 | 384 pthread_mutex_lock(&memmut); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
385 last_alloc->next = header; /* set next */ |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
386 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
387 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
388 header->prev = last_alloc; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
389 header->next = 0; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
390 last_alloc = header; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
391 alccnt++; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
392 pthread_mutex_unlock(&memmut); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
393 #endif |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
394 header->deadbeef = 0xdeadbeef; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
395 header->size = size; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
396 header->type = type; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
397 |
3128 | 398 //if (alccnt < 40000) printf("MY_REQ: %p\t%d t:%d (cnt:%d)\n", header, size, type, alccnt); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
399 return header + 1; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
400 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
401 |
7386 | 402 static int my_release(void* memory) |
1 | 403 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
404 alloc_header* header = (alloc_header*) memory - 1; |
128 | 405 #ifdef GARBAGE |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
406 alloc_header* prevmem; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
407 alloc_header* nextmem; |
3134 | 408 |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
409 if (memory == 0) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
410 return 0; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
411 |
7386 | 412 if (header->deadbeef != (long) 0xdeadbeef) |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
413 { |
12258
25310086fc95
Less verbosity by moving some debug messages from printf --> dbgprintf.
diego
parents:
12074
diff
changeset
|
414 dbgprintf("FATAL releasing corrupted memory! %p 0x%lx (%d)\n", header, header->deadbeef, alccnt); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
415 return 0; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
416 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
417 |
3128 | 418 pthread_mutex_lock(&memmut); |
419 | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
420 switch(header->type) |
128 | 421 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
422 case AREATYPE_EVENT: |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
423 destroy_event(memory); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
424 break; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
425 case AREATYPE_COND: |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
426 pthread_cond_destroy((pthread_cond_t*)memory); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
427 break; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
428 case AREATYPE_MUTEX: |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
429 pthread_mutex_destroy((pthread_mutex_t*)memory); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
430 break; |
3134 | 431 case AREATYPE_CRITSECT: |
432 pthread_mutex_destroy(&((struct CRITSECT*)memory)->mutex); | |
433 break; | |
434 default: | |
435 //memset(memory, 0xcc, header->size); | |
4384 | 436 ; |
128 | 437 } |
3128 | 438 |
3465 | 439 header->deadbeef = 0; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
440 prevmem = header->prev; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
441 nextmem = header->next; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
442 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
443 if (prevmem) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
444 prevmem->next = nextmem; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
445 if (nextmem) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
446 nextmem->prev = prevmem; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
447 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
448 if (header == last_alloc) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
449 last_alloc = prevmem; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
450 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
451 alccnt--; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
452 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
453 if (last_alloc) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
454 pthread_mutex_unlock(&memmut); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
455 else |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
456 pthread_mutex_destroy(&memmut); |
3465 | 457 |
3128 | 458 //if (alccnt < 40000) printf("MY_RELEASE: %p\t%ld (%d)\n", header, header->size, alccnt); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
459 #else |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
460 if (memory == 0) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
461 return 0; |
128 | 462 #endif |
3465 | 463 //memset(header + 1, 0xcc, header->size); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
464 free(header); |
1 | 465 return 0; |
466 } | |
467 #endif | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
468 |
7386 | 469 static inline void* my_mreq(int size, int to_zero) |
3465 | 470 { |
471 return mreq_private(size, to_zero, AREATYPE_CLIENT); | |
472 } | |
473 | |
7386 | 474 static int my_size(void* memory) |
5234 | 475 { |
476 if(!memory) return 0; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
477 return ((alloc_header*)memory)[-1].size; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
478 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
479 |
3465 | 480 static void* my_realloc(void* memory, int size) |
1 | 481 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
482 void *ans = memory; |
5234 | 483 int osize; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
484 if (memory == NULL) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
485 return my_mreq(size, 0); |
5234 | 486 osize = my_size(memory); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
487 if (osize < size) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
488 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
489 ans = my_mreq(size, 0); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
490 memcpy(ans, memory, osize); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
491 my_release(memory); |
2069 | 492 } |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
493 return ans; |
2069 | 494 } |
1 | 495 |
3465 | 496 /* |
497 * | |
498 * WINE API - native implementation for several win32 libraries | |
499 * | |
500 */ | |
501 | |
502 static int WINAPI ext_unknown() | |
1 | 503 { |
504 printf("Unknown func called\n"); | |
505 return 0; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
506 } |
3465 | 507 |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
508 static int WINAPI expGetVolumeInformationA( const char *root, char *label, |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
509 unsigned int label_len, unsigned int *serial, |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
510 unsigned int *filename_len,unsigned int *flags, |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
511 char *fsname, unsigned int fsname_len ) |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
512 { |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
513 dbgprintf("GetVolumeInformationA( %s, 0x%x, %ld, 0x%x, 0x%x, 0x%x, 0x%x, %ld) => 1\n", |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
514 root,label,label_len,serial,filename_len,flags,fsname,fsname_len); |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
515 //hack Do not return any real data - do nothing |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
516 return 1; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
517 } |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
518 |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
519 static unsigned int WINAPI expGetDriveTypeA( const char *root ) |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
520 { |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
521 dbgprintf("GetDriveTypeA( %s ) => %d\n",root,DRIVE_FIXED); |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
522 // hack return as Fixed Drive Type |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
523 return DRIVE_FIXED; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
524 } |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
525 |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
526 static unsigned int WINAPI expGetLogicalDriveStringsA( unsigned int len, char *buffer ) |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
527 { |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
528 dbgprintf("GetLogicalDriveStringsA(%d, 0x%x) => 4\n",len,buffer); |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
529 // hack only have one drive c:\ in this hack |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
530 *buffer++='c'; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
531 *buffer++=':'; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
532 *buffer++='\\'; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
533 *buffer++='\0'; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
534 *buffer= '\0'; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
535 return 4; // 1 drive * 4 bytes (includes null) |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
536 } |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
537 |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
538 |
3465 | 539 static int WINAPI expIsBadWritePtr(void* ptr, unsigned int count) |
1 | 540 { |
3465 | 541 int result = (count == 0 || ptr != 0) ? 0 : 1; |
128 | 542 dbgprintf("IsBadWritePtr(0x%x, 0x%x) => %d\n", ptr, count, result); |
543 return result; | |
1 | 544 } |
3465 | 545 static int WINAPI expIsBadReadPtr(void* ptr, unsigned int count) |
1 | 546 { |
3465 | 547 int result = (count == 0 || ptr != 0) ? 0 : 1; |
128 | 548 dbgprintf("IsBadReadPtr(0x%x, 0x%x) => %d\n", ptr, count, result); |
549 return result; | |
1 | 550 } |
3465 | 551 static int WINAPI expDisableThreadLibraryCalls(int module) |
1 | 552 { |
128 | 553 dbgprintf("DisableThreadLibraryCalls(0x%x) => 0\n", module); |
1 | 554 return 0; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
555 } |
3465 | 556 |
557 static HMODULE WINAPI expGetDriverModuleHandle(DRVR* pdrv) | |
1 | 558 { |
2069 | 559 HMODULE result; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
560 if (pdrv==NULL) |
2069 | 561 result=0; |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
562 else |
3465 | 563 result=pdrv->hDriverModule; |
2069 | 564 dbgprintf("GetDriverModuleHandle(%p) => %p\n", pdrv, result); |
128 | 565 return result; |
1 | 566 } |
567 | |
2069 | 568 #define MODULE_HANDLE_kernel32 ((HMODULE)0x120) |
5234 | 569 #define MODULE_HANDLE_user32 ((HMODULE)0x121) |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
570 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
571 #define MODULE_HANDLE_wininet ((HMODULE)0x122) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
572 #define MODULE_HANDLE_ddraw ((HMODULE)0x123) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
573 #define MODULE_HANDLE_advapi32 ((HMODULE)0x124) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
574 #endif |
10818
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
575 #define MODULE_HANDLE_comdlg32 ((HMODULE)0x125) |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
576 #define MODULE_HANDLE_msvcrt ((HMODULE)0x126) |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
577 #define MODULE_HANDLE_ole32 ((HMODULE)0x127) |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
578 #define MODULE_HANDLE_winmm ((HMODULE)0x128) |
2069 | 579 |
3465 | 580 static HMODULE WINAPI expGetModuleHandleA(const char* name) |
1 | 581 { |
3465 | 582 WINE_MODREF* wm; |
583 HMODULE result; | |
584 if(!name) | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
585 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
586 result=1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
587 #else |
3465 | 588 result=0; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
589 #endif |
3465 | 590 else |
591 { | |
592 wm=MODULE_FindModule(name); | |
593 if(wm==0)result=0; | |
128 | 594 else |
3465 | 595 result=(HMODULE)(wm->module); |
596 } | |
597 if(!result) | |
598 { | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
599 if(name && (strcasecmp(name, "kernel32")==0 || !strcasecmp(name, "kernel32.dll"))) |
3465 | 600 result=MODULE_HANDLE_kernel32; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
601 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
602 if(name && strcasecmp(name, "user32")==0) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
603 result=MODULE_HANDLE_user32; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
604 #endif |
3465 | 605 } |
606 dbgprintf("GetModuleHandleA('%s') => 0x%x\n", name, result); | |
607 return result; | |
1 | 608 } |
128 | 609 |
3465 | 610 static void* WINAPI expCreateThread(void* pSecAttr, long dwStackSize, |
611 void* lpStartAddress, void* lpParameter, | |
612 long dwFlags, long* dwThreadId) | |
1 | 613 { |
614 pthread_t *pth; | |
3465 | 615 // printf("CreateThread:"); |
7386 | 616 pth = (pthread_t*) my_mreq(sizeof(pthread_t), 0); |
1 | 617 pthread_create(pth, NULL, (void*(*)(void*))lpStartAddress, lpParameter); |
618 if(dwFlags) | |
128 | 619 printf( "WARNING: CreateThread flags not supported\n"); |
1 | 620 if(dwThreadId) |
621 *dwThreadId=(long)pth; | |
622 if(list==NULL) | |
623 { | |
624 list=my_mreq(sizeof(th_list), 1); | |
625 list->next=list->prev=NULL; | |
626 } | |
627 else | |
628 { | |
629 list->next=my_mreq(sizeof(th_list), 0); | |
630 list->next->prev=list; | |
631 list->next->next=NULL; | |
632 list=list->next; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
633 } |
1 | 634 list->thread=pth; |
128 | 635 dbgprintf("CreateThread(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x) => 0x%x\n", |
3465 | 636 pSecAttr, dwStackSize, lpStartAddress, lpParameter, dwFlags, dwThreadId, pth); |
1 | 637 return pth; |
638 } | |
639 | |
640 struct mutex_list_t; | |
641 | |
642 struct mutex_list_t | |
643 { | |
128 | 644 char type; |
1 | 645 pthread_mutex_t *pm; |
128 | 646 pthread_cond_t *pc; |
647 char state; | |
648 char reset; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
649 char name[128]; |
128 | 650 int semaphore; |
1 | 651 struct mutex_list_t* next; |
652 struct mutex_list_t* prev; | |
653 }; | |
654 typedef struct mutex_list_t mutex_list; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
655 static mutex_list* mlist=NULL; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
656 |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
657 void destroy_event(void* event) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
658 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
659 mutex_list* pp=mlist; |
3465 | 660 // printf("garbage collector: destroy_event(%x)\n", event); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
661 while(pp) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
662 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
663 if(pp==(mutex_list*)event) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
664 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
665 if(pp->next) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
666 pp->next->prev=pp->prev; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
667 if(pp->prev) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
668 pp->prev->next=pp->next; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
669 if(mlist==(mutex_list*)event) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
670 mlist=mlist->prev; |
3465 | 671 /* |
672 pp=mlist; | |
673 while(pp) | |
674 { | |
675 printf("%x => ", pp); | |
676 pp=pp->prev; | |
677 } | |
678 printf("0\n"); | |
679 */ | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
680 return; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
681 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
682 pp=pp->prev; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
683 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
684 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
685 |
3465 | 686 static void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset, |
687 char bInitialState, const char* name) | |
1 | 688 { |
689 pthread_mutex_t *pm; | |
128 | 690 pthread_cond_t *pc; |
3465 | 691 /* |
692 mutex_list* pp; | |
693 pp=mlist; | |
694 while(pp) | |
695 { | |
696 printf("%x => ", pp); | |
697 pp=pp->prev; | |
698 } | |
699 printf("0\n"); | |
700 */ | |
1 | 701 if(mlist!=NULL) |
702 { | |
703 mutex_list* pp=mlist; | |
704 if(name!=NULL) | |
3465 | 705 do |
1 | 706 { |
128 | 707 if((strcmp(pp->name, name)==0) && (pp->type==0)) |
708 { | |
709 dbgprintf("CreateEventA(0x%x, 0x%x, 0x%x, 0x%x='%s') => 0x%x\n", | |
3465 | 710 pSecAttr, bManualReset, bInitialState, name, name, pp->pm); |
1 | 711 return pp->pm; |
128 | 712 } |
2069 | 713 }while((pp=pp->prev) != NULL); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
714 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
715 pm=mreq_private(sizeof(pthread_mutex_t), 0, AREATYPE_MUTEX); |
1 | 716 pthread_mutex_init(pm, NULL); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
717 pc=mreq_private(sizeof(pthread_cond_t), 0, AREATYPE_COND); |
128 | 718 pthread_cond_init(pc, NULL); |
1 | 719 if(mlist==NULL) |
720 { | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
721 mlist=mreq_private(sizeof(mutex_list), 00, AREATYPE_EVENT); |
1 | 722 mlist->next=mlist->prev=NULL; |
723 } | |
724 else | |
725 { | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
726 mlist->next=mreq_private(sizeof(mutex_list), 00, AREATYPE_EVENT); |
128 | 727 mlist->next->prev=mlist; |
1 | 728 mlist->next->next=NULL; |
729 mlist=mlist->next; | |
730 } | |
128 | 731 mlist->type=0; /* Type Event */ |
1 | 732 mlist->pm=pm; |
128 | 733 mlist->pc=pc; |
734 mlist->state=bInitialState; | |
735 mlist->reset=bManualReset; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
736 if(name) |
3465 | 737 strncpy(mlist->name, name, 127); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
738 else |
1 | 739 mlist->name[0]=0; |
740 if(pm==NULL) | |
741 dbgprintf("ERROR::: CreateEventA failure\n"); | |
3465 | 742 /* |
743 if(bInitialState) | |
744 pthread_mutex_lock(pm); | |
745 */ | |
128 | 746 if(name) |
3465 | 747 dbgprintf("CreateEventA(0x%x, 0x%x, 0x%x, 0x%x='%s') => 0x%x\n", |
748 pSecAttr, bManualReset, bInitialState, name, name, mlist); | |
128 | 749 else |
3465 | 750 dbgprintf("CreateEventA(0x%x, 0x%x, 0x%x, NULL) => 0x%x\n", |
751 pSecAttr, bManualReset, bInitialState, mlist); | |
128 | 752 return mlist; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
753 } |
1 | 754 |
3465 | 755 static void* WINAPI expSetEvent(void* event) |
1 | 756 { |
128 | 757 mutex_list *ml = (mutex_list *)event; |
758 dbgprintf("SetEvent(%x) => 0x1\n", event); | |
759 pthread_mutex_lock(ml->pm); | |
760 if (ml->state == 0) { | |
761 ml->state = 1; | |
762 pthread_cond_signal(ml->pc); | |
763 } | |
764 pthread_mutex_unlock(ml->pm); | |
765 | |
766 return (void *)1; | |
1 | 767 } |
3465 | 768 static void* WINAPI expResetEvent(void* event) |
1 | 769 { |
128 | 770 mutex_list *ml = (mutex_list *)event; |
771 dbgprintf("ResetEvent(0x%x) => 0x1\n", event); | |
772 pthread_mutex_lock(ml->pm); | |
773 ml->state = 0; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
774 pthread_mutex_unlock(ml->pm); |
128 | 775 |
776 return (void *)1; | |
1 | 777 } |
778 | |
3465 | 779 static void* WINAPI expWaitForSingleObject(void* object, int duration) |
1 | 780 { |
128 | 781 mutex_list *ml = (mutex_list *)object; |
2069 | 782 // FIXME FIXME FIXME - this value is sometime unititialize !!! |
783 int ret = WAIT_FAILED; | |
128 | 784 mutex_list* pp=mlist; |
2779 | 785 if(object == (void*)0xcfcf9898) |
786 { | |
3465 | 787 /** |
788 From GetCurrentThread() documentation: | |
789 A pseudo handle is a special constant that is interpreted as the current thread handle. The calling thread can use this handle to specify itself whenever a thread handle is required. Pseudo handles are not inherited by child processes. | |
790 | |
791 This handle has the maximum possible access to the thread object. For systems that support security descriptors, this is the maximum access allowed by the security descriptor for the calling process. For systems that do not support security descriptors, this is THREAD_ALL_ACCESS. | |
792 | |
793 The function cannot be used by one thread to create a handle that can be used by other threads to refer to the first thread. The handle is always interpreted as referring to the thread that is using it. A thread can create a "real" handle to itself that can be used by other threads, or inherited by other processes, by specifying the pseudo handle as the source handle in a call to the DuplicateHandle function. | |
794 **/ | |
2779 | 795 dbgprintf("WaitForSingleObject(thread_handle) called\n"); |
3128 | 796 return (void*)WAIT_FAILED; |
2779 | 797 } |
2069 | 798 dbgprintf("WaitForSingleObject(0x%x, duration %d) =>\n",object, duration); |
799 | |
718 | 800 // loop below was slightly fixed - its used just for checking if |
801 // this object really exists in our list | |
802 if (!ml) | |
3465 | 803 return (void*) ret; |
718 | 804 while (pp && (pp->pm != ml->pm)) |
2069 | 805 pp = pp->prev; |
718 | 806 if (!pp) { |
2069 | 807 dbgprintf("WaitForSingleObject: NotFound\n"); |
808 return (void*)ret; | |
718 | 809 } |
128 | 810 |
811 pthread_mutex_lock(ml->pm); | |
812 | |
813 switch(ml->type) { | |
3465 | 814 case 0: /* Event */ |
128 | 815 if (duration == 0) { /* Check Only */ |
3465 | 816 if (ml->state == 1) ret = WAIT_FAILED; |
817 else ret = WAIT_OBJECT_0; | |
128 | 818 } |
819 if (duration == -1) { /* INFINITE */ | |
3465 | 820 if (ml->state == 0) |
821 pthread_cond_wait(ml->pc,ml->pm); | |
822 if (ml->reset) | |
823 ml->state = 0; | |
824 ret = WAIT_OBJECT_0; | |
128 | 825 } |
826 if (duration > 0) { /* Timed Wait */ | |
3465 | 827 struct timespec abstime; |
828 struct timeval now; | |
829 gettimeofday(&now, 0); | |
830 abstime.tv_sec = now.tv_sec + (now.tv_usec+duration)/1000000; | |
831 abstime.tv_nsec = ((now.tv_usec+duration)%1000000)*1000; | |
832 if (ml->state == 0) | |
833 ret=pthread_cond_timedwait(ml->pc,ml->pm,&abstime); | |
834 if (ret == ETIMEDOUT) ret = WAIT_TIMEOUT; | |
835 else ret = WAIT_OBJECT_0; | |
836 if (ml->reset) | |
837 ml->state = 0; | |
128 | 838 } |
3465 | 839 break; |
840 case 1: /* Semaphore */ | |
841 if (duration == 0) { | |
842 if(ml->semaphore==0) ret = WAIT_FAILED; | |
843 else { | |
844 ml->semaphore++; | |
845 ret = WAIT_OBJECT_0; | |
846 } | |
847 } | |
128 | 848 if (duration == -1) { |
3465 | 849 if (ml->semaphore==0) |
850 pthread_cond_wait(ml->pc,ml->pm); | |
851 ml->semaphore--; | |
128 | 852 } |
3465 | 853 break; |
128 | 854 } |
855 pthread_mutex_unlock(ml->pm); | |
856 | |
857 dbgprintf("WaitForSingleObject(0x%x, %d): 0x%x => 0x%x \n",object,duration,ml,ret); | |
858 return (void *)ret; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
859 } |
1 | 860 |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
861 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
862 static void* WINAPI expWaitForMultipleObjects(int count, const void** objects, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
863 int WaitAll, int duration) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
864 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
865 int i; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
866 void *object; |
8451 | 867 void *ret; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
868 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
869 dbgprintf("WaitForMultipleObjects(%d, 0x%x, %d, duration %d) =>\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
870 count, objects, WaitAll, duration); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
871 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
872 for (i = 0; i < count; i++) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
873 { |
13182 | 874 object = (void *)objects[i]; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
875 ret = expWaitForSingleObject(object, duration); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
876 if (WaitAll) |
8285 | 877 dbgprintf("WaitAll flag not yet supported...\n"); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
878 else |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
879 return ret; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
880 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
881 return NULL; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
882 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
883 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
884 static void WINAPI expExitThread(int retcode) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
885 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
886 dbgprintf("ExitThread(%d)\n", retcode); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
887 pthread_exit(&retcode); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
888 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
889 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
890 static HANDLE WINAPI expCreateMutexA(void *pSecAttr, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
891 char bInitialOwner, const char *name) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
892 { |
8451 | 893 HANDLE mlist = (HANDLE)expCreateEventA(pSecAttr, 0, 0, name); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
894 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
895 if (name) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
896 dbgprintf("CreateMutexA(0x%x, %d, '%s') => 0x%x\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
897 pSecAttr, bInitialOwner, name, mlist); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
898 else |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
899 dbgprintf("CreateMutexA(0x%x, %d, NULL) => 0x%x\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
900 pSecAttr, bInitialOwner, mlist); |
8281 | 901 #ifndef QTX |
902 /* 10l to QTX, if CreateMutex returns a real mutex, WaitForSingleObject | |
903 waits for ever, else it works ;) */ | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
904 return mlist; |
8281 | 905 #endif |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
906 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
907 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
908 static int WINAPI expReleaseMutex(HANDLE hMutex) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
909 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
910 dbgprintf("ReleaseMutex(%x) => 1\n", hMutex); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
911 /* FIXME:XXX !! not yet implemented */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
912 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
913 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
914 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
915 |
5800
f2136a17b451
workaround: force PF table setup in IsProcessorFeaturePresent
alex
parents:
5770
diff
changeset
|
916 static int pf_set = 0; |
1 | 917 static BYTE PF[64] = {0,}; |
918 | |
128 | 919 static void DumpSystemInfo(const SYSTEM_INFO* si) |
920 { | |
921 dbgprintf(" Processor architecture %d\n", si->u.s.wProcessorArchitecture); | |
922 dbgprintf(" Page size: %d\n", si->dwPageSize); | |
923 dbgprintf(" Minimum app address: %d\n", si->lpMinimumApplicationAddress); | |
924 dbgprintf(" Maximum app address: %d\n", si->lpMaximumApplicationAddress); | |
925 dbgprintf(" Active processor mask: 0x%x\n", si->dwActiveProcessorMask); | |
926 dbgprintf(" Number of processors: %d\n", si->dwNumberOfProcessors); | |
927 dbgprintf(" Processor type: 0x%x\n", si->dwProcessorType); | |
928 dbgprintf(" Allocation granularity: 0x%x\n", si->dwAllocationGranularity); | |
929 dbgprintf(" Processor level: 0x%x\n", si->wProcessorLevel); | |
930 dbgprintf(" Processor revision: 0x%x\n", si->wProcessorRevision); | |
931 } | |
932 | |
3465 | 933 static void WINAPI expGetSystemInfo(SYSTEM_INFO* si) |
1 | 934 { |
3465 | 935 /* FIXME: better values for the two entries below... */ |
936 static int cache = 0; | |
937 static SYSTEM_INFO cachedsi; | |
938 unsigned int regs[4]; | |
939 dbgprintf("GetSystemInfo(%p) =>\n", si); | |
940 | |
941 if (cache) { | |
16650
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
942 goto exit; |
3465 | 943 } |
944 memset(PF,0,sizeof(PF)); | |
5800
f2136a17b451
workaround: force PF table setup in IsProcessorFeaturePresent
alex
parents:
5770
diff
changeset
|
945 pf_set = 1; |
3465 | 946 |
947 cachedsi.u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL; | |
948 cachedsi.dwPageSize = getpagesize(); | |
949 | |
950 /* FIXME: better values for the two entries below... */ | |
951 cachedsi.lpMinimumApplicationAddress = (void *)0x00000000; | |
952 cachedsi.lpMaximumApplicationAddress = (void *)0x7FFFFFFF; | |
953 cachedsi.dwActiveProcessorMask = 1; | |
954 cachedsi.dwNumberOfProcessors = 1; | |
955 cachedsi.dwProcessorType = PROCESSOR_INTEL_386; | |
956 cachedsi.dwAllocationGranularity = 0x10000; | |
957 cachedsi.wProcessorLevel = 5; /* pentium */ | |
958 cachedsi.wProcessorRevision = 0x0101; | |
959 | |
960 #ifdef MPLAYER | |
961 /* mplayer's way to detect PF's */ | |
962 { | |
17020 | 963 #include "cpudetect.h" |
3465 | 964 extern CpuCaps gCpuCaps; |
965 | |
966 if (gCpuCaps.hasMMX) | |
967 PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE; | |
968 if (gCpuCaps.hasSSE) | |
969 PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = TRUE; | |
16632
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
970 if (gCpuCaps.hasSSE2) |
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
971 PF[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = TRUE; |
3465 | 972 if (gCpuCaps.has3DNow) |
973 PF[PF_AMD3D_INSTRUCTIONS_AVAILABLE] = TRUE; | |
3404 | 974 |
10013 | 975 if (gCpuCaps.cpuType == 4) |
976 { | |
977 cachedsi.dwProcessorType = PROCESSOR_INTEL_486; | |
978 cachedsi.wProcessorLevel = 4; | |
979 } | |
10139
8ac4502b7b3d
10l by me, noticed by a guy with a transmeta cpu, but forgot his name, sorry
alex
parents:
10013
diff
changeset
|
980 else if (gCpuCaps.cpuType >= 5) |
3404 | 981 { |
10013 | 982 cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; |
983 cachedsi.wProcessorLevel = 5; | |
984 } | |
985 else | |
986 { | |
987 cachedsi.dwProcessorType = PROCESSOR_INTEL_386; | |
988 cachedsi.wProcessorLevel = 3; | |
3404 | 989 } |
990 cachedsi.wProcessorRevision = gCpuCaps.cpuStepping; | |
991 cachedsi.dwNumberOfProcessors = 1; /* hardcoded */ | |
3465 | 992 } |
3405 | 993 #endif |
3128 | 994 |
3404 | 995 /* disable cpuid based detection (mplayer's cpudetect.c does this - see above) */ |
3465 | 996 #ifndef MPLAYER |
15566 | 997 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__) || defined(__DragonFly__) |
3465 | 998 do_cpuid(1, regs); |
999 switch ((regs[0] >> 8) & 0xf) { // cpu family | |
1000 case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386; | |
1001 cachedsi.wProcessorLevel= 3; | |
1002 break; | |
1003 case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486; | |
1004 cachedsi.wProcessorLevel= 4; | |
1005 break; | |
1006 case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; | |
1007 cachedsi.wProcessorLevel= 5; | |
1008 break; | |
1009 case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; | |
1010 cachedsi.wProcessorLevel= 5; | |
1011 break; | |
1012 default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; | |
1013 cachedsi.wProcessorLevel= 5; | |
1014 break; | |
1015 } | |
1016 cachedsi.wProcessorRevision = regs[0] & 0xf; // stepping | |
1017 if (regs[3] & (1 << 8)) | |
1018 PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE; | |
1019 if (regs[3] & (1 << 23)) | |
1020 PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE; | |
1021 if (regs[3] & (1 << 25)) | |
1022 PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = TRUE; | |
1023 if (regs[3] & (1 << 31)) | |
1024 PF[PF_AMD3D_INSTRUCTIONS_AVAILABLE] = TRUE; | |
1025 cachedsi.dwNumberOfProcessors=1; | |
3404 | 1026 #endif |
3465 | 1027 #endif /* MPLAYER */ |
3404 | 1028 |
3405 | 1029 /* MPlayer: linux detection enabled (based on proc/cpuinfo) for checking |
1030 fdiv_bug and fpu emulation flags -- alex/MPlayer */ | |
3404 | 1031 #ifdef __linux__ |
3465 | 1032 { |
1 | 1033 char buf[20]; |
1034 char line[200]; | |
1035 FILE *f = fopen ("/proc/cpuinfo", "r"); | |
1036 | |
1037 if (!f) | |
16650
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
1038 { |
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
1039 #ifdef MPLAYER |
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
1040 mp_msg(MSGT_WIN32, MSGL_WARN, "expGetSystemInfo: " |
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
1041 "/proc/cpuinfo not readable! " |
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
1042 "Expect bad performance and/or weird behaviour\n"); |
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
1043 #endif |
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
1044 goto exit; |
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
1045 } |
1 | 1046 while (fgets(line,200,f)!=NULL) { |
3465 | 1047 char *s,*value; |
1048 | |
1049 /* NOTE: the ':' is the only character we can rely on */ | |
1050 if (!(value = strchr(line,':'))) | |
1051 continue; | |
1052 /* terminate the valuename */ | |
1053 *value++ = '\0'; | |
1054 /* skip any leading spaces */ | |
1055 while (*value==' ') value++; | |
1056 if ((s=strchr(value,'\n'))) | |
1057 *s='\0'; | |
1058 | |
1059 /* 2.1 method */ | |
1060 if (!lstrncmpiA(line, "cpu family",strlen("cpu family"))) { | |
1061 if (isdigit (value[0])) { | |
1062 switch (value[0] - '0') { | |
1063 case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386; | |
1064 cachedsi.wProcessorLevel= 3; | |
1065 break; | |
1066 case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486; | |
1067 cachedsi.wProcessorLevel= 4; | |
1068 break; | |
1069 case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; | |
1070 cachedsi.wProcessorLevel= 5; | |
1071 break; | |
1072 case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; | |
1073 cachedsi.wProcessorLevel= 5; | |
1074 break; | |
1075 default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; | |
1076 cachedsi.wProcessorLevel= 5; | |
1077 break; | |
1078 } | |
1 | 1079 } |
3465 | 1080 /* set the CPU type of the current processor */ |
1081 sprintf(buf,"CPU %ld",cachedsi.dwProcessorType); | |
1082 continue; | |
1083 } | |
1084 /* old 2.0 method */ | |
1085 if (!lstrncmpiA(line, "cpu",strlen("cpu"))) { | |
1086 if ( isdigit (value[0]) && value[1] == '8' && | |
1087 value[2] == '6' && value[3] == 0 | |
1088 ) { | |
1089 switch (value[0] - '0') { | |
1090 case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386; | |
1091 cachedsi.wProcessorLevel= 3; | |
1092 break; | |
1093 case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486; | |
1094 cachedsi.wProcessorLevel= 4; | |
1095 break; | |
1096 case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; | |
1097 cachedsi.wProcessorLevel= 5; | |
1098 break; | |
1099 case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; | |
1100 cachedsi.wProcessorLevel= 5; | |
1101 break; | |
1102 default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; | |
1103 cachedsi.wProcessorLevel= 5; | |
1104 break; | |
1105 } | |
1 | 1106 } |
3465 | 1107 /* set the CPU type of the current processor */ |
1108 sprintf(buf,"CPU %ld",cachedsi.dwProcessorType); | |
1109 continue; | |
1110 } | |
1111 if (!lstrncmpiA(line,"fdiv_bug",strlen("fdiv_bug"))) { | |
1112 if (!lstrncmpiA(value,"yes",3)) | |
1113 PF[PF_FLOATING_POINT_PRECISION_ERRATA] = TRUE; | |
1114 | |
1115 continue; | |
1116 } | |
1117 if (!lstrncmpiA(line,"fpu",strlen("fpu"))) { | |
1118 if (!lstrncmpiA(value,"no",2)) | |
1119 PF[PF_FLOATING_POINT_EMULATED] = TRUE; | |
1120 | |
1121 continue; | |
1122 } | |
1123 if (!lstrncmpiA(line,"processor",strlen("processor"))) { | |
1124 /* processor number counts up...*/ | |
7386 | 1125 unsigned int x; |
3465 | 1126 |
1127 if (sscanf(value,"%d",&x)) | |
1128 if (x+1>cachedsi.dwNumberOfProcessors) | |
1129 cachedsi.dwNumberOfProcessors=x+1; | |
1130 | |
1131 /* Create a new processor subkey on a multiprocessor | |
1132 * system | |
1133 */ | |
1134 sprintf(buf,"%d",x); | |
1135 } | |
1136 if (!lstrncmpiA(line,"stepping",strlen("stepping"))) { | |
1137 int x; | |
1138 | |
1139 if (sscanf(value,"%d",&x)) | |
1140 cachedsi.wProcessorRevision = x; | |
1141 } | |
1142 if | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1143 ( (!lstrncmpiA(line,"flags",strlen("flags"))) |
3465 | 1144 || (!lstrncmpiA(line,"features",strlen("features"))) ) |
1145 { | |
1146 if (strstr(value,"cx8")) | |
1147 PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE; | |
1148 if (strstr(value,"mmx")) | |
1149 PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE; | |
1150 if (strstr(value,"tsc")) | |
1151 PF[PF_RDTSC_INSTRUCTION_AVAILABLE] = TRUE; | |
16632
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
1152 if (strstr(value,"xmm") || strstr(value,"sse")) |
3465 | 1153 PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = TRUE; |
16632
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
1154 if (strstr(value,"sse2")) |
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
1155 PF[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = TRUE; |
3465 | 1156 if (strstr(value,"3dnow")) |
1157 PF[PF_AMD3D_INSTRUCTIONS_AVAILABLE] = TRUE; | |
1158 } | |
1 | 1159 } |
1160 fclose (f); | |
3465 | 1161 /* |
1162 * ad hoc fix for smp machines. | |
1163 * some problems on WaitForSingleObject,CreateEvent,SetEvent | |
1164 * CreateThread ...etc.. | |
1165 * | |
1166 */ | |
1167 cachedsi.dwNumberOfProcessors=1; | |
1168 } | |
3404 | 1169 #endif /* __linux__ */ |
3465 | 1170 cache = 1; |
16650
831cdc896c4c
expGetSystemInfo should not leave SYSTEM_INFO unitialized, even when
reimar
parents:
16632
diff
changeset
|
1171 exit: |
3465 | 1172 memcpy(si,&cachedsi,sizeof(*si)); |
1173 DumpSystemInfo(si); | |
1 | 1174 } |
1175 | |
7386 | 1176 // avoid undefined expGetSystemInfo |
1177 static WIN_BOOL WINAPI expIsProcessorFeaturePresent(DWORD v) | |
1178 { | |
1179 WIN_BOOL result = 0; | |
1180 if (!pf_set) | |
1181 { | |
1182 SYSTEM_INFO si; | |
1183 expGetSystemInfo(&si); | |
1184 } | |
1185 if(v<64) result=PF[v]; | |
1186 dbgprintf("IsProcessorFeaturePresent(0x%x) => 0x%x\n", v, result); | |
1187 return result; | |
1188 } | |
1189 | |
1190 | |
3465 | 1191 static long WINAPI expGetVersion() |
1 | 1192 { |
128 | 1193 dbgprintf("GetVersion() => 0xC0000004\n"); |
1194 return 0xC0000004;//Windows 95 | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1195 } |
1 | 1196 |
3465 | 1197 static HANDLE WINAPI expHeapCreate(long flags, long init_size, long max_size) |
1 | 1198 { |
3465 | 1199 // printf("HeapCreate:"); |
128 | 1200 HANDLE result; |
1 | 1201 if(init_size==0) |
3465 | 1202 result=(HANDLE)my_mreq(0x110000, 0); |
1 | 1203 else |
3465 | 1204 result=(HANDLE)my_mreq((init_size + 0xfff) & 0x7ffff000 , 0); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1205 dbgprintf("HeapCreate(flags 0x%x, initial size %d, maximum size %d) => 0x%x\n", flags, init_size, max_size, result); |
128 | 1206 return result; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1207 } |
3128 | 1208 |
1209 // this is another dirty hack | |
3465 | 1210 // VP31 is releasing one allocated Heap chunk twice |
3128 | 1211 // we will silently ignore this second call... |
1212 static void* heapfreehack = 0; | |
1213 static int heapfreehackshown = 0; | |
3465 | 1214 //extern void trapbug(void); |
1215 static void* WINAPI expHeapAlloc(HANDLE heap, int flags, int size) | |
1 | 1216 { |
1217 void* z; | |
3465 | 1218 /** |
1219 Morgan's m3jpeg32.dll v. 2.0 encoder expects that request for | |
1220 HeapAlloc returns area larger than size argument :-/ | |
1221 | |
1222 actually according to M$ Doc HeapCreate size should be rounded | |
1223 to page boundaries thus we should simulate this | |
1224 **/ | |
1225 //if (size == 22276) trapbug(); | |
1226 z=my_mreq((size + 0xfff) & 0x7ffff000, (flags & HEAP_ZERO_MEMORY)); | |
1 | 1227 if(z==0) |
1228 printf("HeapAlloc failure\n"); | |
3465 | 1229 dbgprintf("HeapAlloc(heap 0x%x, flags 0x%x, size %d) => 0x%x\n", heap, flags, size, z); |
3128 | 1230 heapfreehack = 0; // reset |
1 | 1231 return z; |
1232 } | |
3465 | 1233 static long WINAPI expHeapDestroy(void* heap) |
1 | 1234 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1235 dbgprintf("HeapDestroy(heap 0x%x) => 1\n", heap); |
1 | 1236 my_release(heap); |
1237 return 1; | |
1238 } | |
1239 | |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
1240 static long WINAPI expHeapFree(HANDLE heap, DWORD dwFlags, LPVOID lpMem) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
1241 { |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
1242 dbgprintf("HeapFree(0x%x, 0x%x, pointer 0x%x) => 1\n", heap, dwFlags, lpMem); |
7386 | 1243 if (heapfreehack != lpMem && lpMem != (void*)0xffffffff |
1244 && lpMem != (void*)0xbdbdbdbd) | |
1245 // 0xbdbdbdbd is for i263_drv.drv && libefence | |
1246 // it seems to be reading from relased memory | |
1247 // EF_PROTECT_FREE doens't show any probleme | |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
1248 my_release(lpMem); |
3128 | 1249 else |
1250 { | |
3465 | 1251 if (!heapfreehackshown++) |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
1252 printf("Info: HeapFree deallocating same memory twice! (%p)\n", lpMem); |
3128 | 1253 } |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
1254 heapfreehack = lpMem; |
1 | 1255 return 1; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1256 } |
3465 | 1257 static long WINAPI expHeapSize(int heap, int flags, void* pointer) |
1 | 1258 { |
128 | 1259 long result=my_size(pointer); |
1260 dbgprintf("HeapSize(heap 0x%x, flags 0x%x, pointer 0x%x) => %d\n", heap, flags, pointer, result); | |
1261 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1262 } |
3465 | 1263 static void* WINAPI expHeapReAlloc(HANDLE heap,int flags,void *lpMem,int size) |
2069 | 1264 { |
3465 | 1265 long orgsize = my_size(lpMem); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1266 dbgprintf("HeapReAlloc() Size %ld org %d\n",orgsize,size); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1267 return my_realloc(lpMem, size); |
2069 | 1268 } |
3465 | 1269 static long WINAPI expGetProcessHeap(void) |
1 | 1270 { |
128 | 1271 dbgprintf("GetProcessHeap() => 1\n"); |
1 | 1272 return 1; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1273 } |
3465 | 1274 static void* WINAPI expVirtualAlloc(void* v1, long v2, long v3, long v4) |
1 | 1275 { |
3465 | 1276 void* z = VirtualAlloc(v1, v2, v3, v4); |
1 | 1277 if(z==0) |
1278 printf("VirtualAlloc failure\n"); | |
128 | 1279 dbgprintf("VirtualAlloc(0x%x, %d, %d, %d) => 0x%x \n",v1,v2,v3,v4, z); |
1 | 1280 return z; |
1281 } | |
3465 | 1282 static int WINAPI expVirtualFree(void* v1, int v2, int v3) |
1 | 1283 { |
3465 | 1284 int result = VirtualFree(v1,v2,v3); |
128 | 1285 dbgprintf("VirtualFree(0x%x, %d, %d) => %d\n",v1,v2,v3, result); |
1286 return result; | |
3128 | 1287 } |
2579 | 1288 |
1289 /* we're building a table of critical sections. cs_win pointer uses the DLL | |
3465 | 1290 cs_unix is the real structure, we're using cs_win only to identifying cs_unix */ |
2579 | 1291 struct critsecs_list_t |
1292 { | |
1293 CRITICAL_SECTION *cs_win; | |
1294 struct CRITSECT *cs_unix; | |
1295 }; | |
1296 | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1297 /* 'NEWTYPE' is working with VIVO, 3ivX and QTX dll (no more segfaults) -- alex */ |
8393
08e71f6a7531
it seems that old CS is working better than newtype now... :)
arpi
parents:
8391
diff
changeset
|
1298 #undef CRITSECS_NEWTYPE |
08e71f6a7531
it seems that old CS is working better than newtype now... :)
arpi
parents:
8391
diff
changeset
|
1299 //#define CRITSECS_NEWTYPE 1 |
3128 | 1300 |
1301 #ifdef CRITSECS_NEWTYPE | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1302 /* increased due to ucod needs more than 32 entries */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1303 /* and 64 should be enough for everything */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1304 #define CRITSECS_LIST_MAX 64 |
2579 | 1305 static struct critsecs_list_t critsecs_list[CRITSECS_LIST_MAX]; |
1306 | |
3465 | 1307 static int critsecs_get_pos(CRITICAL_SECTION *cs_win) |
2579 | 1308 { |
1309 int i; | |
3128 | 1310 |
2579 | 1311 for (i=0; i < CRITSECS_LIST_MAX; i++) |
1312 if (critsecs_list[i].cs_win == cs_win) | |
1313 return(i); | |
1314 return(-1); | |
1315 } | |
1316 | |
3465 | 1317 static int critsecs_get_unused(void) |
2579 | 1318 { |
1319 int i; | |
3128 | 1320 |
2579 | 1321 for (i=0; i < CRITSECS_LIST_MAX; i++) |
1322 if (critsecs_list[i].cs_win == NULL) | |
1323 return(i); | |
1324 return(-1); | |
1325 } | |
1326 | |
1327 struct CRITSECT *critsecs_get_unix(CRITICAL_SECTION *cs_win) | |
1328 { | |
1329 int i; | |
3128 | 1330 |
2579 | 1331 for (i=0; i < CRITSECS_LIST_MAX; i++) |
2670 | 1332 if (critsecs_list[i].cs_win == cs_win && critsecs_list[i].cs_unix) |
2579 | 1333 return(critsecs_list[i].cs_unix); |
1334 return(NULL); | |
1335 } | |
1336 #endif | |
1337 | |
3465 | 1338 static void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c) |
1 | 1339 { |
128 | 1340 dbgprintf("InitializeCriticalSection(0x%x)\n", c); |
3465 | 1341 /* if(sizeof(pthread_mutex_t)>sizeof(CRITICAL_SECTION)) |
1342 { | |
1343 printf(" ERROR:::: sizeof(pthread_mutex_t) is %d, expected <=%d!\n", | |
1344 sizeof(pthread_mutex_t), sizeof(CRITICAL_SECTION)); | |
1345 return; | |
1346 }*/ | |
1347 /* pthread_mutex_init((pthread_mutex_t*)c, NULL); */ | |
2579 | 1348 #ifdef CRITSECS_NEWTYPE |
1349 { | |
3465 | 1350 struct CRITSECT *cs; |
1351 int i = critsecs_get_unused(); | |
1352 | |
1353 if (i < 0) | |
1354 { | |
1355 printf("InitializeCriticalSection(%p) - no more space in list\n", c); | |
1356 return; | |
1357 } | |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
1358 dbgprintf("got unused space at %d\n", i); |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
1359 cs = malloc(sizeof(struct CRITSECT)); |
3465 | 1360 if (!cs) |
1361 { | |
1362 printf("InitializeCriticalSection(%p) - out of memory\n", c); | |
1363 return; | |
1364 } | |
1365 pthread_mutex_init(&cs->mutex, NULL); | |
1366 cs->locked = 0; | |
1367 critsecs_list[i].cs_win = c; | |
1368 critsecs_list[i].cs_unix = cs; | |
1369 dbgprintf("InitializeCriticalSection -> itemno=%d, cs_win=%p, cs_unix=%p\n", | |
1370 i, c, cs); | |
2579 | 1371 } |
3465 | 1372 #else |
2670 | 1373 { |
6321
c254cb1c26ef
new (cleaner, nore robust) critsect code by Zdenek Kabelac <kabi@informatics.muni.cz>
arpi
parents:
5872
diff
changeset
|
1374 struct CRITSECT* cs = mreq_private(sizeof(struct CRITSECT) + sizeof(CRITICAL_SECTION), |
c254cb1c26ef
new (cleaner, nore robust) critsect code by Zdenek Kabelac <kabi@informatics.muni.cz>
arpi
parents:
5872
diff
changeset
|
1375 0, AREATYPE_CRITSECT); |
3465 | 1376 pthread_mutex_init(&cs->mutex, NULL); |
1377 cs->locked=0; | |
6321
c254cb1c26ef
new (cleaner, nore robust) critsect code by Zdenek Kabelac <kabi@informatics.muni.cz>
arpi
parents:
5872
diff
changeset
|
1378 cs->deadbeef = 0xdeadbeef; |
7718 | 1379 *(void**)c = cs; |
2670 | 1380 } |
2579 | 1381 #endif |
1 | 1382 return; |
2579 | 1383 } |
1384 | |
3465 | 1385 static void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c) |
1 | 1386 { |
2579 | 1387 #ifdef CRITSECS_NEWTYPE |
1388 struct CRITSECT* cs = critsecs_get_unix(c); | |
1389 #else | |
7718 | 1390 struct CRITSECT* cs = (*(struct CRITSECT**)c); |
2579 | 1391 #endif |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1392 dbgprintf("EnterCriticalSection(0x%x) %p\n",c, cs); |
2069 | 1393 if (!cs) |
1394 { | |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
1395 dbgprintf("entered uninitialized critisec!\n"); |
2069 | 1396 expInitializeCriticalSection(c); |
2579 | 1397 #ifdef CRITSECS_NEWTYPE |
1398 cs=critsecs_get_unix(c); | |
1399 #else | |
7718 | 1400 cs = (*(struct CRITSECT**)c); |
2579 | 1401 #endif |
12074 | 1402 dbgprintf("Win32 Warning: Accessed uninitialized Critical Section (%p)!\n", c); |
2069 | 1403 } |
1 | 1404 if(cs->locked) |
1405 if(cs->id==pthread_self()) | |
1406 return; | |
1407 pthread_mutex_lock(&(cs->mutex)); | |
1408 cs->locked=1; | |
1409 cs->id=pthread_self(); | |
1410 return; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1411 } |
3465 | 1412 static void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c) |
1 | 1413 { |
2579 | 1414 #ifdef CRITSECS_NEWTYPE |
1415 struct CRITSECT* cs = critsecs_get_unix(c); | |
1416 #else | |
7718 | 1417 struct CRITSECT* cs = (*(struct CRITSECT**)c); |
2579 | 1418 #endif |
3465 | 1419 // struct CRITSECT* cs=(struct CRITSECT*)c; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1420 dbgprintf("LeaveCriticalSection(0x%x) 0x%x\n",c, cs); |
2069 | 1421 if (!cs) |
1422 { | |
12074 | 1423 dbgprintf("Win32 Warning: Leaving uninitialized Critical Section %p!!\n", c); |
2069 | 1424 return; |
1425 } | |
11852
0bbdbc75532f
Don't mutex_unlock if it was never locked. Patch by Min Sik Kim
alex
parents:
10818
diff
changeset
|
1426 if (cs->locked) |
0bbdbc75532f
Don't mutex_unlock if it was never locked. Patch by Min Sik Kim
alex
parents:
10818
diff
changeset
|
1427 { |
0bbdbc75532f
Don't mutex_unlock if it was never locked. Patch by Min Sik Kim
alex
parents:
10818
diff
changeset
|
1428 cs->locked=0; |
0bbdbc75532f
Don't mutex_unlock if it was never locked. Patch by Min Sik Kim
alex
parents:
10818
diff
changeset
|
1429 pthread_mutex_unlock(&(cs->mutex)); |
0bbdbc75532f
Don't mutex_unlock if it was never locked. Patch by Min Sik Kim
alex
parents:
10818
diff
changeset
|
1430 } |
11853
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1431 else |
12074 | 1432 dbgprintf("Win32 Warning: Unlocking unlocked Critical Section %p!!\n", c); |
1 | 1433 return; |
1434 } | |
8451 | 1435 |
1436 static void expfree(void* mem); /* forward declaration */ | |
1437 | |
3465 | 1438 static void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c) |
1 | 1439 { |
2579 | 1440 #ifdef CRITSECS_NEWTYPE |
1441 struct CRITSECT* cs = critsecs_get_unix(c); | |
1442 #else | |
7718 | 1443 struct CRITSECT* cs= (*(struct CRITSECT**)c); |
2579 | 1444 #endif |
3465 | 1445 // struct CRITSECT* cs=(struct CRITSECT*)c; |
128 | 1446 dbgprintf("DeleteCriticalSection(0x%x)\n",c); |
3465 | 1447 |
11853
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1448 if (!cs) |
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1449 { |
12074 | 1450 dbgprintf("Win32 Warning: Deleting uninitialized Critical Section %p!!\n", c); |
11853
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1451 return; |
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1452 } |
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1453 |
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1454 if (cs->locked) |
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1455 { |
12074 | 1456 dbgprintf("Win32 Warning: Deleting unlocked Critical Section %p!!\n", c); |
11853
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1457 pthread_mutex_unlock(&(cs->mutex)); |
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1458 } |
b5805b819ff9
reviewed the locking codes, a mutex should be unlocked before destroying it
alex
parents:
11852
diff
changeset
|
1459 |
3465 | 1460 #ifndef GARBAGE |
128 | 1461 pthread_mutex_destroy(&(cs->mutex)); |
3465 | 1462 // released by GarbageCollector in my_relase otherwise |
1463 #endif | |
1464 my_release(cs); | |
2579 | 1465 #ifdef CRITSECS_NEWTYPE |
1466 { | |
3465 | 1467 int i = critsecs_get_pos(c); |
1468 | |
1469 if (i < 0) | |
1470 { | |
1471 printf("DeleteCriticalSection(%p) error (critsec not found)\n", c); | |
1472 return; | |
1473 } | |
1474 | |
1475 critsecs_list[i].cs_win = NULL; | |
1476 expfree(critsecs_list[i].cs_unix); | |
1477 critsecs_list[i].cs_unix = NULL; | |
1478 dbgprintf("DeleteCriticalSection -> itemno=%d\n", i); | |
2579 | 1479 } |
1480 #endif | |
1 | 1481 return; |
1482 } | |
3465 | 1483 static int WINAPI expGetCurrentThreadId() |
1 | 1484 { |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1485 dbgprintf("GetCurrentThreadId() => %d\n", pthread_self()); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1486 return pthread_self(); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1487 } |
3465 | 1488 static int WINAPI expGetCurrentProcess() |
128 | 1489 { |
1490 dbgprintf("GetCurrentProcess() => %d\n", getpid()); | |
1 | 1491 return getpid(); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1492 } |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1493 |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1494 #ifdef QTX |
3128 | 1495 // this version is required for Quicktime codecs (.qtx/.qts) to work. |
1496 // (they assume some pointers at FS: segment) | |
1497 | |
7386 | 1498 extern void* fs_seg; |
1499 | |
2779 | 1500 //static int tls_count; |
1501 static int tls_use_map[64]; | |
3465 | 1502 static int WINAPI expTlsAlloc() |
2779 | 1503 { |
1504 int i; | |
1505 for(i=0; i<64; i++) | |
1506 if(tls_use_map[i]==0) | |
1507 { | |
1508 tls_use_map[i]=1; | |
5234 | 1509 dbgprintf("TlsAlloc() => %d\n",i); |
2779 | 1510 return i; |
1511 } | |
5234 | 1512 dbgprintf("TlsAlloc() => -1 (ERROR)\n"); |
2779 | 1513 return -1; |
1514 } | |
1515 | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1516 //static int WINAPI expTlsSetValue(DWORD index, void* value) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1517 static int WINAPI expTlsSetValue(int index, void* value) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1518 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
1519 dbgprintf("TlsSetValue(%d,0x%x) => 1\n",index,value); |
5234 | 1520 // if((index<0) || (index>64)) |
1521 if((index>=64)) | |
2779 | 1522 return 0; |
1523 *(void**)((char*)fs_seg+0x88+4*index) = value; | |
1524 return 1; | |
1525 } | |
1526 | |
5234 | 1527 static void* WINAPI expTlsGetValue(DWORD index) |
1528 { | |
1529 dbgprintf("TlsGetValue(%d)\n",index); | |
1530 // if((index<0) || (index>64)) | |
1531 if((index>=64)) return NULL; | |
1532 return *(void**)((char*)fs_seg+0x88+4*index); | |
2779 | 1533 } |
1534 | |
3465 | 1535 static int WINAPI expTlsFree(int idx) |
2779 | 1536 { |
3465 | 1537 int index = (int) idx; |
5234 | 1538 dbgprintf("TlsFree(%d)\n",index); |
2779 | 1539 if((index<0) || (index>64)) |
1540 return 0; | |
1541 tls_use_map[index]=0; | |
1542 return 1; | |
1543 } | |
1544 | |
1545 #else | |
2069 | 1546 struct tls_s { |
1 | 1547 void* value; |
1548 int used; | |
1549 struct tls_s* prev; | |
1550 struct tls_s* next; | |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1551 }; |
2069 | 1552 |
3465 | 1553 static void* WINAPI expTlsAlloc() |
1 | 1554 { |
7386 | 1555 if (g_tls == NULL) |
1 | 1556 { |
1557 g_tls=my_mreq(sizeof(tls_t), 0); | |
1558 g_tls->next=g_tls->prev=NULL; | |
1559 } | |
1560 else | |
1561 { | |
1562 g_tls->next=my_mreq(sizeof(tls_t), 0); | |
1563 g_tls->next->prev=g_tls; | |
1564 g_tls->next->next=NULL; | |
1565 g_tls=g_tls->next; | |
1566 } | |
128 | 1567 dbgprintf("TlsAlloc() => 0x%x\n", g_tls); |
2670 | 1568 if (g_tls) |
1569 g_tls->value=0; /* XXX For Divx.dll */ | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1570 return g_tls; |
1 | 1571 } |
1572 | |
3465 | 1573 static int WINAPI expTlsSetValue(void* idx, void* value) |
1 | 1574 { |
3465 | 1575 tls_t* index = (tls_t*) idx; |
128 | 1576 int result; |
1 | 1577 if(index==0) |
128 | 1578 result=0; |
1579 else | |
1580 { | |
1581 index->value=value; | |
1582 result=1; | |
1583 } | |
1584 dbgprintf("TlsSetValue(index 0x%x, value 0x%x) => %d \n", index, value, result ); | |
1585 return result; | |
1 | 1586 } |
3465 | 1587 static void* WINAPI expTlsGetValue(void* idx) |
1 | 1588 { |
3465 | 1589 tls_t* index = (tls_t*) idx; |
128 | 1590 void* result; |
1 | 1591 if(index==0) |
128 | 1592 result=0; |
1593 else | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1594 result=index->value; |
128 | 1595 dbgprintf("TlsGetValue(index 0x%x) => 0x%x\n", index, result); |
1596 return result; | |
1 | 1597 } |
3465 | 1598 static int WINAPI expTlsFree(void* idx) |
1 | 1599 { |
3465 | 1600 tls_t* index = (tls_t*) idx; |
128 | 1601 int result; |
1 | 1602 if(index==0) |
128 | 1603 result=0; |
1604 else | |
1605 { | |
1606 if(index->next) | |
1607 index->next->prev=index->prev; | |
1608 if(index->prev) | |
3465 | 1609 index->prev->next=index->next; |
7386 | 1610 if (g_tls == index) |
1611 g_tls = index->prev; | |
128 | 1612 my_release((void*)index); |
1613 result=1; | |
1614 } | |
1615 dbgprintf("TlsFree(index 0x%x) => %d\n", index, result); | |
1616 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1617 } |
2779 | 1618 #endif |
1619 | |
3465 | 1620 static void* WINAPI expLocalAlloc(int flags, int size) |
1 | 1621 { |
3465 | 1622 void* z = my_mreq(size, (flags & GMEM_ZEROINIT)); |
1623 if (z == 0) | |
1 | 1624 printf("LocalAlloc() failed\n"); |
128 | 1625 dbgprintf("LocalAlloc(%d, flags 0x%x) => 0x%x\n", size, flags, z); |
1 | 1626 return z; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1627 } |
2069 | 1628 |
3465 | 1629 static void* WINAPI expLocalReAlloc(int handle,int size, int flags) |
2069 | 1630 { |
3465 | 1631 void *newpointer; |
1632 int oldsize; | |
1633 | |
1634 newpointer=NULL; | |
1635 if (flags & LMEM_MODIFY) { | |
1636 dbgprintf("LocalReAlloc MODIFY\n"); | |
1637 return (void *)handle; | |
1638 } | |
1639 oldsize = my_size((void *)handle); | |
1640 newpointer = my_realloc((void *)handle,size); | |
1641 dbgprintf("LocalReAlloc(%x %d(old %d), flags 0x%x) => 0x%x\n", handle,size,oldsize, flags,newpointer); | |
1642 | |
1643 return newpointer; | |
2069 | 1644 } |
1645 | |
3465 | 1646 static void* WINAPI expLocalLock(void* z) |
1 | 1647 { |
128 | 1648 dbgprintf("LocalLock(0x%x) => 0x%x\n", z, z); |
1 | 1649 return z; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1650 } |
128 | 1651 |
3465 | 1652 static void* WINAPI expGlobalAlloc(int flags, int size) |
1 | 1653 { |
1654 void* z; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1655 dbgprintf("GlobalAlloc(%d, flags 0x%X)\n", size, flags); |
3465 | 1656 |
1657 z=my_mreq(size, (flags & GMEM_ZEROINIT)); | |
1658 //z=calloc(size, 1); | |
1659 //z=malloc(size); | |
1 | 1660 if(z==0) |
128 | 1661 printf("GlobalAlloc() failed\n"); |
1662 dbgprintf("GlobalAlloc(%d, flags 0x%x) => 0x%x\n", size, flags, z); | |
1 | 1663 return z; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1664 } |
3465 | 1665 static void* WINAPI expGlobalLock(void* z) |
1 | 1666 { |
128 | 1667 dbgprintf("GlobalLock(0x%x) => 0x%x\n", z, z); |
1 | 1668 return z; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1669 } |
3128 | 1670 // pvmjpg20 - but doesn't work anyway |
3465 | 1671 static int WINAPI expGlobalSize(void* amem) |
3128 | 1672 { |
1673 int size = 100000; | |
1674 #ifdef GARBAGE | |
1675 alloc_header* header = last_alloc; | |
1676 alloc_header* mem = (alloc_header*) amem - 1; | |
1677 if (amem == 0) | |
3465 | 1678 return 0; |
3128 | 1679 pthread_mutex_lock(&memmut); |
1680 while (header) | |
1681 { | |
3465 | 1682 if (header->deadbeef != 0xdeadbeef) |
1683 { | |
12258
25310086fc95
Less verbosity by moving some debug messages from printf --> dbgprintf.
diego
parents:
12074
diff
changeset
|
1684 dbgprintf("FATAL found corrupted memory! %p 0x%lx (%d)\n", header, header->deadbeef, alccnt); |
3465 | 1685 break; |
1686 } | |
1687 | |
1688 if (header == mem) | |
1689 { | |
1690 size = header->size; | |
1691 break; | |
1692 } | |
1693 | |
1694 header = header->prev; | |
3128 | 1695 } |
1696 pthread_mutex_unlock(&memmut); | |
1697 #endif | |
1698 | |
1699 dbgprintf("GlobalSize(0x%x)\n", amem); | |
1700 return size; | |
1701 } | |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
1702 |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
1703 static int WINAPI expLoadIconA( long hinstance, char *name ) |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
1704 { |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
1705 dbgprintf("LoadIconA( %ld, 0x%x ) => 1\n",hinstance,name); |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
1706 return 1; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
1707 } |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
1708 |
3465 | 1709 static int WINAPI expLoadStringA(long instance, long id, void* buf, long size) |
1 | 1710 { |
128 | 1711 int result=LoadStringA(instance, id, buf, size); |
3465 | 1712 // if(buf) |
128 | 1713 dbgprintf("LoadStringA(instance 0x%x, id 0x%x, buffer 0x%x, size %d) => %d ( %s )\n", |
3465 | 1714 instance, id, buf, size, result, buf); |
1715 // else | |
1716 // dbgprintf("LoadStringA(instance 0x%x, id 0x%x, buffer 0x%x, size %d) => %d\n", | |
1717 // instance, id, buf, size, result); | |
128 | 1718 return result; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1719 } |
1 | 1720 |
3465 | 1721 static long WINAPI expMultiByteToWideChar(long v1, long v2, char* s1, long siz1, short* s2, int siz2) |
1 | 1722 { |
1723 #warning FIXME | |
128 | 1724 int i; |
1725 int result; | |
1 | 1726 if(s2==0) |
3465 | 1727 result=1; |
128 | 1728 else |
1729 { | |
3465 | 1730 if(siz1>siz2/2)siz1=siz2/2; |
1731 for(i=1; i<=siz1; i++) | |
1732 { | |
1733 *s2=*s1; | |
1734 if(!*s1)break; | |
1735 s2++; | |
1736 s1++; | |
1737 } | |
1738 result=i; | |
128 | 1739 } |
1740 if(s1) | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1741 dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string 0x%x='%s'," |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1742 "size %d, dest buffer 0x%x, dest size %d) => %d\n", |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1743 v1, v2, s1, s1, siz1, s2, siz2, result); |
128 | 1744 else |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1745 dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string NULL," |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1746 "size %d, dest buffer 0x%x, dest size %d) =>\n", |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1747 v1, v2, siz1, s2, siz2, result); |
128 | 1748 return result; |
1749 } | |
1750 static void wch_print(const short* str) | |
1751 { | |
1752 dbgprintf(" src: "); | |
1753 while(*str)dbgprintf("%c", *str++); | |
1754 dbgprintf("\n"); | |
1 | 1755 } |
3465 | 1756 static long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1, |
1757 char* s2, int siz2, char* c3, int* siz3) | |
1 | 1758 { |
1759 int result; | |
128 | 1760 dbgprintf("WideCharToMultiByte(codepage %d, flags 0x%x, src 0x%x, src size %d, " |
3465 | 1761 "dest 0x%x, dest size %d, defch 0x%x, used_defch 0x%x)", v1, v2, s1, siz1, s2, siz2, c3, siz3); |
1 | 1762 result=WideCharToMultiByte(v1, v2, s1, siz1, s2, siz2, c3, siz3); |
1763 dbgprintf("=> %d\n", result); | |
2069 | 1764 //if(s1)wch_print(s1); |
128 | 1765 if(s2)dbgprintf(" dest: %s\n", s2); |
1 | 1766 return result; |
1767 } | |
3465 | 1768 static long WINAPI expGetVersionExA(OSVERSIONINFOA* c) |
1 | 1769 { |
128 | 1770 dbgprintf("GetVersionExA(0x%x) => 1\n"); |
1771 c->dwOSVersionInfoSize=sizeof(*c); | |
1 | 1772 c->dwMajorVersion=4; |
128 | 1773 c->dwMinorVersion=0; |
1774 c->dwBuildNumber=0x4000457; | |
5234 | 1775 #if 1 |
2069 | 1776 // leave it here for testing win9x-only codecs |
1 | 1777 c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS; |
128 | 1778 strcpy(c->szCSDVersion, " B"); |
2069 | 1779 #else |
1780 c->dwPlatformId=VER_PLATFORM_WIN32_NT; // let's not make DLL assume that it can read CR* registers | |
1781 strcpy(c->szCSDVersion, "Service Pack 3"); | |
1782 #endif | |
128 | 1783 dbgprintf(" Major version: 4\n Minor version: 0\n Build number: 0x4000457\n" |
3465 | 1784 " Platform Id: VER_PLATFORM_WIN32_NT\n Version string: 'Service Pack 3'\n"); |
1 | 1785 return 1; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1786 } |
3465 | 1787 static HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, |
1788 long max_count, char* name) | |
1 | 1789 { |
128 | 1790 pthread_mutex_t *pm; |
1791 pthread_cond_t *pc; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1792 mutex_list* pp; |
3465 | 1793 /* |
1794 printf("CreateSemaphoreA(%p = %s)\n", name, (name ? name : "<null>")); | |
1795 pp=mlist; | |
1796 while(pp) | |
1797 { | |
1798 printf("%p => ", pp); | |
1799 pp=pp->prev; | |
1800 } | |
1801 printf("0\n"); | |
1802 */ | |
128 | 1803 if(mlist!=NULL) |
1 | 1804 { |
128 | 1805 mutex_list* pp=mlist; |
1806 if(name!=NULL) | |
3465 | 1807 do |
128 | 1808 { |
1809 if((strcmp(pp->name, name)==0) && (pp->type==1)) | |
1810 { | |
3465 | 1811 dbgprintf("CreateSemaphoreA(0x%x, init_count %d, max_count %d, name 0x%x='%s') => 0x%x\n", |
1812 v1, init_count, max_count, name, name, mlist); | |
128 | 1813 return (HANDLE)mlist; |
1814 } | |
2069 | 1815 }while((pp=pp->prev) != NULL); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1816 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1817 pm=mreq_private(sizeof(pthread_mutex_t), 0, AREATYPE_MUTEX); |
128 | 1818 pthread_mutex_init(pm, NULL); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1819 pc=mreq_private(sizeof(pthread_cond_t), 0, AREATYPE_COND); |
128 | 1820 pthread_cond_init(pc, NULL); |
1821 if(mlist==NULL) | |
1822 { | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1823 mlist=mreq_private(sizeof(mutex_list), 00, AREATYPE_EVENT); |
128 | 1824 mlist->next=mlist->prev=NULL; |
1825 } | |
1826 else | |
1 | 1827 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1828 mlist->next=mreq_private(sizeof(mutex_list), 00, AREATYPE_EVENT); |
128 | 1829 mlist->next->prev=mlist; |
1830 mlist->next->next=NULL; | |
1831 mlist=mlist->next; | |
3465 | 1832 // printf("new semaphore %p\n", mlist); |
1 | 1833 } |
128 | 1834 mlist->type=1; /* Type Semaphore */ |
1835 mlist->pm=pm; | |
1836 mlist->pc=pc; | |
1837 mlist->state=0; | |
1838 mlist->reset=0; | |
1839 mlist->semaphore=init_count; | |
1840 if(name!=NULL) | |
3465 | 1841 strncpy(mlist->name, name, 64); |
128 | 1842 else |
1843 mlist->name[0]=0; | |
1844 if(pm==NULL) | |
1845 dbgprintf("ERROR::: CreateSemaphoreA failure\n"); | |
1846 if(name) | |
3465 | 1847 dbgprintf("CreateSemaphoreA(0x%x, init_count %d, max_count %d, name 0x%x='%s') => 0x%x\n", |
1848 v1, init_count, max_count, name, name, mlist); | |
128 | 1849 else |
3465 | 1850 dbgprintf("CreateSemaphoreA(0x%x, init_count %d, max_count %d, name 0) => 0x%x\n", |
1851 v1, init_count, max_count, mlist); | |
128 | 1852 return (HANDLE)mlist; |
1 | 1853 } |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1854 |
3465 | 1855 static long WINAPI expReleaseSemaphore(long hsem, long increment, long* prev_count) |
1 | 1856 { |
3465 | 1857 // The state of a semaphore object is signaled when its count |
1858 // is greater than zero and nonsignaled when its count is equal to zero | |
1859 // Each time a waiting thread is released because of the semaphore's signaled | |
1860 // state, the count of the semaphore is decreased by one. | |
128 | 1861 mutex_list *ml = (mutex_list *)hsem; |
1 | 1862 |
128 | 1863 pthread_mutex_lock(ml->pm); |
1864 if (prev_count != 0) *prev_count = ml->semaphore; | |
1865 if (ml->semaphore == 0) pthread_cond_signal(ml->pc); | |
1866 ml->semaphore += increment; | |
1867 pthread_mutex_unlock(ml->pm); | |
1868 dbgprintf("ReleaseSemaphore(semaphore 0x%x, increment %d, prev_count 0x%x) => 1\n", | |
3465 | 1869 hsem, increment, prev_count); |
128 | 1870 return 1; |
1 | 1871 } |
1872 | |
1873 | |
3465 | 1874 static long WINAPI expRegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey) |
1 | 1875 { |
128 | 1876 long result=RegOpenKeyExA(key, subkey, reserved, access, newkey); |
1877 dbgprintf("RegOpenKeyExA(key 0x%x, subkey %s, reserved %d, access 0x%x, pnewkey 0x%x) => %d\n", | |
3465 | 1878 key, subkey, reserved, access, newkey, result); |
128 | 1879 if(newkey)dbgprintf(" New key: 0x%x\n", *newkey); |
1880 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1881 } |
3465 | 1882 static long WINAPI expRegCloseKey(long key) |
1 | 1883 { |
128 | 1884 long result=RegCloseKey(key); |
1885 dbgprintf("RegCloseKey(0x%x) => %d\n", key, result); | |
1886 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1887 } |
3465 | 1888 static long WINAPI expRegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count) |
1 | 1889 { |
128 | 1890 long result=RegQueryValueExA(key, value, reserved, type, data, count); |
1891 dbgprintf("RegQueryValueExA(key 0x%x, value %s, reserved 0x%x, data 0x%x, count 0x%x)" | |
3465 | 1892 " => 0x%x\n", key, value, reserved, data, count, result); |
128 | 1893 if(data && count)dbgprintf(" read %d bytes: '%s'\n", *count, data); |
1894 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1895 } |
12059
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
1896 |
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
1897 //from wine source dlls/advapi32/registry.c |
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
1898 static long WINAPI expRegCreateKeyA(long hkey, const char* name, int *retkey) |
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
1899 { |
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
1900 dbgprintf("RegCreateKeyA(key 0x%x, name 0x%x='%s',newkey=0x%x)\n",hkey,name,retkey); |
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
1901 return RegCreateKeyExA( hkey, name, 0, NULL,REG_OPTION_NON_VOLATILE, |
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
1902 KEY_ALL_ACCESS , NULL, retkey, NULL ); |
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
1903 } |
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
1904 |
3465 | 1905 static long WINAPI expRegCreateKeyExA(long key, const char* name, long reserved, |
1906 void* classs, long options, long security, | |
1907 void* sec_attr, int* newkey, int* status) | |
1 | 1908 { |
128 | 1909 long result=RegCreateKeyExA(key, name, reserved, classs, options, security, sec_attr, newkey, status); |
1910 dbgprintf("RegCreateKeyExA(key 0x%x, name 0x%x='%s', reserved=0x%x," | |
3465 | 1911 " 0x%x, 0x%x, 0x%x, newkey=0x%x, status=0x%x) => %d\n", |
1912 key, name, name, reserved, classs, options, security, sec_attr, newkey, status, result); | |
128 | 1913 if(!result && newkey) dbgprintf(" New key: 0x%x\n", *newkey); |
1914 if(!result && status) dbgprintf(" New key status: 0x%x\n", *status); | |
1915 return result; | |
1 | 1916 } |
3465 | 1917 static long WINAPI expRegSetValueExA(long key, const char* name, long v1, long v2, void* data, long size) |
1 | 1918 { |
128 | 1919 long result=RegSetValueExA(key, name, v1, v2, data, size); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1920 dbgprintf("RegSetValueExA(key 0x%x, name '%s', 0x%x, 0x%x, data 0x%x -> 0x%x '%s', size=%d) => %d", |
3465 | 1921 key, name, v1, v2, data, *(int*)data, data, size, result); |
128 | 1922 return result; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1923 } |
1 | 1924 |
3465 | 1925 static long WINAPI expRegOpenKeyA (long hKey, LPCSTR lpSubKey, int* phkResult) |
3134 | 1926 { |
128 | 1927 long result=RegOpenKeyExA(hKey, lpSubKey, 0, 0, phkResult); |
1928 dbgprintf("RegOpenKeyExA(key 0x%x, subkey '%s', 0x%x) => %d\n", | |
3465 | 1929 hKey, lpSubKey, phkResult, result); |
128 | 1930 if(!result && phkResult) dbgprintf(" New key: 0x%x\n", *phkResult); |
1931 return result; | |
1 | 1932 } |
1933 | |
3465 | 1934 static DWORD WINAPI expRegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count, |
1935 LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count) | |
2069 | 1936 { |
1937 return RegEnumValueA(hkey, index, value, val_count, | |
1938 reserved, type, data, count); | |
1939 } | |
1940 | |
3465 | 1941 static DWORD WINAPI expRegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcbName, |
1942 LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcbClass, | |
1943 LPFILETIME lpftLastWriteTime) | |
1944 { | |
1945 return RegEnumKeyExA(hKey, dwIndex, lpName, lpcbName, lpReserved, lpClass, | |
1946 lpcbClass, lpftLastWriteTime); | |
1947 } | |
1948 | |
1949 static long WINAPI expQueryPerformanceCounter(long long* z) | |
1 | 1950 { |
1951 longcount(z); | |
128 | 1952 dbgprintf("QueryPerformanceCounter(0x%x) => 1 ( %Ld )\n", z, *z); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1953 return 1; |
1 | 1954 } |
1955 | |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1956 /* |
9896
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1957 * dummy function RegQueryInfoKeyA(), required by vss codecs |
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1958 */ |
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1959 static DWORD WINAPI expRegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDWORD reserved, |
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1960 LPDWORD subkeys, LPDWORD max_subkey, LPDWORD max_class, |
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1961 LPDWORD values, LPDWORD max_value, LPDWORD max_data, |
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1962 LPDWORD security, FILETIME *modif ) |
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1963 { |
13182 | 1964 return ERROR_SUCCESS; |
9896
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1965 } |
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1966 |
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
1967 /* |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1968 * return CPU clock (in kHz), using linux's /proc filesystem (/proc/cpuinfo) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1969 */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1970 static double linux_cpuinfo_freq() |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1971 { |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1972 double freq=-1; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1973 FILE *f; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1974 char line[200]; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1975 char *s,*value; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1976 |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1977 f = fopen ("/proc/cpuinfo", "r"); |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1978 if (f != NULL) { |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1979 while (fgets(line,sizeof(line),f)!=NULL) { |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1980 /* NOTE: the ':' is the only character we can rely on */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1981 if (!(value = strchr(line,':'))) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1982 continue; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1983 /* terminate the valuename */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1984 *value++ = '\0'; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1985 /* skip any leading spaces */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1986 while (*value==' ') value++; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1987 if ((s=strchr(value,'\n'))) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1988 *s='\0'; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1989 |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1990 if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz")) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1991 && sscanf(value, "%lf", &freq) == 1) { |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1992 freq*=1000; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1993 break; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
1994 } |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1995 } |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1996 fclose(f); |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1997 } |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1998 return freq; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
1999 } |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2000 |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2001 |
3465 | 2002 static double solaris_kstat_freq() |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2003 { |
1679
73c8f54305b1
Add a few ifdefs, so that the code compiles on old solaris releases (2.6 and 7)
jkeil
parents:
1543
diff
changeset
|
2004 #if defined(HAVE_LIBKSTAT) && defined(KSTAT_DATA_INT32) |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2005 /* |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2006 * try to extract the CPU speed from the solaris kernel's kstat data |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2007 */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2008 kstat_ctl_t *kc; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2009 kstat_t *ksp; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2010 kstat_named_t *kdata; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2011 int mhz = 0; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2012 |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2013 kc = kstat_open(); |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2014 if (kc != NULL) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2015 { |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2016 ksp = kstat_lookup(kc, "cpu_info", 0, "cpu_info0"); |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2017 |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2018 /* kstat found and name/value pairs? */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2019 if (ksp != NULL && ksp->ks_type == KSTAT_TYPE_NAMED) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2020 { |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2021 /* read the kstat data from the kernel */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2022 if (kstat_read(kc, ksp, NULL) != -1) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2023 { |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2024 /* |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2025 * lookup desired "clock_MHz" entry, check the expected |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2026 * data type |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2027 */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2028 kdata = (kstat_named_t *)kstat_data_lookup(ksp, "clock_MHz"); |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2029 if (kdata != NULL && kdata->data_type == KSTAT_DATA_INT32) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2030 mhz = kdata->value.i32; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2031 } |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2032 } |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2033 kstat_close(kc); |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2034 } |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2035 |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2036 if (mhz > 0) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2037 return mhz * 1000.; |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2038 #endif /* HAVE_LIBKSTAT */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2039 return -1; // kstat stuff is not available, CPU freq is unknown |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2040 } |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2041 |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2042 /* |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2043 * Measure CPU freq using the pentium's time stamp counter register (TSC) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2044 */ |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2045 static double tsc_freq() |
1 | 2046 { |
128 | 2047 static double ofreq=0.0; |
2048 int i; | |
1 | 2049 int x,y; |
128 | 2050 i=time(NULL); |
2051 if (ofreq != 0.0) return ofreq; | |
1 | 2052 while(i==time(NULL)); |
2053 x=localcount(); | |
2054 i++; | |
2055 while(i==time(NULL)); | |
2056 y=localcount(); | |
128 | 2057 ofreq = (double)(y-x)/1000.; |
2058 return ofreq; | |
1 | 2059 } |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2060 |
1 | 2061 static double CPU_Freq() |
2062 { | |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2063 double freq; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2064 |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2065 if ((freq = linux_cpuinfo_freq()) > 0) |
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2066 return freq; |
1 | 2067 |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2068 if ((freq = solaris_kstat_freq()) > 0) |
1 | 2069 return freq; |
1307
d8c1b0b38edc
Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents:
1096
diff
changeset
|
2070 |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2071 return tsc_freq(); |
1 | 2072 } |
2073 | |
3465 | 2074 static long WINAPI expQueryPerformanceFrequency(long long* z) |
1 | 2075 { |
2076 *z=(long long)CPU_Freq(); | |
128 | 2077 dbgprintf("QueryPerformanceFrequency(0x%x) => 1 ( %Ld )\n", z, *z); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2078 return 1; |
1 | 2079 } |
3465 | 2080 static long WINAPI exptimeGetTime() |
1 | 2081 { |
2082 struct timeval t; | |
128 | 2083 long result; |
1 | 2084 gettimeofday(&t, 0); |
128 | 2085 result=1000*t.tv_sec+t.tv_usec/1000; |
2086 dbgprintf("timeGetTime() => %d\n", result); | |
2087 return result; | |
1 | 2088 } |
3465 | 2089 static void* WINAPI expLocalHandle(void* v) |
1 | 2090 { |
128 | 2091 dbgprintf("LocalHandle(0x%x) => 0x%x\n", v, v); |
1 | 2092 return v; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2093 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2094 |
3465 | 2095 static void* WINAPI expGlobalHandle(void* v) |
1 | 2096 { |
128 | 2097 dbgprintf("GlobalHandle(0x%x) => 0x%x\n", v, v); |
1 | 2098 return v; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2099 } |
3465 | 2100 static int WINAPI expGlobalUnlock(void* v) |
1 | 2101 { |
128 | 2102 dbgprintf("GlobalUnlock(0x%x) => 1\n", v); |
1 | 2103 return 1; |
2104 } | |
3465 | 2105 static void* WINAPI expGlobalFree(void* v) |
1 | 2106 { |
128 | 2107 dbgprintf("GlobalFree(0x%x) => 0\n", v); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2108 my_release(v); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2109 //free(v); |
1 | 2110 return 0; |
128 | 2111 } |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2112 |
3465 | 2113 static void* WINAPI expGlobalReAlloc(void* v, int size, int flags) |
128 | 2114 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2115 void* result=my_realloc(v, size); |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2116 //void* result=realloc(v, size); |
128 | 2117 dbgprintf("GlobalReAlloc(0x%x, size %d, flags 0x%x) => 0x%x\n", v,size,flags,result); |
2118 return result; | |
2119 } | |
1 | 2120 |
3465 | 2121 static int WINAPI expLocalUnlock(void* v) |
1 | 2122 { |
128 | 2123 dbgprintf("LocalUnlock(0x%x) => 1\n", v); |
1 | 2124 return 1; |
2125 } | |
3465 | 2126 // |
2127 static void* WINAPI expLocalFree(void* v) | |
1 | 2128 { |
128 | 2129 dbgprintf("LocalFree(0x%x) => 0\n", v); |
1 | 2130 my_release(v); |
2131 return 0; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2132 } |
3465 | 2133 static HRSRC WINAPI expFindResourceA(HMODULE module, char* name, char* type) |
1 | 2134 { |
3465 | 2135 HRSRC result; |
2136 | |
2137 result=FindResourceA(module, name, type); | |
4545 | 2138 dbgprintf("FindResourceA(module 0x%x, name 0x%x(%s), type 0x%x(%s)) => 0x%x\n", |
2139 module, name, HIWORD(name) ? name : "UNICODE", type, HIWORD(type) ? type : "UNICODE", result); | |
128 | 2140 return result; |
1 | 2141 } |
3465 | 2142 |
128 | 2143 extern HRSRC WINAPI LoadResource(HMODULE, HRSRC); |
3465 | 2144 static HGLOBAL WINAPI expLoadResource(HMODULE module, HRSRC res) |
1 | 2145 { |
128 | 2146 HGLOBAL result=LoadResource(module, res); |
2147 dbgprintf("LoadResource(module 0x%x, resource 0x%x) => 0x%x\n", module, res, result); | |
2148 return result; | |
1 | 2149 } |
3465 | 2150 static void* WINAPI expLockResource(long res) |
1 | 2151 { |
128 | 2152 void* result=LockResource(res); |
2153 dbgprintf("LockResource(0x%x) => 0x%x\n", res, result); | |
2154 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2155 } |
3465 | 2156 static int WINAPI expFreeResource(long res) |
1 | 2157 { |
128 | 2158 int result=FreeResource(res); |
2159 dbgprintf("FreeResource(0x%x) => %d\n", res, result); | |
2160 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2161 } |
1 | 2162 //bool fun(HANDLE) |
2163 //!0 on success | |
3465 | 2164 static int WINAPI expCloseHandle(long v1) |
1 | 2165 { |
128 | 2166 dbgprintf("CloseHandle(0x%x) => 1\n", v1); |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
2167 /* do not close stdin,stdout and stderr */ |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
2168 if (v1 > 2) |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
2169 if (!close(v1)) |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
2170 return 0; |
1 | 2171 return 1; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2172 } |
1 | 2173 |
3465 | 2174 static const char* WINAPI expGetCommandLineA() |
1 | 2175 { |
128 | 2176 dbgprintf("GetCommandLineA() => \"c:\\aviplay.exe\"\n"); |
1 | 2177 return "c:\\aviplay.exe"; |
2178 } | |
128 | 2179 static short envs[]={'p', 'a', 't', 'h', ' ', 'c', ':', '\\', 0, 0}; |
3465 | 2180 static LPWSTR WINAPI expGetEnvironmentStringsW() |
1 | 2181 { |
3465 | 2182 dbgprintf("GetEnvironmentStringsW() => 0\n", envs); |
2183 return 0; | |
1 | 2184 } |
3465 | 2185 static void * WINAPI expRtlZeroMemory(void *p, size_t len) |
121 | 2186 { |
2187 void* result=memset(p,0,len); | |
2188 dbgprintf("RtlZeroMemory(0x%x, len %d) => 0x%x\n",p,len,result); | |
2189 return result; | |
2190 } | |
3465 | 2191 static void * WINAPI expRtlMoveMemory(void *dst, void *src, size_t len) |
121 | 2192 { |
2193 void* result=memmove(dst,src,len); | |
2194 dbgprintf("RtlMoveMemory (dest 0x%x, src 0x%x, len %d) => 0x%x\n",dst,src,len,result); | |
2195 return result; | |
2196 } | |
2197 | |
3465 | 2198 static void * WINAPI expRtlFillMemory(void *p, int ch, size_t len) |
121 | 2199 { |
2200 void* result=memset(p,ch,len); | |
2201 dbgprintf("RtlFillMemory(0x%x, char 0x%x, len %d) => 0x%x\n",p,ch,len,result); | |
2202 return result; | |
2203 } | |
3465 | 2204 static int WINAPI expFreeEnvironmentStringsW(short* strings) |
1 | 2205 { |
128 | 2206 dbgprintf("FreeEnvironmentStringsW(0x%x) => 1\n", strings); |
1 | 2207 return 1; |
2208 } | |
3465 | 2209 static int WINAPI expFreeEnvironmentStringsA(char* strings) |
128 | 2210 { |
3465 | 2211 dbgprintf("FreeEnvironmentStringsA(0x%x) => 1\n", strings); |
2212 return 1; | |
128 | 2213 } |
3465 | 2214 |
128 | 2215 static const char ch_envs[]= |
3465 | 2216 "__MSVCRT_HEAP_SELECT=__GLOBAL_HEAP_SELECTED,1\r\n" |
2217 "PATH=C:\\;C:\\windows\\;C:\\windows\\system\r\n"; | |
2218 static LPCSTR WINAPI expGetEnvironmentStrings() | |
1 | 2219 { |
128 | 2220 dbgprintf("GetEnvironmentStrings() => 0x%x\n", ch_envs); |
2221 return (LPCSTR)ch_envs; | |
3465 | 2222 // dbgprintf("GetEnvironmentStrings() => 0\n"); |
2223 // return 0; | |
1 | 2224 } |
2225 | |
3465 | 2226 static int WINAPI expGetStartupInfoA(STARTUPINFOA *s) |
1 | 2227 { |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2228 int i; |
128 | 2229 dbgprintf("GetStartupInfoA(0x%x) => 1\n"); |
1 | 2230 memset(s, 0, sizeof(*s)); |
2231 s->cb=sizeof(*s); | |
3465 | 2232 // s->lpReserved="Reserved"; |
2233 // s->lpDesktop="Desktop"; | |
2234 // s->lpTitle="Title"; | |
2235 // s->dwX=s->dwY=0; | |
2236 // s->dwXSize=s->dwYSize=200; | |
2237 s->dwFlags=s->wShowWindow=1; | |
2238 // s->hStdInput=s->hStdOutput=s->hStdError=0x1234; | |
128 | 2239 dbgprintf(" cb=%d\n", s->cb); |
2240 dbgprintf(" lpReserved='%s'\n", s->lpReserved); | |
2241 dbgprintf(" lpDesktop='%s'\n", s->lpDesktop); | |
2242 dbgprintf(" lpTitle='%s'\n", s->lpTitle); | |
2243 dbgprintf(" dwX=%d dwY=%d dwXSize=%d dwYSize=%d\n", | |
3465 | 2244 s->dwX, s->dwY, s->dwXSize, s->dwYSize); |
128 | 2245 dbgprintf(" dwXCountChars=%d dwYCountChars=%d dwFillAttribute=%d\n", |
3465 | 2246 s->dwXCountChars, s->dwYCountChars, s->dwFillAttribute); |
128 | 2247 dbgprintf(" dwFlags=0x%x wShowWindow=0x%x cbReserved2=0x%x\n", |
3465 | 2248 s->dwFlags, s->wShowWindow, s->cbReserved2); |
128 | 2249 dbgprintf(" lpReserved2=0x%x hStdInput=0x%x hStdOutput=0x%x hStdError=0x%x\n", |
3465 | 2250 s->lpReserved2, s->hStdInput, s->hStdOutput, s->hStdError); |
1 | 2251 return 1; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2252 } |
1 | 2253 |
3465 | 2254 static int WINAPI expGetStdHandle(int z) |
1 | 2255 { |
3465 | 2256 dbgprintf("GetStdHandle(0x%x) => 0x%x\n", z+0x1234); |
2257 return z+0x1234; | |
1 | 2258 } |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2259 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2260 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2261 #define FILE_HANDLE_quicktimeqts ((HANDLE)0x444) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2262 #define FILE_HANDLE_quicktimeqtx ((HANDLE)0x445) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2263 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2264 |
3465 | 2265 static int WINAPI expGetFileType(int handle) |
1 | 2266 { |
3465 | 2267 dbgprintf("GetFileType(0x%x) => 0x3 = pipe\n", handle); |
2268 return 0x3; | |
1 | 2269 } |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2270 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2271 static int WINAPI expGetFileAttributesA(char *filename) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2272 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2273 dbgprintf("GetFileAttributesA(%s) => FILE_ATTR_NORMAL\n", filename); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2274 if (strstr(filename, "QuickTime.qts")) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2275 return FILE_ATTRIBUTE_SYSTEM; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2276 return FILE_ATTRIBUTE_NORMAL; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2277 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2278 #endif |
3465 | 2279 static int WINAPI expSetHandleCount(int count) |
1 | 2280 { |
128 | 2281 dbgprintf("SetHandleCount(0x%x) => 1\n", count); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2282 return 1; |
1 | 2283 } |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2284 static int WINAPI expGetACP(void) |
1 | 2285 { |
128 | 2286 dbgprintf("GetACP() => 0\n"); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2287 return 0; |
1 | 2288 } |
2289 extern WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m); | |
3465 | 2290 static int WINAPI expGetModuleFileNameA(int module, char* s, int len) |
1 | 2291 { |
2292 WINE_MODREF *mr; | |
128 | 2293 int result; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2294 //printf("File name of module %X (%s) requested\n", module, s); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2295 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2296 if (module == 0 && len >= 12) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2297 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2298 /* return caller program name */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2299 strcpy(s, "aviplay.dll"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2300 result=1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2301 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2302 else if(s==0) |
128 | 2303 result=0; |
2304 else | |
3465 | 2305 if(len<35) |
2306 result=0; | |
128 | 2307 else |
3465 | 2308 { |
2309 result=1; | |
2310 strcpy(s, "c:\\windows\\system\\"); | |
2311 mr=MODULE32_LookupHMODULE(module); | |
2312 if(mr==0)//oops | |
2313 strcat(s, "aviplay.dll"); | |
2314 else | |
2315 if(strrchr(mr->filename, '/')==NULL) | |
2316 strcat(s, mr->filename); | |
2317 else | |
2318 strcat(s, strrchr(mr->filename, '/')+1); | |
2319 } | |
128 | 2320 if(!s) |
3465 | 2321 dbgprintf("GetModuleFileNameA(0x%x, 0x%x, %d) => %d\n", |
2322 module, s, len, result); | |
1 | 2323 else |
3465 | 2324 dbgprintf("GetModuleFileNameA(0x%x, 0x%x, %d) => %d ( '%s' )\n", |
2325 module, s, len, result, s); | |
128 | 2326 return result; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2327 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2328 |
3465 | 2329 static int WINAPI expSetUnhandledExceptionFilter(void* filter) |
1 | 2330 { |
128 | 2331 dbgprintf("SetUnhandledExceptionFilter(0x%x) => 1\n", filter); |
1 | 2332 return 1;//unsupported and probably won't ever be supported |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2333 } |
2069 | 2334 |
3465 | 2335 static int WINAPI expLoadLibraryA(char* name) |
1 | 2336 { |
2069 | 2337 int result = 0; |
713 | 2338 char* lastbc; |
2069 | 2339 int i; |
713 | 2340 if (!name) |
2341 return -1; | |
2342 // we skip to the last backslash | |
2343 // this is effectively eliminating weird characters in | |
2344 // the text output windows | |
2069 | 2345 |
713 | 2346 lastbc = strrchr(name, '\\'); |
2347 if (lastbc) | |
2348 { | |
3465 | 2349 int i; |
2350 lastbc++; | |
713 | 2351 for (i = 0; 1 ;i++) |
2352 { | |
2353 name[i] = *lastbc++; | |
2354 if (!name[i]) | |
2355 break; | |
2356 } | |
2357 } | |
2069 | 2358 if(strncmp(name, "c:\\windows\\", 11)==0) name += 11; |
1416 | 2359 if(strncmp(name, ".\\", 2)==0) name += 2; |
2069 | 2360 |
2361 dbgprintf("Entering LoadLibraryA(%s)\n", name); | |
3465 | 2362 |
3440 | 2363 // PIMJ and VIVO audio are loading kernel32.dll |
2364 if (strcasecmp(name, "kernel32.dll") == 0 || strcasecmp(name, "kernel32") == 0) | |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
2365 return MODULE_HANDLE_kernel32; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
2366 // return ERROR_SUCCESS; /* yeah, we have also the kernel32 calls */ |
3457 | 2367 /* exported -> do not return failed! */ |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2368 |
5234 | 2369 if (strcasecmp(name, "user32.dll") == 0 || strcasecmp(name, "user32") == 0) |
2370 // return MODULE_HANDLE_kernel32; | |
2371 return MODULE_HANDLE_user32; | |
2372 | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2373 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2374 if (strcasecmp(name, "wininet.dll") == 0 || strcasecmp(name, "wininet") == 0) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2375 return MODULE_HANDLE_wininet; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2376 if (strcasecmp(name, "ddraw.dll") == 0 || strcasecmp(name, "ddraw") == 0) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2377 return MODULE_HANDLE_ddraw; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2378 if (strcasecmp(name, "advapi32.dll") == 0 || strcasecmp(name, "advapi32") == 0) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2379 return MODULE_HANDLE_advapi32; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2380 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2381 |
10818
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2382 if (strcasecmp(name, "comdlg32.dll") == 0 || strcasecmp(name, "comdlg32") == 0) |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2383 return MODULE_HANDLE_comdlg32; |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2384 if (strcasecmp(name, "msvcrt.dll") == 0 || strcasecmp(name, "msvcrt") == 0) |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2385 return MODULE_HANDLE_msvcrt; |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2386 if (strcasecmp(name, "ole32.dll") == 0 || strcasecmp(name, "ole32") == 0) |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2387 return MODULE_HANDLE_ole32; |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2388 if (strcasecmp(name, "winmm.dll") == 0 || strcasecmp(name, "winmm") == 0) |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2389 return MODULE_HANDLE_winmm; |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2390 |
2069 | 2391 result=LoadLibraryA(name); |
2392 dbgprintf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result); | |
2393 | |
128 | 2394 return result; |
2069 | 2395 } |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2396 |
3465 | 2397 static int WINAPI expFreeLibrary(int module) |
1 | 2398 { |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2399 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2400 int result=0; /* FIXME:XXX: qtx svq3 frees up qt.qts */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2401 #else |
128 | 2402 int result=FreeLibrary(module); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2403 #endif |
128 | 2404 dbgprintf("FreeLibrary(0x%x) => %d\n", module, result); |
2405 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2406 } |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2407 |
3465 | 2408 static void* WINAPI expGetProcAddress(HMODULE mod, char* name) |
1 | 2409 { |
2069 | 2410 void* result; |
5234 | 2411 switch(mod){ |
2412 case MODULE_HANDLE_kernel32: | |
2413 result=LookupExternalByName("kernel32.dll", name); break; | |
2414 case MODULE_HANDLE_user32: | |
2415 result=LookupExternalByName("user32.dll", name); break; | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2416 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2417 case MODULE_HANDLE_wininet: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2418 result=LookupExternalByName("wininet.dll", name); break; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2419 case MODULE_HANDLE_ddraw: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2420 result=LookupExternalByName("ddraw.dll", name); break; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2421 case MODULE_HANDLE_advapi32: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2422 result=LookupExternalByName("advapi32.dll", name); break; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2423 #endif |
10818
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2424 case MODULE_HANDLE_comdlg32: |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2425 result=LookupExternalByName("comdlg32.dll", name); break; |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2426 case MODULE_HANDLE_msvcrt: |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2427 result=LookupExternalByName("msvcrt.dll", name); break; |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2428 case MODULE_HANDLE_ole32: |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2429 result=LookupExternalByName("ole32.dll", name); break; |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2430 case MODULE_HANDLE_winmm: |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
2431 result=LookupExternalByName("winmm.dll", name); break; |
5234 | 2432 default: |
128 | 2433 result=GetProcAddress(mod, name); |
5234 | 2434 } |
128 | 2435 dbgprintf("GetProcAddress(0x%x, '%s') => 0x%x\n", mod, name, result); |
2436 return result; | |
2069 | 2437 } |
1 | 2438 |
3465 | 2439 static long WINAPI expCreateFileMappingA(int hFile, void* lpAttr, |
2440 long flProtect, long dwMaxHigh, | |
2441 long dwMaxLow, const char* name) | |
1 | 2442 { |
128 | 2443 long result=CreateFileMappingA(hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name); |
2444 if(!name) | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2445 dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x," |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2446 "flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0) => %d\n", |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2447 hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, result); |
128 | 2448 else |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2449 dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x," |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2450 "flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0x%x='%s') => %d\n", |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2451 hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name, name, result); |
128 | 2452 return result; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2453 } |
1 | 2454 |
3465 | 2455 static long WINAPI expOpenFileMappingA(long hFile, long hz, const char* name) |
1 | 2456 { |
128 | 2457 long result=OpenFileMappingA(hFile, hz, name); |
2458 if(!name) | |
2459 dbgprintf("OpenFileMappingA(0x%x, 0x%x, 0) => %d\n", | |
3465 | 2460 hFile, hz, result); |
128 | 2461 else |
2462 dbgprintf("OpenFileMappingA(0x%x, 0x%x, 0x%x='%s') => %d\n", | |
3465 | 2463 hFile, hz, name, name, result); |
128 | 2464 return result; |
1 | 2465 } |
2466 | |
3465 | 2467 static void* WINAPI expMapViewOfFile(HANDLE file, DWORD mode, DWORD offHigh, |
2468 DWORD offLow, DWORD size) | |
1 | 2469 { |
128 | 2470 dbgprintf("MapViewOfFile(0x%x, 0x%x, 0x%x, 0x%x, size %d) => 0x%x\n", |
3465 | 2471 file,mode,offHigh,offLow,size,(char*)file+offLow); |
1 | 2472 return (char*)file+offLow; |
2473 } | |
2474 | |
3465 | 2475 static void* WINAPI expUnmapViewOfFile(void* view) |
1 | 2476 { |
128 | 2477 dbgprintf("UnmapViewOfFile(0x%x) => 0\n", view); |
1 | 2478 return 0; |
2479 } | |
2480 | |
3465 | 2481 static void* WINAPI expSleep(int time) |
2482 { | |
2483 #if HAVE_NANOSLEEP | |
2484 /* solaris doesn't have thread safe usleep */ | |
2485 struct timespec tsp; | |
2486 tsp.tv_sec = time / 1000000; | |
2487 tsp.tv_nsec = (time % 1000000) * 1000; | |
2488 nanosleep(&tsp, NULL); | |
2489 #else | |
2490 usleep(time); | |
2491 #endif | |
2492 dbgprintf("Sleep(%d) => 0\n", time); | |
2493 return 0; | |
2494 } | |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
2495 |
3465 | 2496 // why does IV32 codec want to call this? I don't know ... |
2497 static int WINAPI expCreateCompatibleDC(int hdc) | |
1 | 2498 { |
3465 | 2499 int dc = 0;//0x81; |
2500 //dbgprintf("CreateCompatibleDC(%d) => 0x81\n", hdc); | |
2501 dbgprintf("CreateCompatibleDC(%d) => %d\n", hdc, dc); | |
2502 return dc; | |
2503 } | |
2504 | |
2505 static int WINAPI expGetDeviceCaps(int hdc, int unk) | |
2506 { | |
2507 dbgprintf("GetDeviceCaps(0x%x, %d) => 0\n", hdc, unk); | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2508 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2509 #define BITSPIXEL 12 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2510 #define PLANES 14 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2511 if (unk == BITSPIXEL) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2512 return 24; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2513 if (unk == PLANES) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2514 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2515 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2516 return 1; |
3465 | 2517 } |
2518 | |
2519 static WIN_BOOL WINAPI expDeleteDC(int hdc) | |
2520 { | |
2521 dbgprintf("DeleteDC(0x%x) => 0\n", hdc); | |
2522 if (hdc == 0x81) | |
2523 return 1; | |
1 | 2524 return 0; |
2525 } | |
3465 | 2526 |
2527 static WIN_BOOL WINAPI expDeleteObject(int hdc) | |
1 | 2528 { |
3465 | 2529 dbgprintf("DeleteObject(0x%x) => 1\n", hdc); |
2530 /* FIXME - implement code here */ | |
2531 return 1; | |
1 | 2532 } |
2533 | |
3465 | 2534 /* btvvc32.drv wants this one */ |
2535 static void* WINAPI expGetWindowDC(int hdc) | |
1 | 2536 { |
3465 | 2537 dbgprintf("GetWindowDC(%d) => 0x0\n", hdc); |
3128 | 2538 return 0; |
2539 } | |
2540 | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2541 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2542 static int WINAPI expGetWindowRect(HWND win, RECT *r) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2543 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2544 dbgprintf("GetWindowRect(0x%x, 0x%x) => 1\n", win, r); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2545 /* (win == 0) => desktop */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2546 r->right = PSEUDO_SCREEN_WIDTH; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2547 r->left = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2548 r->bottom = PSEUDO_SCREEN_HEIGHT; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2549 r->top = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2550 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2551 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2552 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2553 static int WINAPI expMonitorFromWindow(HWND win, int flags) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2554 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2555 dbgprintf("MonitorFromWindow(0x%x, 0x%x) => 0\n", win, flags); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2556 return 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2557 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2558 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2559 static int WINAPI expMonitorFromRect(RECT *r, int flags) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2560 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2561 dbgprintf("MonitorFromRect(0x%x, 0x%x) => 0\n", r, flags); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2562 return 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2563 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2564 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2565 static int WINAPI expMonitorFromPoint(void *p, int flags) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2566 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2567 dbgprintf("MonitorFromPoint(0x%x, 0x%x) => 0\n", p, flags); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2568 return 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2569 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2570 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2571 static int WINAPI expEnumDisplayMonitors(void *dc, RECT *r, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2572 int WINAPI (*callback_proc)(), void *callback_param) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2573 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2574 dbgprintf("EnumDisplayMonitors(0x%x, 0x%x, 0x%x, 0x%x) => ?\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2575 dc, r, callback_proc, callback_param); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2576 return callback_proc(0, dc, r, callback_param); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2577 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2578 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2579 #if 0 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2580 typedef struct tagMONITORINFO { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2581 DWORD cbSize; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2582 RECT rcMonitor; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2583 RECT rcWork; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2584 DWORD dwFlags; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2585 } MONITORINFO, *LPMONITORINFO; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2586 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2587 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2588 #define CCHDEVICENAME 8 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2589 typedef struct tagMONITORINFOEX { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2590 DWORD cbSize; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2591 RECT rcMonitor; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2592 RECT rcWork; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2593 DWORD dwFlags; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2594 TCHAR szDevice[CCHDEVICENAME]; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2595 } MONITORINFOEX, *LPMONITORINFOEX; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2596 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2597 static int WINAPI expGetMonitorInfoA(void *mon, LPMONITORINFO lpmi) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2598 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2599 dbgprintf("GetMonitorInfoA(0x%x, 0x%x) => 1\n", mon, lpmi); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2600 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2601 lpmi->rcMonitor.right = lpmi->rcWork.right = PSEUDO_SCREEN_WIDTH; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2602 lpmi->rcMonitor.left = lpmi->rcWork.left = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2603 lpmi->rcMonitor.bottom = lpmi->rcWork.bottom = PSEUDO_SCREEN_HEIGHT; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2604 lpmi->rcMonitor.top = lpmi->rcWork.top = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2605 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2606 lpmi->dwFlags = 1; /* primary monitor */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2607 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2608 if (lpmi->cbSize == sizeof(MONITORINFOEX)) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2609 { |
8451 | 2610 LPMONITORINFOEX lpmiex = (LPMONITORINFOEX)lpmi; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2611 dbgprintf("MONITORINFOEX!\n"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2612 strncpy(lpmiex->szDevice, "Monitor1", CCHDEVICENAME); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2613 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2614 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2615 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2616 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2617 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2618 static int WINAPI expEnumDisplayDevicesA(const char *device, int devnum, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2619 void *dispdev, int flags) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2620 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2621 dbgprintf("EnumDisplayDevicesA(0x%x = %s, %d, 0x%x, %x) => 1\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2622 device, device, devnum, dispdev, flags); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2623 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2624 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2625 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2626 static int WINAPI expIsWindowVisible(HWND win) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2627 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2628 dbgprintf("IsWindowVisible(0x%x) => 1\n", win); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2629 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2630 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2631 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2632 static HWND WINAPI expGetActiveWindow(void) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2633 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2634 dbgprintf("GetActiveWindow() => 0\n"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2635 return (HWND)0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2636 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2637 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2638 static int WINAPI expGetClassNameA(HWND win, LPTSTR classname, int maxcount) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2639 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2640 strncat(classname, "QuickTime", maxcount); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2641 dbgprintf("GetClassNameA(0x%x, 0x%x, %d) => %d\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2642 win, classname, maxcount, strlen(classname)); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2643 return strlen(classname); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2644 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2645 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2646 #define LPWNDCLASS void * |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2647 static int WINAPI expGetClassInfoA(HINSTANCE inst, LPCSTR classname, LPWNDCLASS wndclass) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2648 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2649 dbgprintf("GetClassInfoA(0x%x, 0x%x = %s, 0x%x) => 1\n", inst, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2650 classname, classname, wndclass); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2651 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2652 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2653 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2654 static int WINAPI expGetWindowLongA(HWND win, int index) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2655 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2656 dbgprintf("GetWindowLongA(0x%x, %d) => 0\n", win, index); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2657 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2658 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2659 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2660 static int WINAPI expGetObjectA(HGDIOBJ hobj, int objsize, LPVOID obj) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2661 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2662 dbgprintf("GetObjectA(0x%x, %d, 0x%x) => %d\n", hobj, objsize, obj, objsize); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2663 return objsize; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2664 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2665 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2666 static int WINAPI expCreateRectRgn(int x, int y, int width, int height) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2667 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2668 dbgprintf("CreateRectRgn(%d, %d, %d, %d) => 0\n", x, y, width, height); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2669 return 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2670 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2671 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2672 static int WINAPI expEnumWindows(int (*callback_func)(), void *callback_param) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2673 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2674 int i, i2; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2675 dbgprintf("EnumWindows(0x%x, 0x%x) => 1\n", callback_func, callback_param); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2676 i = callback_func(0, callback_param); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2677 i2 = callback_func(1, callback_param); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2678 return i && i2; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2679 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2680 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2681 static int WINAPI expGetWindowThreadProcessId(HWND win, int *pid_data) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2682 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2683 int tid = pthread_self(); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2684 dbgprintf("GetWindowThreadProcessId(0x%x, 0x%x) => %d\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2685 win, pid_data, tid); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2686 if (pid_data) |
12374 | 2687 *(int*)pid_data = tid; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2688 return tid; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2689 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2690 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2691 //HWND WINAPI CreateWindowExA(DWORD,LPCSTR,LPCSTR,DWORD,INT,INT, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2692 // INT,INT,HWND,HMENU,HINSTANCE,LPVOID); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2693 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2694 static HWND WINAPI expCreateWindowExA(int exstyle, const char *classname, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2695 const char *winname, int style, int x, int y, int w, int h, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2696 HWND parent, HMENU menu, HINSTANCE inst, LPVOID param) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2697 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2698 printf("CreateWindowEx() called\n"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2699 dbgprintf("CreateWindowEx(%d, 0x%x = %s, 0x%x = %s, %d, %d, %d, %d, %d, 0x%x, 0x%x, 0x%x, 0x%x) => 1\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2700 exstyle, classname, classname, winname, winname, style, x, y, w, h, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2701 parent, menu, inst, param); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2702 printf("CreateWindowEx() called okey\n"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2703 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2704 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2705 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2706 static int WINAPI expwaveOutGetNumDevs(void) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2707 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2708 dbgprintf("waveOutGetNumDevs() => 0\n"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2709 return 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2710 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2711 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2712 |
3465 | 2713 /* |
2714 * Returns the number of milliseconds, modulo 2^32, since the start | |
2715 * of the wineserver. | |
2716 */ | |
2717 static int WINAPI expGetTickCount(void) | |
1 | 2718 { |
3465 | 2719 static int tcstart = 0; |
2720 struct timeval t; | |
2721 int tc; | |
2722 gettimeofday( &t, NULL ); | |
2723 tc = ((t.tv_sec * 1000) + (t.tv_usec / 1000)) - tcstart; | |
2724 if (tcstart == 0) | |
2725 { | |
2726 tcstart = 0; | |
2727 tc = 0; | |
2728 } | |
2729 dbgprintf("GetTickCount() => %d\n", tc); | |
2730 return tc; | |
1 | 2731 } |
2732 | |
3465 | 2733 static int WINAPI expCreateFontA(void) |
2734 { | |
2735 dbgprintf("CreateFontA() => 0x0\n"); | |
2736 return 1; | |
2737 } | |
2738 | |
2739 /* tried to get pvmjpg work in a different way - no success */ | |
2740 static int WINAPI expDrawTextA(int hDC, char* lpString, int nCount, | |
2741 LPRECT lpRect, unsigned int uFormat) | |
2742 { | |
2743 dbgprintf("expDrawTextA(%p,...) => 8\n", hDC); | |
2744 return 8; | |
2745 } | |
2746 | |
2747 static int WINAPI expGetPrivateProfileIntA(const char* appname, | |
2748 const char* keyname, | |
2749 int default_value, | |
2750 const char* filename) | |
1 | 2751 { |
2752 int size=255; | |
2753 char buffer[256]; | |
2754 char* fullname; | |
2755 int result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2756 |
1 | 2757 buffer[255]=0; |
128 | 2758 if(!(appname && keyname && filename) ) |
2759 { | |
3465 | 2760 dbgprintf("GetPrivateProfileIntA('%s', '%s', %d, '%s') => %d\n", appname, keyname, default_value, filename, default_value ); |
128 | 2761 return default_value; |
2762 } | |
18878 | 2763 fullname=malloc(50+strlen(appname)+strlen(keyname)+strlen(filename)); |
1 | 2764 strcpy(fullname, "Software\\IniFileMapping\\"); |
2765 strcat(fullname, appname); | |
2766 strcat(fullname, "\\"); | |
2767 strcat(fullname, keyname); | |
2768 strcat(fullname, "\\"); | |
2769 strcat(fullname, filename); | |
2770 result=RegQueryValueExA(HKEY_LOCAL_MACHINE, fullname, NULL, NULL, (int*)buffer, &size); | |
2771 if((size>=0)&&(size<256)) | |
2772 buffer[size]=0; | |
3465 | 2773 // printf("GetPrivateProfileIntA(%s, %s, %s) -> %s\n", appname, keyname, filename, buffer); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2774 free(fullname); |
1 | 2775 if(result) |
128 | 2776 result=default_value; |
1 | 2777 else |
128 | 2778 result=atoi(buffer); |
2779 dbgprintf("GetPrivateProfileIntA('%s', '%s', %d, '%s') => %d\n", appname, keyname, default_value, filename, result); | |
2780 return result; | |
1 | 2781 } |
3465 | 2782 static int WINAPI expGetProfileIntA(const char* appname, |
2783 const char* keyname, | |
2784 int default_value) | |
128 | 2785 { |
2786 dbgprintf("GetProfileIntA -> "); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2787 return expGetPrivateProfileIntA(appname, keyname, default_value, "default"); |
128 | 2788 } |
2789 | |
3465 | 2790 static int WINAPI expGetPrivateProfileStringA(const char* appname, |
2791 const char* keyname, | |
2792 const char* def_val, | |
2793 char* dest, unsigned int len, | |
2794 const char* filename) | |
1 | 2795 { |
2796 int result; | |
2797 int size; | |
2798 char* fullname; | |
128 | 2799 dbgprintf("GetPrivateProfileStringA('%s', '%s', def_val '%s', 0x%x, 0x%x, '%s')", appname, keyname, def_val, dest, len, filename ); |
1 | 2800 if(!(appname && keyname && filename) ) return 0; |
18878 | 2801 fullname=malloc(50+strlen(appname)+strlen(keyname)+strlen(filename)); |
1 | 2802 strcpy(fullname, "Software\\IniFileMapping\\"); |
2803 strcat(fullname, appname); | |
2804 strcat(fullname, "\\"); | |
2805 strcat(fullname, keyname); | |
2806 strcat(fullname, "\\"); | |
2807 strcat(fullname, filename); | |
2808 size=len; | |
2809 result=RegQueryValueExA(HKEY_LOCAL_MACHINE, fullname, NULL, NULL, (int*)dest, &size); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2810 free(fullname); |
128 | 2811 if(result) |
2812 { | |
2813 strncpy(dest, def_val, size); | |
2814 if (strlen(def_val)< size) size = strlen(def_val); | |
2815 } | |
2816 dbgprintf(" => %d ( '%s' )\n", size, dest); | |
1 | 2817 return size; |
2818 } | |
3465 | 2819 static int WINAPI expWritePrivateProfileStringA(const char* appname, |
2820 const char* keyname, | |
2821 const char* string, | |
2822 const char* filename) | |
1 | 2823 { |
2824 int size=256; | |
2825 char* fullname; | |
128 | 2826 dbgprintf("WritePrivateProfileStringA('%s', '%s', '%s', '%s')", appname, keyname, string, filename ); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2827 if(!(appname && keyname && filename) ) |
128 | 2828 { |
2829 dbgprintf(" => -1\n"); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2830 return -1; |
128 | 2831 } |
18878 | 2832 fullname=malloc(50+strlen(appname)+strlen(keyname)+strlen(filename)); |
1 | 2833 strcpy(fullname, "Software\\IniFileMapping\\"); |
2834 strcat(fullname, appname); | |
2835 strcat(fullname, "\\"); | |
2836 strcat(fullname, keyname); | |
2837 strcat(fullname, "\\"); | |
2838 strcat(fullname, filename); | |
2839 RegSetValueExA(HKEY_LOCAL_MACHINE, fullname, 0, REG_SZ, (int*)string, strlen(string)); | |
3465 | 2840 // printf("RegSetValueExA(%s,%d)\n", string, strlen(string)); |
2841 // printf("WritePrivateProfileStringA(%s, %s, %s, %s)\n", appname, keyname, string, filename ); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2842 free(fullname); |
128 | 2843 dbgprintf(" => 0\n"); |
1 | 2844 return 0; |
2845 } | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2846 |
1 | 2847 unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, INT default_value, const char* filename) |
2848 { | |
2849 return expGetPrivateProfileIntA(appname, keyname, default_value, filename); | |
2850 } | |
2851 int _GetPrivateProfileStringA(const char* appname, const char* keyname, | |
3465 | 2852 const char* def_val, char* dest, unsigned int len, const char* filename) |
1 | 2853 { |
2854 return expGetPrivateProfileStringA(appname, keyname, def_val, dest, len, filename); | |
2855 } | |
2856 int _WritePrivateProfileStringA(const char* appname, const char* keyname, | |
3465 | 2857 const char* string, const char* filename) |
1 | 2858 { |
2859 return expWritePrivateProfileStringA(appname, keyname, string, filename); | |
2860 } | |
2861 | |
2862 | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2863 |
3465 | 2864 static int WINAPI expDefDriverProc(int _private, int id, int msg, int arg1, int arg2) |
1 | 2865 { |
128 | 2866 dbgprintf("DefDriverProc(0x%x, 0x%x, 0x%x, 0x%x, 0x%x) => 0\n", _private, id, msg, arg1, arg2); |
1 | 2867 return 0; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2868 } |
1 | 2869 |
3465 | 2870 static int WINAPI expSizeofResource(int v1, int v2) |
1 | 2871 { |
128 | 2872 int result=SizeofResource(v1, v2); |
2873 dbgprintf("SizeofResource(0x%x, 0x%x) => %d\n", v1, v2, result); | |
2874 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2875 } |
1 | 2876 |
3465 | 2877 static int WINAPI expGetLastError() |
1 | 2878 { |
128 | 2879 int result=GetLastError(); |
2880 dbgprintf("GetLastError() => 0x%x\n", result); | |
2881 return result; | |
1 | 2882 } |
2883 | |
3465 | 2884 static void WINAPI expSetLastError(int error) |
1 | 2885 { |
128 | 2886 dbgprintf("SetLastError(0x%x)\n", error); |
1 | 2887 SetLastError(error); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2888 } |
1 | 2889 |
3465 | 2890 static int WINAPI expStringFromGUID2(GUID* guid, char* str, int cbMax) |
128 | 2891 { |
2069 | 2892 int result=snprintf(str, cbMax, "%.8x-%.4x-%.4x-%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", |
2893 guid->f1, guid->f2, guid->f3, | |
2894 (unsigned char)guid->f4[0], (unsigned char)guid->f4[1], | |
2895 (unsigned char)guid->f4[2], (unsigned char)guid->f4[3], | |
2896 (unsigned char)guid->f4[4], (unsigned char)guid->f4[5], | |
2897 (unsigned char)guid->f4[6], (unsigned char)guid->f4[7]); | |
128 | 2898 dbgprintf("StringFromGUID2(0x%x, 0x%x='%s', %d) => %d\n", guid, str, str, cbMax, result); |
2899 return result; | |
2900 } | |
2901 | |
1 | 2902 |
3465 | 2903 static int WINAPI expGetFileVersionInfoSizeA(const char* name, int* lpHandle) |
1 | 2904 { |
128 | 2905 dbgprintf("GetFileVersionInfoSizeA(0x%x='%s', 0x%X) => 0\n", name, name, lpHandle); |
1 | 2906 return 0; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2907 } |
1 | 2908 |
3465 | 2909 static int WINAPI expIsBadStringPtrW(const short* string, int nchars) |
1 | 2910 { |
128 | 2911 int result; |
2912 if(string==0)result=1; else result=0; | |
2913 dbgprintf("IsBadStringPtrW(0x%x, %d) => %d", string, nchars, result); | |
2914 if(string)wch_print(string); | |
2915 return result; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2916 } |
3465 | 2917 static int WINAPI expIsBadStringPtrA(const char* string, int nchars) |
3128 | 2918 { |
2919 return expIsBadStringPtrW((const short*)string, nchars); | |
2920 } | |
3465 | 2921 static long WINAPI expInterlockedExchangeAdd( long* dest, long incr ) |
1 | 2922 { |
2923 long ret; | |
3465 | 2924 __asm__ __volatile__ |
2925 ( | |
2926 "lock; xaddl %0,(%1)" | |
2927 : "=r" (ret) | |
2928 : "r" (dest), "0" (incr) | |
2929 : "memory" | |
2930 ); | |
1 | 2931 return ret; |
2932 } | |
2933 | |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2934 static long WINAPI expInterlockedCompareExchange( unsigned long* dest, unsigned long exchange, unsigned long comperand) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2935 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2936 unsigned long retval = *dest; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2937 if(*dest == comperand) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2938 *dest = exchange; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2939 return retval; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2940 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2941 |
3465 | 2942 static long WINAPI expInterlockedIncrement( long* dest ) |
1 | 2943 { |
3465 | 2944 long result=expInterlockedExchangeAdd( dest, 1 ) + 1; |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2945 dbgprintf("InterlockedIncrement(0x%x => %d) => %d\n", dest, *dest, result); |
128 | 2946 return result; |
1 | 2947 } |
3465 | 2948 static long WINAPI expInterlockedDecrement( long* dest ) |
1 | 2949 { |
3465 | 2950 long result=expInterlockedExchangeAdd( dest, -1 ) - 1; |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
2951 dbgprintf("InterlockedDecrement(0x%x => %d) => %d\n", dest, *dest, result); |
128 | 2952 return result; |
1 | 2953 } |
2954 | |
3465 | 2955 static void WINAPI expOutputDebugStringA( const char* string ) |
1 | 2956 { |
128 | 2957 dbgprintf("OutputDebugStringA(0x%x='%s')\n", string); |
1 | 2958 fprintf(stderr, "DEBUG: %s\n", string); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2959 } |
1 | 2960 |
3465 | 2961 static int WINAPI expGetDC(int hwnd) |
1 | 2962 { |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2963 dbgprintf("GetDC(0x%x) => 1\n", hwnd); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2964 return 1; |
1 | 2965 } |
2966 | |
3465 | 2967 static int WINAPI expReleaseDC(int hwnd, int hdc) |
1 | 2968 { |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2969 dbgprintf("ReleaseDC(0x%x, 0x%x) => 1\n", hwnd, hdc); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2970 return 1; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
2971 } |
3465 | 2972 |
2973 static int WINAPI expGetDesktopWindow() | |
128 | 2974 { |
3465 | 2975 dbgprintf("GetDesktopWindow() => 0\n"); |
2976 return 0; | |
128 | 2977 } |
3465 | 2978 |
2979 static int cursor[100]; | |
2980 | |
2981 static int WINAPI expLoadCursorA(int handle,LPCSTR name) | |
2982 { | |
2983 dbgprintf("LoadCursorA(%d, 0x%x='%s') => 0x%x\n", handle, name, (int)&cursor[0]); | |
2984 return (int)&cursor[0]; | |
2985 } | |
2986 static int WINAPI expSetCursor(void *cursor) | |
128 | 2987 { |
2988 dbgprintf("SetCursor(0x%x) => 0x%x\n", cursor, cursor); | |
2989 return (int)cursor; | |
2990 } | |
3465 | 2991 static int WINAPI expGetCursorPos(void *cursor) |
2069 | 2992 { |
2993 dbgprintf("GetCursorPos(0x%x) => 0x%x\n", cursor, cursor); | |
2994 return 1; | |
2995 } | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2996 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2997 static int show_cursor = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2998 static int WINAPI expShowCursor(int show) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
2999 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3000 dbgprintf("ShowCursor(%d) => %d\n", show, show); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3001 if (show) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3002 show_cursor++; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3003 else |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3004 show_cursor--; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3005 return show_cursor; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3006 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3007 #endif |
3465 | 3008 static int WINAPI expRegisterWindowMessageA(char *message) |
2069 | 3009 { |
3010 dbgprintf("RegisterWindowMessageA(%s)\n", message); | |
3011 return 1; | |
3012 } | |
3465 | 3013 static int WINAPI expGetProcessVersion(int pid) |
2069 | 3014 { |
3015 dbgprintf("GetProcessVersion(%d)\n", pid); | |
3016 return 1; | |
3017 } | |
3465 | 3018 static int WINAPI expGetCurrentThread(void) |
2069 | 3019 { |
3457 | 3020 #warning FIXME! |
3021 dbgprintf("GetCurrentThread() => %x\n", 0xcfcf9898); | |
2779 | 3022 return 0xcfcf9898; |
2069 | 3023 } |
3465 | 3024 static int WINAPI expGetOEMCP(void) |
2069 | 3025 { |
3026 dbgprintf("GetOEMCP()\n"); | |
3027 return 1; | |
3028 } | |
3465 | 3029 static int WINAPI expGetCPInfo(int cp,void *info) |
2069 | 3030 { |
3031 dbgprintf("GetCPInfo()\n"); | |
3032 return 0; | |
3033 } | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3034 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3035 #define SM_CXSCREEN 0 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3036 #define SM_CYSCREEN 1 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3037 #define SM_XVIRTUALSCREEN 76 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3038 #define SM_YVIRTUALSCREEN 77 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3039 #define SM_CXVIRTUALSCREEN 78 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3040 #define SM_CYVIRTUALSCREEN 79 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3041 #define SM_CMONITORS 80 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3042 #endif |
3465 | 3043 static int WINAPI expGetSystemMetrics(int index) |
2069 | 3044 { |
3045 dbgprintf("GetSystemMetrics(%d)\n", index); | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3046 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3047 switch(index) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3048 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3049 case SM_XVIRTUALSCREEN: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3050 case SM_YVIRTUALSCREEN: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3051 return 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3052 case SM_CXSCREEN: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3053 case SM_CXVIRTUALSCREEN: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3054 return PSEUDO_SCREEN_WIDTH; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3055 case SM_CYSCREEN: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3056 case SM_CYVIRTUALSCREEN: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3057 return PSEUDO_SCREEN_HEIGHT; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3058 case SM_CMONITORS: |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3059 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3060 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3061 #endif |
2069 | 3062 return 1; |
3063 } | |
3465 | 3064 static int WINAPI expGetSysColor(int index) |
2069 | 3065 { |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3066 dbgprintf("GetSysColor(%d) => 1\n", index); |
2069 | 3067 return 1; |
3068 } | |
3465 | 3069 static int WINAPI expGetSysColorBrush(int index) |
2069 | 3070 { |
3071 dbgprintf("GetSysColorBrush(%d)\n", index); | |
3072 return 1; | |
3073 } | |
3074 | |
3075 | |
3076 | |
3465 | 3077 static int WINAPI expGetSystemPaletteEntries(int hdc, int iStartIndex, int nEntries, void* lppe) |
128 | 3078 { |
3079 dbgprintf("GetSystemPaletteEntries(0x%x, 0x%x, 0x%x, 0x%x) => 0\n", | |
3465 | 3080 hdc, iStartIndex, nEntries, lppe); |
1 | 3081 return 0; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3082 } |
1 | 3083 |
3084 /* | |
3465 | 3085 typedef struct _TIME_ZONE_INFORMATION { |
3086 long Bias; | |
3087 char StandardName[32]; | |
3088 SYSTEMTIME StandardDate; | |
3089 long StandardBias; | |
3090 char DaylightName[32]; | |
3091 SYSTEMTIME DaylightDate; | |
3092 long DaylightBias; | |
3093 } TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION; | |
3094 */ | |
3095 | |
3096 static int WINAPI expGetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation) | |
1 | 3097 { |
128 | 3098 const short name[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'S', 't', 'a', |
3099 'n', 'd', 'a', 'r', 'd', ' ', 'T', 'i', 'm', 'e', 0}; | |
3100 const short pname[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'D', 'a', 'y', | |
3101 'l', 'i', 'g', 'h', 't', ' ', 'T', 'i', 'm', 'e', 0}; | |
3102 dbgprintf("GetTimeZoneInformation(0x%x) => TIME_ZONE_ID_STANDARD\n"); | |
1 | 3103 memset(lpTimeZoneInformation, 0, sizeof(TIME_ZONE_INFORMATION)); |
128 | 3104 lpTimeZoneInformation->Bias=360;//GMT-6 |
3105 memcpy(lpTimeZoneInformation->StandardName, name, sizeof(name)); | |
3106 lpTimeZoneInformation->StandardDate.wMonth=10; | |
3107 lpTimeZoneInformation->StandardDate.wDay=5; | |
3108 lpTimeZoneInformation->StandardDate.wHour=2; | |
3109 lpTimeZoneInformation->StandardBias=0; | |
3110 memcpy(lpTimeZoneInformation->DaylightName, pname, sizeof(pname)); | |
3111 lpTimeZoneInformation->DaylightDate.wMonth=4; | |
3112 lpTimeZoneInformation->DaylightDate.wDay=1; | |
3113 lpTimeZoneInformation->DaylightDate.wHour=2; | |
3114 lpTimeZoneInformation->DaylightBias=-60; | |
3115 return TIME_ZONE_ID_STANDARD; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3116 } |
1 | 3117 |
3465 | 3118 static void WINAPI expGetLocalTime(SYSTEMTIME* systime) |
1 | 3119 { |
3120 time_t local_time; | |
3121 struct tm *local_tm; | |
3122 struct timeval tv; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3123 |
128 | 3124 dbgprintf("GetLocalTime(0x%x)\n"); |
1 | 3125 gettimeofday(&tv, NULL); |
3126 local_time=tv.tv_sec; | |
3127 local_tm=localtime(&local_time); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3128 |
1 | 3129 systime->wYear = local_tm->tm_year + 1900; |
3130 systime->wMonth = local_tm->tm_mon + 1; | |
3131 systime->wDayOfWeek = local_tm->tm_wday; | |
3132 systime->wDay = local_tm->tm_mday; | |
3133 systime->wHour = local_tm->tm_hour; | |
3134 systime->wMinute = local_tm->tm_min; | |
3135 systime->wSecond = local_tm->tm_sec; | |
3136 systime->wMilliseconds = (tv.tv_usec / 1000) % 1000; | |
128 | 3137 dbgprintf(" Year: %d\n Month: %d\n Day of week: %d\n" |
3465 | 3138 " Day: %d\n Hour: %d\n Minute: %d\n Second: %d\n" |
3139 " Milliseconds: %d\n", | |
3140 systime->wYear, systime->wMonth, systime->wDayOfWeek, systime->wDay, | |
3141 systime->wHour, systime->wMinute, systime->wSecond, systime->wMilliseconds); | |
1 | 3142 } |
3143 | |
3465 | 3144 static int WINAPI expGetSystemTime(SYSTEMTIME* systime) |
1 | 3145 { |
3146 time_t local_time; | |
3147 struct tm *local_tm; | |
3148 struct timeval tv; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3149 |
128 | 3150 dbgprintf("GetSystemTime(0x%x)\n", systime); |
1 | 3151 gettimeofday(&tv, NULL); |
3152 local_time=tv.tv_sec; | |
3153 local_tm=gmtime(&local_time); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3154 |
1 | 3155 systime->wYear = local_tm->tm_year + 1900; |
3156 systime->wMonth = local_tm->tm_mon + 1; | |
3157 systime->wDayOfWeek = local_tm->tm_wday; | |
3158 systime->wDay = local_tm->tm_mday; | |
3159 systime->wHour = local_tm->tm_hour; | |
3160 systime->wMinute = local_tm->tm_min; | |
3161 systime->wSecond = local_tm->tm_sec; | |
3162 systime->wMilliseconds = (tv.tv_usec / 1000) % 1000; | |
128 | 3163 dbgprintf(" Year: %d\n Month: %d\n Day of week: %d\n" |
3465 | 3164 " Day: %d\n Hour: %d\n Minute: %d\n Second: %d\n" |
3165 " Milliseconds: %d\n", | |
3166 systime->wYear, systime->wMonth, systime->wDayOfWeek, systime->wDay, | |
3167 systime->wHour, systime->wMinute, systime->wSecond, systime->wMilliseconds); | |
2069 | 3168 return 0; |
1 | 3169 } |
3170 | |
7386 | 3171 #define SECS_1601_TO_1970 ((369 * 365 + 89) * 86400ULL) |
3172 static void WINAPI expGetSystemTimeAsFileTime(FILETIME* systime) | |
3173 { | |
3174 struct tm *local_tm; | |
3175 struct timeval tv; | |
3176 unsigned long long secs; | |
3177 | |
3178 dbgprintf("GetSystemTime(0x%x)\n", systime); | |
3179 gettimeofday(&tv, NULL); | |
3180 secs = (tv.tv_sec + SECS_1601_TO_1970) * 10000000; | |
3181 secs += tv.tv_usec * 10; | |
3182 systime->dwLowDateTime = secs & 0xffffffff; | |
3183 systime->dwHighDateTime = (secs >> 32); | |
3184 } | |
3185 | |
3465 | 3186 static int WINAPI expGetEnvironmentVariableA(const char* name, char* field, int size) |
1 | 3187 { |
128 | 3188 char *p; |
3465 | 3189 // printf("%s %x %x\n", name, field, size); |
1 | 3190 if(field)field[0]=0; |
3465 | 3191 /* |
3192 p = getenv(name); | |
3193 if (p) strncpy(field,p,size); | |
3194 */ | |
128 | 3195 if (strcmp(name,"__MSVCRT_HEAP_SELECT")==0) |
3465 | 3196 strcpy(field,"__GLOBAL_HEAP_SELECTED,1"); |
128 | 3197 dbgprintf("GetEnvironmentVariableA(0x%x='%s', 0x%x, %d) => %d\n", name, name, field, size, strlen(field)); |
3198 return strlen(field); | |
3199 } | |
3200 | |
5744
16a7eee0aca3
added SetEnvironmentVariableA for UCOD-ClearVideo DLL
alex
parents:
5742
diff
changeset
|
3201 static int WINAPI expSetEnvironmentVariableA(const char *name, const char *value) |
16a7eee0aca3
added SetEnvironmentVariableA for UCOD-ClearVideo DLL
alex
parents:
5742
diff
changeset
|
3202 { |
16a7eee0aca3
added SetEnvironmentVariableA for UCOD-ClearVideo DLL
alex
parents:
5742
diff
changeset
|
3203 dbgprintf("SetEnvironmentVariableA(%s, %s)\n", name, value); |
16a7eee0aca3
added SetEnvironmentVariableA for UCOD-ClearVideo DLL
alex
parents:
5742
diff
changeset
|
3204 return 0; |
16a7eee0aca3
added SetEnvironmentVariableA for UCOD-ClearVideo DLL
alex
parents:
5742
diff
changeset
|
3205 } |
16a7eee0aca3
added SetEnvironmentVariableA for UCOD-ClearVideo DLL
alex
parents:
5742
diff
changeset
|
3206 |
3465 | 3207 static void* WINAPI expCoTaskMemAlloc(ULONG cb) |
128 | 3208 { |
3209 return my_mreq(cb, 0); | |
3210 } | |
3465 | 3211 static void WINAPI expCoTaskMemFree(void* cb) |
128 | 3212 { |
3213 my_release(cb); | |
3214 } | |
3215 | |
3465 | 3216 |
3217 | |
3218 | |
3547 | 3219 void* CoTaskMemAlloc(unsigned long cb) |
3465 | 3220 { |
3221 return expCoTaskMemAlloc(cb); | |
3222 } | |
3223 void CoTaskMemFree(void* cb) | |
3224 { | |
3225 expCoTaskMemFree(cb); | |
3226 } | |
128 | 3227 |
3228 struct COM_OBJECT_INFO | |
3229 { | |
3230 GUID clsid; | |
7386 | 3231 long (*GetClassObject) (GUID* clsid, const GUID* iid, void** ppv); |
128 | 3232 }; |
3233 | |
3234 static struct COM_OBJECT_INFO* com_object_table=0; | |
3235 static int com_object_size=0; | |
7386 | 3236 int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs) |
128 | 3237 { |
2069 | 3238 if(!clsid || !gcs) |
3239 return -1; | |
128 | 3240 com_object_table=realloc(com_object_table, sizeof(struct COM_OBJECT_INFO)*(++com_object_size)); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3241 com_object_table[com_object_size-1].clsid=*clsid; |
128 | 3242 com_object_table[com_object_size-1].GetClassObject=gcs; |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3243 return 0; |
128 | 3244 } |
3245 | |
7386 | 3246 int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs) |
2069 | 3247 { |
3248 int found = 0; | |
3249 int i = 0; | |
3250 if(!clsid || !gcs) | |
3251 return -1; | |
3252 | |
3253 if (com_object_table == 0) | |
3254 printf("Warning: UnregisterComClass() called without any registered class\n"); | |
3255 while (i < com_object_size) | |
3256 { | |
3257 if (found && i > 0) | |
3258 { | |
3259 memcpy(&com_object_table[i - 1].clsid, | |
3260 &com_object_table[i].clsid, sizeof(GUID)); | |
3261 com_object_table[i - 1].GetClassObject = | |
3262 com_object_table[i].GetClassObject; | |
3263 } | |
3264 else if (memcmp(&com_object_table[i].clsid, clsid, sizeof(GUID)) == 0 | |
3265 && com_object_table[i].GetClassObject == gcs) | |
3266 { | |
3465 | 3267 found++; |
2069 | 3268 } |
3269 i++; | |
3270 } | |
3271 if (found) | |
3272 { | |
3273 if (--com_object_size == 0) | |
3274 { | |
3275 free(com_object_table); | |
3465 | 3276 com_object_table = 0; |
2069 | 3277 } |
3278 } | |
3279 return 0; | |
3280 } | |
3281 | |
3282 | |
7386 | 3283 const GUID IID_IUnknown = |
3465 | 3284 { |
3285 0x00000000, 0x0000, 0x0000, | |
3286 {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} | |
3287 }; | |
7386 | 3288 const GUID IID_IClassFactory = |
3465 | 3289 { |
3290 0x00000001, 0x0000, 0x0000, | |
3291 {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} | |
3292 }; | |
3293 | |
3294 static long WINAPI expCoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, | |
7386 | 3295 long dwClsContext, const GUID* riid, void** ppv) |
128 | 3296 { |
3297 int i; | |
3298 struct COM_OBJECT_INFO* ci=0; | |
3299 for(i=0; i<com_object_size; i++) | |
3300 if(!memcmp(rclsid, &com_object_table[i].clsid, sizeof(GUID))) | |
3301 ci=&com_object_table[i]; | |
3465 | 3302 if(!ci)return REGDB_E_CLASSNOTREG; |
128 | 3303 // in 'real' world we should mess with IClassFactory here |
3304 i=ci->GetClassObject(rclsid, riid, ppv); | |
3305 return i; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3306 } |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3307 |
128 | 3308 long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter, |
7386 | 3309 long dwClsContext, const GUID* riid, void** ppv) |
128 | 3310 { |
3311 return expCoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv); | |
3312 } | |
3313 | |
3465 | 3314 static int WINAPI expIsRectEmpty(CONST RECT *lprc) |
128 | 3315 { |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3316 int r = 0; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3317 int w,h; |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3318 //trapbug(); |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3319 if (lprc) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3320 { |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3321 w = lprc->right - lprc->left; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3322 h = lprc->bottom - lprc->top; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3323 if (w <= 0 || h <= 0) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3324 r = 1; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3325 } |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3326 else |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3327 r = 1; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3328 |
3465 | 3329 dbgprintf("IsRectEmpty(%p) => %s\n", lprc, (r) ? "TRUE" : "FALSE"); |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3330 //printf("Rect: left: %d, top: %d, right: %d, bottom: %d\n", lprc->left, lprc->top, lprc->right, lprc->bottom); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3331 // return 0; // wmv9? |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3332 return r; // TM20 |
128 | 3333 } |
3334 | |
3465 | 3335 static int _adjust_fdiv=0; //what's this? - used to adjust division |
16632
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
3336 static int _winver = 0x510; // windows version |
3465 | 3337 |
3338 | |
3339 | |
3340 | |
3341 static unsigned int WINAPI expGetTempPathA(unsigned int len, char* path) | |
128 | 3342 { |
3343 dbgprintf("GetTempPathA(%d, 0x%x)", len, path); | |
3344 if(len<5) | |
3345 { | |
3346 dbgprintf(" => 0\n"); | |
3347 return 0; | |
3348 } | |
3349 strcpy(path, "/tmp"); | |
3350 dbgprintf(" => 5 ( '/tmp' )\n"); | |
3351 return 5; | |
3352 } | |
3353 /* | |
3465 | 3354 FYI: |
3355 typedef struct | |
3356 { | |
3357 DWORD dwFileAttributes; | |
3358 FILETIME ftCreationTime; | |
3359 FILETIME ftLastAccessTime; | |
3360 FILETIME ftLastWriteTime; | |
3361 DWORD nFileSizeHigh; | |
3362 DWORD nFileSizeLow; | |
3363 DWORD dwReserved0; | |
3364 DWORD dwReserved1; | |
3365 CHAR cFileName[260]; | |
3366 CHAR cAlternateFileName[14]; | |
3367 } WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA; | |
3368 */ | |
3369 | |
8391
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3370 static DIR* qtx_dir=NULL; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3371 |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3372 static WIN_BOOL WINAPI expFindNextFileA(HANDLE h,LPWIN32_FIND_DATAA lpfd) |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3373 { |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3374 #ifdef QTX |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3375 dbgprintf("FindNextFileA(0x%x, 0x%x) => 0\n", h, lpfd); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3376 if(h==FILE_HANDLE_quicktimeqtx){ |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3377 struct dirent* d; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3378 if(!qtx_dir) return 0; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3379 while((d=readdir(qtx_dir))){ |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3380 char* x=strrchr(d->d_name,'.'); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3381 if(!x) continue; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3382 if(strcmp(x,".qtx")) continue; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3383 strcpy(lpfd->cFileName,d->d_name); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3384 // sprintf(lpfd->cAlternateFileName,"%-8s.qtx",d->d_name); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3385 strcpy(lpfd->cAlternateFileName,"foobar.qtx"); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3386 printf("### FindNext: %s\n",lpfd->cFileName); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3387 return 1; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3388 } |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3389 closedir(qtx_dir); qtx_dir=NULL; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3390 return 0; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3391 } |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3392 #endif |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3393 return 0; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3394 } |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3395 |
3465 | 3396 static HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd) |
128 | 3397 { |
8798
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3398 dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => 0\n", s, s, lpfd); |
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3399 // printf("\n### FindFirstFileA('%s')...\n",s); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3400 #ifdef QTX |
8798
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3401 if(strstr(s, "quicktime\\*.QTX")){ |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3402 dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => QTX\n", s, s, lpfd); |
8658 | 3403 printf("\n### Searching for QuickTime plugins (*.qtx) at %s...\n",def_path); |
8391
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3404 qtx_dir=opendir(def_path); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3405 if(!qtx_dir) return (HANDLE)-1; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3406 memset(lpfd,0,sizeof(*lpfd)); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3407 if(expFindNextFileA(FILE_HANDLE_quicktimeqtx,lpfd)) |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3408 return FILE_HANDLE_quicktimeqtx; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3409 printf("loader: Couldn't find the QuickTime plugins (.qtx files) at %s\n",def_path); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3410 return (HANDLE)-1; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3411 } |
8798
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3412 #if 0 |
8391
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3413 if(strstr(s, "QuickTime.qts")){ |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3414 dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => QTS\n", s, s, lpfd); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3415 // if(!strcmp(s,"C:\\windows\\QuickTime.qts\\QuickTime.qts\\*.QTX")) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3416 // return (HANDLE)-1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3417 strcpy(lpfd->cFileName, "QuickTime.qts"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3418 strcpy(lpfd->cAlternateFileName, "QuickT~1.qts"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3419 return FILE_HANDLE_quicktimeqts; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3420 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3421 #endif |
8798
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3422 #endif |
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3423 if(strstr(s, "*.vwp")){ |
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3424 // hack for VoxWare codec plugins: |
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3425 strcpy(lpfd->cFileName, "msms001.vwp"); |
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3426 strcpy(lpfd->cAlternateFileName, "msms001.vwp"); |
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3427 return (HANDLE)0; |
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3428 } |
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3429 // return 'file not found' |
b16c91194e40
qt vs. voxware fixed (hopefully), also some qt speedup
arpi
parents:
8764
diff
changeset
|
3430 return (HANDLE)-1; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3431 } |
8391
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3432 |
3465 | 3433 static WIN_BOOL WINAPI expFindClose(HANDLE h) |
128 | 3434 { |
3435 dbgprintf("FindClose(0x%x) => 0\n", h); | |
8391
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3436 #ifdef QTX |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3437 // if(h==FILE_HANDLE_quicktimeqtx && qtx_dir){ |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3438 // closedir(qtx_dir); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3439 // qtx_dir=NULL; |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3440 // } |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3441 #endif |
128 | 3442 return 0; |
3443 } | |
3465 | 3444 static UINT WINAPI expSetErrorMode(UINT i) |
128 | 3445 { |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3446 dbgprintf("SetErrorMode(%d) => 0\n", i); |
128 | 3447 return 0; |
3448 } | |
3465 | 3449 static UINT WINAPI expGetWindowsDirectoryA(LPSTR s,UINT c) |
128 | 3450 { |
3451 char windir[]="c:\\windows"; | |
3452 int result; | |
3453 strncpy(s, windir, c); | |
3454 result=1+((c<strlen(windir))?c:strlen(windir)); | |
3455 dbgprintf("GetWindowsDirectoryA(0x%x, %d) => %d\n", s, c, result); | |
3456 return result; | |
3457 } | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3458 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3459 static UINT WINAPI expGetCurrentDirectoryA(UINT c, LPSTR s) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3460 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3461 char curdir[]="c:\\"; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3462 int result; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3463 strncpy(s, curdir, c); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3464 result=1+((c<strlen(curdir))?c:strlen(curdir)); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3465 dbgprintf("GetCurrentDirectoryA(0x%x, %d) => %d\n", s, c, result); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3466 return result; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3467 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3468 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3469 static int WINAPI expSetCurrentDirectoryA(const char *pathname) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3470 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3471 dbgprintf("SetCurrentDirectoryA(0x%x = %s) => 1\n", pathname, pathname); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3472 #if 0 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3473 if (strrchr(pathname, '\\')) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3474 chdir(strcat(strrchr(pathname, '\\')+1, '/')); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3475 else |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3476 chdir(pathname); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3477 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3478 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3479 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3480 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3481 static int WINAPI expCreateDirectoryA(const char *pathname, void *sa) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3482 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3483 dbgprintf("CreateDirectory(0x%x = %s, 0x%x) => 1\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3484 pathname, pathname, sa); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3485 #if 0 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3486 p = strrchr(pathname, '\\')+1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3487 strcpy(&buf[0], p); /* should be strncpy */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3488 if (!strlen(p)) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3489 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3490 buf[0] = '.'; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3491 buf[1] = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3492 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3493 #if 0 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3494 if (strrchr(pathname, '\\')) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3495 mkdir(strcat(strrchr(pathname, '\\')+1, '/'), 666); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3496 else |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3497 mkdir(pathname, 666); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3498 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3499 mkdir(&buf); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3500 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3501 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3502 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3503 #endif |
3465 | 3504 static WIN_BOOL WINAPI expDeleteFileA(LPCSTR s) |
128 | 3505 { |
3506 dbgprintf("DeleteFileA(0x%x='%s') => 0\n", s, s); | |
3507 return 0; | |
3508 } | |
3465 | 3509 static WIN_BOOL WINAPI expFileTimeToLocalFileTime(const FILETIME* cpf, LPFILETIME pf) |
128 | 3510 { |
3511 dbgprintf("FileTimeToLocalFileTime(0x%x, 0x%x) => 0\n", cpf, pf); | |
3512 return 0; | |
3513 } | |
3514 | |
3465 | 3515 static UINT WINAPI expGetTempFileNameA(LPCSTR cs1,LPCSTR cs2,UINT i,LPSTR ps) |
128 | 3516 { |
3517 char mask[16]="/tmp/AP_XXXXXX"; | |
3518 int result; | |
3519 dbgprintf("GetTempFileNameA(0x%x='%s', 0x%x='%s', %d, 0x%x)", cs1, cs1, cs2, cs2, i, ps); | |
3520 if(i && i<10) | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3521 { |
128 | 3522 dbgprintf(" => -1\n"); |
3523 return -1; | |
3524 } | |
3525 result=mkstemp(mask); | |
3526 sprintf(ps, "AP%d", result); | |
3527 dbgprintf(" => %d\n", strlen(ps)); | |
3528 return strlen(ps); | |
3529 } | |
3530 // | |
3531 // This func might need proper implementation if we want AngelPotion codec. | |
3532 // They try to open APmpeg4v1.apl with it. | |
3533 // DLL will close opened file with CloseHandle(). | |
3534 // | |
3465 | 3535 static HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2, |
3536 LPSECURITY_ATTRIBUTES p1, DWORD i3,DWORD i4,HANDLE i5) | |
128 | 3537 { |
3538 dbgprintf("CreateFileA(0x%x='%s', %d, %d, 0x%x, %d, %d, 0x%x)\n", cs1, cs1, i1, | |
3465 | 3539 i2, p1, i3, i4, i5); |
128 | 3540 if((!cs1) || (strlen(cs1)<2))return -1; |
3128 | 3541 |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3542 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3543 if(strstr(cs1, "QuickTime.qts")) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3544 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3545 int result; |
18878 | 3546 char* tmp=malloc(strlen(def_path)+50); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3547 strcpy(tmp, def_path); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3548 strcat(tmp, "/"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3549 strcat(tmp, "QuickTime.qts"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3550 result=open(tmp, O_RDONLY); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3551 free(tmp); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3552 return result; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3553 } |
8391
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3554 if(strstr(cs1, ".qtx")) |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3555 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3556 int result; |
18878 | 3557 char* tmp=malloc(strlen(def_path)+250); |
8391
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3558 char* x=strrchr(cs1,'\\'); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3559 sprintf(tmp,"%s/%s",def_path,x?(x+1):cs1); |
780d0e226ac5
support for *.qtx (scan for all .qtx files at quicktime init)
arpi
parents:
8293
diff
changeset
|
3560 // printf("### Open: %s -> %s\n",cs1,tmp); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3561 result=open(tmp, O_RDONLY); |
8285 | 3562 free(tmp); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3563 return result; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3564 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3565 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3566 |
3128 | 3567 if(strncmp(cs1, "AP", 2) == 0) |
128 | 3568 { |
3569 int result; | |
18878 | 3570 char* tmp=malloc(strlen(def_path)+50); |
128 | 3571 strcpy(tmp, def_path); |
3572 strcat(tmp, "/"); | |
3573 strcat(tmp, "APmpg4v1.apl"); | |
3574 result=open(tmp, O_RDONLY); | |
3575 free(tmp); | |
3576 return result; | |
3128 | 3577 } |
3578 if (strstr(cs1, "vp3")) | |
3579 { | |
3580 int r; | |
3581 int flg = 0; | |
18878 | 3582 char* tmp=malloc(20 + strlen(cs1)); |
3128 | 3583 strcpy(tmp, "/tmp/"); |
3584 strcat(tmp, cs1); | |
3585 r = 4; | |
3586 while (tmp[r]) | |
3587 { | |
3588 if (tmp[r] == ':' || tmp[r] == '\\') | |
3589 tmp[r] = '_'; | |
3590 r++; | |
3591 } | |
3592 if (GENERIC_READ & i1) | |
3593 flg |= O_RDONLY; | |
3594 else if (GENERIC_WRITE & i1) | |
3595 { | |
3596 flg |= O_WRONLY; | |
3597 printf("Warning: openning filename %s %d (flags; 0x%x) for write\n", tmp, r, flg); | |
3598 } | |
3599 r=open(tmp, flg); | |
3600 free(tmp); | |
3601 return r; | |
3602 } | |
3603 | |
12735
5af0b22d55a6
Support for Winnov Videum WINX and WNV1 codecs with binary dll
rtognimp
parents:
12374
diff
changeset
|
3604 // Needed by wnvplay1.dll |
5af0b22d55a6
Support for Winnov Videum WINX and WNV1 codecs with binary dll
rtognimp
parents:
12374
diff
changeset
|
3605 if (strstr(cs1, "WINNOV.bmp")) |
5af0b22d55a6
Support for Winnov Videum WINX and WNV1 codecs with binary dll
rtognimp
parents:
12374
diff
changeset
|
3606 { |
5af0b22d55a6
Support for Winnov Videum WINX and WNV1 codecs with binary dll
rtognimp
parents:
12374
diff
changeset
|
3607 int r; |
5af0b22d55a6
Support for Winnov Videum WINX and WNV1 codecs with binary dll
rtognimp
parents:
12374
diff
changeset
|
3608 r=open("/dev/null", 0); |
5af0b22d55a6
Support for Winnov Videum WINX and WNV1 codecs with binary dll
rtognimp
parents:
12374
diff
changeset
|
3609 return r; |
5af0b22d55a6
Support for Winnov Videum WINX and WNV1 codecs with binary dll
rtognimp
parents:
12374
diff
changeset
|
3610 } |
5af0b22d55a6
Support for Winnov Videum WINX and WNV1 codecs with binary dll
rtognimp
parents:
12374
diff
changeset
|
3611 |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3612 #if 0 |
7386 | 3613 /* we need this for some virtualdub filters */ |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3614 { |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3615 int r; |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3616 int flg = 0; |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3617 if (GENERIC_READ & i1) |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3618 flg |= O_RDONLY; |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3619 else if (GENERIC_WRITE & i1) |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3620 { |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3621 flg |= O_WRONLY; |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3622 printf("Warning: openning filename %s %d (flags; 0x%x) for write\n", cs1, r, flg); |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3623 } |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3624 r=open(cs1, flg); |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3625 return r; |
7386 | 3626 } |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3627 #endif |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3628 |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3629 return atoi(cs1+2); |
128 | 3630 } |
5234 | 3631 static UINT WINAPI expGetSystemDirectoryA( |
3632 char* lpBuffer, // address of buffer for system directory | |
3633 UINT uSize // size of directory buffer | |
3634 ){ | |
3635 dbgprintf("GetSystemDirectoryA(%p,%d)\n", lpBuffer,uSize); | |
3636 if(!lpBuffer) strcpy(lpBuffer,"."); | |
3637 return 1; | |
3638 } | |
3639 /* | |
128 | 3640 static char sysdir[]="."; |
3465 | 3641 static LPCSTR WINAPI expGetSystemDirectoryA() |
128 | 3642 { |
3643 dbgprintf("GetSystemDirectoryA() => 0x%x='%s'\n", sysdir, sysdir); | |
3644 return sysdir; | |
3645 } | |
5234 | 3646 */ |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3647 static DWORD WINAPI expGetFullPathNameA |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3648 ( |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3649 LPCTSTR lpFileName, |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3650 DWORD nBufferLength, |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3651 LPTSTR lpBuffer, |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3652 LPTSTR lpFilePart |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3653 ){ |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3654 if(!lpFileName) return 0; |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3655 dbgprintf("GetFullPathNameA('%s',%d,%p,%p)\n",lpFileName,nBufferLength, |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3656 lpBuffer, lpFilePart); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3657 #if 0 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3658 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3659 strcpy(lpFilePart, "Quick123.qts"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3660 #else |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3661 strcpy(lpFilePart, lpFileName); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3662 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3663 #else |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3664 if (strrchr(lpFileName, '\\')) |
8451 | 3665 lpFilePart = strrchr(lpFileName, '\\'); |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3666 else |
13182 | 3667 lpFilePart = (LPTSTR)lpFileName; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3668 #endif |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3669 strcpy(lpBuffer, lpFileName); |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3670 // strncpy(lpBuffer, lpFileName, rindex(lpFileName, '\\')-lpFileName); |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3671 return strlen(lpBuffer); |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3672 } |
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
3673 |
5234 | 3674 static DWORD WINAPI expGetShortPathNameA |
3675 ( | |
3676 LPCSTR longpath, | |
3677 LPSTR shortpath, | |
3678 DWORD shortlen | |
3679 ){ | |
3680 if(!longpath) return 0; | |
3681 dbgprintf("GetShortPathNameA('%s',%p,%d)\n",longpath,shortpath,shortlen); | |
3682 strcpy(shortpath,longpath); | |
3683 return strlen(shortpath); | |
3684 } | |
7386 | 3685 |
3465 | 3686 static WIN_BOOL WINAPI expReadFile(HANDLE h,LPVOID pv,DWORD size,LPDWORD rd,LPOVERLAPPED unused) |
128 | 3687 { |
3688 int result; | |
3689 dbgprintf("ReadFile(%d, 0x%x, %d -> 0x%x)\n", h, pv, size, rd); | |
3690 result=read(h, pv, size); | |
3691 if(rd)*rd=result; | |
3692 if(!result)return 0; | |
3693 return 1; | |
3694 } | |
3695 | |
3465 | 3696 static WIN_BOOL WINAPI expWriteFile(HANDLE h,LPCVOID pv,DWORD size,LPDWORD wr,LPOVERLAPPED unused) |
128 | 3697 { |
3698 int result; | |
3699 dbgprintf("WriteFile(%d, 0x%x, %d -> 0x%x)\n", h, pv, size, wr); | |
3700 if(h==1234)h=1; | |
3701 result=write(h, pv, size); | |
3702 if(wr)*wr=result; | |
3703 if(!result)return 0; | |
3704 return 1; | |
3705 } | |
3465 | 3706 static DWORD WINAPI expSetFilePointer(HANDLE h, LONG val, LPLONG ext, DWORD whence) |
128 | 3707 { |
3708 int wh; | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3709 dbgprintf("SetFilePointer(%d, 0x%x, 0x%x = %d, %d)\n", h, val, ext, *ext, whence); |
3465 | 3710 //why would DLL want temporary file with >2Gb size? |
128 | 3711 switch(whence) |
3712 { | |
3713 case FILE_BEGIN: | |
3714 wh=SEEK_SET;break; | |
3715 case FILE_END: | |
3716 wh=SEEK_END;break; | |
3717 case FILE_CURRENT: | |
3718 wh=SEEK_CUR;break; | |
3719 default: | |
3720 return -1; | |
3721 } | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3722 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3723 if (val == 0 && ext != 0) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3724 val = val&(*ext); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3725 #endif |
128 | 3726 return lseek(h, val, wh); |
3727 } | |
3728 | |
3465 | 3729 static HDRVR WINAPI expOpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName, |
3730 LPARAM lParam2) | |
128 | 3731 { |
3732 dbgprintf("OpenDriverA(0x%x='%s', 0x%x='%s', 0x%x) => -1\n", szDriverName, szDriverName, szSectionName, szSectionName, lParam2); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3733 return -1; |
128 | 3734 } |
3465 | 3735 static HDRVR WINAPI expOpenDriver(LPCSTR szDriverName, LPCSTR szSectionName, |
3736 LPARAM lParam2) | |
128 | 3737 { |
3738 dbgprintf("OpenDriver(0x%x='%s', 0x%x='%s', 0x%x) => -1\n", szDriverName, szDriverName, szSectionName, szSectionName, lParam2); | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
3739 return -1; |
128 | 3740 } |
1 | 3741 |
3742 | |
3465 | 3743 static WIN_BOOL WINAPI expGetProcessAffinityMask(HANDLE hProcess, |
3744 LPDWORD lpProcessAffinityMask, | |
3745 LPDWORD lpSystemAffinityMask) | |
128 | 3746 { |
3747 dbgprintf("GetProcessAffinityMask(0x%x, 0x%x, 0x%x) => 1\n", | |
3465 | 3748 hProcess, lpProcessAffinityMask, lpSystemAffinityMask); |
128 | 3749 if(lpProcessAffinityMask)*lpProcessAffinityMask=1; |
3750 if(lpSystemAffinityMask)*lpSystemAffinityMask=1; | |
3751 return 1; | |
1 | 3752 } |
3753 | |
18580
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3754 // Fake implementation: does nothing, but does it right :) |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3755 static WIN_BOOL WINAPI expSetProcessAffinityMask(HANDLE hProcess, |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3756 LPDWORD dwProcessAffinityMask) |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3757 { |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3758 dbgprintf("SetProcessAffinityMask(0x%x, 0x%x) => 1\n", |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3759 hProcess, dwProcessAffinityMask); |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3760 |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3761 return 1; |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3762 }; |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
3763 |
3465 | 3764 static int WINAPI expMulDiv(int nNumber, int nNumerator, int nDenominator) |
713 | 3765 { |
3766 static const long long max_int=0x7FFFFFFFLL; | |
3767 static const long long min_int=-0x80000000LL; | |
3768 long long tmp=(long long)nNumber*(long long)nNumerator; | |
3465 | 3769 dbgprintf("expMulDiv %d * %d / %d\n", nNumber, nNumerator, nDenominator); |
713 | 3770 if(!nDenominator)return 1; |
3771 tmp/=nDenominator; | |
3772 if(tmp<min_int) return 1; | |
3773 if(tmp>max_int) return 1; | |
3774 return (int)tmp; | |
3775 } | |
3776 | |
3465 | 3777 static LONG WINAPI explstrcmpiA(const char* str1, const char* str2) |
713 | 3778 { |
3779 LONG result=strcasecmp(str1, str2); | |
3780 dbgprintf("strcmpi(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result); | |
3781 return result; | |
3782 } | |
3783 | |
3465 | 3784 static LONG WINAPI explstrlenA(const char* str1) |
713 | 3785 { |
3786 LONG result=strlen(str1); | |
3134 | 3787 dbgprintf("strlen(0x%x='%.50s') => %d\n", str1, str1, result); |
713 | 3788 return result; |
3789 } | |
3790 | |
3465 | 3791 static LONG WINAPI explstrcpyA(char* str1, const char* str2) |
713 | 3792 { |
3793 int result= (int) strcpy(str1, str2); | |
3134 | 3794 dbgprintf("strcpy(0x%.50x, 0x%.50x='%.50s') => %d\n", str1, str2, str2, result); |
713 | 3795 return result; |
3796 } | |
3465 | 3797 static LONG WINAPI explstrcpynA(char* str1, const char* str2,int len) |
2069 | 3798 { |
3799 int result; | |
3800 if (strlen(str2)>len) | |
3465 | 3801 result = (int) strncpy(str1, str2,len); |
2069 | 3802 else |
3465 | 3803 result = (int) strcpy(str1,str2); |
2069 | 3804 dbgprintf("strncpy(0x%x, 0x%x='%s' len %d strlen %d) => %x\n", str1, str2, str2,len, strlen(str2),result); |
3805 return result; | |
3806 } | |
3465 | 3807 static LONG WINAPI explstrcatA(char* str1, const char* str2) |
2069 | 3808 { |
3809 int result= (int) strcat(str1, str2); | |
3810 dbgprintf("strcat(0x%x, 0x%x='%s') => %d\n", str1, str2, str2, result); | |
3811 return result; | |
3812 } | |
3813 | |
128 | 3814 |
3465 | 3815 static LONG WINAPI expInterlockedExchange(long *dest, long l) |
497 | 3816 { |
3465 | 3817 long retval = *dest; |
3818 *dest = l; | |
3819 return retval; | |
497 | 3820 } |
3821 | |
3465 | 3822 static void WINAPI expInitCommonControls(void) |
1543 | 3823 { |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3824 dbgprintf("InitCommonControls called!\n"); |
2069 | 3825 return; |
1543 | 3826 } |
3827 | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3828 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3829 /* needed by QuickTime.qts */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3830 static HWND WINAPI expCreateUpDownControl (DWORD style, INT x, INT y, INT cx, INT cy, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3831 HWND parent, INT id, HINSTANCE inst, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3832 HWND buddy, INT maxVal, INT minVal, INT curVal) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3833 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3834 dbgprintf("CreateUpDownControl(...)\n"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3835 return 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3836 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3837 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3838 |
3457 | 3839 /* alex: implement this call! needed for 3ivx */ |
3465 | 3840 static HRESULT WINAPI expCoCreateFreeThreadedMarshaler(void *pUnkOuter, void **ppUnkInner) |
2396 | 3841 { |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
3842 dbgprintf("CoCreateFreeThreadedMarshaler(%p, %p) called!\n", |
3465 | 3843 pUnkOuter, ppUnkInner); |
5742
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
3844 // return 0; |
3457 | 3845 return ERROR_CALL_NOT_IMPLEMENTED; |
2396 | 3846 } |
3847 | |
2779 | 3848 |
3465 | 3849 static int WINAPI expDuplicateHandle(HANDLE hSourceProcessHandle, // handle to source process |
3850 HANDLE hSourceHandle, // handle to duplicate | |
3851 HANDLE hTargetProcessHandle, // handle to target process | |
3852 HANDLE* lpTargetHandle, // duplicate handle | |
3853 DWORD dwDesiredAccess, // requested access | |
3854 int bInheritHandle, // handle inheritance option | |
3855 DWORD dwOptions // optional actions | |
3856 ) | |
2779 | 3857 { |
3858 dbgprintf("DuplicateHandle(%p, %p, %p, %p, 0x%x, %d, %d) called\n", | |
3465 | 3859 hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, |
3860 lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions); | |
2779 | 3861 *lpTargetHandle = hSourceHandle; |
3862 return 1; | |
3863 } | |
3864 | |
3128 | 3865 // required by PIM1 codec (used by win98 PCTV Studio capture sw) |
3465 | 3866 static HRESULT WINAPI expCoInitialize( |
3867 LPVOID lpReserved /* [in] pointer to win32 malloc interface | |
3868 (obsolete, should be NULL) */ | |
3869 ) | |
3033 | 3870 { |
3465 | 3871 /* |
3872 * Just delegate to the newer method. | |
3873 */ | |
3874 return 0; //CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED); | |
3033 | 3875 } |
3876 | |
3465 | 3877 static DWORD WINAPI expSetThreadAffinityMask |
3441 | 3878 ( |
3879 HANDLE hThread, | |
3880 DWORD dwThreadAffinityMask | |
3881 ){ | |
3882 return 0; | |
3883 }; | |
3033 | 3884 |
3465 | 3885 /* |
3886 * no WINAPI functions - CDECL | |
3887 */ | |
3888 static void* expmalloc(int size) | |
3889 { | |
3890 //printf("malloc"); | |
3891 // return malloc(size); | |
3892 void* result=my_mreq(size,0); | |
3893 dbgprintf("malloc(0x%x) => 0x%x\n", size,result); | |
3894 if(result==0) | |
3895 printf("WARNING: malloc() failed\n"); | |
3896 return result; | |
3897 } | |
3898 static void expfree(void* mem) | |
3899 { | |
3900 // return free(mem); | |
3901 dbgprintf("free(%p)\n", mem); | |
3902 my_release(mem); | |
3903 } | |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3904 /* needed by atrac3.acm */ |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3905 static void *expcalloc(int num, int size) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3906 { |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3907 void* result=my_mreq(num*size,1); |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3908 dbgprintf("calloc(%d,%d) => %p\n", num,size,result); |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3909 if(result==0) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3910 printf("WARNING: calloc() failed\n"); |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3911 return result; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
3912 } |
3465 | 3913 static void* expnew(int size) |
3914 { | |
3915 // printf("NEW:: Call from address %08x\n STACK DUMP:\n", *(-1+(int*)&size)); | |
3916 // printf("%08x %08x %08x %08x\n", | |
3917 // size, *(1+(int*)&size), | |
3918 // *(2+(int*)&size),*(3+(int*)&size)); | |
3919 void* result; | |
3920 assert(size >= 0); | |
3921 | |
3922 result=my_mreq(size,0); | |
3923 dbgprintf("new(%d) => %p\n", size, result); | |
3924 if (result==0) | |
3925 printf("WARNING: new() failed\n"); | |
3926 return result; | |
3927 | |
3928 } | |
3929 static int expdelete(void* memory) | |
3930 { | |
3931 dbgprintf("delete(%p)\n", memory); | |
3932 my_release(memory); | |
3933 return 0; | |
3934 } | |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3935 |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3936 /* |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3937 * local definition - we need only the last two members at this point |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3938 * otherwice we would have to introduce here GUIDs and some more types.. |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3939 */ |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3940 typedef struct __attribute__((__packed__)) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3941 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3942 char hay[0x40]; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3943 unsigned long cbFormat; //0x40 |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3944 char* pbFormat; //0x44 |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3945 } MY_MEDIA_TYPE; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3946 static HRESULT WINAPI expMoCopyMediaType(MY_MEDIA_TYPE* dest, const MY_MEDIA_TYPE* src) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3947 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3948 if (!dest || !src) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3949 return E_POINTER; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3950 memcpy(dest, src, sizeof(MY_MEDIA_TYPE)); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3951 if (dest->cbFormat) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3952 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3953 dest->pbFormat = (char*) my_mreq(dest->cbFormat, 0); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3954 if (!dest->pbFormat) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3955 return E_OUTOFMEMORY; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3956 memcpy(dest->pbFormat, src->pbFormat, dest->cbFormat); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3957 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3958 return S_OK; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3959 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3960 static HRESULT WINAPI expMoInitMediaType(MY_MEDIA_TYPE* dest, DWORD cbFormat) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3961 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3962 if (!dest) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3963 return E_POINTER; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3964 memset(dest, 0, sizeof(MY_MEDIA_TYPE)); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3965 if (cbFormat) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3966 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3967 dest->pbFormat = (char*) my_mreq(cbFormat, 0); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3968 if (!dest->pbFormat) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3969 return E_OUTOFMEMORY; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3970 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3971 return S_OK; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3972 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3973 static HRESULT WINAPI expMoCreateMediaType(MY_MEDIA_TYPE** dest, DWORD cbFormat) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3974 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3975 if (!dest) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3976 return E_POINTER; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3977 *dest = my_mreq(sizeof(MY_MEDIA_TYPE), 0); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3978 return expMoInitMediaType(*dest, cbFormat); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3979 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3980 static HRESULT WINAPI expMoDuplicateMediaType(MY_MEDIA_TYPE** dest, const void* src) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3981 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3982 if (!dest) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3983 return E_POINTER; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3984 *dest = my_mreq(sizeof(MY_MEDIA_TYPE), 0); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3985 return expMoCopyMediaType(*dest, src); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3986 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3987 static HRESULT WINAPI expMoFreeMediaType(MY_MEDIA_TYPE* dest) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3988 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3989 if (!dest) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3990 return E_POINTER; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3991 if (dest->pbFormat) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3992 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3993 my_release(dest->pbFormat); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3994 dest->pbFormat = 0; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3995 dest->cbFormat = 0; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3996 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3997 return S_OK; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3998 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
3999 static HRESULT WINAPI expMoDeleteMediaType(MY_MEDIA_TYPE* dest) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4000 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4001 if (!dest) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4002 return E_POINTER; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4003 expMoFreeMediaType(dest); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4004 my_release(dest); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4005 return S_OK; |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4006 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4007 |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4008 static int exp_snprintf( char *str, int size, const char *format, ... ) |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4009 { |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4010 int x; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4011 va_list va; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4012 va_start(va, format); |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4013 x=snprintf(str,size,format,va); |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4014 dbgprintf("_snprintf( 0x%x, %d, %s, ... ) => %d\n",str,size,format,x); |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4015 va_end(va); |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4016 return x; |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4017 } |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4018 |
7386 | 4019 #if 0 |
3465 | 4020 static int exp_initterm(int v1, int v2) |
4021 { | |
4022 dbgprintf("_initterm(0x%x, 0x%x) => 0\n", v1, v2); | |
4023 return 0; | |
4024 } | |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4025 #else |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4026 /* merged from wine - 2002.04.21 */ |
7386 | 4027 typedef void (*_INITTERMFUNC)(); |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4028 static int exp_initterm(_INITTERMFUNC *start, _INITTERMFUNC *end) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4029 { |
7386 | 4030 dbgprintf("_initterm(0x%x, 0x%x) %p\n", start, end, *start); |
4031 while (start < end) | |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4032 { |
7386 | 4033 if (*start) |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4034 { |
7386 | 4035 //printf("call _initfunc: from: %p %d\n", *start); |
4036 // ok this trick with push/pop is necessary as otherwice | |
4037 // edi/esi registers are being trashed | |
4038 void* p = *start; | |
4039 __asm__ __volatile__ | |
4040 ( | |
4041 "pushl %%ebx \n\t" | |
4042 "pushl %%ecx \n\t" | |
4043 "pushl %%edx \n\t" | |
4044 "pushl %%edi \n\t" | |
4045 "pushl %%esi \n\t" | |
4046 "call *%%eax \n\t" | |
4047 "popl %%esi \n\t" | |
4048 "popl %%edi \n\t" | |
4049 "popl %%edx \n\t" | |
4050 "popl %%ecx \n\t" | |
4051 "popl %%ebx \n\t" | |
4052 : | |
4053 : "a"(p) | |
4054 : "memory" | |
4055 ); | |
4056 //printf("done %p %d:%d\n", end); | |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4057 } |
7386 | 4058 start++; |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4059 } |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4060 return 0; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4061 } |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
4062 #endif |
3465 | 4063 |
7386 | 4064 static void* exp__dllonexit() |
4065 { | |
4066 // FIXME extract from WINE | |
4067 return NULL; | |
4068 } | |
4069 | |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4070 static int expwsprintfA(char* string, const char* format, ...) |
3465 | 4071 { |
4072 va_list va; | |
4073 int result; | |
4074 va_start(va, format); | |
4075 result = vsprintf(string, format, va); | |
4076 dbgprintf("wsprintfA(0x%x, '%s', ...) => %d\n", string, format, result); | |
4077 va_end(va); | |
4078 return result; | |
4079 } | |
4080 | |
4081 static int expsprintf(char* str, const char* format, ...) | |
4082 { | |
4083 va_list args; | |
4084 int r; | |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4085 dbgprintf("sprintf(0x%x, %s)\n", str, format); |
3465 | 4086 va_start(args, format); |
4087 r = vsprintf(str, format, args); | |
4088 va_end(args); | |
4089 return r; | |
4090 } | |
4091 static int expsscanf(const char* str, const char* format, ...) | |
4092 { | |
4093 va_list args; | |
4094 int r; | |
4095 dbgprintf("sscanf(%s, %s)\n", str, format); | |
4096 va_start(args, format); | |
4097 r = vsscanf(str, format, args); | |
4098 va_end(args); | |
4099 return r; | |
4100 } | |
4101 static void* expfopen(const char* path, const char* mode) | |
4102 { | |
4103 printf("fopen: \"%s\" mode:%s\n", path, mode); | |
4104 //return fopen(path, mode); | |
4105 return fdopen(0, mode); // everything on screen | |
4106 } | |
4107 static int expfprintf(void* stream, const char* format, ...) | |
4108 { | |
4109 va_list args; | |
4110 int r = 0; | |
4111 dbgprintf("fprintf(%p, %s, ...)\n", stream, format); | |
4112 #if 1 | |
4113 va_start(args, format); | |
4114 r = vfprintf((FILE*) stream, format, args); | |
4115 va_end(args); | |
4116 #endif | |
4117 return r; | |
4118 } | |
4119 | |
4120 static int expprintf(const char* format, ...) | |
4121 { | |
4122 va_list args; | |
4123 int r; | |
4124 dbgprintf("printf(%s, ...)\n", format); | |
4125 va_start(args, format); | |
4126 r = vprintf(format, args); | |
4127 va_end(args); | |
4128 return r; | |
4129 } | |
4130 | |
4131 static char* expgetenv(const char* varname) | |
4132 { | |
4133 char* v = getenv(varname); | |
4134 dbgprintf("getenv(%s) => %s\n", varname, v); | |
4135 return v; | |
4136 } | |
4137 | |
4138 static void* expwcscpy(WCHAR* dst, const WCHAR* src) | |
4139 { | |
4140 WCHAR* p = dst; | |
4141 while ((*p++ = *src++)) | |
4142 ; | |
4143 return dst; | |
4144 } | |
4145 | |
4146 static char* expstrrchr(char* string, int value) | |
4147 { | |
4148 char* result=strrchr(string, value); | |
4149 if(result) | |
4150 dbgprintf("strrchr(0x%x='%s', %d) => 0x%x='%s'", string, string, value, result, result); | |
4151 else | |
4152 dbgprintf("strrchr(0x%x='%s', %d) => 0", string, string, value); | |
4153 return result; | |
4154 } | |
4155 | |
4156 static char* expstrchr(char* string, int value) | |
4157 { | |
4158 char* result=strchr(string, value); | |
4159 if(result) | |
4160 dbgprintf("strchr(0x%x='%s', %d) => 0x%x='%s'", string, string, value, result, result); | |
4161 else | |
4162 dbgprintf("strchr(0x%x='%s', %d) => 0", string, string, value); | |
4163 return result; | |
4164 } | |
4165 static int expstrlen(char* str) | |
4166 { | |
4167 int result=strlen(str); | |
4168 dbgprintf("strlen(0x%x='%s') => %d\n", str, str, result); | |
4169 return result; | |
4170 } | |
4171 static char* expstrcpy(char* str1, const char* str2) | |
4172 { | |
4173 char* result= strcpy(str1, str2); | |
4174 dbgprintf("strcpy(0x%x, 0x%x='%s') => %p\n", str1, str2, str2, result); | |
4175 return result; | |
4176 } | |
9397 | 4177 static char* expstrncpy(char* str1, const char* str2, size_t count) |
4178 { | |
4179 char* result= strncpy(str1, str2, count); | |
4180 dbgprintf("strncpy(0x%x, 0x%x='%s', %d) => %p\n", str1, str2, str2, count, result); | |
4181 return result; | |
4182 } | |
3465 | 4183 static int expstrcmp(const char* str1, const char* str2) |
4184 { | |
4185 int result=strcmp(str1, str2); | |
4186 dbgprintf("strcmp(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result); | |
4187 return result; | |
4188 } | |
4189 static int expstrncmp(const char* str1, const char* str2,int x) | |
4190 { | |
4191 int result=strncmp(str1, str2,x); | |
4192 dbgprintf("strcmp(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result); | |
4193 return result; | |
4194 } | |
4195 static char* expstrcat(char* str1, const char* str2) | |
4196 { | |
4197 char* result = strcat(str1, str2); | |
4198 dbgprintf("strcat(0x%x='%s', 0x%x='%s') => %p\n", str1, str1, str2, str2, result); | |
4199 return result; | |
4200 } | |
4201 static char* exp_strdup(const char* str1) | |
4202 { | |
4203 int l = strlen(str1); | |
7386 | 4204 char* result = (char*) my_mreq(l + 1,0); |
3465 | 4205 if (result) |
4206 strcpy(result, str1); | |
4207 dbgprintf("_strdup(0x%x='%s') => %p\n", str1, str1, result); | |
4208 return result; | |
4209 } | |
4210 static int expisalnum(int c) | |
4211 { | |
4212 int result= (int) isalnum(c); | |
4213 dbgprintf("isalnum(0x%x='%c' => %d\n", c, c, result); | |
4214 return result; | |
4215 } | |
3672
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4216 static int expisspace(int c) |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4217 { |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4218 int result= (int) isspace(c); |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4219 dbgprintf("isspace(0x%x='%c' => %d\n", c, c, result); |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4220 return result; |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4221 } |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4222 static int expisalpha(int c) |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4223 { |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4224 int result= (int) isalpha(c); |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4225 dbgprintf("isalpha(0x%x='%c' => %d\n", c, c, result); |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4226 return result; |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4227 } |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4228 static int expisdigit(int c) |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4229 { |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4230 int result= (int) isdigit(c); |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4231 dbgprintf("isdigit(0x%x='%c' => %d\n", c, c, result); |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4232 return result; |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4233 } |
3465 | 4234 static void* expmemmove(void* dest, void* src, int n) |
4235 { | |
4236 void* result = memmove(dest, src, n); | |
4237 dbgprintf("memmove(0x%x, 0x%x, %d) => %p\n", dest, src, n, result); | |
4238 return result; | |
4239 } | |
4240 static int expmemcmp(void* dest, void* src, int n) | |
4241 { | |
4242 int result = memcmp(dest, src, n); | |
4243 dbgprintf("memcmp(0x%x, 0x%x, %d) => %d\n", dest, src, n, result); | |
4244 return result; | |
4245 } | |
4246 static void* expmemcpy(void* dest, void* src, int n) | |
4247 { | |
4248 void *result = memcpy(dest, src, n); | |
4249 dbgprintf("memcpy(0x%x, 0x%x, %d) => %p\n", dest, src, n, result); | |
4250 return result; | |
4251 } | |
3672
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4252 static void* expmemset(void* dest, int c, size_t n) |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4253 { |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4254 void *result = memset(dest, c, n); |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4255 dbgprintf("memset(0x%x, %d, %d) => %p\n", dest, c, n, result); |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4256 return result; |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
4257 } |
3465 | 4258 static time_t exptime(time_t* t) |
4259 { | |
4260 time_t result = time(t); | |
4261 dbgprintf("time(0x%x) => %d\n", t, result); | |
4262 return result; | |
4263 } | |
4264 | |
4265 static int exprand(void) | |
4266 { | |
4267 return rand(); | |
4268 } | |
4269 | |
4270 static void expsrand(int seed) | |
4271 { | |
4272 srand(seed); | |
4273 } | |
4274 | |
4275 #if 1 | |
4276 | |
4277 // prefered compilation with -O2 -ffast-math ! | |
4278 | |
4279 static double explog10(double x) | |
4280 { | |
4281 /*printf("Log10 %f => %f 0x%Lx\n", x, log10(x), *((int64_t*)&x));*/ | |
4282 return log10(x); | |
4283 } | |
4284 | |
4285 static double expcos(double x) | |
4286 { | |
4287 /*printf("Cos %f => %f 0x%Lx\n", x, cos(x), *((int64_t*)&x));*/ | |
4288 return cos(x); | |
4289 } | |
4290 | |
4291 /* doens't work */ | |
4292 static long exp_ftol_wrong(double x) | |
4293 { | |
4294 return (long) x; | |
4295 } | |
4296 | |
4297 #else | |
4298 | |
4299 static void explog10(void) | |
4300 { | |
4301 __asm__ __volatile__ | |
4302 ( | |
4303 "fldl 8(%esp) \n\t" | |
4304 "fldln2 \n\t" | |
4305 "fxch %st(1) \n\t" | |
4306 "fyl2x \n\t" | |
4307 ); | |
4308 } | |
4309 | |
4310 static void expcos(void) | |
4311 { | |
4312 __asm__ __volatile__ | |
4313 ( | |
4314 "fldl 8(%esp) \n\t" | |
4315 "fcos \n\t" | |
4316 ); | |
4317 } | |
4318 | |
4319 #endif | |
4320 | |
4321 // this seem to be the only how to make this function working properly | |
4322 // ok - I've spent tremendous amount of time (many many many hours | |
4323 // of debuging fixing & testing - it's almost unimaginable - kabi | |
4324 | |
4325 // _ftol - operated on the float value which is already on the FPU stack | |
3923
3fd9b781a9d2
workaround for the guilty code that caused sig11 when compiled with gcc-3.0.x
pl
parents:
3672
diff
changeset
|
4326 |
3465 | 4327 static void exp_ftol(void) |
4328 { | |
4329 __asm__ __volatile__ | |
4330 ( | |
4331 "sub $12, %esp \n\t" | |
4332 "fstcw -2(%ebp) \n\t" | |
4333 "wait \n\t" | |
3925 | 4334 "movw -2(%ebp), %ax \n\t" |
4335 "orb $0x0C, %ah \n\t" | |
4336 "movw %ax, -4(%ebp) \n\t" | |
3465 | 4337 "fldcw -4(%ebp) \n\t" |
4338 "fistpl -12(%ebp) \n\t" | |
4339 "fldcw -2(%ebp) \n\t" | |
3925 | 4340 "movl -12(%ebp), %eax \n\t" |
4341 //Note: gcc 3.03 does not do the following op if it | |
4342 // knows that ebp=esp | |
4343 "movl %ebp, %esp \n\t" | |
3465 | 4344 ); |
4345 } | |
4346 | |
13739
09b6ce70be8e
Fix for Windows media audio 9 voice codec (format 0x0a)
rtognimp
parents:
13598
diff
changeset
|
4347 #define FPU_DOUBLES(var1,var2) double var1,var2; \ |
09b6ce70be8e
Fix for Windows media audio 9 voice codec (format 0x0a)
rtognimp
parents:
13598
diff
changeset
|
4348 __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \ |
09b6ce70be8e
Fix for Windows media audio 9 voice codec (format 0x0a)
rtognimp
parents:
13598
diff
changeset
|
4349 __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : ) |
09b6ce70be8e
Fix for Windows media audio 9 voice codec (format 0x0a)
rtognimp
parents:
13598
diff
changeset
|
4350 |
09b6ce70be8e
Fix for Windows media audio 9 voice codec (format 0x0a)
rtognimp
parents:
13598
diff
changeset
|
4351 static double exp_CIpow(void) |
09b6ce70be8e
Fix for Windows media audio 9 voice codec (format 0x0a)
rtognimp
parents:
13598
diff
changeset
|
4352 { |
09b6ce70be8e
Fix for Windows media audio 9 voice codec (format 0x0a)
rtognimp
parents:
13598
diff
changeset
|
4353 FPU_DOUBLES(x,y); |
09b6ce70be8e
Fix for Windows media audio 9 voice codec (format 0x0a)
rtognimp
parents:
13598
diff
changeset
|
4354 |
09b6ce70be8e
Fix for Windows media audio 9 voice codec (format 0x0a)
rtognimp
parents:
13598
diff
changeset
|
4355 dbgprintf("_CIpow(%lf, %lf)\n", x, y); |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4356 return pow(x, y); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4357 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4358 |
3465 | 4359 static double exppow(double x, double y) |
4360 { | |
4361 /*printf("Pow %f %f 0x%Lx 0x%Lx => %f\n", x, y, *((int64_t*)&x), *((int64_t*)&y), pow(x, y));*/ | |
4362 return pow(x, y); | |
4363 } | |
4364 | |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4365 static double expldexp(double x, int expo) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4366 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4367 /*printf("Cos %f => %f 0x%Lx\n", x, cos(x), *((int64_t*)&x));*/ |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4368 return ldexp(x, expo); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4369 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4370 |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4371 static double expfrexp(double x, int* expo) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4372 { |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4373 /*printf("Cos %f => %f 0x%Lx\n", x, cos(x), *((int64_t*)&x));*/ |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4374 return frexp(x, expo); |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4375 } |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4376 |
3465 | 4377 |
4378 | |
4379 static int exp_stricmp(const char* s1, const char* s2) | |
4380 { | |
4381 return strcasecmp(s1, s2); | |
4382 } | |
4383 | |
4384 /* from declaration taken from Wine sources - this fountion seems to be | |
4385 * undocumented in any M$ doc */ | |
4386 static int exp_setjmp3(void* jmpbuf, int x) | |
4387 { | |
4388 //dbgprintf("!!!!UNIMPLEMENTED: setjmp3(%p, %d) => 0\n", jmpbuf, x); | |
4389 //return 0; | |
4390 __asm__ __volatile__ | |
4391 ( | |
4392 //"mov 4(%%esp), %%edx \n\t" | |
4393 "mov (%%esp), %%eax \n\t" | |
4394 "mov %%eax, (%%edx) \n\t" // store ebp | |
4395 | |
4396 //"mov %%ebp, (%%edx) \n\t" | |
4397 "mov %%ebx, 4(%%edx) \n\t" | |
4398 "mov %%edi, 8(%%edx) \n\t" | |
4399 "mov %%esi, 12(%%edx) \n\t" | |
4400 "mov %%esp, 16(%%edx) \n\t" | |
4401 | |
4402 "mov 4(%%esp), %%eax \n\t" | |
4403 "mov %%eax, 20(%%edx) \n\t" | |
4404 | |
4405 "movl $0x56433230, 32(%%edx) \n\t" // VC20 ?? | |
4406 "movl $0, 36(%%edx) \n\t" | |
4407 : // output | |
4408 : "d"(jmpbuf) // input | |
7386 | 4409 : "eax" |
3465 | 4410 ); |
4411 #if 1 | |
4412 __asm__ __volatile__ | |
4413 ( | |
4414 "mov %%fs:0, %%eax \n\t" // unsure | |
4415 "mov %%eax, 24(%%edx) \n\t" | |
4416 "cmp $0xffffffff, %%eax \n\t" | |
4417 "jnz l1 \n\t" | |
4418 "mov %%eax, 28(%%edx) \n\t" | |
4419 "l1: \n\t" | |
4420 : | |
4421 : | |
7386 | 4422 : "eax" |
3465 | 4423 ); |
4424 #endif | |
4425 | |
4426 return 0; | |
4427 } | |
4428 | |
5234 | 4429 static DWORD WINAPI expGetCurrentProcessId(void) |
4430 { | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4431 dbgprintf("GetCurrentProcessId(void) => %d\n", getpid()); |
5234 | 4432 return getpid(); //(DWORD)NtCurrentTeb()->pid; |
4433 } | |
4434 | |
4435 | |
4436 typedef struct { | |
4437 UINT wPeriodMin; | |
4438 UINT wPeriodMax; | |
4439 } TIMECAPS, *LPTIMECAPS; | |
4440 | |
4441 static MMRESULT WINAPI exptimeGetDevCaps(LPTIMECAPS lpCaps, UINT wSize) | |
4442 { | |
4443 dbgprintf("timeGetDevCaps(%p, %u) !\n", lpCaps, wSize); | |
4444 | |
4445 lpCaps->wPeriodMin = 1; | |
4446 lpCaps->wPeriodMax = 65535; | |
4447 return 0; | |
4448 } | |
4449 | |
4450 static MMRESULT WINAPI exptimeBeginPeriod(UINT wPeriod) | |
4451 { | |
4452 dbgprintf("timeBeginPeriod(%u) !\n", wPeriod); | |
4453 | |
4454 if (wPeriod < 1 || wPeriod > 65535) return 96+1; //TIMERR_NOCANDO; | |
4455 return 0; | |
4456 } | |
4457 | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4458 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4459 static MMRESULT WINAPI exptimeEndPeriod(UINT wPeriod) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4460 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4461 dbgprintf("timeEndPeriod(%u) !\n", wPeriod); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4462 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4463 if (wPeriod < 1 || wPeriod > 65535) return 96+1; //TIMERR_NOCANDO; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4464 return 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4465 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4466 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4467 |
5234 | 4468 static void WINAPI expGlobalMemoryStatus( |
4469 LPMEMORYSTATUS lpmem | |
4470 ) { | |
4471 static MEMORYSTATUS cached_memstatus; | |
4472 static int cache_lastchecked = 0; | |
4473 SYSTEM_INFO si; | |
4474 FILE *f; | |
4475 | |
4476 if (time(NULL)==cache_lastchecked) { | |
4477 memcpy(lpmem,&cached_memstatus,sizeof(MEMORYSTATUS)); | |
4478 return; | |
4479 } | |
4480 | |
4481 #if 1 | |
4482 f = fopen( "/proc/meminfo", "r" ); | |
4483 if (f) | |
4484 { | |
4485 char buffer[256]; | |
4486 int total, used, free, shared, buffers, cached; | |
4487 | |
4488 lpmem->dwLength = sizeof(MEMORYSTATUS); | |
4489 lpmem->dwTotalPhys = lpmem->dwAvailPhys = 0; | |
4490 lpmem->dwTotalPageFile = lpmem->dwAvailPageFile = 0; | |
4491 while (fgets( buffer, sizeof(buffer), f )) | |
4492 { | |
4493 /* old style /proc/meminfo ... */ | |
4494 if (sscanf( buffer, "Mem: %d %d %d %d %d %d", &total, &used, &free, &shared, &buffers, &cached )) | |
4495 { | |
4496 lpmem->dwTotalPhys += total; | |
4497 lpmem->dwAvailPhys += free + buffers + cached; | |
4498 } | |
4499 if (sscanf( buffer, "Swap: %d %d %d", &total, &used, &free )) | |
4500 { | |
4501 lpmem->dwTotalPageFile += total; | |
4502 lpmem->dwAvailPageFile += free; | |
4503 } | |
4504 | |
4505 /* new style /proc/meminfo ... */ | |
4506 if (sscanf(buffer, "MemTotal: %d", &total)) | |
4507 lpmem->dwTotalPhys = total*1024; | |
4508 if (sscanf(buffer, "MemFree: %d", &free)) | |
4509 lpmem->dwAvailPhys = free*1024; | |
4510 if (sscanf(buffer, "SwapTotal: %d", &total)) | |
4511 lpmem->dwTotalPageFile = total*1024; | |
4512 if (sscanf(buffer, "SwapFree: %d", &free)) | |
4513 lpmem->dwAvailPageFile = free*1024; | |
4514 if (sscanf(buffer, "Buffers: %d", &buffers)) | |
4515 lpmem->dwAvailPhys += buffers*1024; | |
4516 if (sscanf(buffer, "Cached: %d", &cached)) | |
4517 lpmem->dwAvailPhys += cached*1024; | |
4518 } | |
4519 fclose( f ); | |
4520 | |
4521 if (lpmem->dwTotalPhys) | |
4522 { | |
4523 DWORD TotalPhysical = lpmem->dwTotalPhys+lpmem->dwTotalPageFile; | |
4524 DWORD AvailPhysical = lpmem->dwAvailPhys+lpmem->dwAvailPageFile; | |
4525 lpmem->dwMemoryLoad = (TotalPhysical-AvailPhysical) | |
4526 / (TotalPhysical / 100); | |
4527 } | |
4528 } else | |
4529 #endif | |
4530 { | |
4531 /* FIXME: should do something for other systems */ | |
4532 lpmem->dwMemoryLoad = 0; | |
4533 lpmem->dwTotalPhys = 16*1024*1024; | |
4534 lpmem->dwAvailPhys = 16*1024*1024; | |
4535 lpmem->dwTotalPageFile = 16*1024*1024; | |
4536 lpmem->dwAvailPageFile = 16*1024*1024; | |
4537 } | |
4538 expGetSystemInfo(&si); | |
4539 lpmem->dwTotalVirtual = si.lpMaximumApplicationAddress-si.lpMinimumApplicationAddress; | |
4540 /* FIXME: we should track down all the already allocated VM pages and substract them, for now arbitrarily remove 64KB so that it matches NT */ | |
4541 lpmem->dwAvailVirtual = lpmem->dwTotalVirtual-64*1024; | |
4542 memcpy(&cached_memstatus,lpmem,sizeof(MEMORYSTATUS)); | |
4543 cache_lastchecked = time(NULL); | |
4544 | |
4545 /* it appears some memory display programs want to divide by these values */ | |
4546 if(lpmem->dwTotalPageFile==0) | |
4547 lpmem->dwTotalPageFile++; | |
4548 | |
4549 if(lpmem->dwAvailPageFile==0) | |
4550 lpmem->dwAvailPageFile++; | |
4551 } | |
4552 | |
16632
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
4553 static INT WINAPI expGetThreadPriority(HANDLE hthread) |
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
4554 { |
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
4555 dbgprintf("GetThreadPriority(%p)\n",hthread); |
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
4556 return 0; |
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
4557 } |
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
4558 |
5234 | 4559 /********************************************************************** |
4560 * SetThreadPriority [KERNEL32.@] Sets priority for thread. | |
4561 * | |
4562 * RETURNS | |
4563 * Success: TRUE | |
4564 * Failure: FALSE | |
4565 */ | |
4566 static WIN_BOOL WINAPI expSetThreadPriority( | |
4567 HANDLE hthread, /* [in] Handle to thread */ | |
4568 INT priority) /* [in] Thread priority level */ | |
4569 { | |
4570 dbgprintf("SetThreadPriority(%p,%d)\n",hthread,priority); | |
4571 return TRUE; | |
4572 } | |
4573 | |
4574 static void WINAPI expExitProcess( DWORD status ) | |
4575 { | |
8451 | 4576 printf("EXIT - code %ld\n",status); |
5234 | 4577 exit(status); |
4578 } | |
4579 | |
4580 static INT WINAPI expMessageBoxA(HWND hWnd, LPCSTR text, LPCSTR title, UINT type){ | |
4581 printf("MSGBOX '%s' '%s' (%d)\n",text,title,type); | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4582 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4583 if (type == MB_ICONHAND && !strlen(text) && !strlen(title)) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4584 return IDIGNORE; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4585 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4586 return IDOK; |
5234 | 4587 } |
4588 | |
5742
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4589 /* these are needed for mss1 */ |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4590 |
21368 | 4591 /** |
4592 * \brief this symbol is defined within exp_EH_prolog_dummy | |
4593 * \param dest jump target | |
4594 */ | |
4595 void exp_EH_prolog(void *dest); | |
4596 //! just a dummy function that acts a container for the asm section | |
4597 void exp_EH_prolog_dummy(void) { | |
4598 asm volatile ( | |
4599 // take care, this "function" may not change flags or | |
4600 // registers besides eax (which is also why we can't use | |
4601 // exp_EH_prolog_dummy directly) | |
4602 MANGLE(exp_EH_prolog)": \n\t" | |
4603 "pop %eax \n\t" | |
4604 "push %ebp \n\t" | |
4605 "mov %esp, %ebp \n\t" | |
4606 "lea -12(%esp), %esp \n\t" | |
4607 "jmp *%eax \n\t" | |
4608 ); | |
4609 } | |
5742
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4610 |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4611 #include <netinet/in.h> |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4612 static WINAPI inline unsigned long int exphtonl(unsigned long int hostlong) |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4613 { |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4614 // dbgprintf("htonl(%x) => %x\n", hostlong, htonl(hostlong)); |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4615 return htonl(hostlong); |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4616 } |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4617 |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4618 static WINAPI inline unsigned long int expntohl(unsigned long int netlong) |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4619 { |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4620 // dbgprintf("ntohl(%x) => %x\n", netlong, ntohl(netlong)); |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4621 return ntohl(netlong); |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
4622 } |
7386 | 4623 static void WINAPI expVariantInit(void* p) |
4624 { | |
4625 printf("InitCommonControls called!\n"); | |
4626 return; | |
4627 } | |
2779 | 4628 |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4629 static int WINAPI expRegisterClassA(const void/*WNDCLASSA*/ *wc) |
5752
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4630 { |
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4631 dbgprintf("RegisterClassA(%p) => random id\n", wc); |
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4632 return time(NULL); /* be precise ! */ |
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4633 } |
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4634 |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4635 static int WINAPI expUnregisterClassA(const char *className, HINSTANCE hInstance) |
5752
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4636 { |
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4637 dbgprintf("UnregisterClassA(%s, %p) => 0\n", className, hInstance); |
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4638 return 0; |
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4639 } |
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
4640 |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4641 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4642 /* should be fixed bcs it's not fully strlen equivalent */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4643 static int expSysStringByteLen(void *str) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4644 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4645 dbgprintf("SysStringByteLen(%p) => %d\n", str, strlen(str)); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4646 return strlen(str); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4647 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4648 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4649 static int expDirectDrawCreate(void) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4650 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4651 dbgprintf("DirectDrawCreate(...) => NULL\n"); |
8451 | 4652 return 0; |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4653 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4654 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4655 #if 1 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4656 typedef struct tagPALETTEENTRY { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4657 BYTE peRed; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4658 BYTE peGreen; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4659 BYTE peBlue; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4660 BYTE peFlags; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4661 } PALETTEENTRY; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4662 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4663 /* reversed the first 2 entries */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4664 typedef struct tagLOGPALETTE { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4665 WORD palNumEntries; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4666 WORD palVersion; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4667 PALETTEENTRY palPalEntry[1]; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4668 } LOGPALETTE; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4669 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4670 static HPALETTE WINAPI expCreatePalette(CONST LOGPALETTE *lpgpl) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4671 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4672 HPALETTE test; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4673 int i; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4674 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4675 dbgprintf("CreatePalette(%x) => NULL\n", lpgpl); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4676 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4677 i = sizeof(LOGPALETTE)+((lpgpl->palNumEntries-1)*sizeof(PALETTEENTRY)); |
8451 | 4678 test = (HPALETTE)malloc(i); |
4679 memcpy((void *)test, lpgpl, i); | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4680 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4681 return test; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4682 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4683 #else |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4684 static int expCreatePalette(void) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4685 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4686 dbgprintf("CreatePalette(...) => NULL\n"); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4687 return NULL; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4688 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4689 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4690 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4691 static int WINAPI expGetClientRect(HWND win, RECT *r) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4692 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4693 dbgprintf("GetClientRect(0x%x, 0x%x) => 1\n", win, r); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4694 r->right = PSEUDO_SCREEN_WIDTH; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4695 r->left = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4696 r->bottom = PSEUDO_SCREEN_HEIGHT; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4697 r->top = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4698 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4699 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4700 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4701 #if 0 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4702 typedef struct tagPOINT { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4703 LONG x; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4704 LONG y; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4705 } POINT, *PPOINT; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4706 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4707 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4708 static int WINAPI expClientToScreen(HWND win, POINT *p) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4709 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4710 dbgprintf("ClientToScreen(0x%x, 0x%x = %d,%d) => 1\n", win, p, p->x, p->y); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4711 p->x = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4712 p->y = 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4713 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4714 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4715 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4716 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4717 /* for m3jpeg */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4718 static int WINAPI expSetThreadIdealProcessor(HANDLE thread, int proc) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4719 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4720 dbgprintf("SetThreadIdealProcessor(0x%x, %x) => 0\n", thread, proc); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4721 return 0; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4722 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4723 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4724 static int WINAPI expMessageBeep(int type) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4725 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4726 dbgprintf("MessageBeep(%d) => 1\n", type); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4727 return 1; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4728 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4729 |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4730 static int WINAPI expDialogBoxParamA(void *inst, const char *name, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4731 HWND parent, void *dialog_func, void *init_param) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4732 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4733 dbgprintf("DialogBoxParamA(0x%x, 0x%x = %s, 0x%x, 0x%x, 0x%x) => 0x42424242\n", |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4734 inst, name, name, parent, dialog_func, init_param); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4735 return 0x42424242; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4736 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4737 |
16338
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4738 static void WINAPI expRegisterClipboardFormatA(const char *name) { |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4739 dbgprintf("RegisterClipboardFormatA(0x%x = %s)\n", name, name); |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4740 } |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4741 |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4742 /* needed by imagepower mjpeg2k */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4743 static void *exprealloc(void *ptr, size_t size) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4744 { |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4745 dbgprintf("realloc(0x%x, %x)\n", ptr, size); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4746 if (!ptr) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4747 return my_mreq(size,0); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4748 else |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4749 return my_realloc(ptr, size); |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4750 } |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4751 |
10818
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
4752 /* Fake GetOpenFileNameA from comdlg32.dll for ViVD codec */ |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
4753 static WIN_BOOL WINAPI expGetOpenFileNameA(/*LPOPENFILENAMEA*/ void* lpfn) |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
4754 { |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
4755 return 1; |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
4756 } |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
4757 |
16338
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4758 static char * WINAPI expPathFindExtensionA(const char *path) { |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4759 char *ext; |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4760 if (!path) |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4761 ext = NULL; |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4762 else { |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4763 ext = strrchr(path, '.'); |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4764 if (!ext) |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4765 ext = &path[strlen(path)]; |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4766 } |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4767 dbgprintf("PathFindExtensionA(0x%x = %s) => 0x%x, %s\n", path, path, ext, ext); |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4768 return ext; |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4769 } |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4770 |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4771 static char * WINAPI expPathFindFileNameA(const char *path) { |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4772 char *name; |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4773 if (!path || strlen(path) < 2) |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4774 name = path; |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4775 else { |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4776 name = strrchr(path - 1, '\\'); |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4777 if (!name) |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4778 name = path; |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4779 } |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4780 dbgprintf("PathFindFileNameA(0x%x = %s) => 0x%x, %s\n", path, path, name, name); |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4781 return name; |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4782 } |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
4783 |
13598
7a626d236929
Windows Media Image (WMVP) can be decoded with WMV9 dmo codec
rtognimp
parents:
13379
diff
changeset
|
4784 static double expfloor(double x) |
7a626d236929
Windows Media Image (WMVP) can be decoded with WMV9 dmo codec
rtognimp
parents:
13379
diff
changeset
|
4785 { |
7a626d236929
Windows Media Image (WMVP) can be decoded with WMV9 dmo codec
rtognimp
parents:
13379
diff
changeset
|
4786 dbgprintf("floor(%lf)\n", x); |
7a626d236929
Windows Media Image (WMVP) can be decoded with WMV9 dmo codec
rtognimp
parents:
13379
diff
changeset
|
4787 return floor(x); |
7a626d236929
Windows Media Image (WMVP) can be decoded with WMV9 dmo codec
rtognimp
parents:
13379
diff
changeset
|
4788 } |
7a626d236929
Windows Media Image (WMVP) can be decoded with WMV9 dmo codec
rtognimp
parents:
13379
diff
changeset
|
4789 |
13751 | 4790 #define FPU_DOUBLE(var) double var; \ |
4791 __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : ) | |
4792 | |
4793 static double exp_CIcos(void) | |
4794 { | |
4795 FPU_DOUBLE(x); | |
4796 | |
4797 dbgprintf("_CIcos(%lf)\n", x); | |
4798 return cos(x); | |
4799 } | |
4800 | |
4801 static double exp_CIsin(void) | |
4802 { | |
4803 FPU_DOUBLE(x); | |
4804 | |
4805 dbgprintf("_CIsin(%lf)\n", x); | |
4806 return sin(x); | |
4807 } | |
4808 | |
18580
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4809 static double exp_CIsqrt(void) |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4810 { |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4811 FPU_DOUBLE(x); |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4812 |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4813 dbgprintf("_CIsqrt(%lf)\n", x); |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4814 return sqrt(x); |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4815 } |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4816 |
17071 | 4817 /* Needed by rp8 sipr decoder */ |
4818 static LPSTR WINAPI expCharNextA(LPCSTR ptr) | |
4819 { | |
4820 if (!*ptr) return (LPSTR)ptr; | |
4821 // dbgprintf("CharNextA(0x%08x), %s\n", ptr, ptr); | |
4822 return (LPSTR)(ptr + 1); | |
4823 } | |
4824 | |
18580
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4825 // Fake implementation, needed by wvc1dmod.dll |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4826 static int WINAPI expPropVariantClear(void *pvar) |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4827 { |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4828 // dbgprintf("PropVariantclear (0x%08x), %s\n", ptr, ptr); |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4829 return 1; |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4830 } |
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
4831 |
20652
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4832 // This define is fake, the real thing is a struct |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4833 #define LPDEVMODEA void* |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4834 // Dummy implementation, always return 1 |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4835 // Required for frapsvid.dll 2.8.1, return value does not matter |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4836 static WIN_BOOL WINAPI expEnumDisplaySettingsA(LPCSTR name ,DWORD n, |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4837 LPDEVMODEA devmode) |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4838 { |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4839 dbgprintf("EnumDisplaySettingsA (dummy) => 1\n"); |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4840 return 1; |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4841 } |
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
4842 |
1 | 4843 struct exports |
4844 { | |
4845 char name[64]; | |
4846 int id; | |
4847 void* func; | |
4848 }; | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
4849 struct libs |
1 | 4850 { |
4851 char name[64]; | |
4852 int length; | |
4853 struct exports* exps; | |
4854 }; | |
4855 | |
4856 #define FF(X,Y) \ | |
3465 | 4857 {#X, Y, (void*)exp##X}, |
4858 | |
4859 struct exports exp_kernel32[]= | |
4860 { | |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4861 FF(GetVolumeInformationA,-1) |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4862 FF(GetDriveTypeA,-1) |
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
4863 FF(GetLogicalDriveStringsA,-1) |
3465 | 4864 FF(IsBadWritePtr, 357) |
4865 FF(IsBadReadPtr, 354) | |
4866 FF(IsBadStringPtrW, -1) | |
4867 FF(IsBadStringPtrA, -1) | |
4868 FF(DisableThreadLibraryCalls, -1) | |
4869 FF(CreateThread, -1) | |
4870 FF(CreateEventA, -1) | |
4871 FF(SetEvent, -1) | |
4872 FF(ResetEvent, -1) | |
4873 FF(WaitForSingleObject, -1) | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4874 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4875 FF(WaitForMultipleObjects, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4876 FF(ExitThread, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4877 FF(CreateMutexA,-1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4878 FF(ReleaseMutex,-1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4879 #endif |
3465 | 4880 FF(GetSystemInfo, -1) |
4881 FF(GetVersion, 332) | |
4882 FF(HeapCreate, 461) | |
4883 FF(HeapAlloc, -1) | |
4884 FF(HeapDestroy, -1) | |
4885 FF(HeapFree, -1) | |
4886 FF(HeapSize, -1) | |
4887 FF(HeapReAlloc,-1) | |
4888 FF(GetProcessHeap, -1) | |
4889 FF(VirtualAlloc, -1) | |
4890 FF(VirtualFree, -1) | |
4891 FF(InitializeCriticalSection, -1) | |
4892 FF(EnterCriticalSection, -1) | |
4893 FF(LeaveCriticalSection, -1) | |
4894 FF(DeleteCriticalSection, -1) | |
4895 FF(TlsAlloc, -1) | |
4896 FF(TlsFree, -1) | |
4897 FF(TlsGetValue, -1) | |
4898 FF(TlsSetValue, -1) | |
4899 FF(GetCurrentThreadId, -1) | |
4900 FF(GetCurrentProcess, -1) | |
4901 FF(LocalAlloc, -1) | |
4902 FF(LocalReAlloc,-1) | |
4903 FF(LocalLock, -1) | |
4904 FF(GlobalAlloc, -1) | |
4905 FF(GlobalReAlloc, -1) | |
4906 FF(GlobalLock, -1) | |
4907 FF(GlobalSize, -1) | |
4908 FF(MultiByteToWideChar, 427) | |
4909 FF(WideCharToMultiByte, -1) | |
4910 FF(GetVersionExA, -1) | |
4911 FF(CreateSemaphoreA, -1) | |
4912 FF(QueryPerformanceCounter, -1) | |
4913 FF(QueryPerformanceFrequency, -1) | |
4914 FF(LocalHandle, -1) | |
4915 FF(LocalUnlock, -1) | |
4916 FF(LocalFree, -1) | |
4917 FF(GlobalHandle, -1) | |
4918 FF(GlobalUnlock, -1) | |
4919 FF(GlobalFree, -1) | |
4920 FF(LoadResource, -1) | |
4921 FF(ReleaseSemaphore, -1) | |
4922 FF(FindResourceA, -1) | |
4923 FF(LockResource, -1) | |
4924 FF(FreeResource, -1) | |
4925 FF(SizeofResource, -1) | |
4926 FF(CloseHandle, -1) | |
4927 FF(GetCommandLineA, -1) | |
4928 FF(GetEnvironmentStringsW, -1) | |
4929 FF(FreeEnvironmentStringsW, -1) | |
4930 FF(FreeEnvironmentStringsA, -1) | |
4931 FF(GetEnvironmentStrings, -1) | |
4932 FF(GetStartupInfoA, -1) | |
4933 FF(GetStdHandle, -1) | |
4934 FF(GetFileType, -1) | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4935 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4936 FF(GetFileAttributesA, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4937 #endif |
3465 | 4938 FF(SetHandleCount, -1) |
4939 FF(GetACP, -1) | |
4940 FF(GetModuleFileNameA, -1) | |
4941 FF(SetUnhandledExceptionFilter, -1) | |
4942 FF(LoadLibraryA, -1) | |
4943 FF(GetProcAddress, -1) | |
4944 FF(FreeLibrary, -1) | |
4945 FF(CreateFileMappingA, -1) | |
4946 FF(OpenFileMappingA, -1) | |
4947 FF(MapViewOfFile, -1) | |
4948 FF(UnmapViewOfFile, -1) | |
4949 FF(Sleep, -1) | |
4950 FF(GetModuleHandleA, -1) | |
4951 FF(GetProfileIntA, -1) | |
4952 FF(GetPrivateProfileIntA, -1) | |
4953 FF(GetPrivateProfileStringA, -1) | |
4954 FF(WritePrivateProfileStringA, -1) | |
4955 FF(GetLastError, -1) | |
4956 FF(SetLastError, -1) | |
4957 FF(InterlockedIncrement, -1) | |
4958 FF(InterlockedDecrement, -1) | |
4959 FF(GetTimeZoneInformation, -1) | |
4960 FF(OutputDebugStringA, -1) | |
4961 FF(GetLocalTime, -1) | |
4962 FF(GetSystemTime, -1) | |
7386 | 4963 FF(GetSystemTimeAsFileTime, -1) |
3465 | 4964 FF(GetEnvironmentVariableA, -1) |
5744
16a7eee0aca3
added SetEnvironmentVariableA for UCOD-ClearVideo DLL
alex
parents:
5742
diff
changeset
|
4965 FF(SetEnvironmentVariableA, -1) |
3465 | 4966 FF(RtlZeroMemory,-1) |
4967 FF(RtlMoveMemory,-1) | |
4968 FF(RtlFillMemory,-1) | |
4969 FF(GetTempPathA,-1) | |
4970 FF(FindFirstFileA,-1) | |
4971 FF(FindNextFileA,-1) | |
4972 FF(FindClose,-1) | |
4973 FF(FileTimeToLocalFileTime,-1) | |
4974 FF(DeleteFileA,-1) | |
4975 FF(ReadFile,-1) | |
4976 FF(WriteFile,-1) | |
4977 FF(SetFilePointer,-1) | |
4978 FF(GetTempFileNameA,-1) | |
4979 FF(CreateFileA,-1) | |
4980 FF(GetSystemDirectoryA,-1) | |
4981 FF(GetWindowsDirectoryA,-1) | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4982 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4983 FF(GetCurrentDirectoryA,-1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4984 FF(SetCurrentDirectoryA,-1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4985 FF(CreateDirectoryA,-1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
4986 #endif |
5234 | 4987 FF(GetShortPathNameA,-1) |
5739
b7e0cf4cb7a9
fixed mp_msg, fixed CreateFile for VDub, added GetFullPathName for VDub, cleaned up a bit the critisecs
alex
parents:
5234
diff
changeset
|
4988 FF(GetFullPathNameA,-1) |
3465 | 4989 FF(SetErrorMode, -1) |
4990 FF(IsProcessorFeaturePresent, -1) | |
4991 FF(GetProcessAffinityMask, -1) | |
4992 FF(InterlockedExchange, -1) | |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
4993 FF(InterlockedCompareExchange, -1) |
3465 | 4994 FF(MulDiv, -1) |
4995 FF(lstrcmpiA, -1) | |
4996 FF(lstrlenA, -1) | |
4997 FF(lstrcpyA, -1) | |
4998 FF(lstrcatA, -1) | |
4999 FF(lstrcpynA,-1) | |
5000 FF(GetProcessVersion,-1) | |
5001 FF(GetCurrentThread,-1) | |
5002 FF(GetOEMCP,-1) | |
5003 FF(GetCPInfo,-1) | |
5004 FF(DuplicateHandle,-1) | |
5005 FF(GetTickCount, -1) | |
5006 FF(SetThreadAffinityMask,-1) | |
5234 | 5007 FF(GetCurrentProcessId,-1) |
5008 FF(GlobalMemoryStatus,-1) | |
16632
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
5009 FF(GetThreadPriority,-1) |
5234 | 5010 FF(SetThreadPriority,-1) |
5011 FF(ExitProcess,-1) | |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5012 {"LoadLibraryExA", -1, (void*)&LoadLibraryExA}, |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5013 FF(SetThreadIdealProcessor,-1) |
18580
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
5014 FF(SetProcessAffinityMask, -1) |
1 | 5015 }; |
5016 | |
5017 struct exports exp_msvcrt[]={ | |
3465 | 5018 FF(malloc, -1) |
5019 FF(_initterm, -1) | |
7386 | 5020 FF(__dllonexit, -1) |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
5021 FF(_snprintf,-1) |
3465 | 5022 FF(free, -1) |
5023 {"??3@YAXPAX@Z", -1, expdelete}, | |
5024 {"??2@YAPAXI@Z", -1, expnew}, | |
5025 {"_adjust_fdiv", -1, (void*)&_adjust_fdiv}, | |
16632
bdc49c9c419e
Several minor fixes: Correctly advertise SSE and SSE2 instruction sets,
reimar
parents:
16338
diff
changeset
|
5026 {"_winver",-1,(void*)&_winver}, |
3465 | 5027 FF(strrchr, -1) |
5028 FF(strchr, -1) | |
5029 FF(strlen, -1) | |
5030 FF(strcpy, -1) | |
9397 | 5031 FF(strncpy, -1) |
3465 | 5032 FF(wcscpy, -1) |
5033 FF(strcmp, -1) | |
5034 FF(strncmp, -1) | |
5035 FF(strcat, -1) | |
5036 FF(_stricmp,-1) | |
5037 FF(_strdup,-1) | |
5038 FF(_setjmp3,-1) | |
5039 FF(isalnum, -1) | |
3672
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
5040 FF(isspace, -1) |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
5041 FF(isalpha, -1) |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
5042 FF(isdigit, -1) |
3465 | 5043 FF(memmove, -1) |
5044 FF(memcmp, -1) | |
3672
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
5045 FF(memset, -1) |
1d48df12001b
fixes for vdub plugin support - by Fredrik Kuivinen <freku045@student.liu.se>
arpi
parents:
3547
diff
changeset
|
5046 FF(memcpy, -1) |
3465 | 5047 FF(time, -1) |
5048 FF(rand, -1) | |
5049 FF(srand, -1) | |
5050 FF(log10, -1) | |
5051 FF(pow, -1) | |
5052 FF(cos, -1) | |
5053 FF(_ftol,-1) | |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5054 FF(_CIpow,-1) |
13751 | 5055 FF(_CIcos,-1) |
5056 FF(_CIsin,-1) | |
18580
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
5057 FF(_CIsqrt,-1) |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5058 FF(ldexp,-1) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5059 FF(frexp,-1) |
3465 | 5060 FF(sprintf,-1) |
5061 FF(sscanf,-1) | |
5062 FF(fopen,-1) | |
5063 FF(fprintf,-1) | |
5064 FF(printf,-1) | |
5065 FF(getenv,-1) | |
13598
7a626d236929
Windows Media Image (WMVP) can be decoded with WMV9 dmo codec
rtognimp
parents:
13379
diff
changeset
|
5066 FF(floor,-1) |
15474 | 5067 /* needed by frapsvid.dll */ |
5068 {"strstr",-1,(char *)&strstr}, | |
5069 {"qsort",-1,(void *)&qsort}, | |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5070 #ifdef MPLAYER |
5742
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
5071 FF(_EH_prolog,-1) |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5072 #endif |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5073 FF(calloc,-1) |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5074 {"ceil",-1,(void*)&ceil}, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5075 /* needed by imagepower mjpeg2k */ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5076 {"clock",-1,(void*)&clock}, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5077 {"memchr",-1,(void*)&memchr}, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5078 {"vfprintf",-1,(void*)&vfprintf}, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5079 // {"realloc",-1,(void*)&realloc}, |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5080 FF(realloc,-1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5081 {"puts",-1,(void*)&puts} |
1 | 5082 }; |
5083 struct exports exp_winmm[]={ | |
3465 | 5084 FF(GetDriverModuleHandle, -1) |
5085 FF(timeGetTime, -1) | |
5086 FF(DefDriverProc, -1) | |
5087 FF(OpenDriverA, -1) | |
5088 FF(OpenDriver, -1) | |
5234 | 5089 FF(timeGetDevCaps, -1) |
5090 FF(timeBeginPeriod, -1) | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5091 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5092 FF(timeEndPeriod, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5093 FF(waveOutGetNumDevs, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5094 #endif |
1 | 5095 }; |
5096 struct exports exp_user32[]={ | |
12066
792eec413bd5
Support for Alparysoft lossless video codec (DShow and VfW)
rtognimp
parents:
12059
diff
changeset
|
5097 FF(LoadIconA,-1) |
3465 | 5098 FF(LoadStringA, -1) |
5099 FF(wsprintfA, -1) | |
5100 FF(GetDC, -1) | |
5101 FF(GetDesktopWindow, -1) | |
5102 FF(ReleaseDC, -1) | |
5103 FF(IsRectEmpty, -1) | |
5104 FF(LoadCursorA,-1) | |
5105 FF(SetCursor,-1) | |
5106 FF(GetCursorPos,-1) | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5107 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5108 FF(ShowCursor,-1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5109 #endif |
3465 | 5110 FF(RegisterWindowMessageA,-1) |
5111 FF(GetSystemMetrics,-1) | |
5112 FF(GetSysColor,-1) | |
5113 FF(GetSysColorBrush,-1) | |
5114 FF(GetWindowDC, -1) | |
5115 FF(DrawTextA, -1) | |
5234 | 5116 FF(MessageBoxA, -1) |
5752
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
5117 FF(RegisterClassA, -1) |
3f6b724efe83
RegisterClassA and UnregisterClassA for VoxWare RT24 speech codec ACM
alex
parents:
5751
diff
changeset
|
5118 FF(UnregisterClassA, -1) |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5119 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5120 FF(GetWindowRect, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5121 FF(MonitorFromWindow, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5122 FF(MonitorFromRect, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5123 FF(MonitorFromPoint, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5124 FF(EnumDisplayMonitors, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5125 FF(GetMonitorInfoA, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5126 FF(EnumDisplayDevicesA, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5127 FF(GetClientRect, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5128 FF(ClientToScreen, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5129 FF(IsWindowVisible, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5130 FF(GetActiveWindow, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5131 FF(GetClassNameA, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5132 FF(GetClassInfoA, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5133 FF(GetWindowLongA, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5134 FF(EnumWindows, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5135 FF(GetWindowThreadProcessId, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5136 FF(CreateWindowExA, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5137 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5138 FF(MessageBeep, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5139 FF(DialogBoxParamA, -1) |
16338
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
5140 FF(RegisterClipboardFormatA, -1) |
17071 | 5141 FF(CharNextA, -1) |
20652
0c342e00c63d
Dummy EnumDisplaySettingsA, required by frapsvid.dll 2.8.1
rtogni
parents:
18878
diff
changeset
|
5142 FF(EnumDisplaySettingsA, -1) |
1 | 5143 }; |
5144 struct exports exp_advapi32[]={ | |
3465 | 5145 FF(RegCloseKey, -1) |
12059
937a520811e9
Add support for Lead MCMW 2.0 wavelet codec eval version
rtognimp
parents:
11853
diff
changeset
|
5146 FF(RegCreateKeyA, -1) |
3465 | 5147 FF(RegCreateKeyExA, -1) |
5148 FF(RegEnumKeyExA, -1) | |
5149 FF(RegEnumValueA, -1) | |
5150 FF(RegOpenKeyA, -1) | |
5151 FF(RegOpenKeyExA, -1) | |
5152 FF(RegQueryValueExA, -1) | |
5153 FF(RegSetValueExA, -1) | |
9896
acf96aea152c
Vanguard codecs support, patch by Andreas Hess <jaska (at) gmx (dot) net>
rtognimp
parents:
9592
diff
changeset
|
5154 FF(RegQueryInfoKeyA, -1) |
1 | 5155 }; |
5156 struct exports exp_gdi32[]={ | |
3465 | 5157 FF(CreateCompatibleDC, -1) |
5158 FF(CreateFontA, -1) | |
5159 FF(DeleteDC, -1) | |
5160 FF(DeleteObject, -1) | |
5161 FF(GetDeviceCaps, -1) | |
5162 FF(GetSystemPaletteEntries, -1) | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5163 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5164 FF(CreatePalette, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5165 FF(GetObjectA, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5166 FF(CreateRectRgn, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5167 #endif |
1 | 5168 }; |
5169 struct exports exp_version[]={ | |
3465 | 5170 FF(GetFileVersionInfoSizeA, -1) |
1 | 5171 }; |
128 | 5172 struct exports exp_ole32[]={ |
3465 | 5173 FF(CoCreateFreeThreadedMarshaler,-1) |
5174 FF(CoCreateInstance, -1) | |
5175 FF(CoInitialize, -1) | |
5176 FF(CoTaskMemAlloc, -1) | |
5177 FF(CoTaskMemFree, -1) | |
5178 FF(StringFromGUID2, -1) | |
18580
d444160ee47c
Support WVC1 decoding via dmo binary codec wvc1dmod.dll
rtogni
parents:
17932
diff
changeset
|
5179 FF(PropVariantClear, -1) |
128 | 5180 }; |
3465 | 5181 // do we really need crtdll ??? |
5182 // msvcrt is the correct place probably... | |
130 | 5183 struct exports exp_crtdll[]={ |
3465 | 5184 FF(memcpy, -1) |
5185 FF(wcscpy, -1) | |
130 | 5186 }; |
2069 | 5187 struct exports exp_comctl32[]={ |
3465 | 5188 FF(StringFromGUID2, -1) |
5189 FF(InitCommonControls, 17) | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5190 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5191 FF(CreateUpDownControl, 16) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5192 #endif |
2069 | 5193 }; |
5742
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
5194 struct exports exp_wsock32[]={ |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
5195 FF(htonl,8) |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
5196 FF(ntohl,14) |
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
5197 }; |
3465 | 5198 struct exports exp_msdmo[]={ |
5199 FF(memcpy, -1) // just test | |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5200 FF(MoCopyMediaType, -1) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5201 FF(MoCreateMediaType, -1) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5202 FF(MoDeleteMediaType, -1) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5203 FF(MoDuplicateMediaType, -1) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5204 FF(MoFreeMediaType, -1) |
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5205 FF(MoInitMediaType, -1) |
7386 | 5206 }; |
5207 struct exports exp_oleaut32[]={ | |
5208 FF(VariantInit, 8) | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5209 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5210 FF(SysStringByteLen, 149) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5211 #endif |
3465 | 5212 }; |
6359 | 5213 |
5214 /* realplayer8: | |
5215 DLL Name: PNCRT.dll | |
5216 vma: Hint/Ord Member-Name | |
5217 22ff4 615 free | |
5218 2302e 250 _ftol | |
5219 22fea 666 malloc | |
5220 2303e 609 fprintf | |
5221 2305e 167 _adjust_fdiv | |
5222 23052 280 _initterm | |
5223 | |
5224 22ffc 176 _beginthreadex | |
5225 23036 284 _iob | |
5226 2300e 85 __CxxFrameHandler | |
5227 23022 411 _purecall | |
5228 */ | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5229 #ifdef REALPLAYER |
6359 | 5230 struct exports exp_pncrt[]={ |
5231 FF(malloc, -1) // just test | |
5232 FF(free, -1) // just test | |
5233 FF(fprintf, -1) // just test | |
5234 {"_adjust_fdiv", -1, (void*)&_adjust_fdiv}, | |
5235 FF(_ftol,-1) | |
5236 FF(_initterm, -1) | |
9397 | 5237 {"??3@YAXPAX@Z", -1, expdelete}, |
5238 {"??2@YAPAXI@Z", -1, expnew}, | |
5239 FF(__dllonexit, -1) | |
5240 FF(strncpy, -1) | |
5241 FF(_CIpow,-1) | |
5242 FF(calloc,-1) | |
5243 FF(memmove, -1) | |
17072
4c50b2f11ad8
export ldexp() and frexp() in pncrt, they are needed by rp8 sipr dll
rtognimp
parents:
17071
diff
changeset
|
5244 FF(ldexp, -1) |
4c50b2f11ad8
export ldexp() and frexp() in pncrt, they are needed by rp8 sipr dll
rtognimp
parents:
17071
diff
changeset
|
5245 FF(frexp, -1) |
6359 | 5246 }; |
7386 | 5247 #endif |
3465 | 5248 |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5249 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5250 struct exports exp_ddraw[]={ |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5251 FF(DirectDrawCreate, -1) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5252 }; |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5253 #endif |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5254 |
10818
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
5255 struct exports exp_comdlg32[]={ |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
5256 FF(GetOpenFileNameA, -1) |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
5257 }; |
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
5258 |
16338
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
5259 struct exports exp_shlwapi[]={ |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
5260 FF(PathFindExtensionA, -1) |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
5261 FF(PathFindFileNameA, -1) |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
5262 }; |
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
5263 |
1 | 5264 #define LL(X) \ |
3465 | 5265 {#X".dll", sizeof(exp_##X)/sizeof(struct exports), exp_##X}, |
1 | 5266 |
5267 struct libs libraries[]={ | |
3465 | 5268 LL(kernel32) |
5269 LL(msvcrt) | |
5270 LL(winmm) | |
5271 LL(user32) | |
5272 LL(advapi32) | |
5273 LL(gdi32) | |
5274 LL(version) | |
5275 LL(ole32) | |
7386 | 5276 LL(oleaut32) |
3465 | 5277 LL(crtdll) |
5278 LL(comctl32) | |
5742
310c836e3fb3
added _EH_prolog and some wsock32 funcs needed by mss1 codec -> mss1 codec works now
alex
parents:
5740
diff
changeset
|
5279 LL(wsock32) |
3465 | 5280 LL(msdmo) |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5281 #ifdef REALPLAYER |
6359 | 5282 LL(pncrt) |
7386 | 5283 #endif |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5284 #ifdef QTX |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5285 LL(ddraw) |
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5286 #endif |
10818
fa41f83edff0
ViVD v2 codec (fourcc gxve) support with vfw dll ViVD2.dll
rtognimp
parents:
10139
diff
changeset
|
5287 LL(comdlg32) |
16338
cbd034008ee0
Support On2 VP7 via binary decoder by implementing USER32.RegisterClipboardFormatA,
reimar
parents:
15566
diff
changeset
|
5288 LL(shlwapi) |
1 | 5289 }; |
7386 | 5290 |
3465 | 5291 static void ext_stubs(void) |
5292 { | |
21365
fef7a6713be2
Change add_stub code to also work without -fomit-frame-pointer
reimar
parents:
21313
diff
changeset
|
5293 volatile int idx = 0xdeadabcd; |
21461
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5294 // make sure gcc does not do eip-relative call or something like that |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5295 volatile void (*my_printf)(char *, char *) = (void *)0xdeadfbcd; |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5296 my_printf("Called unk_%s\n", export_names[idx]); |
3465 | 5297 } |
5298 | |
21366
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5299 #define MAX_STUB_SIZE 0x60 |
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5300 #define MAX_NUM_STUBS 200 |
7386 | 5301 static int pos=0; |
21366
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5302 static char extcode[MAX_NUM_STUBS * MAX_STUB_SIZE]; |
3465 | 5303 |
8293
f436f419e5ab
avifile sync (added only the new functions, all cosmetics ignored)
arpi
parents:
8285
diff
changeset
|
5304 static void* add_stub(void) |
3465 | 5305 { |
21365
fef7a6713be2
Change add_stub code to also work without -fomit-frame-pointer
reimar
parents:
21313
diff
changeset
|
5306 int i; |
21461
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5307 int found = 0; |
7386 | 5308 // generated code in runtime! |
21366
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5309 char* answ = extcode + pos * MAX_STUB_SIZE; |
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5310 if (pos >= MAX_NUM_STUBS) { |
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5311 printf("too many stubs, expect crash\n"); |
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5312 return NULL; |
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5313 } |
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5314 memcpy(answ, ext_stubs, MAX_STUB_SIZE); |
516351d9a796
Some extra checks and safety space for add_stub function.
reimar
parents:
21365
diff
changeset
|
5315 for (i = 0; i < MAX_STUB_SIZE - 3; i++) { |
21461
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5316 int *magic = (int *)(answ + i); |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5317 if (*magic == 0xdeadabcd) { |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5318 *magic = pos; |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5319 found |= 1; |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5320 } |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5321 if (*magic == 0xdeadfbcd) { |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5322 *magic = (intptr_t)printf; |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5323 found |= 2; |
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5324 } |
21365
fef7a6713be2
Change add_stub code to also work without -fomit-frame-pointer
reimar
parents:
21313
diff
changeset
|
5325 } |
21461
71235c49d6ac
Fix 21381, make sure gcc does not make any ip-relative calls or similar.
reimar
parents:
21368
diff
changeset
|
5326 if (found != 3) { |
21365
fef7a6713be2
Change add_stub code to also work without -fomit-frame-pointer
reimar
parents:
21313
diff
changeset
|
5327 printf("magic code not found in ext_subs, expect crash\n"); |
fef7a6713be2
Change add_stub code to also work without -fomit-frame-pointer
reimar
parents:
21313
diff
changeset
|
5328 return NULL; |
fef7a6713be2
Change add_stub code to also work without -fomit-frame-pointer
reimar
parents:
21313
diff
changeset
|
5329 } |
3465 | 5330 pos++; |
5331 return (void*)answ; | |
5332 } | |
2069 | 5333 |
1 | 5334 void* LookupExternal(const char* library, int ordinal) |
5335 { | |
5336 int i,j; | |
5337 if(library==0) | |
5338 { | |
5339 printf("ERROR: library=0\n"); | |
5340 return (void*)ext_unknown; | |
5341 } | |
3465 | 5342 // printf("%x %x\n", &unk_exp1, &unk_exp2); |
1 | 5343 |
13379 | 5344 dbgprintf("External func %s:%d\n", library, ordinal); |
5751
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5345 |
5770
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5346 for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5347 { |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5348 if(strcasecmp(library, libraries[i].name)) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5349 continue; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5350 for(j=0; j<libraries[i].length; j++) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5351 { |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5352 if(ordinal!=libraries[i].exps[j].id) |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5353 continue; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5354 //printf("Hit: 0x%p\n", libraries[i].exps[j].func); |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5355 return libraries[i].exps[j].func; |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5356 } |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5357 } |
ec71380bdbca
fixed IsRectEmpty, added expcalloc, ceil, exporting LoadLibraryExA, IC* for some new codecs
alex
parents:
5752
diff
changeset
|
5358 |
9592
b20b0c80298b
Fix for truespeech dll, patch by <dimakar(at)yahoo.com>
rtognimp
parents:
9397
diff
changeset
|
5359 #ifndef LOADLIB_TRY_NATIVE |
9897 | 5360 /* hack for truespeech and vssh264*/ |
13748 | 5361 if (!strcmp(library, "tsd32.dll") || !strcmp(library,"vssh264dec.dll") || !strcmp(library,"LCMW2.dll") || !strcmp(library,"VDODEC32.dll")) |
9592
b20b0c80298b
Fix for truespeech dll, patch by <dimakar(at)yahoo.com>
rtognimp
parents:
9397
diff
changeset
|
5362 #endif |
5751
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5363 /* ok, this is a hack, and a big memory leak. should be fixed. - alex */ |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5364 { |
7386 | 5365 int hand; |
5751
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5366 WINE_MODREF *wm; |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5367 void *func; |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5368 |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5369 hand = LoadLibraryA(library); |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5370 if (!hand) |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5371 goto no_dll; |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5372 wm = MODULE32_LookupHMODULE(hand); |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5373 if (!wm) |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5374 { |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5375 FreeLibrary(hand); |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5376 goto no_dll; |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5377 } |
7386 | 5378 func = PE_FindExportedFunction(wm, (LPCSTR) ordinal, 0); |
5751
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5379 if (!func) |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5380 { |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5381 printf("No such ordinal in external dll\n"); |
7386 | 5382 FreeLibrary((int)hand); |
5751
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5383 goto no_dll; |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5384 } |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5385 |
7386 | 5386 printf("External dll loaded (offset: 0x%x, func: %p)\n", |
5387 hand, func); | |
5751
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5388 return func; |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5389 } |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5390 |
271bd43aed88
loading requested library if available, and try to find function there in LookupExternal, needed for Truespeech codec
alex
parents:
5744
diff
changeset
|
5391 no_dll: |
1 | 5392 if(pos>150)return 0; |
5393 sprintf(export_names[pos], "%s:%d", library, ordinal); | |
7386 | 5394 return add_stub(); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
5395 } |
1 | 5396 |
5397 void* LookupExternalByName(const char* library, const char* name) | |
5398 { | |
5399 char* answ; | |
5400 int i,j; | |
3465 | 5401 // return (void*)ext_unknown; |
1 | 5402 if(library==0) |
5403 { | |
5404 printf("ERROR: library=0\n"); | |
5405 return (void*)ext_unknown; | |
5406 } | |
5407 if(name==0) | |
5408 { | |
5409 printf("ERROR: name=0\n"); | |
5410 return (void*)ext_unknown; | |
5411 } | |
8279
fade8f754da0
_qtx support_ and m3jpeg,mjpeg2k fixes (some cleanup and _lot of testing needed_)
alex
parents:
8141
diff
changeset
|
5412 dbgprintf("External func %s:%s\n", library, name); |
1 | 5413 for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++) |
5414 { | |
5415 if(strcasecmp(library, libraries[i].name)) | |
5416 continue; | |
5417 for(j=0; j<libraries[i].length; j++) | |
5418 { | |
5419 if(strcmp(name, libraries[i].exps[j].name)) | |
5420 continue; | |
3465 | 5421 // printf("Hit: 0x%08X\n", libraries[i].exps[j].func); |
1 | 5422 return libraries[i].exps[j].func; |
5423 } | |
5424 } | |
9897 | 5425 |
5426 #ifndef LOADLIB_TRY_NATIVE | |
5427 /* hack for vss h264 */ | |
5428 if (!strcmp(library,"vssh264core.dll")) | |
5429 #endif | |
5430 /* ok, this is a hack, and a big memory leak. should be fixed. - alex */ | |
5431 { | |
5432 int hand; | |
5433 WINE_MODREF *wm; | |
5434 void *func; | |
5435 | |
5436 hand = LoadLibraryA(library); | |
5437 if (!hand) | |
5438 goto no_dll_byname; | |
5439 wm = MODULE32_LookupHMODULE(hand); | |
5440 if (!wm) | |
5441 { | |
5442 FreeLibrary(hand); | |
5443 goto no_dll_byname; | |
5444 } | |
5445 func = PE_FindExportedFunction(wm, name, 0); | |
5446 if (!func) | |
5447 { | |
5448 printf("No such name in external dll\n"); | |
5449 FreeLibrary((int)hand); | |
5450 goto no_dll_byname; | |
5451 } | |
5452 | |
5453 printf("External dll loaded (offset: 0x%x, func: %p)\n", | |
5454 hand, func); | |
5455 return func; | |
5456 } | |
5457 | |
5458 no_dll_byname: | |
3465 | 5459 if(pos>150)return 0;// to many symbols |
1 | 5460 strcpy(export_names[pos], name); |
7386 | 5461 return add_stub(); |
1 | 5462 } |
5463 | |
2069 | 5464 void my_garbagecollection(void) |
128 | 5465 { |
5466 #ifdef GARBAGE | |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
5467 int unfree = 0, unfreecnt = 0; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
5468 |
7386 | 5469 int max_fatal = 8; |
3134 | 5470 free_registry(); |
2651
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
5471 while (last_alloc) |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
5472 { |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
5473 alloc_header* mem = last_alloc + 1; |
958d10763c34
partially synced with avifile... (TODO: migrate to new registry.c and driver.c)
arpi
parents:
2579
diff
changeset
|
5474 unfree += my_size(mem); |
3465 | 5475 unfreecnt++; |
7386 | 5476 if (my_release(mem) != 0) |
5477 // avoid endless loop when memory is trashed | |
5478 if (--max_fatal < 0) | |
5479 break; | |
128 | 5480 } |
12258
25310086fc95
Less verbosity by moving some debug messages from printf --> dbgprintf.
diego
parents:
12074
diff
changeset
|
5481 dbgprintf("Total Unfree %d bytes cnt %d [%p,%d]\n",unfree, unfreecnt, last_alloc, alccnt); |
128 | 5482 #endif |
3134 | 5483 g_tls = NULL; |
5484 list = NULL; | |
128 | 5485 } |