acea97fb1d560c6f220c102ce5438c2921d3f0b2
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.
19 /* $Id: mkhive.c,v 1.5 2004/11/15 19:20:23 gdalsnes Exp $
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS hive maker
22 * FILE: tools/mkhive/mkhive.c
24 * PROGRAMMER: Eric Kohl
40 #define DIR_SEPARATOR_CHAR '/'
41 #define DIR_SEPARATOR_STRING "/"
43 #define DIR_SEPARATOR_CHAR '\\'
44 #define DIR_SEPARATOR_STRING "\\"
50 printf ("Usage: mkhive <srcdir> <dstdir> <addinf>\n\n");
51 printf (" srcdir - inf files are read from this directory\n");
52 printf (" dstdir - binary hive files are created in this directory\n");
53 printf (" addinf - additional inf files with full path\n");
56 void convert_path(char *dst
, char *src
)
85 int main (int argc
, char *argv
[])
87 char FileName
[PATH_MAX
];
90 printf ("Binary hive maker\n");
98 RegInitializeRegistry ();
100 convert_path (FileName
, argv
[1]);
101 strcat (FileName
, DIR_SEPARATOR_STRING
);
102 strcat (FileName
, "hivesys.inf");
103 ImportRegistryFile (FileName
, "AddReg", FALSE
);
105 convert_path (FileName
, argv
[1]);
106 strcat (FileName
, DIR_SEPARATOR_STRING
);
107 strcat (FileName
, "hivecls.inf");
108 ImportRegistryFile (FileName
, "AddReg", FALSE
);
110 convert_path (FileName
, argv
[1]);
111 strcat (FileName
, DIR_SEPARATOR_STRING
);
112 strcat (FileName
, "hivesft.inf");
113 ImportRegistryFile (FileName
, "AddReg", FALSE
);
115 convert_path (FileName
, argv
[1]);
116 strcat (FileName
, DIR_SEPARATOR_STRING
);
117 strcat (FileName
, "hivedef.inf");
118 ImportRegistryFile (FileName
, "AddReg", FALSE
);
120 for (Param
= 3; Param
< argc
; Param
++)
122 convert_path (FileName
, argv
[Param
]);
123 ImportRegistryFile (FileName
, "AddReg", FALSE
);
126 convert_path (FileName
, argv
[2]);
127 strcat (FileName
, DIR_SEPARATOR_STRING
);
128 strcat (FileName
, "system");
129 if (!ExportBinaryHive (FileName
, "\\Registry\\Machine\\SYSTEM"))
134 convert_path (FileName
, argv
[2]);
135 strcat (FileName
, DIR_SEPARATOR_STRING
);
136 strcat (FileName
, "software");
137 if (!ExportBinaryHive (FileName
, "\\Registry\\Machine\\SOFTWARE"))
142 convert_path (FileName
, argv
[2]);
143 strcat (FileName
, DIR_SEPARATOR_STRING
);
144 strcat (FileName
, "sam");
145 if (!ExportBinaryHive (FileName
, "\\Registry\\Machine\\SAM"))
150 convert_path (FileName
, argv
[2]);
151 strcat (FileName
, DIR_SEPARATOR_STRING
);
152 strcat (FileName
, "security");
153 if (!ExportBinaryHive (FileName
, "\\Registry\\Machine\\SECURITY"))
158 convert_path (FileName
, argv
[2]);
159 strcat (FileName
, DIR_SEPARATOR_STRING
);
160 strcat (FileName
, "default");
161 if (!ExportBinaryHive (FileName
, "\\Registry\\User\\.DEFAULT"))
166 // RegShutdownRegistry ();