Better handling of REG_LINK values

Try to fix Linux build (thanks Usurp on IRC)

svn path=/trunk/; revision=24066
This commit is contained in:
Hervé Poussineau 2006-09-11 11:04:33 +00:00
parent 4f6a751b6f
commit 7b79f44d6b
6 changed files with 30 additions and 26 deletions

View file

@ -32,7 +32,7 @@ CMLIB_HOST_OBJECTS = \
CMLIB_HOST_CFLAGS = -O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
-D_X86_ -D__i386__ -D_REACTOS_ -D_NTOSKRNL_\
-DCMLIB_HOST -D_M_IX86 -I$(CMLIB_BASE) -Iinclude/reactos -Iinclude/psdk -Iinclude/ddk \
-DCMLIB_HOST -D_M_IX86 -I$(CMLIB_BASE) -Iinclude/reactos -Iinclude/psdk -Iinclude/ddk -Iinclude/crt \
-D__NO_CTYPE_INLINES
$(CMLIB_HOST_TARGET): $(CMLIB_HOST_OBJECTS) | $(CMLIB_OUT)

View file

@ -398,7 +398,7 @@ CmiCompareHashI(
Buffer[2] = (KeyName->Length >= 6) ? (CHAR)KeyName->Buffer[2] : 0;
Buffer[3] = (KeyName->Length >= 8) ? (CHAR)KeyName->Buffer[3] : 0;
return (_strnicmp(Buffer, HashString, 4) == 0);
return (strncasecmp(Buffer, HashString, 4) == 0);
}
static BOOLEAN

View file

@ -76,10 +76,12 @@ static void DPRINT ( const char* fmt, ... )
#define CHECKPOINT
#ifdef WIN32
#define strncasecmp strnicmp
#ifdef _WIN32
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif//WIN32
#else
#include <string.h>
#endif//_WIN32
#ifdef _MSC_VER
#define GCC_PACKED

View file

@ -32,7 +32,7 @@ MKHIVE_OBJECTS = \
MKHIVE_HOST_CFLAGS = $(xTOOLS_CFLAGS) -I$(INFLIB_BASE) -I$(CMLIB_BASE) \
-D_NTOSKRNL_ \
-Iinclude/reactos -Iinclude/ddk -Iinclude/ndk -Iinclude/psdk -Iinclude -g3
-Iinclude/reactos -Iinclude/ddk -Iinclude/ndk -Iinclude/psdk -Iinclude -Iinclude/crt -g3
MKHIVE_HOST_LFLAGS = $(xTOOLS_LFLAGS) -g3

View file

@ -132,6 +132,9 @@ RegpOpenOrCreateKey(
else
RtlInitUnicodeString(&KeyString, LocalKeyName);
while (ParentKey->DataType == REG_LINK)
ParentKey = ParentKey->LinkedKey;
/* Check subkey in memory structure */
Ptr = ParentKey->SubKeyList.Flink;
while (Ptr != &ParentKey->SubKeyList)
@ -180,9 +183,6 @@ RegpOpenOrCreateKey(
ParentKey->SubKeyCount++;
nextsubkey:
/* Follow registry links */
while (CurrentKey->LinkedKey)
CurrentKey = CurrentKey->LinkedKey;
ParentKey = CurrentKey;
if (End)
LocalKeyName = End + 1;
@ -276,7 +276,7 @@ RegOpenKeyA(
return rc;
}
static NTSTATUS
static LONG
RegpOpenOrCreateValue(
IN HKEY hKey,
IN LPCWSTR ValueName,
@ -308,8 +308,8 @@ RegpOpenOrCreateValue(
ValueCellOffset);
}
if (!NT_SUCCESS(Status))
return Status;
return STATUS_SUCCESS;
return ERROR_UNSUCCESSFUL;
return ERROR_SUCCESS;
}
LONG WINAPI
@ -318,7 +318,7 @@ RegSetValueExW(
IN LPCWSTR lpValueName OPTIONAL,
IN ULONG Reserved,
IN ULONG dwType,
IN const PUCHAR lpData,
IN const UCHAR* lpData,
IN USHORT cbData)
{
MEMKEY Key, DestKey;
@ -339,13 +339,14 @@ RegSetValueExW(
DestKey = HKEY_TO_MEMKEY(*phKey);
/* Create the link in memory */
Key->DataType = REG_LINK;
Key->LinkedKey = DestKey;
/* Create the link in registry hive (if applicable) */
if (Key->RegistryHive != DestKey->RegistryHive)
return STATUS_SUCCESS;
DPRINT1("Save link to registry\n");
return STATUS_NOT_IMPLEMENTED;
lpData = (PUCHAR)&DestKey->KeyCellOffset;
cbData = sizeof(HCELL_INDEX);
}
if ((cbData & REG_DATA_SIZE_MASK) != cbData)
@ -428,11 +429,11 @@ RegSetValueExA(
IN LPCSTR lpValueName OPTIONAL,
IN ULONG Reserved,
IN ULONG dwType,
IN const PUCHAR lpData,
IN const UCHAR* lpData,
IN ULONG cbData)
{
LPWSTR lpValueNameW = NULL;
PUCHAR lpDataW;
const UCHAR* lpDataW;
USHORT cbDataW;
LONG rc = ERROR_SUCCESS;
@ -457,7 +458,7 @@ RegSetValueExA(
AnsiString.Length = (USHORT)cbData - 1;
AnsiString.MaximumLength = (USHORT)cbData;
RtlAnsiStringToUnicodeString (&Data, &AnsiString, TRUE);
lpDataW = (const PUCHAR)Data.Buffer;
lpDataW = (const UCHAR*)Data.Buffer;
cbDataW = Data.MaximumLength;
}
else
@ -471,7 +472,7 @@ RegSetValueExA(
if (lpValueNameW)
free(lpValueNameW);
if (lpData != lpDataW)
free(lpDataW);
free((PVOID)lpDataW);
return rc;
}
@ -487,17 +488,20 @@ RegQueryValueExW(
//ParentKey = HKEY_TO_MEMKEY(RootKey);
PCM_KEY_VALUE ValueCell;
HCELL_INDEX ValueCellOffset;
NTSTATUS Status;
LONG rc;
Status = RegpOpenOrCreateValue(
rc = RegpOpenOrCreateValue(
hKey,
lpValueName,
FALSE,
&ValueCell,
&ValueCellOffset);
if (rc != ERROR_SUCCESS)
return rc;
DPRINT1("RegQueryValueExW(%S) not implemented\n", lpValueName);
/* ValueCell and ValueCellOffset are valid */
//Status = CmiScanForValueKey(
// x
return ERROR_UNSUCCESSFUL;
}
@ -513,7 +517,6 @@ RegQueryValueExA(
LPWSTR lpValueNameW = NULL;
LONG rc;
DPRINT1("RegQueryValueExA(%s) not implemented\n", lpValueName);
if (lpValueName)
{
lpValueNameW = MultiByteToWideChar(lpValueName);
@ -673,7 +676,6 @@ RegInitializeRegistry(VOID)
NULL,
L"Registry\\Machine\\SYSTEM\\CurrentControlSet",
&LinkKey);
printf("ControlSetKey %p\n", ControlSetKey);
RegSetValueExW(LinkKey, NULL, 0, REG_LINK, (PCHAR)&ControlSetKey, sizeof(PVOID));
}

View file

@ -220,7 +220,7 @@ RegSetValueExA(
IN LPCSTR lpValueName OPTIONAL,
ULONG Reserved,
IN ULONG dwType,
IN const PUCHAR lpData,
IN const UCHAR* lpData,
IN ULONG cbData);
LONG WINAPI