[ros-diffs] [cfinck] 28425: - mkhive's "registry.c" used wcsncmp for comparing two strings. But this function seems to work different on different hosts (probably due to different handling of wchar_t's or whatever). To avoid this problem, use memcmp now to compare the strings as it's done two lines later. This fixes the Live-CD on Linux/Unix hosts. (For the first time, Live-CDs created by our 64-Bit Debug Buildslave are usable :-) - Change __volatile to volatile in "winddk.h". This fixes compilation problems under MSVC. - Make the prototype of RtlCompareMemory in "winnt.h" similar to the one in "winddk.h". Fixes a compilation problem in MSVC. - Define the prototype for xwcschr in "mkhive.h". Silences a warning in MSVC. - Add some casts to "reginf.c" to silence some warnings in MSVC. - Add a MSVC 2005 project file for mkhive. mkhive can be compiled under MSVC with this project file, when cmlib and inflib_host are compiled. - Remove the duplicate definition of CMLIB_HOST in "cmlib.mak".

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sun Aug 19 21:37:47 CEST 2007


Author: cfinck
Date: Sun Aug 19 23:37:47 2007
New Revision: 28425

URL: http://svn.reactos.org/svn/reactos?rev=28425&view=rev
Log:
- mkhive's "registry.c" used wcsncmp for comparing two strings. But this function seems to work different on different hosts (probably due to different handling of wchar_t's or whatever).
  To avoid this problem, use memcmp now to compare the strings as it's done two lines later. This fixes the Live-CD on Linux/Unix hosts.
  (For the first time, Live-CDs created by our 64-Bit Debug Buildslave are usable :-)
- Change __volatile to volatile in "winddk.h". This fixes compilation problems under MSVC.
- Make the prototype of RtlCompareMemory in "winnt.h" similar to the one in "winddk.h". Fixes a compilation problem in MSVC.
- Define the prototype for xwcschr in "mkhive.h". Silences a warning in MSVC.
- Add some casts to "reginf.c" to silence some warnings in MSVC.
- Add a MSVC 2005 project file for mkhive. mkhive can be compiled under MSVC with this project file, when cmlib and inflib_host are compiled.
- Remove the duplicate definition of CMLIB_HOST in "cmlib.mak".

Added:
    trunk/reactos/tools/mkhive/mkhive.sln
    trunk/reactos/tools/mkhive/mkhive.vcproj
Modified:
    trunk/reactos/include/ddk/winddk.h
    trunk/reactos/include/psdk/winnt.h
    trunk/reactos/lib/cmlib/cmlib.mak
    trunk/reactos/tools/mkhive/mkhive.h
    trunk/reactos/tools/mkhive/reginf.c
    trunk/reactos/tools/mkhive/registry.c

Modified: trunk/reactos/include/ddk/winddk.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=28425&r1=28424&r2=28425&view=diff
==============================================================================
--- trunk/reactos/include/ddk/winddk.h (original)
+++ trunk/reactos/include/ddk/winddk.h Sun Aug 19 23:37:47 2007
@@ -1266,8 +1266,8 @@
 {
     union
     {
-        __volatile ULONG_PTR Count;
-        __volatile PVOID Ptr;
+        volatile ULONG_PTR Count;
+        volatile PVOID Ptr;
     };
 } EX_RUNDOWN_REF, *PEX_RUNDOWN_REF;
 
@@ -1362,7 +1362,7 @@
   ULONG  Flags;
   union {
     struct _IRP  *MasterIrp;
-    __volatile LONG  IrpCount;
+    volatile LONG  IrpCount;
     PVOID  SystemBuffer;
   } AssociatedIrp;
   LIST_ENTRY  ThreadListEntry;
@@ -1384,7 +1384,7 @@
     } AsynchronousParameters;
     LARGE_INTEGER  AllocationSize;
   } Overlay;
