[ros-diffs] [arty] 26531: A perversely delightful hack to make hives of either BE or LE.

arty at svn.reactos.org arty at svn.reactos.org
Fri Apr 27 07:48:13 CEST 2007


Author: arty
Date: Fri Apr 27 09:48:13 2007
New Revision: 26531

URL: http://svn.reactos.org/svn/reactos?rev=26531&view=rev
Log:
A perversely delightful hack to make hives of either BE or LE.

Added:
    branches/powerpc/reactos/tools/mkhive/bytesex.h
Modified:
    branches/powerpc/reactos/tools/mkhive/binhive.c
    branches/powerpc/reactos/tools/mkhive/mkhive.c
    branches/powerpc/reactos/tools/mkhive/mkhive.h
    branches/powerpc/reactos/tools/mkhive/mkhive.mak
    branches/powerpc/reactos/tools/mkhive/reginf.c

Modified: branches/powerpc/reactos/tools/mkhive/binhive.c
URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/mkhive/binhive.c?rev=26531&r1=26530&r2=26531&view=diff
==============================================================================
--- branches/powerpc/reactos/tools/mkhive/binhive.c (original)
+++ branches/powerpc/reactos/tools/mkhive/binhive.c Fri Apr 27 09:48:13 2007
@@ -35,6 +35,7 @@
 #include "binhive.h"
 #include "registry.h"
 
+using namespace ReactosBytesex;
 
 #define  REG_HIVE_ID                   0x66676572
 #define  REG_BIN_ID                    0x6e696268
@@ -56,7 +57,7 @@
 
 
 // BLOCK_OFFSET = offset in file after header block
-typedef ULONG BLOCK_OFFSET, *PBLOCK_OFFSET;
+typedef E_ULONG BLOCK_OFFSET, *PBLOCK_OFFSET;
 
 #ifdef _MSC_VER
 typedef unsigned __int64 FILETIME;
