annotate loader/win32.c @ 1373:d1d37abe6389

only FAQ and SOUNDCARDS stuff not formatted/missing
author gabucino
date Sat, 21 Jul 2001 13:24:41 +0000
parents d8c1b0b38edc
children 8e841fe5668b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /***********************************************************
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 Win32 emulation code. Functions that emulate
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 responses from corresponding Win32 API calls.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 Since we are not going to be able to load
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 virtually any DLL, we can only implement this
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 much, adding needed functions with each new codec.
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
8
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
9 Basic principle of implementation: it's not good
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
10 for DLL to know too much about its environment.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 ************************************************************/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 #include <config.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 #include "win32.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 #include <pthread.h>
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
19 #include <errno.h>
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
20 #include <ctype.h>
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
21 #include <stdlib.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #ifdef HAVE_MALLOC_H
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include <malloc.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 #include <time.h>
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
26 #include <unistd.h>
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
27 #include <fcntl.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include <sys/types.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #include <sys/time.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include <sys/timeb.h>
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
31 #if HAVE_LIBKSTAT
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
32 #include <kstat.h>
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
33 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 #include <wine/winbase.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 #include <wine/winreg.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #include <wine/winnt.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 #include <wine/winerror.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 #include <wine/debugtools.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #include <wine/module.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 #include <registry.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 #include <loader.h>
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
44 #include <com.h>
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
45
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
46 char* def_path=WIN32_PATH;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
47
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
48 static void do_cpuid(unsigned int *regs)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
49 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
50 unsigned int ax;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
51 ax=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
52 __asm__ __volatile__(
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
53 "pushl %%ebx; pushl %%ecx; pushl %%edx; "
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
54 ".byte 0x0f, 0xa2;"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
55 "movl %%eax, (%2);"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
56 "movl %%ebx, 4(%2);"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
57 "movl %%ecx, 8(%2);"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
58 "movl %%edx, 12(%2);"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
59 "popl %%edx; popl %%ecx; popl %%ebx; "
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
60 : "=a" (ax)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
61 : "0" (ax), "S" (&regs));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
62 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
63 static unsigned int c_localcount_tsc()
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 int a;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 __asm__ __volatile__("rdtsc\n\t"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 :"=a"(a)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 :
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 :"edx");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 return a;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
72 static void c_longcount_tsc(long long* z)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 __asm__ __volatile__(
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 "pushl %%ebx\n\t"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 "movl %%eax, %%ebx\n\t"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 "rdtsc\n\t"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 "movl %%eax, 0(%%ebx)\n\t"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 "movl %%edx, 4(%%ebx)\n\t"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 "popl %%ebx\n\t"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 ::"a"(z));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
83 static unsigned int c_localcount_notsc()
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 struct timeval tv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 unsigned limit=~0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 limit/=1000000;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 gettimeofday(&tv, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 return limit*tv.tv_usec;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
91 static void c_longcount_notsc(long long* z)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 struct timeval tv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 unsigned long long result;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 unsigned limit=~0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 if(!z)return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 limit/=1000000;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 gettimeofday(&tv, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 result=tv.tv_sec;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 result<<=32;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 result+=limit*tv.tv_usec;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 *z=result;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
104
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
105 static unsigned int localcount_stub(void);
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
106 static void longcount_stub(long long* z);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
107 static unsigned int (*localcount)()=localcount_stub;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
108 static void (*longcount)(long long*)=longcount_stub;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
110 static unsigned int localcount_stub(void)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
111 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
112 unsigned int regs[4];
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
113 do_cpuid(regs);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
114 if ((regs[3] & 0x00000010) == 0)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
115 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
116 localcount=c_localcount_tsc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
117 longcount=c_longcount_tsc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
118 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
119 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
120 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
121 localcount=c_localcount_notsc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
122 longcount=c_longcount_notsc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
123 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
124 return localcount();
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
125 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
126 static void longcount_stub(long long* z)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
128 unsigned int regs[4];
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
129 do_cpuid(regs);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
130 if ((regs[3] & 0x00000010) == 0)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
131 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
132 localcount=c_localcount_tsc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
133 longcount=c_longcount_tsc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
134 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
135 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
136 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
137 localcount=c_localcount_notsc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
138 longcount=c_longcount_notsc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
139 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
140 longcount(z);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
141 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
142
235
6f96d4143806 verbose output changed
arpi_esp
parents: 130
diff changeset
143 int LOADER_DEBUG=1;
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
144 static inline void dbgprintf(char* fmt, ...)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
145 {
235
6f96d4143806 verbose output changed
arpi_esp
parents: 130
diff changeset
146 #ifdef DETAILED_OUT
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
147 if(LOADER_DEBUG)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
148 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
149 FILE* f;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
150 va_list va;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
151 va_start(va, fmt);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
152 f=fopen("./log", "a");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
153 vprintf(fmt, va);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
154 if(f)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
155 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
156 vfprintf(f, fmt, va);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
157 fsync(fileno(f));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
158 fclose(f);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
159 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
160 va_end(va);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
161 }
235
6f96d4143806 verbose output changed
arpi_esp
parents: 130
diff changeset
162 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 char export_names[500][30]={
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 "name1",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 //"name2",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 //"name3"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 //#define min(x,y) ((x)<(y)?(x):(y))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 static unsigned char* heap=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 static int heap_counter=0;
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
173 static void test_heap()
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 int offset=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 if(heap==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 while(offset<heap_counter)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 if(*(int*)(heap+offset)!=0x433476)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 printf("Heap corruption at address %d\n", offset);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 offset+=8+*(int*)(heap+offset+4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 for(;offset<min(offset+1000, 20000000); offset++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 if(heap[offset]!=0xCC)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 printf("Free heap corruption at address %d\n", offset);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 #undef MEMORY_DEBUG
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 #ifdef MEMORY_DEBUG
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 void* my_mreq(int size, int to_zero)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 static int test=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 test++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 if(test%10==0)printf("Memory: %d bytes allocated\n", heap_counter);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 // test_heap();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 if(heap==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 heap=malloc(20000000);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 memset(heap, 0xCC,20000000);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 if(heap==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 printf("No enough memory\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 if(heap_counter+size>20000000)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 printf("No enough memory\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 *(int*)(heap+heap_counter)=0x433476;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 heap_counter+=4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 *(int*)(heap+heap_counter)=size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 heap_counter+=4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 printf("Allocated %d bytes of memory: sys %d, user %d-%d\n", size, heap_counter-8, heap_counter, heap_counter+size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 if(to_zero)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 memset(heap+heap_counter, 0, size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 heap_counter+=size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 return heap+heap_counter-size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 }
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
228 int my_release(void* memory)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 // test_heap();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 if(memory==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 printf("ERROR: free(0)\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 if(*(int*)(memory-8)!=0x433476)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 printf("MEMORY CORRUPTION !!!!!!!!!!!!!!!!!!!\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 printf("Freed %d bytes of memory\n", *(int*)(memory-4));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 // memset(memory-8, *(int*)(memory-4), 0xCC);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 #else
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
247 #define GARBAGE
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
248 #ifdef GARBAGE
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
249 struct alc_list_t;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
250 typedef struct alc_list_t {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
251 int size;
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
252 void *addr;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
253 struct alc_list_t *prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
254 struct alc_list_t *next;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
255 }alc_list;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
256 static alc_list *alclist=NULL;
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
257 static int alccnt=0;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
258 #endif
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
259
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 void* my_mreq(int size, int to_zero)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 void* answer;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 if(to_zero)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 answer=calloc(size+4, 1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 answer=malloc(size+4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 *(int*)answer=size;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
268 #ifdef GARBAGE
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
269 if (alclist==NULL) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
270 alclist=malloc(sizeof(alc_list));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
271 alclist->prev=alclist->next=NULL;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
272 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
273 else {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
274 alclist->next=malloc(sizeof(alc_list));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
275 alclist->next->prev=alclist;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
276 alclist->next->next=NULL;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
277 alclist=alclist->next;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
278 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
279 alclist->size=size;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
280 alclist->addr=answer;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
281 alccnt++;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
282 #endif
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
283 return (int*)((int)answer+sizeof(int));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 }
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
285 int my_release(void* memory)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
287 #ifdef GARBAGE
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
288 alc_list* pp;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 if(memory==0)return 0;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
290 if(alclist!=NULL)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
291 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
292 pp=alclist;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
293 if ((pp->prev==NULL) && (pp->next == NULL)){
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
294 free(pp);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
295 alclist=NULL;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
296 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
297 else {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
298 for(;pp;pp=pp->prev) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
299 if (pp->addr == memory-4) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
300 if (pp->prev)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
301 pp->prev->next=pp->next;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
302 if (pp->next)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
303 pp->next->prev=pp->prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
304 if (pp == alclist)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
305 alclist=pp->prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
306 free(pp);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
307 alccnt--;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
308 break;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
309 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
310 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
311 if (pp == NULL) {
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
312 printf("Not Found %p %d\n",memory-4,alccnt);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
313 return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
314 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
315 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
316 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
317 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 free(memory-4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 int my_size(char* memory)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 return *(int*)(memory-4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 extern int unk_exp1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 char extcode[20000];// place for 200 unresolved exports
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 int pos=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
331 int WINAPI ext_unknown(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 printf("Unknown func called\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 int WINAPI expIsBadWritePtr(void* ptr, unsigned int count)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
338 int result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 if(count==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
340 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
341 else
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 if(ptr==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
343 result=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
344 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
345 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
346 dbgprintf("IsBadWritePtr(0x%x, 0x%x) => %d\n", ptr, count, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
347 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349 int WINAPI expIsBadReadPtr(void* ptr, unsigned int count)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
351 int result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 if(count==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
353 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
354 else
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355 if(ptr==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
356 result=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
357 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
358 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
359 dbgprintf("IsBadReadPtr(0x%x, 0x%x) => %d\n", ptr, count, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
360 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362 void* CDECL expmalloc(int size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 //printf("malloc");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 // return malloc(size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
366 void* result=my_mreq(size,0);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
367 dbgprintf("malloc(0x%x) => 0x%x\n", size,result);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368 if(result==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 printf("WARNING: malloc() failed\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 return result;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 void CDECL expfree(void* mem)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 // return free(mem);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
375 dbgprintf("free(0x%x)\n", mem);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 my_release(mem);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 void* CDECL expnew(int size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380 // printf("NEW:: Call from address %08x\n STACK DUMP:\n", *(-1+(int*)&size));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 // printf("%08x %08x %08x %08x\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 // size, *(1+(int*)&size),
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 // *(2+(int*)&size),*(3+(int*)&size));
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
384 void* result=my_mreq(size,0);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
385 dbgprintf("new(0x%x) => 0x%x\n", size, result);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386 if(result==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
387 printf("WARNING: new() failed\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 return result;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391 int CDECL expdelete(void* memory)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
393 dbgprintf("delete(0x%x)\n", memory);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
394 my_release(memory);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 int WINAPI expDisableThreadLibraryCalls(int module)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
399 dbgprintf("DisableThreadLibraryCalls(0x%x) => 0\n", module);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 int CDECL exp_initterm(int v1, int v2)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
404 dbgprintf("_initterm(0x%x, 0x%x) => 0\n", v1, v2);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
407
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 void* WINAPI expGetDriverModuleHandle(DRVR* pdrv)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
409 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
410 void* result;
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
411 if (pdrv==NULL)
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
412 result=NULL;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
413 else
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
414 result=(void*) pdrv->hDriverModule;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
415 dbgprintf("GetDriverModuleHandle(0x%x) => 0x%x\n", pdrv, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
416 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419 void* WINAPI expGetModuleHandleA(const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
420 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421 WINE_MODREF* wm;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
422 void* result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
423 if(!name)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
424 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
425 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
426 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
427 wm=MODULE_FindModule(name);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
428 if(wm==0)result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
429 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
430 result=(void*)(wm->module);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
431 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
432 if(!result)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
433 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
434 if(strcasecmp(name, "kernel32")==0)
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
435 result=(void *) 0x120;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
436 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
437 dbgprintf("GetModuleHandleA('%s') => 0x%x\n", name, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
438 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
439 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
440
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441 struct th_list_t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
442 typedef struct th_list_t{
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
443 int id;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
444 void* thread;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445 struct th_list_t* next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
446 struct th_list_t* prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447 }th_list;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
448
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449 static th_list* list=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 void* WINAPI expCreateThread(void* pSecAttr, long dwStackSize, void* lpStartAddress,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
454 void* lpParameter, long dwFlags, long* dwThreadId)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456 pthread_t *pth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
457 // printf("CreateThread:");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
458 pth=my_mreq(sizeof(pthread_t), 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459 pthread_create(pth, NULL, (void*(*)(void*))lpStartAddress, lpParameter);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
460 if(dwFlags)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
461 printf( "WARNING: CreateThread flags not supported\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
462 if(dwThreadId)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
463 *dwThreadId=(long)pth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
464 if(list==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
465 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
466 list=my_mreq(sizeof(th_list), 1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
467 list->next=list->prev=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
468 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
469 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
471 list->next=my_mreq(sizeof(th_list), 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
472 list->next->prev=list;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
473 list->next->next=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
474 list=list->next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
475 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
476 list->thread=pth;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
477 dbgprintf("CreateThread(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x) => 0x%x\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
478 pSecAttr, dwStackSize, lpStartAddress, lpParameter, dwFlags, dwThreadId, pth);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
479 return pth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
480 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
481
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
482 struct mutex_list_t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
483
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
484 struct mutex_list_t
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
485 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
486 char type;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
487 pthread_mutex_t *pm;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
488 pthread_cond_t *pc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
489 char state;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
490 char reset;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
491 char name[64];
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
492 int semaphore;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
493 struct mutex_list_t* next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
494 struct mutex_list_t* prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
495 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
496 typedef struct mutex_list_t mutex_list;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
497 static mutex_list* mlist=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
498 void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
499 char bInitialState, const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
500 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
501 pthread_mutex_t *pm;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
502 pthread_cond_t *pc;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
503 if(mlist!=NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
504 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
505 mutex_list* pp=mlist;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
506 if(name!=NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
507 do
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
508 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
509 if((strcmp(pp->name, name)==0) && (pp->type==0))
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
510 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
511 dbgprintf("CreateEventA(0x%x, 0x%x, 0x%x, 0x%x='%s') => 0x%x\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
512 pSecAttr, bManualReset, bInitialState, name, name, pp->pm);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
513 return pp->pm;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
514 }
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
515 }while((pp=pp->prev));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
516 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
517 pm=my_mreq(sizeof(pthread_mutex_t), 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
518 pthread_mutex_init(pm, NULL);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
519 pc=my_mreq(sizeof(pthread_cond_t), 0);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
520 pthread_cond_init(pc, NULL);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
521 if(mlist==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
522 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
523 mlist=my_mreq(sizeof(mutex_list), 00);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
524 mlist->next=mlist->prev=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
525 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
526 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
527 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
528 mlist->next=my_mreq(sizeof(mutex_list), 00);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
529 mlist->next->prev=mlist;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
530 mlist->next->next=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
531 mlist=mlist->next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
532 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
533 mlist->type=0; /* Type Event */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
534 mlist->pm=pm;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
535 mlist->pc=pc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
536 mlist->state=bInitialState;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
537 mlist->reset=bManualReset;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
538 if(name!=NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
539 strncpy(mlist->name, name, 64);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
540 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
541 mlist->name[0]=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
542 if(pm==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
543 dbgprintf("ERROR::: CreateEventA failure\n");
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
544 /*
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
545 if(bInitialState)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
546 pthread_mutex_lock(pm);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
547 */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
548 if(name)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
549 dbgprintf("CreateEventA(0x%x, 0x%x, 0x%x, 0x%x='%s') => 0x%x\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
550 pSecAttr, bManualReset, bInitialState, name, name, mlist);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
551 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
552 dbgprintf("CreateEventA(0x%x, 0x%x, 0x%x, NULL) => 0x%x\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
553 pSecAttr, bManualReset, bInitialState, mlist);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
554 return mlist;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
555 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
556
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
557 void* WINAPI expSetEvent(void* event)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
558 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
559 mutex_list *ml = (mutex_list *)event;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
560 dbgprintf("SetEvent(%x) => 0x1\n", event);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
561 pthread_mutex_lock(ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
562 if (ml->state == 0) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
563 ml->state = 1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
564 pthread_cond_signal(ml->pc);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
565 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
566 pthread_mutex_unlock(ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
567
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
568 return (void *)1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
569 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
570 void* WINAPI expResetEvent(void* event)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
571 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
572 mutex_list *ml = (mutex_list *)event;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
573 dbgprintf("ResetEvent(0x%x) => 0x1\n", event);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
574 pthread_mutex_lock(ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
575 ml->state = 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
576 pthread_mutex_unlock(ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
577
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
578 return (void *)1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
579 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
580
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
581 void* WINAPI expWaitForSingleObject(void* object, int duration)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
582 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
583 mutex_list *ml = (mutex_list *)object;
718
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
584 int ret=WAIT_FAILED; // fixed by Zdenek Kabelac
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
585 mutex_list* pp=mlist;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
586 // dbgprintf("WaitForSingleObject(0x%x, duration %d) =>\n",object, duration);
718
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
587 // loop below was slightly fixed - its used just for checking if
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
588 // this object really exists in our list
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
589 if (!ml)
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
590 return (void*) ret;
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
591 while (pp && (pp->pm != ml->pm))
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
592 pp = pp->prev;
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
593 if (!pp) {
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
594 //dbgprintf("WaitForSingleObject: NotFound\n");
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
595 return (void*)ret;
3156ab0adffe Applies kabis changes to avifile 0.6 cvs
atmosfear
parents: 713
diff changeset
596 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
597
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
598 pthread_mutex_lock(ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
599
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
600 switch(ml->type) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
601 case 0: /* Event */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
602 if (duration == 0) { /* Check Only */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
603 if (ml->state == 1) ret = WAIT_FAILED;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
604 else ret = WAIT_OBJECT_0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
605 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
606 if (duration == -1) { /* INFINITE */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
607 if (ml->state == 0)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
608 pthread_cond_wait(ml->pc,ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
609 if (ml->reset)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
610 ml->state = 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
611 ret = WAIT_OBJECT_0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
612 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
613 if (duration > 0) { /* Timed Wait */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
614 struct timespec abstime;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
615 struct timeval now;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
616 gettimeofday(&now, 0);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
617 abstime.tv_sec = now.tv_sec + (now.tv_usec+duration)/1000000;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
618 abstime.tv_nsec = ((now.tv_usec+duration)%1000000)*1000;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
619 if (ml->state == 0)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
620 ret=pthread_cond_timedwait(ml->pc,ml->pm,&abstime);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
621 if (ret == ETIMEDOUT) ret = WAIT_TIMEOUT;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
622 else ret = WAIT_OBJECT_0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
623 if (ml->reset)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
624 ml->state = 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
625 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
626 break;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
627 case 1: /* Semaphore */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
628 if (duration == 0) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
629 if(ml->semaphore==0) ret = WAIT_FAILED;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
630 else {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
631 ml->semaphore++;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
632 ret = WAIT_OBJECT_0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
633 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
634 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
635 if (duration == -1) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
636 if (ml->semaphore==0)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
637 pthread_cond_wait(ml->pc,ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
638 ml->semaphore--;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
639 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
640 break;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
641 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
642 pthread_mutex_unlock(ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
643
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
644 dbgprintf("WaitForSingleObject(0x%x, %d): 0x%x => 0x%x \n",object,duration,ml,ret);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
645 return (void *)ret;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
646 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
647
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
648 static BYTE PF[64] = {0,};
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
649
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
650 WIN_BOOL WINAPI expIsProcessorFeaturePresent(DWORD v)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
651 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
652 WIN_BOOL result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
653 if(v>63)result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
654 else result=PF[v];
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
655 dbgprintf("IsProcessorFeaturePresent(0x%x) => 0x%x\n", v, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
656 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
657 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
658
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
659 static void DumpSystemInfo(const SYSTEM_INFO* si)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
660 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
661 dbgprintf(" Processor architecture %d\n", si->u.s.wProcessorArchitecture);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
662 dbgprintf(" Page size: %d\n", si->dwPageSize);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
663 dbgprintf(" Minimum app address: %d\n", si->lpMinimumApplicationAddress);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
664 dbgprintf(" Maximum app address: %d\n", si->lpMaximumApplicationAddress);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
665 dbgprintf(" Active processor mask: 0x%x\n", si->dwActiveProcessorMask);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
666 dbgprintf(" Number of processors: %d\n", si->dwNumberOfProcessors);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
667 dbgprintf(" Processor type: 0x%x\n", si->dwProcessorType);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
668 dbgprintf(" Allocation granularity: 0x%x\n", si->dwAllocationGranularity);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
669 dbgprintf(" Processor level: 0x%x\n", si->wProcessorLevel);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
670 dbgprintf(" Processor revision: 0x%x\n", si->wProcessorRevision);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
671 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
672
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
673 void WINAPI expGetSystemInfo(SYSTEM_INFO* si)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
674 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
675 /* FIXME: better values for the two entries below... */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
676 static int cache = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
677 static SYSTEM_INFO cachedsi;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
678 unsigned int regs[4];
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
679 HKEY xhkey=0,hkey;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
680 dbgprintf("GetSystemInfo(0x%d) =>\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
681
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
682 if (cache) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
683 memcpy(si,&cachedsi,sizeof(*si));
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
684 DumpSystemInfo(si);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
685 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
686 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
687 memset(PF,0,sizeof(PF));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
688
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
689 cachedsi.u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
690 cachedsi.dwPageSize = getpagesize();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
691
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
692 /* FIXME: better values for the two entries below... */
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
693 cachedsi.lpMinimumApplicationAddress = (void *)0x00000000;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
694 cachedsi.lpMaximumApplicationAddress = (void *)0x7FFFFFFF;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
695 cachedsi.dwActiveProcessorMask = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
696 cachedsi.dwNumberOfProcessors = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
697 cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
698 cachedsi.dwAllocationGranularity = 0x10000;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
699 cachedsi.wProcessorLevel = 5; /* pentium */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
700 cachedsi.wProcessorRevision = 0x0101;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
701
1038
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
702 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__svr4__)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
703 do_cpuid(regs);
1038
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
704 switch ((regs[0] >> 8) & 0xf) { // cpu family
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
705 case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
706 cachedsi.wProcessorLevel= 3;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
707 break;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
708 case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
709 cachedsi.wProcessorLevel= 4;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
710 break;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
711 case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
712 cachedsi.wProcessorLevel= 5;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
713 break;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
714 case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
715 cachedsi.wProcessorLevel= 5;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
716 break;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
717 default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
718 cachedsi.wProcessorLevel= 5;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
719 break;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
720 }
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
721 cachedsi.wProcessorRevision = regs[0] & 0xf; // stepping
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
722 if (regs[3] & (1 << 8))
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
723 PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
b36fb1ae4b53 applied solaris8/netbsd/other fixes patch by J«ärgen Keil <jk@tools.de>
arpi_esp
parents: 718
diff changeset
724 if (regs[3] & (1 << 23))
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
725 PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
726 cachedsi.dwNumberOfProcessors=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
727 #else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
728 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
729 char buf[20];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
730 char line[200];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
731 FILE *f = fopen ("/proc/cpuinfo", "r");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
732
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
733 if (!f)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
734 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
735 xhkey = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
736 while (fgets(line,200,f)!=NULL) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
737 char *s,*value;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
738
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
739 /* NOTE: the ':' is the only character we can rely on */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
740 if (!(value = strchr(line,':')))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
741 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
742 /* terminate the valuename */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
743 *value++ = '\0';
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
744 /* skip any leading spaces */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
745 while (*value==' ') value++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
746 if ((s=strchr(value,'\n')))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
747 *s='\0';
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
748
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
749 /* 2.1 method */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
750 if (!lstrncmpiA(line, "cpu family",strlen("cpu family"))) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
751 if (isdigit (value[0])) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
752 switch (value[0] - '0') {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
753 case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
754 cachedsi.wProcessorLevel= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
755 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
756 case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
757 cachedsi.wProcessorLevel= 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
758 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
759 case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
760 cachedsi.wProcessorLevel= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
761 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
762 case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
763 cachedsi.wProcessorLevel= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
764 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
765 default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
766 cachedsi.wProcessorLevel= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
767 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
768 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
769 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
770 /* set the CPU type of the current processor */
1096
bf973bffe240 some possible buffer overflow places fixed
al3x
parents: 1038
diff changeset
771 snprintf(buf,20,"CPU %ld",cachedsi.dwProcessorType);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
772 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
773 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
774 /* old 2.0 method */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
775 if (!lstrncmpiA(line, "cpu",strlen("cpu"))) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
776 if ( isdigit (value[0]) && value[1] == '8' &&
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
777 value[2] == '6' && value[3] == 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
778 ) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
779 switch (value[0] - '0') {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
780 case 3: cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
781 cachedsi.wProcessorLevel= 3;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
782 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
783 case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
784 cachedsi.wProcessorLevel= 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
785 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
786 case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
787 cachedsi.wProcessorLevel= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
788 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
789 case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
790 cachedsi.wProcessorLevel= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
791 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
792 default:cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
793 cachedsi.wProcessorLevel= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
794 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
795 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
796 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
797 /* set the CPU type of the current processor */
1096
bf973bffe240 some possible buffer overflow places fixed
al3x
parents: 1038
diff changeset
798 snprintf(buf,20,"CPU %ld",cachedsi.dwProcessorType);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
799 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
800 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
801 if (!lstrncmpiA(line,"fdiv_bug",strlen("fdiv_bug"))) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
802 if (!lstrncmpiA(value,"yes",3))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
803 PF[PF_FLOATING_POINT_PRECISION_ERRATA] = TRUE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
804
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
805 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
806 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
807 if (!lstrncmpiA(line,"fpu",strlen("fpu"))) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
808 if (!lstrncmpiA(value,"no",2))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
809 PF[PF_FLOATING_POINT_EMULATED] = TRUE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
810
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
811 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
812 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
813 if (!lstrncmpiA(line,"processor",strlen("processor"))) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
814 /* processor number counts up...*/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
815 int x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
816
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
817 if (sscanf(value,"%d",&x))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
818 if (x+1>cachedsi.dwNumberOfProcessors)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
819 cachedsi.dwNumberOfProcessors=x+1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
820
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
821 /* Create a new processor subkey on a multiprocessor
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
822 * system
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
823 */
1096
bf973bffe240 some possible buffer overflow places fixed
al3x
parents: 1038
diff changeset
824 snprintf(buf,20,"%d",x);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
825 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
826 if (!lstrncmpiA(line,"stepping",strlen("stepping"))) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
827 int x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
828
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
829 if (sscanf(value,"%d",&x))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
830 cachedsi.wProcessorRevision = x;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
831 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
832 if
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
833 ( (!lstrncmpiA(line,"flags",strlen("flags")))
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
834 || (!lstrncmpiA(line,"features",strlen("features"))) )
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
835 {
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
836 if (strstr(value,"cx8"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
837 PF[PF_COMPARE_EXCHANGE_DOUBLE] = TRUE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
838 if (strstr(value,"mmx"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
839 PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = TRUE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
840
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
841 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
842 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
843 fclose (f);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
844 /*
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
845 * ad hoc fix for smp machines.
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
846 * some problems on WaitForSingleObject,CreateEvent,SetEvent
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
847 * CreateThread ...etc..
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
848 *
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
849 */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
850 cachedsi.dwNumberOfProcessors=1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
851 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
852 #endif /* __FreeBSD__ */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
853 memcpy(si,&cachedsi,sizeof(*si));
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
854 DumpSystemInfo(si);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
855 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
856
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
857 long WINAPI expGetVersion()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
858 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
859 dbgprintf("GetVersion() => 0xC0000004\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
860 return 0xC0000004;//Windows 95
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
861 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
862
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
863 HANDLE WINAPI expHeapCreate(long flags, long init_size, long max_size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
864 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
865 // printf("HeapCreate:");
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
866 HANDLE result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
867 if(init_size==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
868 result=(HANDLE)my_mreq(0x110000, 0);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
869 else
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
870 result=(HANDLE)my_mreq(init_size, 0);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
871 dbgprintf("HeapCreate(flags 0x%x, initial size %d, maximum size %d) => 0x%x\n", flags, init_size, max_size, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
872 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
873 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
874 void* WINAPI expHeapAlloc(HANDLE heap, int flags, int size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
875 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
876 void* z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
877 // printf("HeapAlloc:");
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
878 /**
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
879 Morgan's m3jpeg32.dll v. 2.0 encoder expects that request for
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
880 HeapAlloc returns area larger than size argument :-/
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
881 **/
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
882 z=my_mreq(((size+4095)/4096)*4096, flags&8);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
883 // z=HeapAlloc(heap,flags,size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
884 if(z==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
885 printf("HeapAlloc failure\n");
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
886 dbgprintf("HeapAlloc(heap 0x%x, flags 0x%x, size 0x%x) => 0x%x\n", heap, flags, size, z);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
887 return z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
888 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
889 long WINAPI expHeapDestroy(void* heap)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
890 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
891 dbgprintf("HeapDestroy(heap 0x%x) => 1\n", heap);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
892 my_release(heap);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
893 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
894 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
895
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
896 long WINAPI expHeapFree(int arg1, int arg2, void* ptr)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
897 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
898 dbgprintf("HeapFree(0x%x, 0x%x, pointer 0x%x) => 1\n", arg1, arg2, ptr);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
899 my_release(ptr);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
900 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
901 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
902 long WINAPI expHeapSize(int heap, int flags, void* pointer)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
903 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
904 long result=my_size(pointer);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
905 dbgprintf("HeapSize(heap 0x%x, flags 0x%x, pointer 0x%x) => %d\n", heap, flags, pointer, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
906 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
907 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
908 long WINAPI expGetProcessHeap(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
909 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
910 dbgprintf("GetProcessHeap() => 1\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
911 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
912 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
913 void* WINAPI expVirtualAlloc(void* v1, long v2, long v3, long v4)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
914 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
915 void* z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
916 z=VirtualAlloc(v1, v2, v3, v4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
917 if(z==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
918 printf("VirtualAlloc failure\n");
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
919 dbgprintf("VirtualAlloc(0x%x, %d, %d, %d) => 0x%x \n",v1,v2,v3,v4, z);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
920 return z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
921 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
922 int WINAPI expVirtualFree(void* v1, int v2, int v3)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
923 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
924 int result=VirtualFree(v1,v2,v3);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
925 dbgprintf("VirtualFree(0x%x, %d, %d) => %d\n",v1,v2,v3, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
926 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
927 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
928 struct CRITSECT
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
929 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
930 pthread_t id;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
931 pthread_mutex_t mutex;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
932 int locked;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
933 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
934 void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
935 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
936 struct CRITSECT cs;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
937 dbgprintf("InitializeCriticalSection(0x%x)\n", c);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
938 /* if(sizeof(pthread_mutex_t)>sizeof(CRITICAL_SECTION))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
939 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
940 printf(" ERROR:::: sizeof(pthread_mutex_t) is %d, expected <=%d!\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
941 sizeof(pthread_mutex_t), sizeof(CRITICAL_SECTION));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
942 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
943 }*/
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
944 /* pthread_mutex_init((pthread_mutex_t*)c, NULL); */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
945 pthread_mutex_init(&cs.mutex, NULL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
946 cs.locked=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
947 *(void**)c=malloc(sizeof cs);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
948 memcpy(*(void**)c, &cs, sizeof cs);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
949 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
950 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
951 void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
952 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
953 struct CRITSECT* cs=*(struct CRITSECT**)c;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
954 dbgprintf("EnterCriticalSection(0x%x)\n",c);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
955 // cs.id=pthread_self();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
956 if(cs->locked)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
957 if(cs->id==pthread_self())
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
958 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
959 pthread_mutex_lock(&(cs->mutex));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
960 cs->locked=1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
961 cs->id=pthread_self();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
962 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
963 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
964 void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
965 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
966 struct CRITSECT* cs=*(struct CRITSECT**)c;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
967 // struct CRITSECT* cs=(struct CRITSECT*)c;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
968 dbgprintf("LeaveCriticalSection(0x%x)\n",c);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
969 cs->locked=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
970 pthread_mutex_unlock(&(cs->mutex));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
971 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
972 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
973 void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
974 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
975 struct CRITSECT* cs=*(struct CRITSECT**)c;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
976 // struct CRITSECT* cs=(struct CRITSECT*)c;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
977 dbgprintf("DeleteCriticalSection(0x%x)\n",c);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
978 pthread_mutex_destroy(&(cs->mutex));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
979 free(cs);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
980 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
981 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
982 int WINAPI expGetCurrentThreadId()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
983 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
984 dbgprintf("GetCurrentThreadId() => %d\n", getpid());
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
985 return getpid();
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
986 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
987 int WINAPI expGetCurrentProcess()
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
988 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
989 dbgprintf("GetCurrentProcess() => %d\n", getpid());
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
990 return getpid();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
991 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
992
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
993 struct tls_s
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
994 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
995 void* value;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
996 int used;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
997 struct tls_s* prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
998 struct tls_s* next;
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
999 };
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1000 tls_t* g_tls=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1001
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1002 void* WINAPI expTlsAlloc()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1003 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1004 if(g_tls==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1005 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1006 g_tls=my_mreq(sizeof(tls_t), 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1007 g_tls->next=g_tls->prev=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1008 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1009 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1010 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1011 g_tls->next=my_mreq(sizeof(tls_t), 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1012 g_tls->next->prev=g_tls;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1013 g_tls->next->next=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1014 g_tls=g_tls->next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1015 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1016 dbgprintf("TlsAlloc() => 0x%x\n", g_tls);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1017 return g_tls;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1018 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1019
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1020 int WINAPI expTlsSetValue(tls_t* index, void* value)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1021 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1022 int result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1023 if(index==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1024 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1025 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1026 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1027 index->value=value;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1028 result=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1029 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1030 dbgprintf("TlsSetValue(index 0x%x, value 0x%x) => %d \n", index, value, result );
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1031 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1032 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1033 void* WINAPI expTlsGetValue(tls_t* index)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1034 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1035 void* result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1036 if(index==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1037 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1038 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1039 result=index->value;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1040 dbgprintf("TlsGetValue(index 0x%x) => 0x%x\n", index, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1041 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1042 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1043 int WINAPI expTlsFree(tls_t* index)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1044 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1045 int result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1046 if(index==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1047 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1048 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1049 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1050 if(index->next)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1051 index->next->prev=index->prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1052 if(index->prev)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1053 index->prev->next=index->next;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1054 my_release((void*)index);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1055 result=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1056 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1057 dbgprintf("TlsFree(index 0x%x) => %d\n", index, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1058 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1059 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1060 void* WINAPI expLocalAlloc(int flags, int size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1061 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1062 void* z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1063 if(flags&GMEM_ZEROINIT)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1064 z=my_mreq(size, 1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1065 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1066 z=my_mreq(size, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1067 if(z==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1068 printf("LocalAlloc() failed\n");
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1069 dbgprintf("LocalAlloc(%d, flags 0x%x) => 0x%x\n", size, flags, z);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1070 return z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1071 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1072 void* WINAPI expLocalLock(void* z)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1073 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1074 dbgprintf("LocalLock(0x%x) => 0x%x\n", z, z);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1075 return z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1076 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1077
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1078 void* WINAPI expGlobalAlloc(int flags, int size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1079 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1080 void* z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1081 dbgprintf("GlobalAlloc(%d, flags 0x%X)\n", size, flags);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1082 if(flags&GMEM_ZEROINIT)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1083 z=calloc(size, 1);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1084 // z=my_mreq(size, 1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1085 else
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1086 z=malloc(size);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1087 // z=my_mreq(size, 0);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1088 if(z==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1089 printf("GlobalAlloc() failed\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1090 dbgprintf("GlobalAlloc(%d, flags 0x%x) => 0x%x\n", size, flags, z);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1091 return z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1092 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1093 void* WINAPI expGlobalLock(void* z)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1094 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1095 dbgprintf("GlobalLock(0x%x) => 0x%x\n", z, z);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1096 return z;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1097 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1098 int WINAPI expLoadStringA(long instance, long id, void* buf, long size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1099 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1100 int result=LoadStringA(instance, id, buf, size);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1101 // if(buf)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1102 dbgprintf("LoadStringA(instance 0x%x, id 0x%x, buffer 0x%x, size %d) => %d ( %s )\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1103 instance, id, buf, size, result, buf);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1104 // else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1105 // dbgprintf("LoadStringA(instance 0x%x, id 0x%x, buffer 0x%x, size %d) => %d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1106 // instance, id, buf, size, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1107 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1108 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1109
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1110 long WINAPI expMultiByteToWideChar(long v1, long v2, char* s1, long siz1, short* s2, int siz2)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1111 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1112 #warning FIXME
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1113 int i;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1114 int result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1115 if(s2==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1116 result=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1117 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1118 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1119 if(siz1>siz2/2)siz1=siz2/2;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1120 for(i=1; i<=siz1; i++)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1121 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1122 *s2=*s1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1123 if(!*s1)break;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1124 s2++;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1125 s1++;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1126 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1127 result=i;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1128 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1129 if(s1)
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1130 dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string 0x%x='%s', "
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1131 "size %d, dest buffer 0x%x, dest size %d) => %d\n",
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1132 v1, v2, s1, s1, siz1, s2, siz2, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1133 else
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1134 dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string NULL, "
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1135 "size %d, dest buffer 0x%x, dest size %d) =>\n",
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1136 v1, v2, siz1, s2, siz2, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1137 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1138 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1139 static void wch_print(const short* str)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1140 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1141 dbgprintf(" src: ");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1142 while(*str)dbgprintf("%c", *str++);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1143 dbgprintf("\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1144 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1145 long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1, char* s2, int siz2, char* c3, int* siz3)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1146 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1147 int result;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1148 dbgprintf("WideCharToMultiByte(codepage %d, flags 0x%x, src 0x%x, src size %d, "
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1149 "dest 0x%x, dest size %d, defch 0x%x, used_defch 0x%x)", v1, v2, s1, siz1, s2, siz2, c3, siz3);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1150 result=WideCharToMultiByte(v1, v2, s1, siz1, s2, siz2, c3, siz3);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1151 dbgprintf("=> %d\n", result);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1152 if(s1)wch_print(s1);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1153 if(s2)dbgprintf(" dest: %s\n", s2);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1154 return result;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1155 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1156 long WINAPI expGetVersionExA(OSVERSIONINFOA* c)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1157 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1158 dbgprintf("GetVersionExA(0x%x) => 1\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1159 c->dwOSVersionInfoSize=sizeof(*c);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1160 c->dwMajorVersion=4;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1161 c->dwMinorVersion=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1162 c->dwBuildNumber=0x4000457;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1163 c->dwPlatformId=VER_PLATFORM_WIN32_WINDOWS;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1164 strcpy(c->szCSDVersion, " B");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1165 dbgprintf(" Major version: 4\n Minor version: 0\n Build number: 0x4000457\n"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1166 " Platform Id: VER_PLATFORM_WIN32_WINDOWS\n Version string: ' B'\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1167 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1168 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1169 HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, long max_count, char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1170 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1171 pthread_mutex_t *pm;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1172 pthread_cond_t *pc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1173 if(mlist!=NULL)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1174 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1175 mutex_list* pp=mlist;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1176 if(name!=NULL)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1177 do
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1178 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1179 if((strcmp(pp->name, name)==0) && (pp->type==1))
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1180 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1181 dbgprintf("CreateSemaphoreA(0x%x, init_count %d, max_count %d, name 0x%x='%s') => 0x%x",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1182 v1, init_count, max_count, name, name, mlist);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1183 return (HANDLE)mlist;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1184 }
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
1185 }while((pp=pp->prev));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1186 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1187 pm=my_mreq(sizeof(pthread_mutex_t), 0);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1188 pthread_mutex_init(pm, NULL);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1189 pc=my_mreq(sizeof(pthread_cond_t), 0);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1190 pthread_cond_init(pc, NULL);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1191 if(mlist==NULL)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1192 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1193 mlist=my_mreq(sizeof(mutex_list), 00);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1194 mlist->next=mlist->prev=NULL;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1195 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1196 else
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1197 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1198 mlist->next=my_mreq(sizeof(mutex_list), 00);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1199 mlist->next->prev=mlist;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1200 mlist->next->next=NULL;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1201 mlist=mlist->next;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1202 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1203 mlist->type=1; /* Type Semaphore */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1204 mlist->pm=pm;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1205 mlist->pc=pc;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1206 mlist->state=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1207 mlist->reset=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1208 mlist->semaphore=init_count;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1209 if(name!=NULL)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1210 strncpy(mlist->name, name, 64);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1211 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1212 mlist->name[0]=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1213 if(pm==NULL)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1214 dbgprintf("ERROR::: CreateSemaphoreA failure\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1215 if(name)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1216 dbgprintf("CreateSemaphoreA(0x%x, init_count %d, max_count %d, name 0x%x='%s') => 0x%x",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1217 v1, init_count, max_count, name, name, mlist);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1218 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1219 dbgprintf("CreateSemaphoreA(0x%x, init_count %d, max_count %d, name 0) => 0x%x",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1220 v1, init_count, max_count, mlist);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1221 return (HANDLE)mlist;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1222 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1223
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1224 long WINAPI expReleaseSemaphore(long hsem, long increment, long* prev_count)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1225 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1226 // The state of a semaphore object is signaled when its count
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1227 // is greater than zero and nonsignaled when its count is equal to zero
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1228 // Each time a waiting thread is released because of the semaphore's signaled
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1229 // state, the count of the semaphore is decreased by one.
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1230 mutex_list *ml = (mutex_list *)hsem;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1231
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1232 pthread_mutex_lock(ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1233 if (prev_count != 0) *prev_count = ml->semaphore;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1234 if (ml->semaphore == 0) pthread_cond_signal(ml->pc);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1235 ml->semaphore += increment;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1236 pthread_mutex_unlock(ml->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1237 dbgprintf("ReleaseSemaphore(semaphore 0x%x, increment %d, prev_count 0x%x) => 1\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1238 hsem, increment, prev_count);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1239 return 1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1240 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1241
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1242
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1243 long WINAPI expRegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1244 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1245 long result=RegOpenKeyExA(key, subkey, reserved, access, newkey);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1246 dbgprintf("RegOpenKeyExA(key 0x%x, subkey %s, reserved %d, access 0x%x, pnewkey 0x%x) => %d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1247 key, subkey, reserved, access, newkey, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1248 if(newkey)dbgprintf(" New key: 0x%x\n", *newkey);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1249 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1250 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1251 long WINAPI expRegCloseKey(long key)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1252 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1253 long result=RegCloseKey(key);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1254 dbgprintf("RegCloseKey(0x%x) => %d\n", key, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1255 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1256 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1257 long WINAPI expRegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1258 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1259 long result=RegQueryValueExA(key, value, reserved, type, data, count);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1260 dbgprintf("RegQueryValueExA(key 0x%x, value %s, reserved 0x%x, data 0x%x, count 0x%x)"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1261 " => 0x%x\n", key, value, reserved, data, count, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1262 if(data && count)dbgprintf(" read %d bytes: '%s'\n", *count, data);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1263 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1264 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1265 long WINAPI expRegCreateKeyExA(long key, const char* name, long reserved,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1266 void* classs, long options, long security,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1267 void* sec_attr, int* newkey, int* status)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1268 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1269 long result=RegCreateKeyExA(key, name, reserved, classs, options, security, sec_attr, newkey, status);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1270 dbgprintf("RegCreateKeyExA(key 0x%x, name 0x%x='%s', reserved=0x%x,"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1271 " 0x%x, 0x%x, 0x%x, newkey=0x%x, status=0x%x) => %d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1272 key, name, name, reserved, classs, options, security, sec_attr, newkey, status, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1273 if(!result && newkey) dbgprintf(" New key: 0x%x\n", *newkey);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1274 if(!result && status) dbgprintf(" New key status: 0x%x\n", *status);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1275 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1276 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1277 long WINAPI expRegSetValueExA(long key, const char* name, long v1, long v2, void* data, long size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1278 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1279 long result=RegSetValueExA(key, name, v1, v2, data, size);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1280 dbgprintf("RegSetValueExA(key 0x%x, name '%s', 0x%x, 0x%x, data 0x%x -> 0x%x '%s', size=%d) => %d",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1281 key, name, v1, v2, data, *(int*)data, data, size, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1282 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1283 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1284
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1285 long WINAPI expRegOpenKeyA (
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1286 long hKey,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1287 LPCSTR lpSubKey,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1288 int* phkResult
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1289 ){
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1290 long result=RegOpenKeyExA(hKey, lpSubKey, 0, 0, phkResult);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1291 dbgprintf("RegOpenKeyExA(key 0x%x, subkey '%s', 0x%x) => %d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1292 hKey, lpSubKey, phkResult, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1293 if(!result && phkResult) dbgprintf(" New key: 0x%x\n", *phkResult);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1294 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1295 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1296
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1297 long WINAPI expQueryPerformanceCounter(long long* z)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1298 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1299 longcount(z);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1300 dbgprintf("QueryPerformanceCounter(0x%x) => 1 ( %Ld )\n", z, *z);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1301 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1302 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1303
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1304 /*
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1305 * 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
1306 */
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1307 static double linux_cpuinfo_freq()
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1308 {
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1309 double freq=-1;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1310 FILE *f;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1311 char line[200];
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1312 char *s,*value;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1313
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1314 f = fopen ("/proc/cpuinfo", "r");
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1315 if (f != NULL) {
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1316 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
1317 /* 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
1318 if (!(value = strchr(line,':')))
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1319 continue;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1320 /* terminate the valuename */
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1321 *value++ = '\0';
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1322 /* skip any leading spaces */
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1323 while (*value==' ') value++;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1324 if ((s=strchr(value,'\n')))
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1325 *s='\0';
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1326
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1327 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
1328 && sscanf(value, "%lf", &freq) == 1) {
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1329 freq*=1000;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1330 break;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1331 }
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1332 }
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1333 fclose(f);
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1334 }
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1335 return freq;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1336 }
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1337
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1338
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1339 static double
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1340 solaris_kstat_freq()
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1341 {
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1342 #if HAVE_LIBKSTAT
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1343 /*
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1344 * 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
1345 */
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1346 kstat_ctl_t *kc;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1347 kstat_t *ksp;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1348 kstat_named_t *kdata;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1349 int mhz = 0;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1350
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1351 kc = kstat_open();
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1352 if (kc != NULL)
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1353 {
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1354 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
1355
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1356 /* 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
1357 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
1358 {
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1359 /* 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
1360 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
1361 {
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1362 /*
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1363 * 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
1364 * data type
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1365 */
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1366 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
1367 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
1368 mhz = kdata->value.i32;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1369 }
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1370 }
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1371 kstat_close(kc);
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1372 }
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1373
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1374 if (mhz > 0)
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1375 return mhz * 1000.;
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1376 #endif /* HAVE_LIBKSTAT */
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1377 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
1378 }
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1379
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1380 /*
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1381 * 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
1382 */
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1383 static double tsc_freq()
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1384 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1385 static double ofreq=0.0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1386 int i;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1387 int x,y;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1388 i=time(NULL);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1389 if (ofreq != 0.0) return ofreq;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1390 while(i==time(NULL));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1391 x=localcount();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1392 i++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1393 while(i==time(NULL));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1394 y=localcount();
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1395 ofreq = (double)(y-x)/1000.;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1396 return ofreq;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1397 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1398
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1399 static double CPU_Freq()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1400 {
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1401 double freq;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1402
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1403 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
1404 return freq;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1405
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1406 if ((freq = solaris_kstat_freq()) > 0)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1407 return freq;
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1408
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1409 return tsc_freq();
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1410 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1411
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1412 long WINAPI expQueryPerformanceFrequency(long long* z)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1413 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1414 *z=(long long)CPU_Freq();
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1415 dbgprintf("QueryPerformanceFrequency(0x%x) => 1 ( %Ld )\n", z, *z);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1416 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1417 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1418 long WINAPI exptimeGetTime()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1419 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1420 struct timeval t;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1421 long result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1422 gettimeofday(&t, 0);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1423 result=1000*t.tv_sec+t.tv_usec/1000;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1424 dbgprintf("timeGetTime() => %d\n", result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1425 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1426 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1427 void* WINAPI expLocalHandle(void* v)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1428 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1429 dbgprintf("LocalHandle(0x%x) => 0x%x\n", v, v);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1430 return v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1431 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1432 void* WINAPI expGlobalHandle(void* v)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1433 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1434 dbgprintf("GlobalHandle(0x%x) => 0x%x\n", v, v);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1435 return v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1436 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1437 int WINAPI expGlobalUnlock(void* v)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1438 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1439 dbgprintf("GlobalUnlock(0x%x) => 1\n", v);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1440 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1441 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1442 //
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1443 void* WINAPI expGlobalFree(void* v)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1444 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1445 dbgprintf("GlobalFree(0x%x) => 0\n", v);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1446 //my_release(v);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1447 free(v);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1448 return 0;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1449 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1450
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1451
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1452 void* WINAPI expGlobalReAlloc(void* v, int size, int flags)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1453 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1454 void* result=realloc(v, size);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1455 dbgprintf("GlobalReAlloc(0x%x, size %d, flags 0x%x) => 0x%x\n", v,size,flags,result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1456 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1457 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1458
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1459 int WINAPI expLocalUnlock(void* v)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1460 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1461 dbgprintf("LocalUnlock(0x%x) => 1\n", v);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1462 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1463 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1464 //
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1465 void* WINAPI expLocalFree(void* v)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1466 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1467 dbgprintf("LocalFree(0x%x) => 0\n", v);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1468 my_release(v);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1469 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1470 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1471 HRSRC WINAPI expFindResourceA(HMODULE module, char* name, char* type)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1472 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1473 HRSRC result=FindResourceA(module, name, type);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1474 dbgprintf("FindResourceA(module 0x%x, name 0x%x, type 0x%x) => 0x%x\n", module, name, type, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1475 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1476 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1477 extern HRSRC WINAPI LoadResource(HMODULE, HRSRC);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1478 HGLOBAL WINAPI expLoadResource(HMODULE module, HRSRC res)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1479 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1480 HGLOBAL result=LoadResource(module, res);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1481 dbgprintf("LoadResource(module 0x%x, resource 0x%x) => 0x%x\n", module, res, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1482 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1483 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1484 void* WINAPI expLockResource(long res)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1485 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1486 void* result=LockResource(res);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1487 dbgprintf("LockResource(0x%x) => 0x%x\n", res, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1488 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1489 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1490 int WINAPI expFreeResource(long res)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1491 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1492 int result=FreeResource(res);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1493 dbgprintf("FreeResource(0x%x) => %d\n", res, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1494 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1495 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1496 //bool fun(HANDLE)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1497 //!0 on success
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1498 int WINAPI expCloseHandle(long v1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1499 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1500 dbgprintf("CloseHandle(0x%x) => 1\n", v1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1501 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1502 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1503
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1504 const char* WINAPI expGetCommandLineA()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1505 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1506 dbgprintf("GetCommandLineA() => \"c:\\aviplay.exe\"\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1507 return "c:\\aviplay.exe";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1508 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1509 static short envs[]={'p', 'a', 't', 'h', ' ', 'c', ':', '\\', 0, 0};
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1510 LPWSTR WINAPI expGetEnvironmentStringsW()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1511 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1512 dbgprintf("GetEnvironmentStringsW() => 0\n", envs);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1513 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1514 }
121
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1515 void * WINAPI expRtlZeroMemory(void *p, size_t len)
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1516 {
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1517 void* result=memset(p,0,len);
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1518 dbgprintf("RtlZeroMemory(0x%x, len %d) => 0x%x\n",p,len,result);
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1519 return result;
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1520 }
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1521 void * WINAPI expRtlMoveMemory(void *dst, void *src, size_t len)
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1522 {
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1523 void* result=memmove(dst,src,len);
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1524 dbgprintf("RtlMoveMemory (dest 0x%x, src 0x%x, len %d) => 0x%x\n",dst,src,len,result);
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1525 return result;
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1526 }
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1527
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1528 void * WINAPI expRtlFillMemory(void *p, int ch, size_t len)
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1529 {
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1530 void* result=memset(p,ch,len);
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1531 dbgprintf("RtlFillMemory(0x%x, char 0x%x, len %d) => 0x%x\n",p,ch,len,result);
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1532 return result;
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
1533 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1534 int WINAPI expFreeEnvironmentStringsW(short* strings)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1535 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1536 dbgprintf("FreeEnvironmentStringsW(0x%x) => 1\n", strings);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1537 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1538 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1539 int WINAPI expFreeEnvironmentStringsA(char* strings)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1540 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1541 dbgprintf("FreeEnvironmentStringsA(0x%x) => 1\n", strings);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1542 return 1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1543 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1544 static const char ch_envs[]=
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1545 "__MSVCRT_HEAP_SELECT=__GLOBAL_HEAP_SELECTED,1\r\n"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1546 "PATH=C:\\;C:\\windows\\;C:\\windows\\system\r\n";
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1547 LPCSTR WINAPI expGetEnvironmentStrings()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1548 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1549 dbgprintf("GetEnvironmentStrings() => 0x%x\n", ch_envs);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1550 return (LPCSTR)ch_envs;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1551 // dbgprintf("GetEnvironmentStrings() => 0\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1552 // return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1553 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1554
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1555 int WINAPI expGetStartupInfoA(STARTUPINFOA *s)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1556 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1557 int i;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1558 dbgprintf("GetStartupInfoA(0x%x) => 1\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1559 memset(s, 0, sizeof(*s));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1560 s->cb=sizeof(*s);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1561 // s->lpReserved="Reserved";
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1562 // s->lpDesktop="Desktop";
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1563 // s->lpTitle="Title";
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1564 // s->dwX=s->dwY=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1565 // s->dwXSize=s->dwYSize=200;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1566 s->dwFlags=s->wShowWindow=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1567 // s->hStdInput=s->hStdOutput=s->hStdError=0x1234;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1568 dbgprintf(" cb=%d\n", s->cb);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1569 dbgprintf(" lpReserved='%s'\n", s->lpReserved);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1570 dbgprintf(" lpDesktop='%s'\n", s->lpDesktop);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1571 dbgprintf(" lpTitle='%s'\n", s->lpTitle);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1572 dbgprintf(" dwX=%d dwY=%d dwXSize=%d dwYSize=%d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1573 s->dwX, s->dwY, s->dwXSize, s->dwYSize);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1574 dbgprintf(" dwXCountChars=%d dwYCountChars=%d dwFillAttribute=%d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1575 s->dwXCountChars, s->dwYCountChars, s->dwFillAttribute);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1576 dbgprintf(" dwFlags=0x%x wShowWindow=0x%x cbReserved2=0x%x\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1577 s->dwFlags, s->wShowWindow, s->cbReserved2);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1578 dbgprintf(" lpReserved2=0x%x hStdInput=0x%x hStdOutput=0x%x hStdError=0x%x\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1579 s->lpReserved2, s->hStdInput, s->hStdOutput, s->hStdError);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1580 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1581 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1582
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1583 int WINAPI expGetStdHandle(int z)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1584 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1585 dbgprintf("GetStdHandle(0x%x) => 0x%x\n", z+0x1234);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1586 return z+0x1234;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1587 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1588 int WINAPI expGetFileType(int handle)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1589 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1590 dbgprintf("GetFileType(0x%x) => 0x3 = pipe\n", handle);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1591 return 0x3;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1592 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1593 int WINAPI expSetHandleCount(int count)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1594 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1595 dbgprintf("SetHandleCount(0x%x) => 1\n", count);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1596 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1597 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1598 int WINAPI expGetACP()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1599 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1600 dbgprintf("GetACP() => 0\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1601 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1602 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1603 extern WINE_MODREF *MODULE32_LookupHMODULE(HMODULE m);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1604 int WINAPI expGetModuleFileNameA(int module, char* s, int len)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1605 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1606 WINE_MODREF *mr;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1607 int result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1608 // printf("File name of module %X requested\n", module);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1609 if(s==0)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1610 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1611 else
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1612 if(len<35)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1613 result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1614 else
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1615 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1616 result=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1617 strcpy(s, "c:\\windows\\system\\");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1618 mr=MODULE32_LookupHMODULE(module);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1619 if(mr==0)//oops
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1620 strcat(s, "aviplay.dll");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1621 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1622 if(strrchr(mr->filename, '/')==NULL)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1623 strcat(s, mr->filename);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1624 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1625 strcat(s, strrchr(mr->filename, '/')+1);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1626 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1627 if(!s)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1628 dbgprintf("GetModuleFileNameA(0x%x, 0x%x, %d) => %d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1629 module, s, len, result);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1630 else
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1631 dbgprintf("GetModuleFileNameA(0x%x, 0x%x, %d) => %d ( '%s' )",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1632 module, s, len, result, s);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1633 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1634 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1635
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1636 int WINAPI expSetUnhandledExceptionFilter(void* filter)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1637 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1638 dbgprintf("SetUnhandledExceptionFilter(0x%x) => 1\n", filter);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1639 return 1;//unsupported and probably won't ever be supported
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1640 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1641 extern char* def_path;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1642 int WINAPI expLoadLibraryA(char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1643 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1644 char qq[256];
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1645 int result;
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1646 char* lastbc;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1647 if (!name)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1648 return -1;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1649 // we skip to the last backslash
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1650 // this is effectively eliminating weird characters in
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1651 // the text output windows
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1652 lastbc = strrchr(name, '\\');
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1653 if (lastbc)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1654 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1655 int i;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1656 lastbc++;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1657 for (i = 0; 1 ;i++)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1658 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1659 name[i] = *lastbc++;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1660 if (!name[i])
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1661 break;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1662 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1663 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1664 // printf("LoadLibrary wants: %s/%s\n", def_path, name);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1665
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1666 if(strncmp(name, "c:\\windows\\", 11)==0)name+=11;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1667 if(name[0]!='/')
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1668 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1669 strcpy(qq, def_path);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1670 strcat(qq, "/");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1671 if(strncmp(name, ".\\", 2)==0)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1672 strcat(qq, name+2);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1673 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1674 strcat(qq, name);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1675 }
341
ac58837db8ad more printf cosmetic on DLL loader
arpi_esp
parents: 340
diff changeset
1676 printf("Loading DLL: %s", qq);fflush(stdout);
340
1f7c824033fb less, and more informal printfs
arpi_esp
parents: 295
diff changeset
1677 // printf("Entering LoadLibraryA(%s)\n", name);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1678 result=LoadLibraryA(qq);
341
ac58837db8ad more printf cosmetic on DLL loader
arpi_esp
parents: 340
diff changeset
1679 if(!result) printf(" FAILED!\n"); else printf(" OK\n");
340
1f7c824033fb less, and more informal printfs
arpi_esp
parents: 295
diff changeset
1680 // printf("Returned LoadLibraryA(0x%x='%s'), def_path=%s => 0x%x\n", name, name, def_path, result);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1681 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1682 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1683 int WINAPI expFreeLibrary(int module)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1684 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1685 int result=FreeLibrary(module);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1686 dbgprintf("FreeLibrary(0x%x) => %d\n", module, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1687 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1688 }
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
1689 void* LookupExternalByName(const char* library, const char* name);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1690 void* WINAPI expGetProcAddress(HMODULE mod, char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1691 {
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
1692 void *result;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1693 if(mod!=0x120)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1694 result=GetProcAddress(mod, name);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1695 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1696 result=LookupExternalByName("kernel32.dll", name);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1697 dbgprintf("GetProcAddress(0x%x, '%s') => 0x%x\n", mod, name, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1698 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1699 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1700
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1701 long WINAPI expCreateFileMappingA(int hFile, void* lpAttr,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1702 long flProtect, long dwMaxHigh, long dwMaxLow, const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1703 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1704 long result=CreateFileMappingA(hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1705 if(!name)
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1706 dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, "
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1707 "flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0) => %d\n",
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1708 hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1709 else
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1710 dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, "
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
1711 "flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0x%x='%s') => %d\n",
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1712 hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name, name, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1713 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1714 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1715
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1716 long WINAPI expOpenFileMappingA(long hFile, long hz, const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1717 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1718 long result=OpenFileMappingA(hFile, hz, name);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1719 if(!name)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1720 dbgprintf("OpenFileMappingA(0x%x, 0x%x, 0) => %d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1721 hFile, hz, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1722 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1723 dbgprintf("OpenFileMappingA(0x%x, 0x%x, 0x%x='%s') => %d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1724 hFile, hz, name, name, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1725 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1726 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1727
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1728 void* WINAPI expMapViewOfFile(HANDLE file, DWORD mode, DWORD offHigh, DWORD offLow, DWORD size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1729 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1730 dbgprintf("MapViewOfFile(0x%x, 0x%x, 0x%x, 0x%x, size %d) => 0x%x\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1731 file,mode,offHigh,offLow,size,(char*)file+offLow);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1732 return (char*)file+offLow;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1733 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1734
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1735 void* WINAPI expUnmapViewOfFile(void* view)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1736 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1737 dbgprintf("UnmapViewOfFile(0x%x) => 0\n", view);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1738 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1739 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1740
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1741 void* WINAPI expSleep(int time)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1742 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1743 dbgprintf("Sleep(%d) => 0\n", time);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1744 usleep(time);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1745 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1746 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1747 // why does IV32 codec want to call this? I don't know ...
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1748 void* WINAPI expCreateCompatibleDC(int hdc)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1749 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1750 dbgprintf("CreateCompatibleDC(%d) => 0x81\n", hdc);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1751 return (void*)0x81;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1752 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1753
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1754 int WINAPI expGetDeviceCaps(int hdc, int unk)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1755 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1756 dbgprintf("GetDeviceCaps(0x%x, %d) => 0\n", hdc, unk);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1757 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1758 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1759
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1760 WIN_BOOL WINAPI expDeleteDC(int hdc)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1761 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1762 dbgprintf("DeleteDC(0x%x) => 0\n", hdc);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1763 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1764 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1765
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1766 int expwsprintfA(char* string, char* format, ...)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1767 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1768 va_list va;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1769 int result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1770 va_start(va, format);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1771 result=vsprintf(string, format, va);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1772 dbgprintf("wsprintfA(0x%x, '%s', ...) => %d\n", string, format, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1773 va_end(va);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1774 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1775 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1776
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1777 int WINAPI expGetPrivateProfileIntA(const char* appname, const char* keyname, int default_value, const char* filename)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1778 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1779 int size=255;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1780 char buffer[256];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1781 char* fullname;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1782 int result;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1783
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1784 buffer[255]=0;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1785 if(!(appname && keyname && filename) )
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1786 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1787 dbgprintf("GetPrivateProfileIntA('%s', '%s', %d, '%s') => %d\n", appname, keyname, default_value, filename, default_value );
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1788 return default_value;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1789 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1790 fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1791 strcpy(fullname, "Software\\IniFileMapping\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1792 strcat(fullname, appname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1793 strcat(fullname, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1794 strcat(fullname, keyname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1795 strcat(fullname, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1796 strcat(fullname, filename);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1797 result=RegQueryValueExA(HKEY_LOCAL_MACHINE, fullname, NULL, NULL, (int*)buffer, &size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1798 if((size>=0)&&(size<256))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1799 buffer[size]=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1800 // printf("GetPrivateProfileIntA(%s, %s, %s) -> %s\n", appname, keyname, filename, buffer);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1801 free(fullname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1802 if(result)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1803 result=default_value;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1804 else
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1805 result=atoi(buffer);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1806 dbgprintf("GetPrivateProfileIntA('%s', '%s', %d, '%s') => %d\n", appname, keyname, default_value, filename, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1807 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1808 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1809 int WINAPI expGetProfileIntA(const char* appname, const char* keyname, int default_value)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1810 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1811 dbgprintf("GetProfileIntA -> ");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1812 // dbgprintf("GetProfileIntA(%s, %s, %d)\n", appname, keyname, default_value);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1813 return expGetPrivateProfileIntA(appname, keyname, default_value, "default");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1814 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1815
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1816 int WINAPI expGetPrivateProfileStringA(const char* appname, const char* keyname,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1817 const char* def_val, char* dest, unsigned int len, const char* filename)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1818 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1819 int result;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1820 int size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1821 char* fullname;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1822 dbgprintf("GetPrivateProfileStringA('%s', '%s', def_val '%s', 0x%x, 0x%x, '%s')", appname, keyname, def_val, dest, len, filename );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1823 if(!(appname && keyname && filename) ) return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1824 fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1825 strcpy(fullname, "Software\\IniFileMapping\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1826 strcat(fullname, appname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1827 strcat(fullname, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1828 strcat(fullname, keyname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1829 strcat(fullname, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1830 strcat(fullname, filename);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1831 size=len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1832 result=RegQueryValueExA(HKEY_LOCAL_MACHINE, fullname, NULL, NULL, (int*)dest, &size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1833 // printf("GetPrivateProfileStringA(%s, %s, %s, %X, %X, %s)\n", appname, keyname, def_val, dest, len, filename );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1834 free(fullname);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1835 if(result)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1836 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1837 strncpy(dest, def_val, size);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1838 if (strlen(def_val)< size) size = strlen(def_val);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1839 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1840 dbgprintf(" => %d ( '%s' )\n", size, dest);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1841 return size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1842 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1843 int WINAPI expWritePrivateProfileStringA(const char* appname, const char* keyname,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1844 const char* string, const char* filename)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1845 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1846 int size=256;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1847 char* fullname;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1848 dbgprintf("WritePrivateProfileStringA('%s', '%s', '%s', '%s')", appname, keyname, string, filename );
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1849 if(!(appname && keyname && filename) )
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1850 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1851 dbgprintf(" => -1\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1852 return -1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1853 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1854 fullname=(char*)malloc(50+strlen(appname)+strlen(keyname)+strlen(filename));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1855 strcpy(fullname, "Software\\IniFileMapping\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1856 strcat(fullname, appname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1857 strcat(fullname, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1858 strcat(fullname, keyname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1859 strcat(fullname, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1860 strcat(fullname, filename);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1861 RegSetValueExA(HKEY_LOCAL_MACHINE, fullname, 0, REG_SZ, (int*)string, strlen(string));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1862 // printf("RegSetValueExA(%s,%d)\n", string, strlen(string));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1863 // printf("WritePrivateProfileStringA(%s, %s, %s, %s)\n", appname, keyname, string, filename );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1864 free(fullname);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1865 dbgprintf(" => 0\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1866 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1867 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1868
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1869 unsigned int _GetPrivateProfileIntA(const char* appname, const char* keyname, INT default_value, const char* filename)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1870 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1871 return expGetPrivateProfileIntA(appname, keyname, default_value, filename);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1872 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1873 int _GetPrivateProfileStringA(const char* appname, const char* keyname,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1874 const char* def_val, char* dest, unsigned int len, const char* filename)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1875 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1876 return expGetPrivateProfileStringA(appname, keyname, def_val, dest, len, filename);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1877 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1878 int _WritePrivateProfileStringA(const char* appname, const char* keyname,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1879 const char* string, const char* filename)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1880 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1881 return expWritePrivateProfileStringA(appname, keyname, string, filename);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1882 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1883
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1884
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1885
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1886 int WINAPI expDefDriverProc(int _private, int id, int msg, int arg1, int arg2)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1887 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1888 dbgprintf("DefDriverProc(0x%x, 0x%x, 0x%x, 0x%x, 0x%x) => 0\n", _private, id, msg, arg1, arg2);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1889 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1890 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1891
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1892 int WINAPI expSizeofResource(int v1, int v2)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1893 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1894 int result=SizeofResource(v1, v2);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1895 dbgprintf("SizeofResource(0x%x, 0x%x) => %d\n", v1, v2, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1896 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1897 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1898
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1899 int WINAPI expGetLastError()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1900 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1901 int result=GetLastError();
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1902 dbgprintf("GetLastError() => 0x%x\n", result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1903 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1904 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1905
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1906 void WINAPI expSetLastError(int error)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1907 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1908 dbgprintf("SetLastError(0x%x)\n", error);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1909 SetLastError(error);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1910 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1911
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1912 char* expstrrchr(char* string, int value)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1913 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1914 char* result=strrchr(string, value);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1915 if(result)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1916 dbgprintf("strrchr(0x%x='%s', %d) => 0x%x='%s'", string, string, value, result, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1917 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1918 dbgprintf("strrchr(0x%x='%s', %d) => 0", string, string, value);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1919 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1920 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1921
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1922 char* expstrchr(char* string, int value)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1923 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1924 char* result=strchr(string, value);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1925 if(result)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1926 dbgprintf("strchr(0x%x='%s', %d) => 0x%x='%s'", string, string, value, result, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1927 else
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1928 dbgprintf("strchr(0x%x='%s', %d) => 0", string, string, value);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1929 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1930 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1931 int expstrlen(char* str)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1932 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1933 int result=strlen(str);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1934 dbgprintf("strlen(0x%x='%s') => %d\n", str, str, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1935 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1936 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1937 int expstrcpy(char* str1, const char* str2)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1938 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1939 int result= (int) strcpy(str1, str2);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1940 dbgprintf("strcpy(0x%x, 0x%x='%s') => %d\n", str1, str2, str2, result);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1941 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1942 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1943 int expstrcmp(const char* str1, const char* str2)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1944 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1945 int result=strcmp(str1, str2);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1946 dbgprintf("strcmp(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1947 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1948 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1949 int expstrcat(char* str1, const char* str2)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1950 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1951 int result= (int) strcat(str1, str2);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1952 dbgprintf("strcat(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1953 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1954 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1955 int expisalnum(int c)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1956 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1957 int result= (int) isalnum(c);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1958 dbgprintf("isalnum(0x%x='%c' => %d\n", c, c, result);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1959 return result;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1960 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1961 int expmemmove(void* dest, void* src, int n)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1962 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1963 int result= (int) memmove(dest, src, n);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1964 dbgprintf("memmove(0x%x, 0x%x, %d) => %d\n", dest, src, n, result);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
1965 return result;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1966 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1967 int expmemcmp(void* dest, void* src, int n)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1968 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1969 int result=memcmp(dest, src, n);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1970 dbgprintf("memcmp(0x%x, 0x%x, %d) => %d\n", dest, src, n, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1971 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1972 }
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
1973 void *expmemcpy(void* dest, void* src, int n)
130
39ceb7a5a9e2 crtdll/memcpy added (req for MJPEG)
arpi_esp
parents: 128
diff changeset
1974 {
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
1975 void *result=memcpy(dest, src, n);
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
1976 dbgprintf("memcpy(0x%x, 0x%x, %d) => %p\n", dest, src, n, result);
130
39ceb7a5a9e2 crtdll/memcpy added (req for MJPEG)
arpi_esp
parents: 128
diff changeset
1977 return result;
39ceb7a5a9e2 crtdll/memcpy added (req for MJPEG)
arpi_esp
parents: 128
diff changeset
1978 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1979 time_t exptime(time_t* t)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1980 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1981 time_t result=time(t);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1982 dbgprintf("time(0x%x) => %d\n", t, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1983 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1984 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1985
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1986 int WINAPI expStringFromGUID2(GUID* guid, char* str, int cbMax)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1987 {
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
1988 int result=snprintf(str, cbMax, "%.8lx-%.4x-%.4x-%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1989 guid->f1, guid->f2, guid->f3,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1990 (unsigned char)guid->f4[0], (unsigned char)guid->f4[1], (unsigned char)guid->f4[2], (unsigned char)guid->f4[3],
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1991 (unsigned char)guid->f4[4], (unsigned char)guid->f4[5], (unsigned char)guid->f4[6], (unsigned char)guid->f4[7]);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1992 dbgprintf("StringFromGUID2(0x%x, 0x%x='%s', %d) => %d\n", guid, str, str, cbMax, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1993 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1994 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1995
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1996
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1997 int WINAPI expGetFileVersionInfoSizeA(const char* name, int* lpHandle)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1998 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
1999 dbgprintf("GetFileVersionInfoSizeA(0x%x='%s', 0x%X) => 0\n", name, name, lpHandle);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2000 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2001 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2002
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2003 int WINAPI expIsBadStringPtrW(const short* string, int nchars)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2004 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2005 int result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2006 if(string==0)result=1; else result=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2007 dbgprintf("IsBadStringPtrW(0x%x, %d) => %d", string, nchars, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2008 if(string)wch_print(string);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2009 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2010 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2011
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2012 int WINAPI expIsBadStringPtrA(const char* string, int nchars)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2013 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2014 int result;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2015 // if(string==0)result=1; else result=0;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2016 // dbgprintf("IsBadStringPtrW(0x%x, %d) => %d", string, nchars, result);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2017 // if(string)wch_print(string);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2018 return result;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2019 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2020
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2021 extern long WINAPI InterlockedExchangeAdd( long* dest, long incr )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2022 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2023 long ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2024 __asm__ __volatile__( "lock; xaddl %0,(%1)"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2025 : "=r" (ret) : "r" (dest), "0" (incr) : "memory" );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2026 return ret;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2027 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2028
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2029 extern long WINAPI expInterlockedIncrement( long* dest )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2030 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2031 long result=InterlockedExchangeAdd( dest, 1 ) + 1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2032 dbgprintf("InterlockedIncrement(0x%x => %d) => %d\n", dest, *dest, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2033 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2034 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2035 extern long WINAPI expInterlockedDecrement( long* dest )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2036 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2037 long result=InterlockedExchangeAdd( dest, -1 ) - 1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2038 dbgprintf("InterlockedDecrement(0x%x => %d) => %d\n", dest, *dest, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2039 return result;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2040 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2041
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2042 extern void WINAPI expOutputDebugStringA( const char* string )
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2043 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2044 dbgprintf("OutputDebugStringA(0x%x='%s')\n", string);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2045 fprintf(stderr, "DEBUG: %s\n", string);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2046 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2047
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2048 int WINAPI expGetDC(int hwnd)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2049 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2050 dbgprintf("GetDC(0x%x) => 0\n", hwnd);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2051 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2052 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2053
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2054 int WINAPI expGetDesktopWindow()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2055 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2056 dbgprintf("GetDesktopWindow() => 0\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2057 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2058 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2059
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2060 int WINAPI expReleaseDC(int hwnd, int hdc)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2061 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2062 dbgprintf("ReleaseDC(0x%x, 0x%x) => 0\n", hwnd, hdc);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2063 return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2064 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2065 static int cursor[100];
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2066
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2067 int WINAPI expLoadCursorA(int handle,LPCSTR name)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2068 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2069 dbgprintf("LoadCursorA(%d, 0x%x='%s') => 0x%x\n", handle, name, (int)&cursor[0]);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2070 return (int)&cursor[0];
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2071 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2072 int WINAPI expSetCursor(void *cursor)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2073 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2074 dbgprintf("SetCursor(0x%x) => 0x%x\n", cursor, cursor);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2075 return (int)cursor;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2076 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2077 int WINAPI expGetSystemPaletteEntries(int hdc, int iStartIndex, int nEntries, void* lppe)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2078 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2079 dbgprintf("GetSystemPaletteEntries(0x%x, 0x%x, 0x%x, 0x%x) => 0\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2080 hdc, iStartIndex, nEntries, lppe);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2081 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2082 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2083
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2084 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2085 typedef struct _TIME_ZONE_INFORMATION {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2086 long Bias;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2087 char StandardName[32];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2088 SYSTEMTIME StandardDate;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2089 long StandardBias;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2090 char DaylightName[32];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2091 SYSTEMTIME DaylightDate;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2092 long DaylightBias;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2093 } TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2094 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2095
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2096 int WINAPI expGetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2097 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2098 const short name[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'S', 't', 'a',
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2099 'n', 'd', 'a', 'r', 'd', ' ', 'T', 'i', 'm', 'e', 0};
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2100 const short pname[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'D', 'a', 'y',
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2101 'l', 'i', 'g', 'h', 't', ' ', 'T', 'i', 'm', 'e', 0};
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2102 dbgprintf("GetTimeZoneInformation(0x%x) => TIME_ZONE_ID_STANDARD\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2103 memset(lpTimeZoneInformation, 0, sizeof(TIME_ZONE_INFORMATION));
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2104 lpTimeZoneInformation->Bias=360;//GMT-6
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2105 memcpy(lpTimeZoneInformation->StandardName, name, sizeof(name));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2106 lpTimeZoneInformation->StandardDate.wMonth=10;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2107 lpTimeZoneInformation->StandardDate.wDay=5;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2108 lpTimeZoneInformation->StandardDate.wHour=2;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2109 lpTimeZoneInformation->StandardBias=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2110 memcpy(lpTimeZoneInformation->DaylightName, pname, sizeof(pname));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2111 lpTimeZoneInformation->DaylightDate.wMonth=4;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2112 lpTimeZoneInformation->DaylightDate.wDay=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2113 lpTimeZoneInformation->DaylightDate.wHour=2;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2114 lpTimeZoneInformation->DaylightBias=-60;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2115 return TIME_ZONE_ID_STANDARD;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2116 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2117
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2118 void WINAPI expGetLocalTime(SYSTEMTIME* systime)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2119 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2120 time_t local_time;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2121 struct tm *local_tm;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2122 struct timeval tv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2123
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2124 dbgprintf("GetLocalTime(0x%x)\n");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2125 gettimeofday(&tv, NULL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2126 local_time=tv.tv_sec;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2127 local_tm=localtime(&local_time);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2128
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2129 systime->wYear = local_tm->tm_year + 1900;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2130 systime->wMonth = local_tm->tm_mon + 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2131 systime->wDayOfWeek = local_tm->tm_wday;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2132 systime->wDay = local_tm->tm_mday;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2133 systime->wHour = local_tm->tm_hour;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2134 systime->wMinute = local_tm->tm_min;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2135 systime->wSecond = local_tm->tm_sec;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2136 systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2137 dbgprintf(" Year: %d\n Month: %d\n Day of week: %d\n"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2138 " Day: %d\n Hour: %d\n Minute: %d\n Second: %d\n"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2139 " Milliseconds: %d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2140 systime->wYear, systime->wMonth, systime->wDayOfWeek, systime->wDay,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2141 systime->wHour, systime->wMinute, systime->wSecond, systime->wMilliseconds);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2142 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2143
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2144 int WINAPI expGetSystemTime(SYSTEMTIME* systime)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2145 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2146 time_t local_time;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2147 struct tm *local_tm;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2148 struct timeval tv;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2149
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2150 dbgprintf("GetSystemTime(0x%x)\n", systime);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2151 gettimeofday(&tv, NULL);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2152 local_time=tv.tv_sec;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2153 local_tm=gmtime(&local_time);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2154
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2155 systime->wYear = local_tm->tm_year + 1900;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2156 systime->wMonth = local_tm->tm_mon + 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2157 systime->wDayOfWeek = local_tm->tm_wday;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2158 systime->wDay = local_tm->tm_mday;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2159 systime->wHour = local_tm->tm_hour;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2160 systime->wMinute = local_tm->tm_min;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2161 systime->wSecond = local_tm->tm_sec;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2162 systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2163 dbgprintf(" Year: %d\n Month: %d\n Day of week: %d\n"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2164 " Day: %d\n Hour: %d\n Minute: %d\n Second: %d\n"
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2165 " Milliseconds: %d\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2166 systime->wYear, systime->wMonth, systime->wDayOfWeek, systime->wDay,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2167 systime->wHour, systime->wMinute, systime->wSecond, systime->wMilliseconds);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2168 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2169
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2170 int WINAPI expGetEnvironmentVariableA(const char* name, char* field, int size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2171 {
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2172 char *p;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2173 // printf("%s %x %x\n", name, field, size);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2174 if(field)field[0]=0;
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2175 /*
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2176 p = getenv(name);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2177 if (p) strncpy(field,p,size);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2178 */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2179 if (strcmp(name,"__MSVCRT_HEAP_SELECT")==0)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2180 strcpy(field,"__GLOBAL_HEAP_SELECTED,1");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2181 dbgprintf("GetEnvironmentVariableA(0x%x='%s', 0x%x, %d) => %d\n", name, name, field, size, strlen(field));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2182 return strlen(field);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2183 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2184
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2185 void* WINAPI expCoTaskMemAlloc(ULONG cb)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2186 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2187 return my_mreq(cb, 0);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2188 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2189 void WINAPI expCoTaskMemFree(void* cb)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2190 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2191 my_release(cb);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2192 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2193
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2194 void* CoTaskMemAlloc(ULONG cb){return expCoTaskMemAlloc(cb);}
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2195 void CoTaskMemFree(void* cb){expCoTaskMemFree(cb);}
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2196
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2197 struct COM_OBJECT_INFO
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2198 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2199 GUID clsid;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2200 long (*GetClassObject) (GUID* clsid, GUID* iid, void** ppv);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2201 };
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2202
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2203 static struct COM_OBJECT_INFO* com_object_table=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2204 static int com_object_size=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2205 int RegisterComClass(GUID* clsid, GETCLASSOBJECT gcs)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2206 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2207 if(!clsid)return -1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2208 if(!gcs)return -1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2209 com_object_table=realloc(com_object_table, sizeof(struct COM_OBJECT_INFO)*(++com_object_size));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2210 com_object_table[com_object_size-1].clsid=*clsid;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2211 com_object_table[com_object_size-1].GetClassObject=gcs;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2212 return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2213 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2214
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2215 GUID IID_IUnknown={0x00000000, 0x0000, 0x0000,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2216 {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2217 GUID IID_IClassFactory={0x00000001, 0x0000, 0x0000,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2218 {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}};
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2219
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2220 long WINAPI expCoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2221 long dwClsContext, GUID* riid, void** ppv)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2222 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2223 int i;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2224 struct COM_OBJECT_INFO* ci=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2225 for(i=0; i<com_object_size; i++)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2226 if(!memcmp(rclsid, &com_object_table[i].clsid, sizeof(GUID)))
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2227 ci=&com_object_table[i];
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2228 if(!ci)return 0x80040154;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2229 // in 'real' world we should mess with IClassFactory here
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2230 i=ci->GetClassObject(rclsid, riid, ppv);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2231 return i;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2232 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2233
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2234 long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2235 long dwClsContext, GUID* riid, void** ppv)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2236 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2237 return expCoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2238 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2239
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2240 int WINAPI
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2241 expIsRectEmpty(
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2242 CONST RECT *lprc)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2243 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2244 dbgprintf("IsRectEmpty(0x%x)");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2245 if((!lprc) || (lprc->right==lprc->left) || (lprc->top==lprc->bottom))
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2246 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2247 dbgprintf(" => TRUE\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2248 return TRUE;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2249 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2250 dbgprintf(" => FALSE\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2251 return FALSE;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2252 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2253
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2254 int _adjust_fdiv=0; //what's this?
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2255
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2256
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2257
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2258
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2259 unsigned int WINAPI expGetTempPathA(unsigned int len, char* path)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2260 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2261 dbgprintf("GetTempPathA(%d, 0x%x)", len, path);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2262 if(len<5)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2263 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2264 dbgprintf(" => 0\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2265 return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2266 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2267 strcpy(path, "/tmp");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2268 dbgprintf(" => 5 ( '/tmp' )\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2269 return 5;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2270 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2271 /*
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2272 FYI:
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2273 typedef struct
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2274 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2275 DWORD dwFileAttributes;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2276 FILETIME ftCreationTime;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2277 FILETIME ftLastAccessTime;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2278 FILETIME ftLastWriteTime;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2279 DWORD nFileSizeHigh;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2280 DWORD nFileSizeLow;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2281 DWORD dwReserved0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2282 DWORD dwReserved1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2283 CHAR cFileName[260];
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2284 CHAR cAlternateFileName[14];
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2285 } WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2286 */
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2287
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2288 HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2289 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2290 dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => 0\n", s, s, lpfd);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2291 strcpy(lpfd->cFileName, "msms001.vwp");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2292 strcpy(lpfd->cAlternateFileName, "msms001.vwp");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2293 return (HANDLE)0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2294 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2295 WIN_BOOL WINAPI expFindNextFileA(HANDLE h,LPWIN32_FIND_DATAA p)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2296 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2297 dbgprintf("FindNextFileA(0x%x, 0x%x) => 0\n", h, p);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2298 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2299 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2300 WIN_BOOL WINAPI expFindClose(HANDLE h)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2301 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2302 dbgprintf("FindClose(0x%x) => 0\n", h);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2303 return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2304 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2305 UINT WINAPI expSetErrorMode(UINT i)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2306 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2307 dbgprintf("SetErrorMode(%d) => 0\n", i);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2308 return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2309 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2310 UINT WINAPI expGetWindowsDirectoryA(LPSTR s,UINT c)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2311 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2312 char windir[]="c:\\windows";
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2313 int result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2314 strncpy(s, windir, c);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2315 result=1+((c<strlen(windir))?c:strlen(windir));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2316 dbgprintf("GetWindowsDirectoryA(0x%x, %d) => %d\n", s, c, result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2317 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2318 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2319
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2320 WIN_BOOL WINAPI expDeleteFileA(LPCSTR s)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2321 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2322 dbgprintf("DeleteFileA(0x%x='%s') => 0\n", s, s);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2323 return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2324 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2325 WIN_BOOL WINAPI expFileTimeToLocalFileTime(const FILETIME* cpf, LPFILETIME pf)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2326 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2327 dbgprintf("FileTimeToLocalFileTime(0x%x, 0x%x) => 0\n", cpf, pf);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2328 return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2329 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2330
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2331 UINT WINAPI expGetTempFileNameA(LPCSTR cs1,LPCSTR cs2,UINT i,LPSTR ps)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2332 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2333 char mask[16]="/tmp/AP_XXXXXX";
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2334 int result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2335 dbgprintf("GetTempFileNameA(0x%x='%s', 0x%x='%s', %d, 0x%x)", cs1, cs1, cs2, cs2, i, ps);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2336 if(i && i<10)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2337 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2338 dbgprintf(" => -1\n");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2339 return -1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2340 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2341 result=mkstemp(mask);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2342 sprintf(ps, "AP%d", result);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2343 dbgprintf(" => %d\n", strlen(ps));
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2344 return strlen(ps);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2345 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2346 //
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2347 // This func might need proper implementation if we want AngelPotion codec.
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2348 // They try to open APmpeg4v1.apl with it.
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2349 // DLL will close opened file with CloseHandle().
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2350 //
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2351 HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2352 LPSECURITY_ATTRIBUTES p1, DWORD i3,DWORD i4,HANDLE i5)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2353 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2354 dbgprintf("CreateFileA(0x%x='%s', %d, %d, 0x%x, %d, %d, 0x%x)\n", cs1, cs1, i1,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2355 i2, p1, i3, i4, i5);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2356 if((!cs1) || (strlen(cs1)<2))return -1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2357 if(strncmp(cs1, "AP", 2))
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2358 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2359 int result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2360 char* tmp=(char*)malloc(strlen(def_path)+50);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2361 strcpy(tmp, def_path);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2362 strcat(tmp, "/");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2363 strcat(tmp, "APmpg4v1.apl");
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2364 result=open(tmp, O_RDONLY);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2365 free(tmp);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2366 return result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2367 };
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2368 return atoi(cs1+2);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2369 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2370 static char sysdir[]=".";
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2371 LPCSTR WINAPI expGetSystemDirectoryA()
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2372 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2373 dbgprintf("GetSystemDirectoryA() => 0x%x='%s'\n", sysdir, sysdir);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2374 return sysdir;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2375 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2376 WIN_BOOL WINAPI expReadFile(HANDLE h,LPVOID pv,DWORD size,LPDWORD rd,LPOVERLAPPED unused)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2377 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2378 int result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2379 dbgprintf("ReadFile(%d, 0x%x, %d -> 0x%x)\n", h, pv, size, rd);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2380 result=read(h, pv, size);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2381 if(rd)*rd=result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2382 if(!result)return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2383 return 1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2384 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2385
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2386 WIN_BOOL WINAPI expWriteFile(HANDLE h,LPCVOID pv,DWORD size,LPDWORD wr,LPOVERLAPPED unused)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2387 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2388 int result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2389 dbgprintf("WriteFile(%d, 0x%x, %d -> 0x%x)\n", h, pv, size, wr);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2390 if(h==1234)h=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2391 result=write(h, pv, size);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2392 if(wr)*wr=result;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2393 if(!result)return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2394 return 1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2395 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2396 DWORD WINAPI expSetFilePointer(HANDLE h, LONG val, LPLONG ext, DWORD whence)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2397 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2398 int wh;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2399 dbgprintf("SetFilePointer(%d, %d, 0x%x, %d)\n", h, val, ext, whence);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2400 //why would DLL want temporary file with >2Gb size?
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2401 switch(whence)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2402 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2403 case FILE_BEGIN:
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2404 wh=SEEK_SET;break;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2405 case FILE_END:
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2406 wh=SEEK_END;break;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2407 case FILE_CURRENT:
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2408 wh=SEEK_CUR;break;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2409 default:
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2410 return -1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2411 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2412 return lseek(h, val, wh);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2413 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2414
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2415 HDRVR WINAPI expOpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2416 LPARAM lParam2)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2417 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2418 dbgprintf("OpenDriverA(0x%x='%s', 0x%x='%s', 0x%x) => -1\n", szDriverName, szDriverName, szSectionName, szSectionName, lParam2);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2419 return -1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2420 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2421 HDRVR WINAPI expOpenDriver(LPCSTR szDriverName, LPCSTR szSectionName,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2422 LPARAM lParam2)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2423 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2424 dbgprintf("OpenDriver(0x%x='%s', 0x%x='%s', 0x%x) => -1\n", szDriverName, szDriverName, szSectionName, szSectionName, lParam2);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2425 return -1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2426 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2427
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2428
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2429 WIN_BOOL
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2430 WINAPI
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2431 expGetProcessAffinityMask(
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2432 HANDLE hProcess,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2433 LPDWORD lpProcessAffinityMask,
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2434 LPDWORD lpSystemAffinityMask
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2435 )
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2436 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2437 dbgprintf("GetProcessAffinityMask(0x%x, 0x%x, 0x%x) => 1\n",
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2438 hProcess, lpProcessAffinityMask, lpSystemAffinityMask);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2439 if(lpProcessAffinityMask)*lpProcessAffinityMask=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2440 if(lpSystemAffinityMask)*lpSystemAffinityMask=1;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2441 return 1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2442 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2443
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2444
295
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2445 /******************************************************************************
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2446 * RegEnumValueA [ADVAPI32.@]
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2447 */
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2448 DWORD WINAPI expRegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2449 LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count )
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2450 {
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2451
340
1f7c824033fb less, and more informal printfs
arpi_esp
parents: 295
diff changeset
2452 // printf("RegEnumValueA(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
1f7c824033fb less, and more informal printfs
arpi_esp
parents: 295
diff changeset
2453 // hkey, index, value, val_count, reserved, type, data, count );
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2454
295
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2455 return -1;
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2456 }
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2457
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2458
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2459 #if 0
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2460 INT WINAPI expMulDiv(int nNumber,int nNumerator,int nDenominator)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2461 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2462 return ((long long)nNumber * (long long)nNumerator) / nDenominator;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2463 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2464 #endif
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2465
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2466 int WINAPI expMulDiv(int nNumber, int nNumerator, int nDenominator)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2467 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2468 static const long long max_int=0x7FFFFFFFLL;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2469 static const long long min_int=-0x80000000LL;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2470 long long tmp=(long long)nNumber*(long long)nNumerator;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2471 if(!nDenominator)return 1;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2472 tmp/=nDenominator;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2473 if(tmp<min_int) return 1;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2474 if(tmp>max_int) return 1;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2475 return (int)tmp;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2476 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2477
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2478 LONG WINAPI explstrcmpiA(const char* str1, const char* str2)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2479 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2480 LONG result=strcasecmp(str1, str2);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2481 dbgprintf("strcmpi(0x%x='%s', 0x%x='%s') => %d\n", str1, str1, str2, str2, result);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2482 return result;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2483 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2484
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2485 LONG WINAPI explstrlenA(const char* str1)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2486 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2487 LONG result=strlen(str1);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2488 dbgprintf("strlen(0x%x='%s') => %d\n", str1, str1, result);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2489 return result;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2490 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2491
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2492 LONG WINAPI explstrcpyA(char* str1, const char* str2)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2493 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2494 int result= (int) strcpy(str1, str2);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2495 dbgprintf("strcpy(0x%x, 0x%x='%s') => %d\n", str1, str2, str2, result);
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2496 return result;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2497 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2498
497
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2499 LONG WINAPI expInterlockedExchange(long *dest, long l)
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2500 {
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2501 long retval;
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2502 retval = *dest;
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2503 *dest = l;
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2504 return retval;
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2505 }
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2506
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2507 struct exports
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2508 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2509 char name[64];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2510 int id;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2511 void* func;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2512 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2513 struct libs
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2514 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2515 char name[64];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2516 int length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2517 struct exports* exps;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2518 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2519
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2520 #define FF(X,Y) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2521 {#X, Y, (void*)exp##X},
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2522
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2523 struct exports exp_kernel32[]={
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2524 FF(IsBadWritePtr, 357)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2525 FF(IsBadReadPtr, 354)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2526 FF(IsBadStringPtrW, -1)
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2527 FF(IsBadStringPtrA, -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2528 FF(DisableThreadLibraryCalls, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2529 FF(CreateThread, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2530 FF(CreateEventA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2531 FF(SetEvent, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2532 FF(ResetEvent, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2533 FF(WaitForSingleObject, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2534 FF(GetSystemInfo, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2535 FF(GetVersion, 332)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2536 FF(HeapCreate, 461)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2537 FF(HeapAlloc, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2538 FF(HeapDestroy, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2539 FF(HeapFree, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2540 FF(HeapSize, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2541 FF(GetProcessHeap, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2542 FF(VirtualAlloc, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2543 FF(VirtualFree, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2544 FF(InitializeCriticalSection, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2545 FF(EnterCriticalSection, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2546 FF(LeaveCriticalSection, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2547 FF(DeleteCriticalSection, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2548 FF(TlsAlloc, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2549 FF(TlsFree, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2550 FF(TlsGetValue, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2551 FF(TlsSetValue, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2552 FF(GetCurrentThreadId, -1)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2553 FF(GetCurrentProcess, -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2554 FF(LocalAlloc, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2555 FF(LocalLock, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2556 FF(GlobalAlloc, -1)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2557 FF(GlobalReAlloc, -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2558 FF(GlobalLock, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2559 FF(MultiByteToWideChar, 427)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2560 FF(WideCharToMultiByte, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2561 FF(GetVersionExA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2562 FF(CreateSemaphoreA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2563 FF(QueryPerformanceCounter, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2564 FF(QueryPerformanceFrequency, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2565 FF(LocalHandle, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2566 FF(LocalUnlock, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2567 FF(LocalFree, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2568 FF(GlobalHandle, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2569 FF(GlobalUnlock, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2570 FF(GlobalFree, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2571 FF(LoadResource, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2572 FF(ReleaseSemaphore, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2573 FF(FindResourceA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2574 FF(LockResource, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2575 FF(FreeResource, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2576 FF(SizeofResource, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2577 FF(CloseHandle, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2578 FF(GetCommandLineA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2579 FF(GetEnvironmentStringsW, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2580 FF(FreeEnvironmentStringsW, -1)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2581 FF(FreeEnvironmentStringsA, -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2582 FF(GetEnvironmentStrings, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2583 FF(GetStartupInfoA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2584 FF(GetStdHandle, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2585 FF(GetFileType, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2586 FF(SetHandleCount, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2587 FF(GetACP, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2588 FF(GetModuleFileNameA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2589 FF(SetUnhandledExceptionFilter, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2590 FF(LoadLibraryA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2591 FF(GetProcAddress, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2592 FF(FreeLibrary, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2593 FF(CreateFileMappingA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2594 FF(OpenFileMappingA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2595 FF(MapViewOfFile, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2596 FF(UnmapViewOfFile, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2597 FF(Sleep, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2598 FF(GetModuleHandleA, -1)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2599 FF(GetProfileIntA, -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2600 FF(GetPrivateProfileIntA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2601 FF(GetPrivateProfileStringA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2602 FF(WritePrivateProfileStringA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2603 FF(GetLastError, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2604 FF(SetLastError, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2605 FF(InterlockedIncrement, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2606 FF(InterlockedDecrement, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2607 FF(GetTimeZoneInformation, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2608 FF(OutputDebugStringA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2609 FF(GetLocalTime, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2610 FF(GetSystemTime, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2611 FF(GetEnvironmentVariableA, -1)
121
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
2612 FF(RtlZeroMemory,-1)
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
2613 FF(RtlMoveMemory,-1)
94a1a9f52050 added RtlMoveMem (for CRAM support)
arpi_esp
parents: 1
diff changeset
2614 FF(RtlFillMemory,-1)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2615 FF(GetTempPathA,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2616 FF(FindFirstFileA,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2617 FF(FindNextFileA,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2618 FF(FindClose,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2619 FF(FileTimeToLocalFileTime,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2620 FF(DeleteFileA,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2621 FF(ReadFile,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2622 FF(WriteFile,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2623 FF(SetFilePointer,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2624 FF(GetTempFileNameA,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2625 FF(CreateFileA,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2626 FF(GetSystemDirectoryA,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2627 FF(GetWindowsDirectoryA,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2628 FF(SetErrorMode, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2629 FF(IsProcessorFeaturePresent, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2630 FF(GetProcessAffinityMask, -1)
497
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2631 FF(InterlockedExchange, -1)
f776e51e531c added MulDiv -> should fix Acelp.net audio
arpi_esp
parents: 341
diff changeset
2632 FF(MulDiv, -1)
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2633 FF(lstrcmpiA, -1)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2634 FF(lstrlenA, -1)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2635 FF(lstrcpyA, -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2636 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2637
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2638 struct exports exp_msvcrt[]={
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2639 FF(malloc, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2640 FF(_initterm, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2641 FF(free, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2642 {"??3@YAXPAX@Z", -1, expdelete},
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2643 {"??2@YAPAXI@Z", -1, expnew},
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2644 {"_adjust_fdiv", -1, (void*)&_adjust_fdiv},
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2645 FF(strrchr, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2646 FF(strchr, -1)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2647 FF(strlen, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2648 FF(strcpy, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2649 FF(strcmp, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2650 FF(strcat, -1)
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 597
diff changeset
2651 FF(isalnum, -1)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2652 FF(memmove, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2653 FF(memcmp, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2654 FF(time, -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2655 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2656 struct exports exp_winmm[]={
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2657 FF(GetDriverModuleHandle, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2658 FF(timeGetTime, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2659 FF(DefDriverProc, -1)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2660 FF(OpenDriverA, -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2661 FF(OpenDriver, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2662 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2663 struct exports exp_user32[]={
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2664 FF(LoadStringA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2665 FF(wsprintfA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2666 FF(GetDC, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2667 FF(GetDesktopWindow, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2668 FF(ReleaseDC, -1)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2669 FF(IsRectEmpty, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2670 FF(LoadCursorA,-1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2671 FF(SetCursor,-1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2672 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2673 struct exports exp_advapi32[]={
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2674 FF(RegOpenKeyA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2675 FF(RegOpenKeyExA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2676 FF(RegCreateKeyExA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2677 FF(RegQueryValueExA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2678 FF(RegSetValueExA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2679 FF(RegCloseKey, -1)
295
c017b21a1990 added expRegEnumValueA(), fixed expWaitForSingleObject()
arpi_esp
parents: 235
diff changeset
2680 //FF(RegEnumValueA, -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2681 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2682 struct exports exp_gdi32[]={
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2683 FF(CreateCompatibleDC, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2684 FF(GetDeviceCaps, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2685 FF(DeleteDC, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2686 FF(GetSystemPaletteEntries, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2687 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2688 struct exports exp_version[]={
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2689 FF(GetFileVersionInfoSizeA, -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2690 };
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2691 struct exports exp_ole32[]={
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2692 FF(CoTaskMemAlloc, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2693 FF(CoTaskMemFree, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2694 FF(CoCreateInstance, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2695 FF(StringFromGUID2, -1)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2696 };
130
39ceb7a5a9e2 crtdll/memcpy added (req for MJPEG)
arpi_esp
parents: 128
diff changeset
2697 struct exports exp_crtdll[]={
39ceb7a5a9e2 crtdll/memcpy added (req for MJPEG)
arpi_esp
parents: 128
diff changeset
2698 FF(memcpy, -1)
39ceb7a5a9e2 crtdll/memcpy added (req for MJPEG)
arpi_esp
parents: 128
diff changeset
2699 };
39ceb7a5a9e2 crtdll/memcpy added (req for MJPEG)
arpi_esp
parents: 128
diff changeset
2700
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2701 #define LL(X) \
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2702 {#X".dll", sizeof(exp_##X)/sizeof(struct exports), exp_##X},
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2703
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2704 struct libs libraries[]={
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2705 LL(kernel32)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2706 LL(msvcrt)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2707 LL(winmm)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2708 LL(user32)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2709 LL(advapi32)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2710 LL(gdi32)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2711 LL(version)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2712 LL(ole32)
130
39ceb7a5a9e2 crtdll/memcpy added (req for MJPEG)
arpi_esp
parents: 128
diff changeset
2713 LL(crtdll)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2714 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2715
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2716 void* LookupExternal(const char* library, int ordinal)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2717 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2718 char* answ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2719 int i,j;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2720 if(library==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2721 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2722 printf("ERROR: library=0\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2723 return (void*)ext_unknown;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2724 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2725 printf("External func %s:%d\n", library, ordinal);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2726 // printf("%x %x\n", &unk_exp1, &unk_exp2);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2727
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2728 for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2729 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2730 if(strcasecmp(library, libraries[i].name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2731 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2732 for(j=0; j<libraries[i].length; j++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2733 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2734 if(ordinal!=libraries[i].exps[j].id)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2735 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2736 printf("Hit: 0x%08X\n", libraries[i].exps[j].func);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2737 return libraries[i].exps[j].func;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2738 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2739 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2740 if(pos>150)return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2741 answ=(char*)extcode+pos*0x64;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2742 memcpy(answ, &unk_exp1, 0x64);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2743 *(int*)(answ+9)=pos;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2744 *(int*)(answ+47)-=((int)answ-(int)&unk_exp1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2745 sprintf(export_names[pos], "%s:%d", library, ordinal);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2746 pos++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2747 return (void*)answ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2748 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2749
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2750 void* LookupExternalByName(const char* library, const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2751 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2752 char* answ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2753 int i,j;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2754 // return (void*)ext_unknown;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2755 if(library==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2756 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2757 printf("ERROR: library=0\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2758 return (void*)ext_unknown;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2759 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2760 if(name==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2761 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2762 printf("ERROR: name=0\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2763 return (void*)ext_unknown;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2764 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2765 // printf("External func %s:%s\n", library, name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2766 for(i=0; i<sizeof(libraries)/sizeof(struct libs); i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2767 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2768 if(strcasecmp(library, libraries[i].name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2769 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2770 for(j=0; j<libraries[i].length; j++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2771 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2772 if(strcmp(name, libraries[i].exps[j].name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2773 continue;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2774 // printf("Hit: 0x%08X\n", libraries[i].exps[j].func);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2775 return libraries[i].exps[j].func;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2776 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2777 }
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2778 // printf("%s %s\n", library, name);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2779 if(pos>150)return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2780 strcpy(export_names[pos], name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2781 answ=(char*)extcode+pos*0x64;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2782 memcpy(answ, &unk_exp1, 0x64);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2783 *(int*)(answ+9)=pos;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2784 *(int*)(answ+47)-=((int)answ-(int)&unk_exp1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2785 pos++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2786 return (void*)answ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2787 // memcpy(extcode, &unk_exp1, 0x64);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2788 // *(int*)(extcode+52)-=((int)extcode-(int)&unk_exp1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2789 // return (void*)extcode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2790 // printf("Unknown func %s:%s\n", library, name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2791 // return (void*)ext_unknown;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2792 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2793
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 1096
diff changeset
2794 int my_garbagecollection(void)
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2795 {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2796 #ifdef GARBAGE
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2797 alc_list* pp,*ppsv;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2798 mutex_list* pm,*pmsv;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2799 int unfree,unfreecnt;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2800 if (mlist != NULL) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2801 pm=mlist;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2802 for(;pm;) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2803 if (pm->prev) pm->prev->next=pm->next;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2804 if (pm->next) pm->next->prev=pm->prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2805 if (pm == mlist) mlist=pm->prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2806 if (pm->pm) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2807 pthread_mutex_destroy(pm->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2808 my_release(pm->pm);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2809 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2810 if (pm->pc) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2811 pthread_cond_destroy(pm->pc);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2812 my_release(pm->pc);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2813 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2814 pmsv = pm;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2815 pm=pm->prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2816 my_release(pmsv);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2817 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2818 }
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2819
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2820 if (alclist==NULL) return 0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2821
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2822 pp=alclist;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2823 unfree=unfreecnt=0;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2824 for(;pp;) {
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2825 unfree+=pp->size;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2826 unfreecnt++;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2827 if (pp->prev)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2828 pp->prev->next=pp->next;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2829 if (pp->next)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2830 pp->next->prev=pp->prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2831 if (pp == alclist)
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2832 alclist=pp->prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2833 free(pp->addr);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2834 ppsv = pp;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2835 pp=pp->prev;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2836 free(ppsv);
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2837 alccnt--;
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2838 }
597
d751f549f29f no more warnings...
szabii
parents: 497
diff changeset
2839 printf("Total Unfree %d bytes cnt %d [%p,%d]\n",unfree,unfreecnt,alclist,alccnt);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2840 #endif
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 121
diff changeset
2841 }