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