mirror of
https://github.com/reactos/reactos.git
synced 2024-10-05 00:43:21 +00:00
- Colin Finck: Replace broken memcmp comparison of wide strings by an own version of wcsncmp (due to the fact it may be different on different hosts).
- Add RtlAssert to mkhive, it was missing in some compiling cases, and fix DbgPrint function implementation. - Mark a memory overwrite in mkhive with a FIXME, to be fixed later. svn path=/trunk/; revision=31232
This commit is contained in:
parent
5bd30618ac
commit
61ed2f0c41
|
@ -68,6 +68,8 @@ CreateInMemoryStructure(
|
||||||
Key->ValueCount = 0;
|
Key->ValueCount = 0;
|
||||||
|
|
||||||
Key->NameSize = KeyName->Length;
|
Key->NameSize = KeyName->Length;
|
||||||
|
/* FIXME: It's not enough to allocate this way, because later
|
||||||
|
this memory gets overwritten with bigger names */
|
||||||
Key->Name = malloc (Key->NameSize);
|
Key->Name = malloc (Key->NameSize);
|
||||||
if (!Key->Name)
|
if (!Key->Name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -136,7 +138,7 @@ RegpOpenOrCreateKey(
|
||||||
RtlInitUnicodeString(&KeyString, LocalKeyName);
|
RtlInitUnicodeString(&KeyString, LocalKeyName);
|
||||||
|
|
||||||
/* Redirect from 'CurrentControlSet' to 'ControlSet001' */
|
/* Redirect from 'CurrentControlSet' to 'ControlSet001' */
|
||||||
if (!memcmp(LocalKeyName, L"CurrentControlSet", 34) &&
|
if (!xwcsncmp(LocalKeyName, L"CurrentControlSet", 17) &&
|
||||||
ParentKey->NameSize == 12 &&
|
ParentKey->NameSize == 12 &&
|
||||||
!memcmp(ParentKey->Name, L"SYSTEM", 12))
|
!memcmp(ParentKey->Name, L"SYSTEM", 12))
|
||||||
RtlInitUnicodeString(&KeyString, L"ControlSet001");
|
RtlInitUnicodeString(&KeyString, L"ControlSet001");
|
||||||
|
|
|
@ -28,6 +28,23 @@ PWSTR xwcschr( PWSTR String, WCHAR Char )
|
||||||
else return NULL;
|
else return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int xwcsncmp(PCWSTR s1, PCWSTR s2, size_t n)
|
||||||
|
{
|
||||||
|
while(n--)
|
||||||
|
{
|
||||||
|
if(*s1 != *s2)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if(*s1 == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
s1++;
|
||||||
|
s2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*
|
*
|
||||||
|
@ -168,4 +185,32 @@ DbgPrint(
|
||||||
va_start(ap, Format);
|
va_start(ap, Format);
|
||||||
vprintf(Format, ap);
|
vprintf(Format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
RtlAssert(PVOID FailedAssertion,
|
||||||
|
PVOID FileName,
|
||||||
|
ULONG LineNumber,
|
||||||
|
PCHAR Message)
|
||||||
|
{
|
||||||
|
if (NULL != Message)
|
||||||
|
{
|
||||||
|
DbgPrint("Assertion \'%s\' failed at %s line %d: %s\n",
|
||||||
|
(PCHAR)FailedAssertion,
|
||||||
|
(PCHAR)FileName,
|
||||||
|
LineNumber,
|
||||||
|
Message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DbgPrint("Assertion \'%s\' failed at %s line %d\n",
|
||||||
|
(PCHAR)FailedAssertion,
|
||||||
|
(PCHAR)FileName,
|
||||||
|
LineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
//DbgBreakPoint();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue