- 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".

svn path=/trunk/; revision=28425
This commit is contained in:
Colin Finck 2007-08-19 19:37:47 +00:00
parent 0f123ca26f
commit 82f18756f0
8 changed files with 283 additions and 21 deletions

View file

@ -1266,8 +1266,8 @@ typedef struct _EX_RUNDOWN_REF
{
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 @@ typedef struct _IRP {
ULONG Flags;
union {
struct _IRP *MasterIrp;
__volatile LONG IrpCount;
volatile LONG IrpCount;
PVOID SystemBuffer;
} AssociatedIrp;
LIST_ENTRY ThreadListEntry;
@ -1384,7 +1384,7 @@ typedef struct _IRP {
} AsynchronousParameters;
LARGE_INTEGER AllocationSize;
} Overlay;
__volatile PDRIVER_CANCEL CancelRoutine;
volatile PDRIVER_CANCEL CancelRoutine;
PVOID UserBuffer;
union {
struct {
@ -2187,7 +2187,7 @@ typedef struct _DEVICE_OBJECT {
PIO_TIMER Timer;
ULONG Flags;
ULONG Characteristics;
__volatile PVPB Vpb;
volatile PVPB Vpb;
PVOID DeviceExtension;
DEVICE_TYPE DeviceType;
CCHAR StackSize;
@ -3147,8 +3147,8 @@ typedef struct _ERESOURCE {
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 @@ typedef struct _FILE_OBJECT
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_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK;
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 @@ typedef struct _IO_REMOVE_LOCK_DBG_BLOCK {
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 VOID
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 {

View file

@ -4017,6 +4017,7 @@ typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
#endif
NTSYSAPI
SIZE_T
STDCALL
RtlCompareMemory (

View file

@ -33,7 +33,7 @@ CMLIB_HOST_OBJECTS = \
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)

View file

@ -101,6 +101,13 @@ static void DPRINT ( const char* fmt, ... )
#define GCC_PACKED __attribute__((packed))
#endif//_MSC_VER
/* rtl.c */
PWSTR
xwcschr(
PWSTR String,
WCHAR Char
);
#endif /* __MKHIVE_H__ */
/* EOF */

View file

@ -0,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

View file

@ -0,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>

View file

@ -262,7 +262,7 @@ do_reg_operation(HKEY KeyHandle,
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 @@ do_reg_operation(HKEY KeyHandle,
if (Str == NULL)
return FALSE;
InfHostGetStringField (Context, 5, Str, Size, NULL);
InfHostGetStringField (Context, 5, Str, (ULONG)Size, NULL);
}
}
@ -347,7 +347,7 @@ do_reg_operation(HKEY KeyHandle,
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 @@ registry_callback (HINF hInf, PCHAR Section, BOOL Delete)
/* 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);

View file

@ -133,7 +133,7 @@ RegpOpenOrCreateKey(
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 @@ RegInitializeRegistry(VOID)
{
UNICODE_STRING RootKeyName = RTL_CONSTANT_STRING(L"\\");
NTSTATUS Status;
HKEY ControlSetKey, LinkKey;
HKEY ControlSetKey;
InitializeListHead(&CmiHiveListHead);