diff --git a/reactos/tools/mkhive/binhive.c b/reactos/tools/mkhive/binhive.c index 8d39e761cef..c927862cdfd 100644 --- a/reactos/tools/mkhive/binhive.c +++ b/reactos/tools/mkhive/binhive.c @@ -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.12 2004/11/15 19:20:23 gdalsnes Exp $ +/* $Id: binhive.c,v 1.13 2004/12/30 16:02:12 royce Exp $ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS hive maker * FILE: tools/mkhive/binhive.c @@ -58,7 +58,15 @@ // BLOCK_OFFSET = offset in file after header block typedef ULONG BLOCK_OFFSET, *PBLOCK_OFFSET; +#ifdef _MSC_VER +typedef unsigned __int64 FILETIME; +#else typedef unsigned long long FILETIME; +#endif + +#ifdef _MSC_VER +#pragma pack ( push, hive_header, 1 ) +#endif//_MSC_VER /* header for registry hive file : */ typedef struct _HIVE_HEADER @@ -105,7 +113,7 @@ typedef struct _HIVE_HEADER /* Checksum of first 0x200 bytes */ ULONG Checksum; -} __attribute__((packed)) HIVE_HEADER, *PHIVE_HEADER; +} GCC_PACKED HIVE_HEADER, *PHIVE_HEADER; typedef struct _HBIN { @@ -126,13 +134,13 @@ typedef struct _HBIN /* ? */ ULONG Unused2; -} __attribute__((packed)) HBIN, *PHBIN; +} GCC_PACKED HBIN, *PHBIN; typedef struct _CELL_HEADER { /* <0 if used, >0 if free */ LONG CellSize; -} __attribute__((packed)) CELL_HEADER, *PCELL_HEADER; +} GCC_PACKED CELL_HEADER, *PCELL_HEADER; typedef struct _KEY_CELL { @@ -189,7 +197,7 @@ typedef struct _KEY_CELL /* Name of key (not zero terminated) */ UCHAR Name[0]; -} __attribute__((packed)) KEY_CELL, *PKEY_CELL; +} GCC_PACKED KEY_CELL, *PKEY_CELL; /* KEY_CELL.Type constants */ #define REG_LINK_KEY_CELL_TYPE 0x10 @@ -203,7 +211,7 @@ typedef struct _HASH_RECORD { BLOCK_OFFSET KeyOffset; ULONG HashValue; -} __attribute__((packed)) HASH_RECORD, *PHASH_RECORD; +} GCC_PACKED HASH_RECORD, *PHASH_RECORD; typedef struct _HASH_TABLE_CELL { @@ -211,13 +219,13 @@ typedef struct _HASH_TABLE_CELL USHORT Id; USHORT HashTableSize; HASH_RECORD Table[0]; -} __attribute__((packed)) HASH_TABLE_CELL, *PHASH_TABLE_CELL; +} GCC_PACKED HASH_TABLE_CELL, *PHASH_TABLE_CELL; typedef struct _VALUE_LIST_CELL { LONG CellSize; BLOCK_OFFSET ValueOffset[0]; -} __attribute__((packed)) VALUE_LIST_CELL, *PVALUE_LIST_CELL; +} GCC_PACKED VALUE_LIST_CELL, *PVALUE_LIST_CELL; typedef struct _VALUE_CELL { @@ -230,7 +238,7 @@ typedef struct _VALUE_CELL USHORT Flags; USHORT Unused1; UCHAR Name[0]; /* warning : not zero terminated */ -} __attribute__((packed)) VALUE_CELL, *PVALUE_CELL; +} GCC_PACKED VALUE_CELL, *PVALUE_CELL; /* VALUE_CELL.Flags constants */ #define REG_VALUE_NAME_PACKED 0x0001 @@ -243,7 +251,11 @@ typedef struct _DATA_CELL { LONG CellSize; UCHAR Data[0]; -} __attribute__((packed)) DATA_CELL, *PDATA_CELL; +} GCC_PACKED DATA_CELL, *PDATA_CELL; + +#ifdef _MSC_VER +#pragma pack ( pop, hive_header ) +#endif//_MSC_VER typedef struct _REGISTRY_HIVE { @@ -279,7 +291,7 @@ CmiCreateDefaultHiveHeader (PHIVE_HEADER Header) Header->BlockId = REG_HIVE_ID; Header->UpdateCounter1 = 0; Header->UpdateCounter2 = 0; - Header->DateModified = 0ULL; + Header->DateModified = 0; Header->Unused3 = 1; Header->Unused4 = 3; Header->Unused5 = 0; @@ -298,7 +310,7 @@ CmiCreateDefaultBinCell(PHBIN BinCell) assert (BinCell); memset (BinCell, 0, REG_BLOCK_SIZE); BinCell->HeaderId = REG_BIN_ID; - BinCell->DateModified = 0ULL; + BinCell->DateModified = 0; BinCell->BinSize = REG_BLOCK_SIZE; } @@ -307,7 +319,7 @@ static VOID CmiCreateDefaultRootKeyCell(PKEY_CELL RootKeyCell, PCHAR KeyName) { PCHAR BaseKeyName; - ULONG NameSize; + USHORT NameSize; ULONG CellSize; assert (RootKeyCell); @@ -317,10 +329,10 @@ CmiCreateDefaultRootKeyCell(PKEY_CELL RootKeyCell, PCHAR KeyName) CellSize = ROUND_UP(sizeof(KEY_CELL) + NameSize - 1, 16); memset (RootKeyCell, 0, CellSize); - RootKeyCell->CellSize = -CellSize; + RootKeyCell->CellSize = (ULONG)-(LONG)CellSize; RootKeyCell->Id = REG_KEY_CELL_ID; RootKeyCell->Type = REG_ROOT_KEY_CELL_TYPE; - RootKeyCell->LastWriteTime = 0ULL; + RootKeyCell->LastWriteTime = 0; RootKeyCell->ParentKeyOffset = 0; RootKeyCell->NumberOfSubKeys = 0; RootKeyCell->HashTableOffset = -1; @@ -725,7 +737,7 @@ CmiAddBin(PREGISTRY_HIVE RegistryHive, RegistryHive->FileSize += BinSize; tmpBin->BinSize = BinSize; tmpBin->Unused1 = 0; - tmpBin->DateModified = 0ULL; + tmpBin->DateModified = 0; tmpBin->Unused2 = 0; /* Increase size of list of blocks */ @@ -840,7 +852,7 @@ CmiAllocateCell (PREGISTRY_HIVE RegistryHive, static BOOL CmiAllocateHashTableCell (PREGISTRY_HIVE Hive, PBLOCK_OFFSET HBOffset, - ULONG SubKeyCount) + USHORT SubKeyCount) { PHASH_TABLE_CELL HashCell; ULONG NewHashSize; @@ -941,7 +953,7 @@ CmiAllocateValueCell(PREGISTRY_HIVE Hive, PCHAR ValueName) { PVALUE_CELL NewValueCell; - ULONG NameSize; + USHORT NameSize; BOOL Status; NameSize = (ValueName == NULL) ? 0 : strlen (ValueName); @@ -1123,7 +1135,7 @@ CmiExportSubKey (PREGISTRY_HIVE Hive, BLOCK_OFFSET NKBOffset; PKEY_CELL NewKeyCell; ULONG KeyCellSize; - ULONG SubKeyCount; + USHORT SubKeyCount; ULONG ValueCount; PLIST_ENTRY Entry; HKEY SubKey; @@ -1146,7 +1158,7 @@ CmiExportSubKey (PREGISTRY_HIVE Hive, /* Initialize key cell */ NewKeyCell->Id = REG_KEY_CELL_ID; NewKeyCell->Type = REG_KEY_CELL_TYPE; - NewKeyCell->LastWriteTime = 0ULL; + NewKeyCell->LastWriteTime = 0; NewKeyCell->ParentKeyOffset = ParentKeyOffset; NewKeyCell->NumberOfSubKeys = 0; NewKeyCell->HashTableOffset = -1; @@ -1249,7 +1261,7 @@ CmiExportHive (PREGISTRY_HIVE Hive, { PKEY_CELL KeyCell; HKEY Key; - ULONG SubKeyCount; + USHORT SubKeyCount; ULONG ValueCount; PLIST_ENTRY Entry; HKEY SubKey; diff --git a/reactos/tools/mkhive/infcache.c b/reactos/tools/mkhive/infcache.c index 0273610094c..e3263cc3cb9 100644 --- a/reactos/tools/mkhive/infcache.c +++ b/reactos/tools/mkhive/infcache.c @@ -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.8 2003/11/14 17:13:36 weiden Exp $ +/* $Id: infcache.c,v 1.9 2004/12/30 16:02:12 royce Exp $ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS hive maker * FILE: tools/mkhive/infcache.c @@ -57,7 +57,7 @@ typedef struct _INFCACHELINE struct _INFCACHELINE *Next; struct _INFCACHELINE *Prev; - LONG FieldCount; + ULONG FieldCount; PCHAR Key; @@ -437,7 +437,7 @@ inline static int is_eol( struct parser *parser, const CHAR *ptr ) /* push data from current token start up to pos into the current token */ static int push_token( struct parser *parser, const CHAR *pos ) { - int len = pos - parser->start; + ULONG len = pos - parser->start; const CHAR *src = parser->start; CHAR *dst = parser->token + parser->token_len; diff --git a/reactos/tools/mkhive/mkhive.c b/reactos/tools/mkhive/mkhive.c index acea97fb1d5..ddcae65e1ce 100644 --- a/reactos/tools/mkhive/mkhive.c +++ b/reactos/tools/mkhive/mkhive.c @@ -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: mkhive.c,v 1.5 2004/11/15 19:20:23 gdalsnes Exp $ +/* $Id: mkhive.c,v 1.6 2004/12/30 16:02:12 royce Exp $ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS hive maker * FILE: tools/mkhive/mkhive.c @@ -33,6 +33,11 @@ #include "reginf.h" #include "binhive.h" +#ifdef _MSC_VER +#include +#define PATH_MAX _MAX_PATH +#endif//_MSC_VER + #ifndef WIN32 #ifndef PATH_MAX #define PATH_MAX 260 diff --git a/reactos/tools/mkhive/mkhive.h b/reactos/tools/mkhive/mkhive.h index 38468f20f45..29391de3a3a 100644 --- a/reactos/tools/mkhive/mkhive.h +++ b/reactos/tools/mkhive/mkhive.h @@ -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: mkhive.h,v 1.2 2003/04/16 15:06:33 ekohl Exp $ +/* $Id: mkhive.h,v 1.3 2004/12/30 16:02:12 royce Exp $ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS hive maker * FILE: tools/mkhive/mkhive.h @@ -65,12 +65,38 @@ typedef int BOOL, *PBOOL; /* Debugging macros */ +#ifdef _MSC_VER +#include +#include +static void DPRINT1(const char* fmt, ... ) +{ + va_list args; + va_start ( args, fmt ); + vprintf ( fmt, args ); + va_end ( args ); +} +static void DPRINT ( const char* fmt, ... ) +{ +} +#else #define DPRINT1(args...) do { printf("(%s:%d) ",__FILE__,__LINE__); printf(args); } while(0); +#define DPRINT(args...) +#endif//_MSC_VER #define CHECKPOINT1 do { printf("%s:%d\n",__FILE__,__LINE__); } while(0); -#define DPRINT(args...) #define CHECKPOINT +#ifdef WIN32 +#define strncasecmp strnicmp +#define strcasecmp stricmp +#endif//WIN32 + +#ifdef _MSC_VER +#define GCC_PACKED +#define inline +#else//_MSC_VER +#define GCC_PACKED __attribute__((packed)) +#endif//_MSC_VER #endif /* __MKHIVE_H__ */ diff --git a/reactos/tools/mkhive/reginf.c b/reactos/tools/mkhive/reginf.c index 5d8b0bde98b..37cf98d9df1 100644 --- a/reactos/tools/mkhive/reginf.c +++ b/reactos/tools/mkhive/reginf.c @@ -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: reginf.c,v 1.7 2004/06/04 23:47:04 navaraf Exp $ +/* $Id: reginf.c,v 1.8 2004/12/30 16:02:12 royce Exp $ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS hive maker * FILE: tools/mkhive/reginf.h @@ -298,7 +298,7 @@ do_reg_operation(HKEY KeyHandle, { ULONG dw = Str ? strtoul (Str, NULL, 0) : 0; - DPRINT("setting dword %s to %lx\n", ValueName, dw); + DPRINT1("setting dword %s to %lx\n", ValueName, dw); RegSetValue (KeyHandle, ValueName, @@ -308,7 +308,7 @@ do_reg_operation(HKEY KeyHandle, } else { - DPRINT ("setting value %s to %s\n", ValueName, Str); + DPRINT1 ("setting value %s to %s\n", ValueName, Str); if (Str) { diff --git a/reactos/tools/mkhive/registry.c b/reactos/tools/mkhive/registry.c index 375fd86cffd..1e8601fcd9f 100644 --- a/reactos/tools/mkhive/registry.c +++ b/reactos/tools/mkhive/registry.c @@ -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: registry.c,v 1.10 2004/06/04 23:47:04 navaraf Exp $ +/* $Id: registry.c,v 1.11 2004/12/30 16:02:12 royce Exp $ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS hive maker * FILE: tools/mkhive/registry.c @@ -126,7 +126,7 @@ RegCreateKey(HKEY ParentKey, int subkeyLength; int stringLength; - DPRINT ("KeyName '%s'\n", KeyName); + DPRINT ("RegCreateKey('%s')\n", KeyName); if (*KeyName == '\\') { @@ -687,7 +687,7 @@ RegEnumValue(HKEY Key, } -ULONG +USHORT RegGetSubKeyCount (HKEY Key) { return Key->SubKeyCount; diff --git a/reactos/tools/mkhive/registry.h b/reactos/tools/mkhive/registry.h index 9e267085848..bad9a3688bf 100644 --- a/reactos/tools/mkhive/registry.h +++ b/reactos/tools/mkhive/registry.h @@ -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: registry.h,v 1.2 2003/04/16 15:06:33 ekohl Exp $ +/* $Id: registry.h,v 1.3 2004/12/30 16:02:12 royce Exp $ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS hive maker * FILE: tools/mkhive/registry.h @@ -43,10 +43,10 @@ typedef struct _REG_KEY LIST_ENTRY SubKeyList; LIST_ENTRY ValueList; - ULONG SubKeyCount; + USHORT SubKeyCount; ULONG ValueCount; - ULONG NameSize; + USHORT NameSize; PUCHAR Name; /* default data */ @@ -283,7 +283,7 @@ RegEnumValue(HKEY Key, PUCHAR Data, PULONG DataSize); -ULONG +USHORT RegGetSubKeyCount (HKEY Key); ULONG