annotate loader/registry.c @ 3053:153fc4f5464f

ehh too much
author gabucino
date Wed, 21 Nov 2001 17:07:40 +0000
parents 8e841fe5668b
children 392316004607
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 #include <config.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 #include <stdio.h>
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
4 #include <stdlib.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 #include <fcntl.h>
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
6 #include <unistd.h>
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 #include <pwd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 #include <sys/types.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 #include <wine/winbase.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 #include <wine/winreg.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 #include <wine/winnt.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 #include <wine/winerror.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 #include <registry.h>
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
16 #include <ext.h>
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
17
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
18 //#undef TRACE
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
19 //#define TRACE printf
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 struct reg_value
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 int type;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 char* name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 int len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 char* value;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 static int reg_size=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 static struct reg_value* regs=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 struct reg_handle_s;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 typedef struct reg_handle_s
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 int handle;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 char* name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 struct reg_handle_s* next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 struct reg_handle_s* prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 } reg_handle_t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 static reg_handle_t* head=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 #define DIR -25
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44
178
55206b791586 get_path()
szabii
parents: 172
diff changeset
45 extern char *get_path(char *);
55206b791586 get_path()
szabii
parents: 172
diff changeset
46
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
47 static void create_registry(void);
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
48 static void open_registry(void);
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
49 static void save_registry(void);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
54 static void create_registry(void){
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 if(regs)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 printf("Logic error: create_registry() called with existing registry\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 save_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 regs=(struct reg_value*)malloc(3*sizeof(struct reg_value));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 regs[0].type=regs[1].type=DIR;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 regs[0].name=(char*)malloc(5);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 strcpy(regs[0].name, "HKLM");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 regs[1].name=(char*)malloc(5);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 strcpy(regs[1].name, "HKCU");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 regs[0].value=regs[1].value=NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 regs[0].len=regs[1].len=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 reg_size=2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 save_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
72 static void open_registry(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 int fd;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 int len;
178
55206b791586 get_path()
szabii
parents: 172
diff changeset
77 // struct passwd* pwent;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 char* pathname;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 if(regs)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 printf("Multiple open_registry(>\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 }
178
55206b791586 get_path()
szabii
parents: 172
diff changeset
84 // pwent=getpwuid(getuid());
55206b791586 get_path()
szabii
parents: 172
diff changeset
85 // pathname=(char*)malloc(strlen(pwent->pw_dir)+20);
55206b791586 get_path()
szabii
parents: 172
diff changeset
86 // strcpy(pathname, pwent->pw_dir);
55206b791586 get_path()
szabii
parents: 172
diff changeset
87 // strcat(pathname, "/.mplayer/registry");
55206b791586 get_path()
szabii
parents: 172
diff changeset
88 pathname = get_path("registry");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 fd=open(pathname, O_RDONLY);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 free(pathname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 if(fd==-1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 printf("Creating new registry\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 create_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 read(fd, &reg_size, 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 regs=(struct reg_value*)malloc(reg_size*sizeof(struct reg_value));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 for(i=0; i<reg_size; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 read(fd,&regs[i].type,4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 read(fd,&len,4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 regs[i].name=(char*)malloc(len+1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 if(regs[i].name==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 reg_size=i+1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 goto error;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 read(fd, regs[i].name, len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 regs[i].name[len]=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 read(fd,&regs[i].len,4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 regs[i].value=(char*)malloc(regs[i].len+1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 if(regs[i].value==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 free(regs[i].name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 reg_size=i+1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 goto error;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 read(fd, regs[i].value, regs[i].len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 regs[i].value[regs[i].len]=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 error:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 close(fd);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
127 static void save_registry(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 int fd, i, len;
178
55206b791586 get_path()
szabii
parents: 172
diff changeset
130 // struct passwd* pwent;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 char* pathname;
178
55206b791586 get_path()
szabii
parents: 172
diff changeset
132 // pwent=getpwuid(getuid());
55206b791586 get_path()
szabii
parents: 172
diff changeset
133 // pathname=(char*)malloc(strlen(pwent->pw_dir)+20);
55206b791586 get_path()
szabii
parents: 172
diff changeset
134 // strcpy(pathname, pwent->pw_dir);
55206b791586 get_path()
szabii
parents: 172
diff changeset
135 // strcat(pathname, "/.mplayer/registry");
55206b791586 get_path()
szabii
parents: 172
diff changeset
136 pathname = get_path("registry");
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 fd=open(pathname, O_WRONLY | O_CREAT, 00777);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 free(pathname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 if(fd==-1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 printf("Failed to open registry file for writing.\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 write(fd, &reg_size, 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 for(i=0; i<reg_size; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 write(fd, &regs[i].type, 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 len=strlen(regs[i].name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 write(fd, &len, 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 write(fd, regs[i].name, len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 write(fd, &regs[i].len, 4);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 write(fd, regs[i].value, regs[i].len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 close(fd);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 static reg_handle_t* find_handle_by_name(const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 for(t=head; t; t=t->prev)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 if(!strcmp(t->name, name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 return t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 static struct reg_value* find_value_by_name(const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 for(i=0; i<reg_size; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 if(!strcmp(regs[i].name, name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 return regs+i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 static reg_handle_t* find_handle(int handle)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 for(t=head; t; t=t->prev)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 if(t->handle==handle)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 return t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 static int generate_handle()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 static int zz=249;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 zz++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 while((zz==HKEY_LOCAL_MACHINE) || (zz==HKEY_CURRENT_USER))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 zz++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 return zz;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 static reg_handle_t* insert_handle(long handle, const char* name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 t=(reg_handle_t*)malloc(sizeof(reg_handle_t));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 if(head==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203 t->prev=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 head->next=t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208 t->prev=head;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210 t->next=0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 t->name=(char*)malloc(strlen(name)+1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 strcpy(t->name, name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 t->handle=handle;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 head=t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215 return t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 static char* build_keyname(long key, const char* subkey)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 char* full_name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 if((t=find_handle(key))==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 TRACE("Invalid key\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 if(subkey==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 subkey="<default>";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 strcpy(full_name, t->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 strcat(full_name, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 strcat(full_name, subkey);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 return full_name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 }
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
234 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
235 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 struct reg_value* v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 char* fullname;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239 if((fullname=build_keyname(handle, name))==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 TRACE("Invalid handle\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 return NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 if((v=find_value_by_name(fullname))==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 //creating new value in registry
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 if(regs==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 create_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250 regs=(struct reg_value*)realloc(regs, sizeof(struct reg_value)*(reg_size+1));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251 v=regs+reg_size;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 reg_size++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 //replacing old one
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 free(v->value);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 free(v->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 v->type=type;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 v->len=len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 v->value=(char*)malloc(len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 memcpy(v->value, value, len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 v->name=(char*)malloc(strlen(fullname)+1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 strcpy(v->name, fullname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 save_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 return v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269
1307
d8c1b0b38edc Add prototypes to wine/loader stuff, so that we can catch __stdcall function
jkeil
parents: 340
diff changeset
270 static void init_registry(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 {
340
1f7c824033fb less, and more informal printfs
arpi_esp
parents: 178
diff changeset
272 #ifdef DETAILED_OUT
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
273 printf("Initializing registry\n");
340
1f7c824033fb less, and more informal printfs
arpi_esp
parents: 178
diff changeset
274 #endif
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 open_registry();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 insert_handle(HKEY_LOCAL_MACHINE, "HKLM");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277 insert_handle(HKEY_CURRENT_USER, "HKCU");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279 static reg_handle_t* find_handle_2(long key, const char* subkey)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281 char* full_name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 if((t=find_handle(key))==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285 TRACE("Invalid key\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 return (reg_handle_t*)-1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288 if(subkey==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 return t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 full_name=(char*)malloc(strlen(t->name)+strlen(subkey)+10);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 strcpy(full_name, t->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292 strcat(full_name, "\\");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 strcat(full_name, subkey);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 t=find_handle_by_name(full_name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 free(full_name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 return t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 long RegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 char* full_name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303 struct reg_value* v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 TRACE("Opening key %s\n", subkey);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 if(!regs)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 init_registry()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 /* t=find_handle_2(key, subkey);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 if(t==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 if(t==(reg_handle_t*)-1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317 */ full_name=build_keyname(key, subkey);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 if(!full_name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319 return -1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320 v=find_value_by_name(full_name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 t=insert_handle(generate_handle(), full_name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 *newkey=t->handle;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 free(full_name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 long RegCloseKey(long key)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 reg_handle_t *handle;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331 if(key==HKEY_LOCAL_MACHINE)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 if(key==HKEY_CURRENT_USER)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 handle=find_handle(key);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 if(handle==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338 if(handle->prev)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 handle->prev->next=handle->next;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 if(handle->next)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 handle->next->prev=handle->prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 if(handle->name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 free(handle->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 if(handle==head)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345 head=head->prev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 free(handle);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349 long RegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 struct reg_value* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 char* c;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353 TRACE("Querying value %s\n", value);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 if(!regs)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355 init_registry()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
357 c=build_keyname(key, value);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
358 if(c==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360 if((t=find_value_by_name(c))==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362 free(c);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 return 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 free(c);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
366 if(type)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 *type=t->type;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368 if(data)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 memcpy(data, t->value, (t->len<*count)?t->len:*count);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371 TRACE("returning %d bytes: %d\n", t->len, *(int*)data);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373 if(*count<t->len)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 *count=t->len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 return ERROR_MORE_DATA;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380 *count=t->len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 long RegCreateKeyExA(long key, const char* name, long reserved,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 void* classs, long options, long security,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386 void* sec_attr, int* newkey, int* status)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 reg_handle_t* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389 char* fullname;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390 struct reg_value* v;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391 // TRACE("Creating/Opening key %s\n", name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 TRACE("Creating/Opening key %s\n", name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393 if(!regs)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
394 init_registry()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396 fullname=build_keyname(key, name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 if(fullname==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
399 v=find_value_by_name(fullname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400 if(v==0)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 int qw=45708;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 v=insert_reg_value(key, name, DIR, &qw, 4);
128
28091b3caff9 DLL loader updated from avifile-0.60beta4
arpi_esp
parents: 1
diff changeset
404 if (status) *status=REG_CREATED_NEW_KEY;
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 else
1416
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
408 {
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
409 // this is a hack as I don't know how RegEnumValueA works
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
410 if (strstr(fullname, "zlib") || strstr(fullname, "mszh"))
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
411 return 1;
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
412 if (status) *status=REG_OPENED_EXISTING_KEY;
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
413 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415 t=insert_handle(generate_handle(), fullname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
416 *newkey=t->handle;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 free(fullname);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419 }
1416
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
420
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
421 long RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
422 LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count)
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
423 {
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
424 // have no idea how this should work
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
425 //printf("Reg Enum 0x%x %d %p %d data: %p %d %d >%s<\n", hkey, index, value, *val_count, data, *count, reg_size, data);
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
426 {
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
427 reg_handle_t* t = find_handle(hkey);
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
428 if (t)
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
429 {
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
430 struct reg_value* v=find_value_by_name(t->name);
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
431 *count = v->len;
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
432 memcpy(data, v->value, *count);
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
433 *val_count = v->len;
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
434 memcpy(value, v->value, *val_count);
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
435 if (type)
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
436 *type = v->type;
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
437 //printf("Found handle %s\n", v->name);
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
438 return 0;
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
439 }
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
440 }
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
441
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
442 return -1;
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
443 }
8e841fe5668b partial avifile-CVS merge
arpi
parents: 1307
diff changeset
444
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445 long RegSetValueExA(long key, const char* name, long v1, long v2, const void* data, long size)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
446 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447 struct reg_value* t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
448 char* c;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449 TRACE("Request to set value %s\n", name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450 if(!regs)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451 init_registry()
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452 ;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 c=build_keyname(key, name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
454 if(c==NULL)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456 insert_reg_value(key, name, v2, data, size);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
457 free(c);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
458 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459 }