3 * Copyright (C) 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS hive maker
22 * FILE: tools/mkhive/mkhive.c
24 * PROGRAMMER: Eric Kohl
39 #define DIR_SEPARATOR_CHAR '/'
40 #define DIR_SEPARATOR_STRING "/"
42 #define DIR_SEPARATOR_CHAR '\\'
43 #define DIR_SEPARATOR_STRING "\\"
49 printf ("Usage: mkhive <srcdir> <dstdir>\n\n");
50 printf (" srcdir - inf files are read from this directory\n");
51 printf (" dstdir - binary hive files are created in this directory\n");
54 void convert_path(char *dst, char *src)
83 int main (int argc, char *argv[])
85 char FileName[PATH_MAX];
87 printf ("Binary hive maker\n");
95 RegInitializeRegistry ();
97 convert_path (FileName, argv[1]);
98 strcat (FileName, DIR_SEPARATOR_STRING);
99 strcat (FileName, "hivesys.inf");
100 ImportRegistryFile (FileName, "AddReg", FALSE);
102 convert_path (FileName, argv[1]);
103 strcat (FileName, DIR_SEPARATOR_STRING);
104 strcat (FileName, "hivecls.inf");
105 ImportRegistryFile (FileName, "AddReg", FALSE);
107 convert_path (FileName, argv[1]);
108 strcat (FileName, DIR_SEPARATOR_STRING);
109 strcat (FileName, "hivesft.inf");
110 ImportRegistryFile (FileName, "AddReg", FALSE);
112 convert_path (FileName, argv[1]);
113 strcat (FileName, DIR_SEPARATOR_STRING);
114 strcat (FileName, "hivedef.inf");
115 ImportRegistryFile (FileName, "AddReg", FALSE);
117 convert_path (FileName, argv[2]);
118 strcat (FileName, DIR_SEPARATOR_STRING);
119 strcat (FileName, "system");
120 ExportBinaryHive (FileName, "\\Registry\\Machine\\SYSTEM");
122 convert_path (FileName, argv[2]);
123 strcat (FileName, DIR_SEPARATOR_STRING);
124 strcat (FileName, "software");
125 ExportBinaryHive (FileName, "\\Registry\\Machine\\SOFTWARE");
127 convert_path (FileName, argv[2]);
128 strcat (FileName, DIR_SEPARATOR_STRING);
129 strcat (FileName, "sam");
130 ExportBinaryHive (FileName, "\\Registry\\Machine\\SAM");
132 convert_path (FileName, argv[2]);
133 strcat (FileName, DIR_SEPARATOR_STRING);
134 strcat (FileName, "security");
135 ExportBinaryHive (FileName, "\\Registry\\Machine\\SECURITY");
137 convert_path (FileName, argv[2]);
138 strcat (FileName, DIR_SEPARATOR_STRING);
139 strcat (FileName, "default");
140 ExportBinaryHive (FileName, "\\Registry\\User\\.DEFAULT");
142 // RegShutdownRegistry ();