@@ -71,131 +72,131 @@
 /* header for registry hive file : */
 typedef struct _HIVE_HEADER
 {
-  /* Hive identifier "regf" (0x66676572) */
-  ULONG  BlockId;
-
-  /* Update counter */
-  ULONG  UpdateCounter1;
-
-  /* Update counter */
-  ULONG  UpdateCounter2;
-
-  /* When this hive file was last modified */
-  FILETIME  DateModified;
-
-  /* Registry format major version (1) */
-  ULONG  MajorVersion;
-
-  /* Registry format minor version (3)
-     Version 3 added fast indexes, version 5 has large value optimizations */
-  ULONG  MinorVersion;
-
-  /* Registry file type (0 - Primary, 1 - Log) */
-  ULONG  Type;
-
-  /* Registry format (1 is the only defined value so far) */
-  ULONG  Format;
-
-  /* Offset into file from the byte after the end of the base block.
-     If the hive is volatile, this is the actual pointer to the KEY_CELL */
-  BLOCK_OFFSET  RootKeyOffset;
-
-  /* Size of each hive block ? */
-  ULONG  BlockSize;
-
-  /* (1?) */
-  ULONG  Unused7;
-
-  /* Name of hive file */
-  WCHAR  FileName[32];
-
-  ULONG  Reserved[99];
-
-  /* Checksum of first 0x200 bytes */
-  ULONG  Checksum;
+    /* Hive identifier "regf" (0x66676572) */
+    E_ULONG  BlockId;
+    
+    /* Update counter */
+    E_ULONG  UpdateCounter1;
+
+    /* Update counter */
+    E_ULONG  UpdateCounter2;
+
+    /* When this hive file was last modified */
+    E_FILETIME  DateModified;
+
+    /* Registry format major version (1) */
+    E_ULONG  MajorVersion;
+
+    /* Registry format minor version (3)
+       Version 3 added fast indexes, version 5 has large value optimizations */
+    E_ULONG  MinorVersion;
+
+    /* Registry file type (0 - Primary, 1 - Log) */
+    E_ULONG  Type;
+
+    /* Registry format (1 is the only defined value so far) */
+    E_ULONG  Format;
+
+    /* Offset into file from the byte after the end of the base block.
+       If the hive is volatile, this is the actual pointer to the KEY_CELL */
+    BLOCK_OFFSET  RootKeyOffset;
+
+    /* Size of each hive block ? */
+    E_ULONG  BlockSize;
+
+    /* (1?) */
+    E_ULONG  Unused7;
+
+    /* Name of hive file */
+    E_WCHAR  FileName[32];
+    
+    E_ULONG  Reserved[99];
+
+    /* Checksum of first 0x200 bytes */
+    E_ULONG  Checksum;
 } GCC_PACKED HIVE_HEADER, *PHIVE_HEADER;
 
 typedef struct _HBIN
 {
-  /* Bin identifier "hbin" (0x6E696268) */
-  ULONG  HeaderId;
-
-  /* Block offset of this bin */
-  BLOCK_OFFSET  BinOffset;
-
-  /* Size in bytes, multiple of the block size (4KB) */
-  ULONG  BinSize;
-
-  ULONG  Reserved[2];
-
-  /* When this bin was last modified */
-  FILETIME  DateModified;
-
-  /* ? (In-memory only) */
-  ULONG  MemAlloc;
+    /* Bin identifier "hbin" (0x6E696268) */
+    E_ULONG  HeaderId;
+    
+    /* Block offset of this bin */
+    BLOCK_OFFSET  BinOffset;
+    
+    /* Size in bytes, multiple of the block size (4KB) */
+    E_ULONG  BinSize;
+    
+    E_ULONG  Reserved[2];
+    
+    /* When this bin was last modified */
+    E_FILETIME  DateModified;
+    
+    /* ? (In-memory only) */
+    E_ULONG  MemAlloc;
 } GCC_PACKED HBIN, *PHBIN;
 
 typedef struct _CELL_HEADER
 {
-  /* <0 if used, >0 if free */
-  LONG  CellSize;
+    /* <0 if used, >0 if free */
+    E_LONG  CellSize;
 } GCC_PACKED CELL_HEADER, *PCELL_HEADER;
 
 typedef struct _KEY_CELL
 {
-  /* Size of this cell */
-  LONG  CellSize;
-
-  /* Key cell identifier "kn" (0x6b6e) */
-  USHORT  Id;
-
-  /* ? */
-  USHORT  Type;
-
-  /* Time of last flush */
-  FILETIME  LastWriteTime;
-
-  /* ? */
-  ULONG  UnUsed1;
-
-  /* Block offset of parent key cell */
-  BLOCK_OFFSET  ParentKeyOffset;
-
-  /* Count of sub keys for the key in this key cell */
-  ULONG  NumberOfSubKeys;
-
-  /* ? */
-  ULONG  UnUsed2;
-
-  /* Block offset of has table for FIXME: subkeys/values? */
-  BLOCK_OFFSET  HashTableOffset;
-
-  /* ? */
-  ULONG  UnUsed3;
-
-  /* Count of values contained in this key cell */
-  ULONG  NumberOfValues;
-
-  /* Block offset of VALUE_LIST_CELL */
-  BLOCK_OFFSET  ValueListOffset;
-
-  /* Block offset of security cell */
-  BLOCK_OFFSET  SecurityKeyOffset;
-
-  /* Block offset of registry key class */
-  BLOCK_OFFSET  ClassNameOffset;
-
-  /* ? */
-  ULONG  Unused4[5];
-
-  /* Size in bytes of key name */
-  USHORT  NameSize;
-
-  /* Size of class name in bytes */
-  USHORT  ClassSize;
-
-  /* Name of key (not zero terminated) */
-  CHAR  Name[0];
+    /* Size of this cell */
+    E_LONG  CellSize;
+    
+    /* Key cell identifier "kn" (0x6b6e) */
+    E_USHORT  Id;
+    
+    /* ? */
+    E_USHORT  Type;
+    
+    /* Time of last flush */
+    E_FILETIME  LastWriteTime;
+    
+    /* ? */
+    E_ULONG  UnUsed1;
+    
+    /* Block offset of parent key cell */
+    BLOCK_OFFSET  ParentKeyOffset;
+    
+    /* Count of sub keys for the key in this key cell */
+    E_ULONG  NumberOfSubKeys;
+    
+    /* ? */
+    E_ULONG  UnUsed2;
+    
+    /* Block offset of has table for FIXME: subkeys/values? */
+    BLOCK_OFFSET  HashTableOffset;
+    
+    /* ? */
+    E_ULONG  UnUsed3;
+    
+    /* Count of values contained in this key cell */
+    E_ULONG  NumberOfValues;
+    
+    /* Block offset of VALUE_LIST_CELL */
+    BLOCK_OFFSET  ValueListOffset;
+    
+    /* Block offset of security cell */
+    BLOCK_OFFSET  SecurityKeyOffset;
+    
+    /* Block offset of registry key class */
+    BLOCK_OFFSET  ClassNameOffset;
+    
+    /* ? */
+    E_ULONG  Unused4[5];
+    
+    /* Size in bytes of key name */
+    E_USHORT  NameSize;
+    
+    /* Size of class name in bytes */
+    E_USHORT  ClassSize;
+    
+    /* Name of key (not zero terminated) */
+    CHAR  Name[0];
 } GCC_PACKED KEY_CELL, *PKEY_CELL;
 
 /* KEY_CELL.Type constants */
