[ros-diffs] [fireball] 29985: - Fix my mistakes when changing type of the Name field. LiveCD / make install_registry now works again. - Convert one more sizeof to FIELD_OFFSET (though sizeof() was operating properly in this particular case). See issue #2780 for more details.

fireball at svn.reactos.org fireball at svn.reactos.org
Tue Oct 30 21:24:27 CET 2007


Author: fireball
Date: Tue Oct 30 23:24:27 2007
New Revision: 29985

URL: http://svn.reactos.org/svn/reactos?rev=29985&view=rev
Log:
- Fix my mistakes when changing type of the Name field. LiveCD / make install_registry now works again.
- Convert one more sizeof to FIELD_OFFSET (though sizeof() was operating properly in this particular case).
See issue #2780 for more details.

Modified:
    trunk/reactos/tools/mkhive/cmi.c

Modified: trunk/reactos/tools/mkhive/cmi.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/cmi.c?rev=29985&r1=29984&r2=29985&view=diff
==============================================================================
--- trunk/reactos/tools/mkhive/cmi.c (original)
+++ trunk/reactos/tools/mkhive/cmi.c Tue Oct 30 23:24:27 2007
@@ -278,7 +278,7 @@
 	Status = STATUS_SUCCESS;
 
 	Storage = (CreateOptions & REG_OPTION_VOLATILE) ? Volatile : Stable;
-	NewBlockSize = sizeof(CM_KEY_NODE) + NameLength;
+	NewBlockSize = FIELD_OFFSET(CM_KEY_NODE, Name) + NameLength;
 	NKBOffset = HvAllocateCell(&RegistryHive->Hive, NewBlockSize, Storage, HCELL_NIL);
 	if (NKBOffset == HCELL_NIL)
 	{
@@ -450,7 +450,7 @@
 
 		for (i = 0; i < KeyCell->NameLength; i++)
 		{
-			if (((PCHAR)KeyName->Buffer)[i] != (WCHAR)KeyCell->Name[i])
+			if (KeyName->Buffer[i] != ((PCHAR)KeyCell->Name)[i])
 				return FALSE;
 		}
 	}
@@ -488,8 +488,8 @@
 		/* FIXME: use _strnicmp */
 		for (i = 0; i < KeyCell->NameLength; i++)
 		{
-			if (RtlUpcaseUnicodeChar(((PCHAR)KeyName->Buffer)[i]) !=
-				RtlUpcaseUnicodeChar((WCHAR)KeyCell->Name[i]))
+			if (RtlUpcaseUnicodeChar(KeyName->Buffer[i]) !=
+				RtlUpcaseUnicodeChar(((PCHAR)KeyCell->Name)[i]))
 			return FALSE;
 		}
 	}




More information about the Ros-diffs mailing list