-  __volatile PDRIVER_CANCEL  CancelRoutine;
+  volatile PDRIVER_CANCEL  CancelRoutine;
   PVOID  UserBuffer;
   union {
     struct {
@@ -2187,7 +2187,7 @@
   PIO_TIMER  Timer;
   ULONG  Flags;
   ULONG  Characteristics;
-  __volatile PVPB  Vpb;
+  volatile PVPB  Vpb;
   PVOID  DeviceExtension;
   DEVICE_TYPE  DeviceType;
   CCHAR  StackSize;
@@ -3147,8 +3147,8 @@
   POWNER_ENTRY  OwnerTable;
   SHORT  ActiveCount;
   USHORT  Flag;
-  __volatile PKSEMAPHORE  SharedWaiters;
-  __volatile PKEVENT  ExclusiveWaiters;
+  volatile PKSEMAPHORE  SharedWaiters;
+  volatile PKEVENT  ExclusiveWaiters;
   OWNER_ENTRY  OwnerThreads[2];
   ULONG  ContentionCount;
   USHORT  NumberOfSharedWaiters;
@@ -3479,15 +3479,15 @@
     ULONG Flags;
     UNICODE_STRING FileName;
     LARGE_INTEGER CurrentByteOffset;
-    __volatile ULONG Waiters;
-    __volatile ULONG Busy;
+    volatile ULONG Waiters;
+    volatile ULONG Busy;
     PVOID LastLock;
     KEVENT Lock;
     KEVENT Event;
-    __volatile PIO_COMPLETION_CONTEXT CompletionContext;
+    volatile PIO_COMPLETION_CONTEXT CompletionContext;
     KSPIN_LOCK IrpListLock;
     LIST_ENTRY IrpList;
-    __volatile PVOID FileObjectExtension;
+    volatile PVOID FileObjectExtension;
 } FILE_OBJECT;
 typedef struct _FILE_OBJECT *PFILE_OBJECT;
 
@@ -4467,7 +4467,7 @@
 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK {
   BOOLEAN  Removed;
   BOOLEAN  Reserved[3];
-  __volatile LONG  IoCount;
+  volatile LONG  IoCount;
   KEVENT  RemoveEvent;
 } IO_REMOVE_LOCK_COMMON_BLOCK;
 
@@ -4478,7 +4478,7 @@
   LONG  AllocateTag;
   LIST_ENTRY  LockList;
   KSPIN_LOCK  Spin;
-  __volatile LONG  LowMemoryCount;
+  volatile LONG  LowMemoryCount;
   ULONG  Reserved1[4];
   PVOID  Reserved2;
   PIO_REMOVE_LOCK_TRACKING_BLOCK  Blocks;
@@ -4651,7 +4651,7 @@
 typedef struct _WORK_QUEUE_ITEM {
   LIST_ENTRY  List;
   PWORKER_THREAD_ROUTINE  WorkerRoutine;
-  __volatile PVOID  Parameter;
+  volatile PVOID  Parameter;
 } WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
 
 typedef enum _KBUGCHECK_CALLBACK_REASON {

Modified: trunk/reactos/include/psdk/winnt.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=28425&r1=28424&r2=28425&view=diff
==============================================================================
--- trunk/reactos/include/psdk/winnt.h (original)
+++ trunk/reactos/include/psdk/winnt.h Sun Aug 19 23:37:47 2007
@@ -4017,6 +4017,7 @@
 ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
 #endif
 
+NTSYSAPI
 SIZE_T
 STDCALL
 RtlCompareMemory (

Modified: trunk/reactos/lib/cmlib/cmlib.mak
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cmlib.mak?rev=28425&r1=28424&r2=28425&view=diff
==============================================================================
--- trunk/reactos/lib/cmlib/cmlib.mak (original)
+++ trunk/reactos/lib/cmlib/cmlib.mak Sun Aug 19 23:37:47 2007
@@ -33,7 +33,7 @@
 CMLIB_HOST_CFLAGS = -O3 -Wall -Wwrite-strings -Wpointer-arith \
   -D_X86_ -D__i386__ -D_REACTOS_ -D_NTOSKRNL_ -D_NTSYSTEM_ \
   -DCMLIB_HOST -D_M_IX86 -I$(CMLIB_BASE) -Iinclude/reactos -Iinclude/psdk -Iinclude/ddk -Iinclude/crt \
-  -D__NO_CTYPE_INLINES -DCMLIB_HOST
+  -D__NO_CTYPE_INLINES
 
 $(CMLIB_HOST_TARGET): $(CMLIB_HOST_OBJECTS) | $(CMLIB_OUT)
 	$(ECHO_AR)

Modified: trunk/reactos/tools/mkhive/mkhive.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/mkhive.h?rev=28425&r1=28424&r2=28425&view=diff
==============================================================================
--- trunk/reactos/tools/mkhive/mkhive.h (original)
+++ trunk/reactos/tools/mkhive/mkhive.h Sun Aug 19 23:37:47 2007
@@ -101,6 +101,13 @@
 #define GCC_PACKED __attribute__((packed))
 #endif//_MSC_VER
 
+/* rtl.c */
+PWSTR
+xwcschr(
+   PWSTR String,
+   WCHAR Char
+);
+
 #endif /* __MKHIVE_H__ */
 
 /* EOF */

Added: trunk/reactos/tools/mkhive/mkhive.sln
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/mkhive.sln?rev=28425&view=auto
==============================================================================
--- trunk/reactos/tools/mkhive/mkhive.sln (added)
+++ trunk/reactos/tools/mkhive/mkhive.sln Sun Aug 19 23:37:47 2007
@@ -1,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mkhive", "mkhive.vcproj", "{4D03FFD1-EB34-41A1-908B-F8F7350118A7}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{4D03FFD1-EB34-41A1-908B-F8F7350118A7}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4D03FFD1-EB34-41A1-908B-F8F7350118A7}.Debug|Win32.Build.0 = Debug|Win32
+		{4D03FFD1-EB34-41A1-908B-F8F7350118A7}.Release|Win32.ActiveCfg = Release|Win32
+		{4D03FFD1-EB34-41A1-908B-F8F7350118A7}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Added: trunk/reactos/tools/mkhive/mkhive.vcproj
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/mkhive.vcproj?rev=28425&view=auto
==============================================================================
--- trunk/reactos/tools/mkhive/mkhive.vcproj (added)
+++ trunk/reactos/tools/mkhive/mkhive.vcproj Sun Aug 19 23:37:47 2007
@@ -1,0 +1,234 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8,00"
+	Name="mkhive"
+	ProjectGUID="{4D03FFD1-EB34-41a1-908B-F8F7350118A7}"
+	RootNamespace="mkhive"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UseUnicodeResponseFiles="true"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../include/ddk;../../include/psdk;../../include/reactos;../../lib/cmlib;../../lib/inflib;../../lib/rtl"
+				PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_WARNINGS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="kernel32.lib ../../obj-i386/lib/cmlib/cmlib.a ../../obj-i386/lib/inflib_host/infcore.o ../../obj-i386/lib/inflib_host/infget.o ../../obj-i386/lib/inflib_host/infhostgen.o ../../obj-i386/lib/inflib_host/infhostget.o ../../obj-i386/lib/inflib_host/infhostglue.o ../../obj-i386/lib/inflib_host/infhostput.o ../../obj-i386/lib/inflib_host/infput.o ../../obj-i386/lib/rtl/rtl.a $(NOINHERIT)"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_WARNINGS"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="kernel32.lib $(NOINHERIT)"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			>
+			<File
+				RelativePath=".\binhive.c"
+				>
+			</File>
+			<File
+				RelativePath=".\cmi.c"
+				>
+			</File>
+			<File
+				RelativePath=".\mkhive.c"
+				>
+			</File>
+			<File
+				RelativePath=".\reginf.c"
+				>
+			</File>
+			<File
+				RelativePath=".\registry.c"
+				>
+			</File>
+			<File
+				RelativePath=".\rtl.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			>
+			<File
+				RelativePath=".\binhive.h"
+				>
+			</File>
+			<File
+				RelativePath=".\cmi.h"
+				>
+			</File>
+			<File
+				RelativePath=".\mkhive.h"
+				>
+			</File>
+			<File
+				RelativePath=".\reginf.h"
+				>
+			</File>
+			<File
+				RelativePath=".\registry.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: trunk/reactos/tools/mkhive/reginf.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/reginf.c?rev=28425&r1=28424&r2=28425&view=diff
==============================================================================
--- trunk/reactos/tools/mkhive/reginf.c (original)
+++ trunk/reactos/tools/mkhive/reginf.c Sun Aug 19 23:37:47 2007
@@ -262,7 +262,7 @@
 	      if (Str == NULL)
 		return FALSE;
 
-	      InfHostGetMultiSzField (Context, 5, Str, Size, NULL);
+	      InfHostGetMultiSzField (Context, 5, Str, (ULONG)Size, NULL);
 	    }
 
 	  if (Flags & FLG_ADDREG_APPEND)
@@ -291,7 +291,7 @@
 	      if (Str == NULL)
 		return FALSE;
 
-	      InfHostGetStringField (Context, 5, Str, Size, NULL);
+	      InfHostGetStringField (Context, 5, Str, (ULONG)Size, NULL);
 	    }
 	}
 
