- Fix two warnings in GCC Linux build (in KeBugCheckEx and in a call to the helper function RepGetValueData).
- Remove two unused RTL ANSI functions.
- Fix USHORT vs. ULONG type misuage.
- Fix SIZE_T vs. ULONG usage.

svn path=/trunk/; revision=70603
This commit is contained in:
Hermès Bélusca-Maïto 2016-01-17 01:29:43 +00:00
parent 30da982e36
commit 660ad50bae
4 changed files with 22 additions and 94 deletions

View file

@ -57,15 +57,6 @@ typedef DWORD REGSAM;
typedef LPVOID LPSECURITY_ATTRIBUTES;
typedef HANDLE HKEY, *PHKEY;
NTSTATUS NTAPI
RtlAnsiStringToUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN PANSI_STRING AnsiSource,
IN BOOLEAN AllocateDestinationString);
VOID NTAPI
RtlInitAnsiString(
IN OUT PANSI_STRING DestinationString,
IN PCSTR SourceString);
VOID NTAPI
RtlInitUnicodeString(
IN OUT PUNICODE_STRING DestinationString,
@ -79,9 +70,9 @@ RegQueryValueExW(
IN HKEY hKey,
IN LPCWSTR lpValueName,
IN PULONG lpReserved,
OUT PULONG lpType,
OUT PUCHAR lpData,
OUT PSIZE_T lpcbData);
OUT PULONG lpType OPTIONAL,
OUT PUCHAR lpData OPTIONAL,
IN OUT PULONG lpcbData OPTIONAL);
LONG WINAPI
RegSetValueExW(
@ -90,7 +81,7 @@ RegSetValueExW(
IN ULONG Reserved,
IN ULONG dwType,
IN const UCHAR* lpData,
IN USHORT cbData);
IN ULONG cbData);
LONG WINAPI
RegDeleteKeyW(

View file

@ -119,11 +119,11 @@ AppendMultiSzValue (
IN HKEY KeyHandle,
IN PWCHAR ValueName,
IN PWCHAR Strings,
IN SIZE_T StringSize)
IN ULONG StringSize)
{
SIZE_T Size;
ULONG Size;
ULONG Type;
size_t Total;
ULONG Total;
PWCHAR Buffer;
PWCHAR p;
size_t len;
@ -182,7 +182,7 @@ AppendMultiSzValue (
0,
REG_MULTI_SZ,
(PUCHAR)Buffer,
(ULONG)Total * sizeof(WCHAR));
Total * sizeof(WCHAR));
}
done:
@ -289,7 +289,7 @@ do_reg_operation(
if (Str == NULL)
return FALSE;
InfHostGetMultiSzField (Context, 5, Str, (ULONG)Size, NULL);
InfHostGetMultiSzField (Context, 5, Str, Size, NULL);
}
if (Flags & FLG_ADDREG_APPEND)
@ -319,7 +319,7 @@ do_reg_operation(
if (Str == NULL)
return FALSE;
InfHostGetStringField (Context, 5, Str, (ULONG)Size, NULL);
InfHostGetStringField (Context, 5, Str, Size, NULL);
}
}
@ -349,7 +349,7 @@ do_reg_operation(
0,
Type,
(PVOID)Str,
(ULONG)Size * sizeof(WCHAR));
Size * sizeof(WCHAR));
}
else
{
@ -359,7 +359,7 @@ do_reg_operation(
0,
Type,
(PVOID)&EmptyStr,
(ULONG)sizeof(WCHAR));
sizeof(WCHAR));
}
}
free (Str);
@ -387,7 +387,7 @@ do_reg_operation(
0,
Type,
(PVOID)Data,
(ULONG)Size);
Size);
free (Data);
}

View file

@ -518,7 +518,7 @@ RegSetValueExW(
IN ULONG Reserved,
IN ULONG dwType,
IN const UCHAR* lpData,
IN USHORT cbData)
IN ULONG cbData)
{
PMEMKEY Key = HKEY_TO_MEMKEY(hKey); // ParentKey
PHHIVE Hive;
@ -528,7 +528,7 @@ RegSetValueExW(
UNICODE_STRING ValueNameString;
PVOID DataCell;
LONG DataCellSize;
ULONG DataCellSize;
NTSTATUS Status;
if (dwType == REG_LINK)
@ -597,7 +597,7 @@ RegSetValueExW(
if (!DataCell)
return ERROR_UNSUCCESSFUL;
DataCellSize = -HvGetCellSize(Hive, DataCell);
DataCellSize = (ULONG)(-HvGetCellSize(Hive, DataCell));
}
else
{
@ -613,12 +613,12 @@ RegSetValueExW(
HvFreeCell(Hive, ValueCell->Data);
RtlCopyMemory(&ValueCell->Data, lpData, cbData);
ValueCell->DataLength = (ULONG)(cbData | CM_KEY_VALUE_SPECIAL_SIZE);
ValueCell->DataLength = (cbData | CM_KEY_VALUE_SPECIAL_SIZE);
ValueCell->Type = dwType;
}
else
{
if (cbData > (SIZE_T)DataCellSize)
if (cbData > DataCellSize)
{
/* New data size is larger than the current, destroy current
* data block and allocate a new one. */
@ -642,7 +642,7 @@ RegSetValueExW(
/* Copy new contents to cell */
RtlCopyMemory(DataCell, lpData, cbData);
ValueCell->DataLength = (ULONG)(cbData & ~CM_KEY_VALUE_SPECIAL_SIZE);
ValueCell->DataLength = (cbData & ~CM_KEY_VALUE_SPECIAL_SIZE);
ValueCell->Type = dwType;
HvMarkCellDirty(Hive, ValueCell->Data, FALSE);
}
@ -712,7 +712,7 @@ RegQueryValueExW(
IN PULONG lpReserved,
OUT PULONG lpType OPTIONAL,
OUT PUCHAR lpData OPTIONAL,
IN OUT PSIZE_T lpcbData OPTIONAL)
IN OUT PULONG lpcbData OPTIONAL)
{
PMEMKEY ParentKey = HKEY_TO_MEMKEY(hKey);
PHHIVE Hive = &ParentKey->RegistryHive->Hive;

View file

@ -17,34 +17,6 @@
#include "mkhive.h"
#include <bitmap.c>
/*
* @implemented
*
* NOTES
* If source is NULL the length of source is assumed to be 0.
*/
VOID NTAPI
RtlInitAnsiString(
IN OUT PANSI_STRING DestinationString,
IN PCSTR SourceString)
{
SIZE_T DestSize;
if(SourceString)
{
DestSize = strlen(SourceString);
DestinationString->Length = (USHORT)DestSize;
DestinationString->MaximumLength = (USHORT)DestSize + sizeof(CHAR);
}
else
{
DestinationString->Length = 0;
DestinationString->MaximumLength = 0;
}
DestinationString->Buffer = (PCHAR)SourceString;
}
/*
* @implemented
*
@ -73,41 +45,6 @@ RtlInitUnicodeString(
DestinationString->Buffer = (PWCHAR)SourceString;
}
NTSTATUS NTAPI
RtlAnsiStringToUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN PANSI_STRING AnsiSource,
IN BOOLEAN AllocateDestinationString)
{
ULONG Length;
PUCHAR WideString;
USHORT i;
Length = AnsiSource->Length * sizeof(WCHAR);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
UniDest->Length = (USHORT)Length;
if (AllocateDestinationString)
{
UniDest->MaximumLength = (USHORT)Length + sizeof(WCHAR);
UniDest->Buffer = (PWSTR) malloc(UniDest->MaximumLength);
if (!UniDest->Buffer)
return STATUS_NO_MEMORY;
}
else if (UniDest->Length >= UniDest->MaximumLength)
{
return STATUS_BUFFER_OVERFLOW;
}
WideString = (PUCHAR)UniDest->Buffer;
for (i = 0; i <= AnsiSource->Length; i++)
{
WideString[2 * i + 0] = AnsiSource->Buffer[i];
WideString[2 * i + 1] = 0;
}
return STATUS_SUCCESS;
}
LONG NTAPI
RtlCompareUnicodeString(
IN PCUNICODE_STRING String1,
@ -222,14 +159,14 @@ RtlAssert(PVOID FailedAssertion,
VOID
NTAPI
KeBugCheckEx(
IN ULONG BugCheckCode,
IN ULONG BugCheckCode,
IN ULONG_PTR BugCheckParameter1,
IN ULONG_PTR BugCheckParameter2,
IN ULONG_PTR BugCheckParameter3,
IN ULONG_PTR BugCheckParameter4)
{
char Buffer[70];
printf("*** STOP: 0x%08lX (0x%08lX, 0x%08lX, 0x%08lX, 0x%08lX)",
printf("*** STOP: 0x%08X (0x%08lX, 0x%08lX, 0x%08lX, 0x%08lX)",
BugCheckCode, BugCheckParameter1, BugCheckParameter2,
BugCheckParameter3, BugCheckParameter4);
ASSERT(FALSE);