Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmkhive.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS kernel 00003 * Copyright (C) 2003, 2006 ReactOS Team 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 /* COPYRIGHT: See COPYING in the top level directory 00020 * PROJECT: ReactOS hive maker 00021 * FILE: tools/mkhive/mkhive.c 00022 * PURPOSE: Hive maker 00023 * PROGRAMMER: Eric Kohl 00024 * Hervé Poussineau 00025 */ 00026 00027 #include <limits.h> 00028 #include <string.h> 00029 #include <stdio.h> 00030 00031 #include "mkhive.h" 00032 00033 #ifdef _MSC_VER 00034 #include <stdlib.h> 00035 #define PATH_MAX _MAX_PATH 00036 #endif//_MSC_VER 00037 00038 #ifndef _WIN32 00039 #ifndef PATH_MAX 00040 #define PATH_MAX 260 00041 #endif 00042 #define DIR_SEPARATOR_CHAR '/' 00043 #define DIR_SEPARATOR_STRING "/" 00044 #else 00045 #define DIR_SEPARATOR_CHAR '\\' 00046 #define DIR_SEPARATOR_STRING "\\" 00047 #endif 00048 00049 00050 void usage (void) 00051 { 00052 printf ("Usage: mkhive <dstdir> <inffiles>\n\n"); 00053 printf (" dstdir - binary hive files are created in this directory\n"); 00054 printf (" inffiles - inf files with full path\n"); 00055 } 00056 00057 void convert_path(char *dst, char *src) 00058 { 00059 int i; 00060 00061 i = 0; 00062 while (src[i] != 0) 00063 { 00064 #ifdef _WIN32 00065 if (src[i] == '/') 00066 { 00067 dst[i] = '\\'; 00068 } 00069 #else 00070 if (src[i] == '\\') 00071 { 00072 dst[i] = '/'; 00073 } 00074 #endif 00075 else 00076 { 00077 dst[i] = src[i]; 00078 } 00079 00080 i++; 00081 } 00082 dst[i] = 0; 00083 } 00084 00085 int main (int argc, char *argv[]) 00086 { 00087 char FileName[PATH_MAX]; 00088 int i; 00089 00090 if (argc < 3) 00091 { 00092 usage (); 00093 return 1; 00094 } 00095 00096 printf ("Binary hive maker\n"); 00097 00098 RegInitializeRegistry (); 00099 00100 for (i = 2; i < argc; i++) 00101 { 00102 convert_path (FileName, argv[i]); 00103 ImportRegistryFile (FileName); 00104 } 00105 00106 convert_path (FileName, argv[1]); 00107 strcat (FileName, DIR_SEPARATOR_STRING); 00108 strcat (FileName, "default"); 00109 if (!ExportBinaryHive (FileName, &DefaultHive)) 00110 { 00111 return 1; 00112 } 00113 00114 convert_path (FileName, argv[1]); 00115 strcat (FileName, DIR_SEPARATOR_STRING); 00116 strcat (FileName, "sam"); 00117 if (!ExportBinaryHive (FileName, &SamHive)) 00118 { 00119 return 1; 00120 } 00121 00122 convert_path (FileName, argv[1]); 00123 strcat (FileName, DIR_SEPARATOR_STRING); 00124 strcat (FileName, "security"); 00125 if (!ExportBinaryHive (FileName, &SecurityHive)) 00126 { 00127 return 1; 00128 } 00129 00130 convert_path (FileName, argv[1]); 00131 strcat (FileName, DIR_SEPARATOR_STRING); 00132 strcat (FileName, "software"); 00133 if (!ExportBinaryHive (FileName, &SoftwareHive)) 00134 { 00135 return 1; 00136 } 00137 00138 convert_path (FileName, argv[1]); 00139 strcat (FileName, DIR_SEPARATOR_STRING); 00140 strcat (FileName, "system"); 00141 if (!ExportBinaryHive (FileName, &SystemHive)) 00142 { 00143 return 1; 00144 } 00145 00146 RegShutdownRegistry (); 00147 00148 printf (" Done.\n"); 00149 00150 return 0; 00151 } 00152 00153 /* EOF */ Generated on Sun May 27 2012 04:37:46 for ReactOS by
1.7.6.1
|