@@ -208,35 +209,35 @@
 // HashValue=four letters of value's name
 typedef struct _HASH_RECORD
 {
-  BLOCK_OFFSET  KeyOffset;
-  ULONG  HashValue;
+    BLOCK_OFFSET  KeyOffset;
+    E_ULONG  HashValue;
 } GCC_PACKED HASH_RECORD, *PHASH_RECORD;
 
 typedef struct _HASH_TABLE_CELL
 {
-  LONG  CellSize;
-  USHORT  Id;
-  USHORT  HashTableSize;
-  HASH_RECORD  Table[0];
+    E_LONG  CellSize;
+    E_USHORT  Id;
+    E_USHORT  HashTableSize;
+    HASH_RECORD  Table[0];
 } GCC_PACKED HASH_TABLE_CELL, *PHASH_TABLE_CELL;
 
 typedef struct _VALUE_LIST_CELL
 {
-  LONG  CellSize;
-  BLOCK_OFFSET  ValueOffset[0];
+    E_LONG  CellSize;
+    BLOCK_OFFSET  ValueOffset[0];
 } GCC_PACKED VALUE_LIST_CELL, *PVALUE_LIST_CELL;
 
 typedef struct _VALUE_CELL
 {
-  LONG  CellSize;
-  USHORT  Id;	// "kv"
-  USHORT  NameSize;	// length of Name
-  ULONG  DataSize;	// length of datas in the cell pointed by DataOffset
-  BLOCK_OFFSET  DataOffset;// datas are here if high bit of DataSize is set
-  ULONG  DataType;
-  USHORT  Flags;
-  USHORT  Unused1;
-  CHAR  Name[0]; /* warning : not zero terminated */
+    E_LONG  CellSize;
+    E_USHORT  Id;	// "kv"
+    E_USHORT  NameSize;	// length of Name
+    E_ULONG  DataSize;	// length of datas in the cell pointed by DataOffset
+    BLOCK_OFFSET  DataOffset;// datas are here if high bit of DataSize is set
+    E_ULONG  DataType;
+    E_USHORT  Flags;
+    E_USHORT  Unused1;
+    CHAR  Name[0]; /* warning : not zero terminated */
 } GCC_PACKED VALUE_CELL, *PVALUE_CELL;
 
 /* VALUE_CELL.Flags constants */
@@ -248,8 +249,8 @@
 
 typedef struct _DATA_CELL
 {
-  LONG  CellSize;
-  CHAR  Data[0];
+    E_LONG  CellSize;
+    CHAR  Data[0];
 } GCC_PACKED DATA_CELL, *PDATA_CELL;
 
 #ifdef _MSC_VER
@@ -276,9 +277,10 @@
 	   ULONG Length)
 {
   ULONG i;
+  E_WCHAR *DstE = (E_WCHAR*)Dst;
 
   for (i = 0; i < Length; i++)
-    Dst[i] = (WCHAR)Src[i];
+      DstE[i] = (WCHAR)Src[i];
 }
 
 
@@ -375,7 +377,7 @@
 
   /* Allocate block list */
   Hive->BlockListSize = 1;
