annotate loader/registry.c @ 31278:2d75e55e74bc

Print media start time with -identify.
author reimar
date Mon, 07 Jun 2010 17:52:28 +0000
parents 9a2e299dc256
children 8fa2f43cb760
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15166
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9965
diff changeset
1 /*
18783
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 15166
diff changeset
2 * Modified for use with MPlayer, detailed changelog at
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 15166
diff changeset
3 * http://svn.mplayerhq.hu/mplayer/trunk/
15166
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9965
diff changeset
4 */
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9965
diff changeset
5
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
6 #include "config.h"
21261
a2e02e6b6379 Rename config.h --> debug.h and include config.h explicitly.
diego
parents: 18889
diff changeset
7 #include "debug.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 #include <stdio.h>
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
10 #include <stdlib.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 #include <fcntl.h>
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
12 #include <unistd.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 #include <pwd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 #include <sys/types.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
16 #include "wine/winbase.h"
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
17 #include "wine/winreg.h"
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
18 #include "wine/winnt.h"
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
19 #include "wine/winerror.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
21 #include "ext.h"
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
22 #include "registry.h"
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
23
30901
76a13038105e Rename get_path.[ch] --> path.[ch].
diego
parents: 30702
diff changeset
24 #include "path.h"
28233
bfb8ccb245a9 #include the appropriate header instead of using local declarations.
diego
parents: 28051
diff changeset
25
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
26 //#undef TRACE
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
27 //#define TRACE printf
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
28
4384
a1d27234018f avoids warnings
pl
parents: 3465
diff changeset
29 // ...can be set before init_registry() call
a1d27234018f avoids warnings
pl
parents: 3465
diff changeset
30 char* regpathname = NULL;
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
31
4384
a1d27234018f avoids warnings
pl
parents: 3465
diff changeset
32 static char* localregpathname = NULL;
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
33
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
34 typedef struct reg_handle_s
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
35 {
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
36 int handle;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
37 char* name;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
38 struct reg_handle_s* next;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
39 struct reg_handle_s* prev;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
40 } reg_handle_t;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
41
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 struct reg_value
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 int type;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 char* name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 int len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 char* value;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
50 static struct reg_value* regs = NULL;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
51 static int reg_size;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
52 static reg_handle_t* head = NULL;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 #define DIR -25
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
56 static void create_registry(void);
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
57 static void open_registry(void);
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
58 static void save_registry(void);
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
59 static void init_registry(void);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
62 static void create_registry(void){
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 if(regs)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 printf("Logic error: create_registry() called with existing registry\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 save_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 return;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
68 }
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
69 regs=malloc(3*sizeof(struct reg_value));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 regs[0].type=regs[1].type=DIR;
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
71 regs[0].name=malloc(5);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 strcpy(regs[0].name, "HKLM");
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
73 regs[1].name=malloc(5);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 strcpy(regs[1].name, "HKCU");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 regs[0].value=regs[1].value=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 regs[0].len=regs[1].len=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 reg_size=2;
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
78 head = 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 save_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 }
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
81
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
82 static void open_registry(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 int fd;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 int i;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
86 unsigned int len;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 if(regs)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 printf("Multiple open_registry(>\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 }
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
92 fd = open(localregpathname, O_RDONLY);
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
93 if (fd == -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 printf("Creating new registry\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 create_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 return;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
98 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 read(fd, &reg_size, 4);
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
100 regs=malloc(reg_size*sizeof(struct reg_value));
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
101 head = 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 for(i=0; i<reg_size; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 read(fd,&regs[i].type,4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 read(fd,&len,4);
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
106 regs[i].name=malloc(len+1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 if(regs[i].name==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 reg_size=i+1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 goto error;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 read(fd, regs[i].name, len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 regs[i].name[len]=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 read(fd,&regs[i].len,4);
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
115 regs[i].value=malloc(regs[i].len+1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 if(regs[i].value==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 {
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
118 free(regs[i].name);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 reg_size=i+1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 goto error;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 read(fd, regs[i].value, regs[i].len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 regs[i].value[regs[i].len]=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 error:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 close(fd);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
130 static void save_registry(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 {
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
132 int fd, i;
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
133 if (!regs)
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
134 init_registry();
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
135 fd = open(localregpathname, O_WRONLY | O_CREAT, 00666);
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
136 if (fd == -1)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 {
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
138 printf("Failed to open registry file '%s' for writing.\n",
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
139 localregpathname);
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
140 return;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 write(fd, &reg_size, 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 for(i=0; i<reg_size; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 {
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
145 unsigned len=strlen(regs[i].name);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 write(fd, &regs[i].type, 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 write(fd, &len, 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 write(fd, regs[i].name, len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 write(fd, &regs[i].len, 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 write(fd, regs[i].value, regs[i].len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 close(fd);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 }
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
154
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
155 void free_registry(void)
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
156 {
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
157 reg_handle_t* t = head;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
158 while (t)
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
159 {
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
160 reg_handle_t* f = t;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
161 if (t->name)
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
162 free(t->name);
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
163 t=t->prev;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
164 free(f);
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
165 }
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
166 head = 0;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
167 if (regs)
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
168 {
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
169 int i;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
170 for(i=0; i<reg_size; i++)
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
171 {
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
172 free(regs[i].name);
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
173 free(regs[i].value);
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
174 }
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
175 free(regs);
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
176 regs = 0;
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
177 }
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
178
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
179 if (localregpathname && localregpathname != regpathname)
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
180 free(localregpathname);
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
181 localregpathname = 0;
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
182 }
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
183
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
184
25807
3cd1d60e7225 Disable unused functions find_handle_2, find_handle_by_name, fixes the warning:
diego
parents: 24387
diff changeset
185 #if 0
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 static reg_handle_t* find_handle_by_name(const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 for(t=head; t; t=t->prev)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 if(!strcmp(t->name, name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 return t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 }
25807
3cd1d60e7225 Disable unused functions find_handle_2, find_handle_by_name, fixes the warning:
diego
parents: 24387
diff changeset
198 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 static struct reg_value* find_value_by_name(const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 for(i=0; i<reg_size; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 if(!strcmp(regs[i].name, name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 return regs+i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 static reg_handle_t* find_handle(int handle)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 for(t=head; t; t=t->prev)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 if(t->handle==handle)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 return t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 return 0;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
218 }
29212
eda346733b8c Add missing 'void' to parameterless function declarations.
diego
parents: 28233
diff changeset
219 static int generate_handle(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
221 static unsigned int zz=249;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 zz++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 while((zz==HKEY_LOCAL_MACHINE) || (zz==HKEY_CURRENT_USER))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 zz++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 return zz;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 static reg_handle_t* insert_handle(long handle, const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 reg_handle_t* t;
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
231 t=malloc(sizeof(reg_handle_t));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 if(head==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 t->prev=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 head->next=t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 t->prev=head;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 t->next=0;
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
242 t->name=malloc(strlen(name)+1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 strcpy(t->name, name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 t->handle=handle;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 head=t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 return t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 static char* build_keyname(long key, const char* subkey)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 char* full_name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 if((t=find_handle(key))==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 TRACE("Invalid key\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 if(subkey==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 subkey="<default>";
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
259 full_name=malloc(strlen(t->name)+strlen(subkey)+10);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 strcpy(full_name, t->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 strcat(full_name, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 strcat(full_name, subkey);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 return full_name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
265 static struct reg_value* insert_reg_value(int handle, const char* name, int type, const void* value, int len)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 struct reg_value* v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 char* fullname;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 if((fullname=build_keyname(handle, name))==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 TRACE("Invalid handle\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 if((v=find_value_by_name(fullname))==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 //creating new value in registry
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 if(regs==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279 create_registry();
30702
9fc9d1e788aa Do not cast the results of malloc/calloc/realloc.
diego
parents: 30219
diff changeset
280 regs = realloc(regs, sizeof(struct reg_value) * (reg_size +1 ));
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
281 //regs=(struct reg_value*)my_realloc(regs, sizeof(struct reg_value)*(reg_size+1));
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282 v=regs+reg_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 reg_size++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 //replacing old one
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 {
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
288 free(v->value);
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
289 free(v->name);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 }
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
291 TRACE("RegInsert '%s' %p v:%d len:%d\n", name, value, *(int*)value, len);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 v->type=type;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 v->len=len;
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
294 v->value=malloc(len);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 memcpy(v->value, value, len);
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
296 v->name=malloc(strlen(fullname)+1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 strcpy(v->name, fullname);
3134
181db9e5a887 avifile sync again... :(
arpi
parents: 3128
diff changeset
298 free(fullname);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 save_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 return v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
303 static void init_registry(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 {
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
305 TRACE("Initializing registry\n");
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
306 // can't be free-ed - it's static and probably thread
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
307 // unsafe structure which is stored in glibc
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
308
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
309 regpathname = get_path("registry");
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
310 localregpathname = regpathname;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
311
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 open_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 insert_handle(HKEY_LOCAL_MACHINE, "HKLM");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 insert_handle(HKEY_CURRENT_USER, "HKCU");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 }
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
316
25807
3cd1d60e7225 Disable unused functions find_handle_2, find_handle_by_name, fixes the warning:
diego
parents: 24387
diff changeset
317 #if 0
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 static reg_handle_t* find_handle_2(long key, const char* subkey)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320 char* full_name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 if((t=find_handle(key))==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 TRACE("Invalid key\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 return (reg_handle_t*)-1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 if(subkey==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 return t;
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
329 full_name=malloc(strlen(t->name)+strlen(subkey)+10);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 strcpy(full_name, t->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331 strcat(full_name, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 strcat(full_name, subkey);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 t=find_handle_by_name(full_name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 free(full_name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 return t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 }
25807
3cd1d60e7225 Disable unused functions find_handle_2, find_handle_by_name, fixes the warning:
diego
parents: 24387
diff changeset
337 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338
9965
692c4467da42 cygwin support patch by Sascha Sommer
alex
parents: 7386
diff changeset
339 long __stdcall RegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 char* full_name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 struct reg_value* v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 TRACE("Opening key %s\n", subkey);
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
345
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 if(!regs)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 init_registry()
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
348 ;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349 /* t=find_handle_2(key, subkey);
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
350
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 if(t==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 if(t==(reg_handle_t*)-1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355 return -1;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
356 */
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
357 full_name=build_keyname(key, subkey);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
358 if(!full_name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359 return -1;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
360 TRACE("Opening key Fullname %s\n", full_name);
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
361 v=find_value_by_name(full_name);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 t=insert_handle(generate_handle(), full_name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 *newkey=t->handle;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 free(full_name);
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
366
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 return 0;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
368 }
9965
692c4467da42 cygwin support patch by Sascha Sommer
alex
parents: 7386
diff changeset
369 long __stdcall RegCloseKey(long key)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
371 reg_handle_t *handle;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
372 if(key==(long)HKEY_LOCAL_MACHINE)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373 return 0;
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
374 if(key==(long)HKEY_CURRENT_USER)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 handle=find_handle(key);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 if(handle==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 if(handle->prev)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380 handle->prev->next=handle->next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 if(handle->next)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 handle->next->prev=handle->prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 if(handle->name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 free(handle->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 if(handle==head)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386 head=head->prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 free(handle);
30219
f08c45c46433 Fix RegCloseKey to not return an error on success.
reimar
parents: 29212
diff changeset
388 return 0;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
389 }
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
390
9965
692c4467da42 cygwin support patch by Sascha Sommer
alex
parents: 7386
diff changeset
391 long __stdcall RegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
393 struct reg_value* t;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
394 char* c;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
395 TRACE("Querying value %s\n", value);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
396 if(!regs)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
397 init_registry();
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
398
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
399 c=build_keyname(key, value);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
400 if (!c)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
401 return 1;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
402 t=find_value_by_name(c);
31139
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
403 if (t==0) {
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
404 // Hacks for CineForm.
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
405 if (strcmp(c, "HKCU\\SOFTWARE\\CineForm\\DecoderProperties\\Resolution") == 0) {
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
406 if (data)
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
407 *data = 1000;
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
408 if (type)
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
409 *type = REG_DWORD;
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
410 if (count)
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
411 *count = sizeof(DWORD);
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
412 free(c);
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
413 return ERROR_SUCCESS;
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
414 }
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
415 if (strcmp(c, "HKCU\\SOFTWARE\\CineForm\\DecoderProperties\\PixelFormats") == 0) {
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
416 if (data)
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
417 *data = 0xffff;
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
418 if (type)
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
419 *type = REG_DWORD;
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
420 if (count)
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
421 *count = sizeof(DWORD);
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
422 free(c);
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
423 return ERROR_SUCCESS;
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
424 }
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
425 free(c);
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
426 return ERROR_FILE_NOT_FOUND;
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
427 }
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
428 free(c);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
429 if (type)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
430 *type=t->type;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
431 if (data)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
432 {
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
433 memcpy(data, t->value, (t->len<*count)?t->len:*count);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
434 TRACE("returning %d bytes: %d\n", t->len, *(int*)data);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
435 }
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
436 if(*count<t->len)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
437 {
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
438 *count=t->len;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
439 return ERROR_MORE_DATA;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
440 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
442 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
443 *count=t->len;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
444 }
31139
9a2e299dc256 Add final missing bits of CineForm HD support on Linux (via the Windows
sesse
parents: 30901
diff changeset
445 return ERROR_SUCCESS;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
446 }
9965
692c4467da42 cygwin support patch by Sascha Sommer
alex
parents: 7386
diff changeset
447 long __stdcall RegCreateKeyExA(long key, const char* name, long reserved,
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
448 void* classs, long options, long security,
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
449 void* sec_attr, int* newkey, int* status)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
451 reg_handle_t* t;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
452 char* fullname;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
453 struct reg_value* v;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
454 // TRACE("Creating/Opening key %s\n", name);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
455 if(!regs)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
456 init_registry();
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
457
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
458 fullname=build_keyname(key, name);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
459 if (!fullname)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
460 return 1;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
461 TRACE("Creating/Opening key %s\n", fullname);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
462 v=find_value_by_name(fullname);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
463 if(v==0)
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
464 {
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
465 int qw=45708;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
466 v=insert_reg_value(key, name, DIR, &qw, 4);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
467 if (status) *status=REG_CREATED_NEW_KEY;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
468 // return 0;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
469 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
471 t=insert_handle(generate_handle(), fullname);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
472 *newkey=t->handle;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
473 free(fullname);
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
474 return 0;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
475 }
1416
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
476
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
477 /*
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
478 LONG RegEnumValue(
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
479 HKEY hKey, // handle to key to query
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
480 DWORD dwIndex, // index of value to query
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
481 LPTSTR lpValueName, // address of buffer for value string
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
482 LPDWORD lpcbValueName, // address for size of value buffer
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
483 LPDWORD lpReserved, // reserved
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
484 LPDWORD lpType, // address of buffer for type code
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
485 LPBYTE lpData, // address of buffer for value data
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
486 LPDWORD lpcbData // address for size of data buffer
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
487 );
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
488 */
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
489
9965
692c4467da42 cygwin support patch by Sascha Sommer
alex
parents: 7386
diff changeset
490 long __stdcall RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
1416
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
491 LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count)
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
492 {
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
493 // currenly just made to support MSZH & ZLIB
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
494 //printf("Reg Enum 0x%x %d %s %d data: %p %d %d >%s<\n", hkey, index,
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
495 // value, *val_count, data, *count, reg_size, data);
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
496 reg_handle_t* t = find_handle(hkey);
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
497 if (t && index < 10)
1416
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
498 {
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
499 struct reg_value* v=find_value_by_name(t->name);
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
500 if (v)
1416
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
501 {
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
502 memcpy(data, v->value, (v->len < *count) ? v->len : *count);
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
503 if(*count < v->len)
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
504 *count = v->len;
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
505 if (type)
1416
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
506 *type = v->type;
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
507 //printf("Found handle %s\n", v->name);
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
508 return 0;
1416
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
509 }
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
510 }
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
511 return ERROR_NO_MORE_ITEMS;
1416
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
512 }
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
513
9965
692c4467da42 cygwin support patch by Sascha Sommer
alex
parents: 7386
diff changeset
514 long __stdcall RegSetValueExA(long key, const char* name, long v1, long v2, const void* data, long size)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
515 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
516 char* c;
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 4384
diff changeset
517 TRACE("Request to set value %s %d\n", name, *(const int*)data);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
518 if(!regs)
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
519 init_registry();
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
520
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
521 c=build_keyname(key, name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
522 if(c==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
523 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
524 insert_reg_value(key, name, v2, data, size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
525 free(c);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
526 return 0;
3128
392316004607 avifile sync... maybe broken, tell me if so.
arpi
parents: 1416
diff changeset
527 }
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
528
9965
692c4467da42 cygwin support patch by Sascha Sommer
alex
parents: 7386
diff changeset
529 long __stdcall RegEnumKeyExA(HKEY hKey, DWORD dwIndex, LPSTR lpName, LPDWORD lpcbName,
3465
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
530 LPDWORD lpReserved, LPSTR lpClass, LPDWORD lpcbClass,
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
531 LPFILETIME lpftLastWriteTime)
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
532 {
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
533 return ERROR_NO_MORE_ITEMS;
4dad31e655b6 avifile merge. kabi: indent changes really suxxxx
arpi
parents: 3138
diff changeset
534 }