@@ -347,7 +347,7 @@
 	    return FALSE;
 
 	  DPRINT("setting binary data %s len %lu\n", ValueName, Size);
-	  InfHostGetBinaryField (Context, 5, Data, Size, NULL);
+	  InfHostGetBinaryField (Context, 5, Data, (ULONG)Size, NULL);
 	}
 
       RegSetValueExA (KeyHandle,
@@ -396,7 +396,7 @@
 
       /* get key */
       Length = strlen (Buffer);
-      if (InfHostGetStringField (Context, 2, Buffer + Length, MAX_INF_STRING_LENGTH - Length, NULL) != 0)
+      if (InfHostGetStringField (Context, 2, Buffer + Length, MAX_INF_STRING_LENGTH - (ULONG)Length, NULL) != 0)
 	*Buffer = 0;
 
       DPRINT("KeyName: <%s>\n", Buffer);

Modified: trunk/reactos/tools/mkhive/registry.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/registry.c?rev=28425&r1=28424&r2=28425&view=diff
==============================================================================
--- trunk/reactos/tools/mkhive/registry.c (original)
+++ trunk/reactos/tools/mkhive/registry.c Sun Aug 19 23:37:47 2007
@@ -133,7 +133,7 @@
 			RtlInitUnicodeString(&KeyString, LocalKeyName);
 
 		/* Redirect from 'CurrentControlSet' to 'ControlSet001' */
-		if (!wcsncmp(LocalKeyName, L"CurrentControlSet", 17) &&
+		if (!memcmp(LocalKeyName, L"CurrentControlSet", 34) &&
                     ParentKey->NameSize == 12 &&
                     !memcmp(ParentKey->Name, L"SYSTEM", 12))
 			RtlInitUnicodeString(&KeyString, L"ControlSet001");
@@ -624,7 +624,7 @@
 {
 	UNICODE_STRING RootKeyName = RTL_CONSTANT_STRING(L"\\");
 	NTSTATUS Status;
-	HKEY ControlSetKey, LinkKey;
+	HKEY ControlSetKey;
 
 	InitializeListHead(&CmiHiveListHead);
 




More information about the Ros-diffs mailing list