Blob Blame History Raw
Index: wine/misc/registry.c
===================================================================
RCS file: /home/wine/wine/misc/registry.c,v
retrieving revision 1.125
diff -u -r1.125 registry.c
--- wine/misc/registry.c	30 Mar 2003 03:05:12 -0000	1.125
+++ wine/misc/registry.c	26 Nov 2002 18:21:01 -0000
@@ -1609,14 +1609,65 @@
 
     strcpy(tmp,confdir);
     strcat(tmp,"/" SAVE_LOCAL_REGBRANCH_USER_DEFAULT);
+    if (access( tmp, R_OK ) && !access( "/etc/wine/" SAVE_LOCAL_REGBRANCH_USER_DEFAULT, R_OK )) {
+	    /* If the registry doesn't exist, copy the global one */
+	    FILE *in, *out;
+	    char buf[1024];
+	    in = fopen( "/etc/wine/" SAVE_LOCAL_REGBRANCH_USER_DEFAULT, "r" );
+	    if(!in)
+		    return;
+	    out = fopen( tmp, "w" );
+	    if(!out) {
+		    fclose(in);
+		    return;
+	    }
+	    while(fgets(buf, 1024, in))
+		    fputs(buf, out);
+	    fclose(in);
+	    fclose(out);
+    }
     load_wine_registry(hkey_users_default,tmp);
 
     strcpy(tmp,confdir);
     strcat(tmp,"/" SAVE_LOCAL_REGBRANCH_CURRENT_USER);
+    if (access( tmp, R_OK ) && !access( "/etc/wine/" SAVE_LOCAL_REGBRANCH_CURRENT_USER, R_OK )) {
+	    /* If the registry doesn't exist, copy the global one */
+	    FILE *in, *out;
+	    char buf[1024];
+	    in = fopen( "/etc/wine/" SAVE_LOCAL_REGBRANCH_CURRENT_USER, "r" );
+	    if(!in)
+		    return;
+	    out = fopen( tmp, "w" );
+	    if(!out) {
+		    fclose(in);
+		    return;
+	    }
+	    while(fgets(buf, 1024, in))
+		    fputs(buf, out);
+	    fclose(in);
+	    fclose(out);
+    }
     load_wine_registry(hkey_current_user,tmp);
 
     strcpy(tmp,confdir);
     strcat(tmp,"/" SAVE_LOCAL_REGBRANCH_LOCAL_MACHINE);
+    if (access( tmp, R_OK ) && !access( "/etc/wine/" SAVE_LOCAL_REGBRANCH_LOCAL_MACHINE, R_OK )) {
+	    /* If the registry doesn't exist, copy the global one */
+	    FILE *in, *out;
+	    char buf[1024];
+	    in = fopen( "/etc/wine/" SAVE_LOCAL_REGBRANCH_LOCAL_MACHINE, "r" );
+	    if(!in)
+		    return;
+	    out = fopen( tmp, "w" );
+	    if(!out) {
+		    fclose(in);
+		    return;
+	    }
+	    while(fgets(buf, 1024, in))
+		    fputs(buf, out);
+	    fclose(in);
+	    fclose(out);
+    }
     load_wine_registry(hkey_local_machine,tmp);
 
     free(tmp);
Index: wine/server/registry.c
===================================================================
RCS file: /home/wine/wine/server/registry.c,v
retrieving revision 1.50
diff -u -r1.50 registry.c
--- wine/server/registry.c	25 Feb 2003 04:04:18 -0000	1.50
+++ wine/server/registry.c	26 Nov 2002 18:21:02 -0000
@@ -1486,6 +1486,23 @@
     if (!(filename = malloc( strlen(config) + 8 ))) fatal_error( "out of memory\n" );
     strcpy( filename, config );
     strcat( filename, "/config" );
+    if (access( filename, R_OK ) && !access( "/etc/wine/wine.conf", R_OK )) {
+	    /* If the registry doesn't exist, copy the global one */
+	    FILE *in, *out;
+	    char buf[1024];
+	    in = fopen( "/etc/wine/wine.conf", "r" );
+	    if(!in)
+		    return;
+	    out = fopen( filename, "w" );
+	    if(!out) {
+		    fclose(in);
+		    return;
+	    }
+	    while(fgets(buf, 1024, in))
+		    fputs(buf, out);
+	    fclose(in);
+	    fclose(out);
+    }
     if ((f = fopen( filename, "r" )))
     {
         struct key *key;