-  Hive->BlockList = malloc (sizeof(PHBIN) * Hive->BlockListSize);
+  Hive->BlockList = (PHBIN*)malloc (sizeof(PHBIN) * Hive->BlockListSize);
   if (Hive->BlockList == NULL)
     {
       free (Hive->HiveHeader);
@@ -385,7 +387,7 @@
 
   /* Allocate free cell list */
   Hive->FreeListMax = 32;
-  Hive->FreeList = malloc(sizeof(PCELL_HEADER) * Hive->FreeListMax);
+  Hive->FreeList = (PCELL_HEADER*)malloc(sizeof(PCELL_HEADER) * Hive->FreeListMax);
   if (Hive->FreeList == NULL)
     {
       free (Hive->BlockList);
@@ -393,7 +395,7 @@
       free (Hive);
       return NULL;
     }
-  Hive->FreeListOffset = malloc(sizeof(BLOCK_OFFSET) * Hive->FreeListMax);
+  Hive->FreeListOffset = (PBLOCK_OFFSET)malloc(sizeof(BLOCK_OFFSET) * Hive->FreeListMax);
   if (Hive->FreeListOffset == NULL)
     {
       free (Hive->FreeList);
@@ -630,13 +632,13 @@
 
   if ((RegistryHive->FreeListSize + 1) > RegistryHive->FreeListMax)
     {
-      tmpList = malloc (sizeof(PCELL_HEADER) * (RegistryHive->FreeListMax + 32));
+	tmpList = (PCELL_HEADER*)malloc (sizeof(PCELL_HEADER) * (RegistryHive->FreeListMax + 32));
       if (tmpList == NULL)
 	{
 	  return FALSE;
 	}
 
-      tmpListOffset = malloc (sizeof(BLOCK_OFFSET) * (RegistryHive->FreeListMax + 32));
+      tmpListOffset = (PBLOCK_OFFSET)malloc (sizeof(BLOCK_OFFSET) * (RegistryHive->FreeListMax + 32));
       if (tmpListOffset == NULL)
 	{
 	  free (tmpList);
@@ -723,7 +725,7 @@
   ULONG i;
 
   BinSize = BlockCount *REG_BLOCK_SIZE;
-  tmpBin = malloc (BinSize);
+  tmpBin = (PHBIN)malloc (BinSize);
   if (tmpBin == NULL)
     {
       return FALSE;
@@ -738,7 +740,7 @@
   tmpBin->MemAlloc = 0;
 
   /* Increase size of list of blocks */
-  tmpBlockList = malloc (sizeof(PHBIN) * (RegistryHive->BlockListSize + BlockCount));
+  tmpBlockList = (PHBIN *)malloc (sizeof(PHBIN) * (RegistryHive->BlockListSize + BlockCount));
   if (tmpBlockList == NULL)
     {
       free (tmpBin);
@@ -830,9 +832,11 @@
       NewBlock = (PCELL_HEADER) ((ULONG_PTR) NewBlock + CellSize);
       NewBlock->CellSize = ((PCELL_HEADER) (*Block))->CellSize - CellSize;
       ((PCELL_HEADER) (*Block))->CellSize = CellSize;
+      BLOCK_OFFSET NewFree;
+      NewFree = *pBlockOffset + CellSize;
       CmiAddFree (RegistryHive,
 		  NewBlock,
-		  *pBlockOffset + CellSize,
+		  NewFree,
 		  TRUE);
     }
   else if (NewBlock->CellSize < CellSize)
@@ -885,16 +889,16 @@
   PKEY_CELL ParentKeyCell;
   ULONG i;
 
-  ParentKeyCell = CmiGetCell (Hive,
-			      ParentKeyOffset,
-			      NULL);
+  ParentKeyCell = (PKEY_CELL)CmiGetCell (Hive,
+					 ParentKeyOffset,
+					 NULL);
   if (ParentKeyCell == NULL)
     {
       DPRINT1 ("CmiGetBlock() failed\n");
       return FALSE;
     }
 
-  HashBlock =CmiGetCell (Hive,
+  HashBlock = (PHASH_TABLE_CELL)CmiGetCell (Hive,
 			 ParentKeyCell->HashTableOffset,
 			 NULL);
   if (HashBlock == NULL)
@@ -933,7 +937,7 @@
 		  (ValueCount * sizeof(BLOCK_OFFSET));
   Status = CmiAllocateCell (Hive,
 			    ValueListSize,
-			    (PVOID)&ValueListCell,
+			    (PVOID*)&ValueListCell,
 			    ValueListOffset);
   if ((ValueListCell == NULL) || (Status == FALSE))
     {
@@ -993,14 +997,14 @@
   PVALUE_LIST_CELL ValueListCell;
   PKEY_CELL KeyCell;
 
-  KeyCell = CmiGetCell (Hive, KeyCellOffset, NULL);
+  KeyCell = (PKEY_CELL)CmiGetCell (Hive, KeyCellOffset, NULL);
   if (KeyCell == NULL)
     {
       DPRINT1 ("CmiGetBlock() failed\n");
       return FALSE;
     }
 
-  ValueListCell = CmiGetCell (Hive, KeyCell->ValueListOffset, NULL);
+  ValueListCell = (PVALUE_LIST_CELL)CmiGetCell (Hive, KeyCell->ValueListOffset, NULL);
   if (ValueListCell == NULL)
     {
       DPRINT1 ("CmiGetBlock() failed\n");
@@ -1148,7 +1152,7 @@
 
   /* Allocate key cell */
   KeyCellSize = sizeof(KEY_CELL) + Key->NameSize - 1;
-  if (!CmiAllocateCell (Hive, KeyCellSize, (PVOID)&NewKeyCell, &NKBOffset))
+  if (!CmiAllocateCell (Hive, KeyCellSize, (PVOID*)&NewKeyCell, &NKBOffset))
     {
       DPRINT1 ("CmiAllocateBlock() failed\n");
       return FALSE;
@@ -1280,7 +1284,7 @@
 
   DPRINT ("Name: %s\n", KeyName);
 
-  KeyCell = CmiGetCell (Hive,
+  KeyCell = (PKEY_CELL)CmiGetCell (Hive,
 			Hive->HiveHeader->RootKeyOffset,
 			NULL);
   if (KeyCell == NULL)

Added: branches/powerpc/reactos/tools/mkhive/bytesex.h
URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/mkhive/bytesex.h?rev=26531&view=auto
==============================================================================
--- branches/powerpc/reactos/tools/mkhive/bytesex.h (added)
+++ branches/powerpc/reactos/tools/mkhive/bytesex.h Fri Apr 27 09:48:13 2007
@@ -1,0 +1,124 @@
+#ifndef BYTESEX_H
+#define BYTESEX_H
+
+enum EndianOrder { BE = -1, LE = 0 };
+enum WordSizeMask { W = 1, D = 3, Q = 7 };
+extern enum EndianOrder order;
+
+#ifdef __GNUC__
+typedef long long LL_T;
+typedef unsigned long long ULL_T;
+#else
+typedef __int64 LL_T;
+typedef unsigned __int64 ULL_T;
+#endif
+
+namespace ReactosBytesex {
+#define C(x,e,m) (x ^ (e & m))
+
+static inline USHORT dtohs(USHORT in)
+{
+    PUCHAR in_ptr = (PUCHAR)&in;
+    return in_ptr[C(0,order,W)] | (in_ptr[C(1,order,W)] << 8);
+}
+
+static inline USHORT htods(USHORT in)
+{
+    USHORT out;
+    PUCHAR out_ptr = (PUCHAR)&out;
+    out_ptr[C(0,order,W)] = in; out_ptr[C(1,order,W)] = in >> 8;
+    return out;
+}
+
+static inline ULONG dtohl(ULONG in)
+{
+    PUCHAR in_ptr = (PUCHAR)&in;
+    return 
+	in_ptr[C(0,order,D)] | 
+	(in_ptr[C(1,order,D)] << 8) | 
+	(in_ptr[C(2,order,D)] << 16) | 
+	(in_ptr[C(3,order,D)] << 24);
+}
+
+static inline ULONG htodl(ULONG in)
+{
+    ULONG out;
+    PUCHAR out_ptr = (PUCHAR)&out;
+    out_ptr[C(0,order,D)] = in      ; out_ptr[C(1,order,D)] = in >> 8;
+    out_ptr[C(2,order,D)] = in >> 16; out_ptr[C(3,order,D)] = in >> 24;
+    return out;
+}
+
+static inline LL_T dtohq(LL_T in)
+{
+    int i;
+    LL_T out = 0;
+    for( i = 0; i < 8; i++ )
+    {
+	out |= (in & 0xff) << ((C(i,order,Q)) * 8);
+	in >>= 8;
+    }
+    return out;
+}
+
+static inline LL_T htodq(LL_T in)
+{
+    int i;
+    LL_T out;
+    PUCHAR out_ptr = (PUCHAR)&out;
+    for( i = 0; i < 8; i++ )
+	out_ptr[C(i,order,Q)] = in >> (i * 8);
+}
+
+namespace {
+template <class T> T toHost( T value );
+template <class T> T toDest( T value );
+template <> SHORT toHost<SHORT>( SHORT value ) { return dtohs(value); }
+template <> USHORT toHost<USHORT>( USHORT value ) { return dtohs(value); }
+template <> LONG toHost<LONG>( LONG value ) { return dtohl(value); }
+template <> ULONG toHost<ULONG>( ULONG value ) { return dtohl(value); }
+template <> LL_T toHost<LL_T>( LL_T value ) { return dtohq(value); }
+template <> ULL_T toHost<ULL_T>( ULL_T value ) { return dtohq(value); }
+template <> SHORT toDest<SHORT>( SHORT value ) { return htods(value); }
+template <> USHORT toDest<USHORT>( USHORT value ) { return htods(value); }
+template <> LONG toDest<LONG>( LONG value ) { return htodl(value); }
+template <> ULONG toDest<ULONG>( ULONG value ) { return htodl(value); }
+template <> LL_T toDest<LL_T>( LL_T value ) { return htodq(value); }
+template <> ULL_T toDest<ULL_T>( ULL_T value ) { return htodq(value); }
+}
+
+#ifdef _MSC_VER
+#pragma pack ( push, hive_header, 1 )
+#endif
+
+template <class T>
+struct LENumber {
+public:
+    operator T () const { return toHost<T>(value); }
+    LENumber &operator = (T other) { value = toDest<T>(other); return *this; }
+    T operator ++ () { (*this) += 1; return *this; }
+    LENumber &operator ++ (int) { (*this) += 1; return *this; }
+    T operator -- () { (*this) -= 1; return *this; }
+    LENumber &operator -- (int) { (*this) -= 1; return *this; }
+    LENumber &operator += (T other) { value = toDest<T>(toHost<T>(value) + other); return *this; }
+    LENumber &operator -= (T other) { return (*this) += -other; }
+    LENumber &operator *= (T other) { int x = (*this); x *= other; (*this) = x; }
+    LENumber &operator &= (T other) { value = toDest<T>(toHost<T>(value) & other); return *this; }
+    LENumber &operator |= (T other) { value = toDest<T>(toHost<T>(value) | other); return *this; }
+private:
+    T value;
+} __attribute__((packed));
+
+#ifdef _MSC_VER
+#pragma pack (pop, hive_header)
+#endif
+
+typedef LENumber<SHORT> E_WCHAR;
+typedef LENumber<SHORT> E_SHORT;
+typedef LENumber<USHORT> E_USHORT;
+typedef LENumber<LONG> E_LONG;
+typedef LENumber<ULONG> E_ULONG;
+typedef LENumber<ULL_T> E_FILETIME;
+}
+
+#endif/*BYTESEX_H*/

Modified: branches/powerpc/reactos/tools/mkhive/mkhive.c
URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/mkhive/mkhive.c?rev=26531&r1=26530&r2=26531&view=diff
==============================================================================
--- branches/powerpc/reactos/tools/mkhive/mkhive.c (original)
+++ branches/powerpc/reactos/tools/mkhive/mkhive.c Fri Apr 27 09:48:13 2007
@@ -32,6 +32,8 @@
 #include "registry.h"
 #include "reginf.h"
 #include "binhive.h"
+
+EndianOrder order;
 
 #ifdef _MSC_VER
 #include <stdlib.h>
@@ -99,6 +101,20 @@
       usage ();
       return 1;
     }
+
+  order = LE;
+  if (!strcmp(argv[1], "-be"))
+  {
+      order = BE;
+      argc--;
+      argv++;
+  }
+  else if(!strcmp(argv[1], "-le"))
+  {
+      order = LE;
+      argc--;
+      argv++;
+  }
 
   RegInitializeRegistry ();
 

Modified: branches/powerpc/reactos/tools/mkhive/mkhive.h
URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/mkhive/mkhive.h?rev=26531&r1=26530&r2=26531&view=diff
==============================================================================
--- branches/powerpc/reactos/tools/mkhive/mkhive.h (original)
+++ branches/powerpc/reactos/tools/mkhive/mkhive.h Fri Apr 27 09:48:13 2007
@@ -27,7 +27,6 @@
 #ifndef __MKHIVE_H__
 #define __MKHIVE_H__
 
-
 #define VOID void
 typedef void *PVOID;
 typedef char CHAR, *PCHAR;
@@ -41,6 +40,8 @@
 typedef unsigned long ULONG_PTR;
 
 typedef int BOOL, *PBOOL;
+
+#include "bytesex.h"
 
 #ifndef FALSE
 #define FALSE 0

Modified: branches/powerpc/reactos/tools/mkhive/mkhive.mak
URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/mkhive/mkhive.mak?rev=26531&r1=26530&r2=26531&view=diff
==============================================================================
--- branches/powerpc/reactos/tools/mkhive/mkhive.mak (original)
+++ branches/powerpc/reactos/tools/mkhive/mkhive.mak Fri Apr 27 09:48:13 2007
@@ -28,9 +28,9 @@
 MKHIVE_OBJECTS = \
 	$(addprefix $(INTERMEDIATE_), $(MKHIVE_SOURCES:.c=.o))
 
-MKHIVE_HOST_CFLAGS = $(xTOOLS_CFLAGS) -I$(INFLIB_BASE) -g3
+MKHIVE_HOST_CFLAGS = $(xTOOLS_CFLAGS) -I$(INFLIB_BASE) -g3 -xc++
 
-MKHIVE_HOST_LFLAGS = $(xTOOLS_LFLAGS) -g3
+MKHIVE_HOST_LFLAGS = $(xTOOLS_LFLAGS) -g3 -lstdc++
 
 .PHONY: mkhive
 mkhive: $(MKHIVE_TARGET)

Modified: branches/powerpc/reactos/tools/mkhive/reginf.c
URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/mkhive/reginf.c?rev=26531&r1=26530&r2=26531&view=diff
==============================================================================
--- branches/powerpc/reactos/tools/mkhive/reginf.c (original)
+++ branches/powerpc/reactos/tools/mkhive/reginf.c Fri Apr 27 09:48:13 2007
@@ -117,7 +117,7 @@
       (Type != REG_MULTI_SZ))
     return;
 
-  Buffer = malloc (Size + StringSize);
+  Buffer = (char *)malloc (Size + StringSize);
   if (Buffer == NULL)
      return;
 
@@ -257,7 +257,7 @@
 
 	  if (Size)
 	    {
-	      Str = malloc (Size);
+	      Str = (char *)malloc (Size);
 	      if (Str == NULL)
 		return FALSE;
 
@@ -286,7 +286,7 @@
 
 	  if (Size)
 	    {
-	      Str = malloc (Size);
+	      Str = (char *)malloc (Size);
 	      if (Str == NULL)
 		return FALSE;
 
@@ -303,7 +303,7 @@
 	  RegSetValue (KeyHandle,
 		       ValueName,
 		       Type,
-		       (PVOID)&dw,
+		       (char *)&dw,
 		       sizeof(ULONG));
 	}
       else
@@ -315,7 +315,7 @@
 	      RegSetValue (KeyHandle,
 			   ValueName,
 			   Type,
-			   (PVOID)Str,
+			   (char *)Str,
 			   Size);
 	    }
 	  else
@@ -323,7 +323,7 @@
 	      RegSetValue (KeyHandle,
 			   ValueName,
 			   Type,
-			   (PVOID)&EmptyStr,
+			   (char *)&EmptyStr,
 			   sizeof(CHAR));
 	    }
 	}
@@ -338,18 +338,18 @@
 
       if (Size)
 	{
-	  Data = malloc (Size);
+	    Data = (char *)malloc (Size);
 	  if (Data == NULL)
 	    return FALSE;
 
 	  DPRINT("setting binary data %s len %lu\n", ValueName, Size);
-	  InfHostGetBinaryField (Context, 5, Data, Size, NULL);
+	  InfHostGetBinaryField (Context, 5, (unsigned char *)Data, Size, NULL);
 	}
 
       RegSetValue (KeyHandle,
 		   ValueName,
 		   Type,
-		   (PVOID)Data,
+		   (char *)Data,
 		   Size);
 
       free (Data);
@@ -403,7 +403,7 @@
       else
         {
           /* get flags */
-          if (InfHostGetIntField (Context, 4, (PLONG)&Flags) != 0)
+          if (InfHostGetIntField (Context, 4, (PULONG)&Flags) != 0)
             Flags = 0;
         }
 




More information about the Ros-diffs mailing list