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