Do not overwrite existing hive files.

Add hive header checksum.

svn path=/trunk/; revision=4710
This commit is contained in:
Eric Kohl 2003-05-18 13:50:58 +00:00
parent bcef4d4f0e
commit 2cd0a85f57
2 changed files with 14 additions and 5 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: binhive.c,v 1.3 2003/04/22 21:14:39 ekohl Exp $
/* $Id: binhive.c,v 1.4 2003/05/18 13:50:58 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS hive maker
* FILE: tools/mkhive/binhive.c
@ -1319,17 +1319,27 @@ CmiWriteHive(PREGISTRY_HIVE Hive,
FILE *File;
ULONG i;
/* FIXME: Calculate header checksum */
/* Check for existing hive file */
File = fopen (FileName, "rb");
if (File != NULL)
{
printf (" File already exists\n");
fclose (File);
return TRUE;
}
/* Create new hive file */
File = fopen (FileName, "w+b");
if (File == NULL)
{
return FALSE;
}
fseek (File, 0, SEEK_SET);
/* Calculate header checksum */
CmiCalcHiveChecksum (Hive);
/* Write hive header */
fwrite (Hive->HiveHeader, REG_BLOCK_SIZE, 1, File);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: infcache.c,v 1.4 2003/05/18 12:12:07 ekohl Exp $
/* $Id: infcache.c,v 1.5 2003/05/18 13:50:58 ekohl Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS hive maker
* FILE: tools/mkhive/infcache.c
@ -426,7 +426,6 @@ inline static int is_eof( struct parser *parser, const CHAR *ptr )
/* check if the pointer points to an end of line */
inline static int is_eol( struct parser *parser, const CHAR *ptr )
{
// return (ptr >= parser->end || *ptr == CONTROL_Z || *ptr == '\r' /*'\n'*/);
return (ptr >= parser->end ||
*ptr == CONTROL_Z ||
*ptr == '\n' ||