mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
more NtXxx vs. ZwXxx fixes
svn path=/trunk/; revision=13215
This commit is contained in:
parent
96245a4ae9
commit
87a8d3ebeb
4 changed files with 160 additions and 120 deletions
|
@ -237,16 +237,19 @@ NtCreateKey(OUT PHANDLE KeyHandle,
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
NtDeleteKey(IN HANDLE KeyHandle)
|
NtDeleteKey(IN HANDLE KeyHandle)
|
||||||
{
|
{
|
||||||
|
KPROCESSOR_MODE PreviousMode;
|
||||||
PKEY_OBJECT KeyObject;
|
PKEY_OBJECT KeyObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT1("NtDeleteKey(KeyHandle %x) called\n", KeyHandle);
|
DPRINT1("NtDeleteKey(KeyHandle %x) called\n", KeyHandle);
|
||||||
|
|
||||||
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
/* Verify that the handle is valid and is a registry key */
|
/* Verify that the handle is valid and is a registry key */
|
||||||
Status = ObReferenceObjectByHandle(KeyHandle,
|
Status = ObReferenceObjectByHandle(KeyHandle,
|
||||||
DELETE,
|
DELETE,
|
||||||
CmiKeyType,
|
CmiKeyType,
|
||||||
UserMode,
|
PreviousMode,
|
||||||
(PVOID *)&KeyObject,
|
(PVOID *)&KeyObject,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -899,14 +902,17 @@ NtFlushKey(IN HANDLE KeyHandle)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKEY_OBJECT KeyObject;
|
PKEY_OBJECT KeyObject;
|
||||||
PREGISTRY_HIVE RegistryHive;
|
PREGISTRY_HIVE RegistryHive;
|
||||||
|
KPROCESSOR_MODE PreviousMode;
|
||||||
|
|
||||||
DPRINT("NtFlushKey (KeyHandle %lx) called\n", KeyHandle);
|
DPRINT("NtFlushKey (KeyHandle %lx) called\n", KeyHandle);
|
||||||
|
|
||||||
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
/* Verify that the handle is valid and is a registry key */
|
/* Verify that the handle is valid and is a registry key */
|
||||||
Status = ObReferenceObjectByHandle(KeyHandle,
|
Status = ObReferenceObjectByHandle(KeyHandle,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
CmiKeyType,
|
CmiKeyType,
|
||||||
UserMode,
|
PreviousMode,
|
||||||
(PVOID *)&KeyObject,
|
(PVOID *)&KeyObject,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -947,8 +953,10 @@ NtOpenKey(OUT PHANDLE KeyHandle,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
UNICODE_STRING RemainingPath;
|
UNICODE_STRING RemainingPath;
|
||||||
NTSTATUS Status;
|
KPROCESSOR_MODE PreviousMode;
|
||||||
PVOID Object;
|
PVOID Object;
|
||||||
|
HANDLE hKey;
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
DPRINT("NtOpenKey(KH %x DA %x OA %x OA->ON '%wZ'\n",
|
DPRINT("NtOpenKey(KH %x DA %x OA %x OA->ON '%wZ'\n",
|
||||||
KeyHandle,
|
KeyHandle,
|
||||||
|
@ -956,6 +964,28 @@ NtOpenKey(OUT PHANDLE KeyHandle,
|
||||||
ObjectAttributes,
|
ObjectAttributes,
|
||||||
ObjectAttributes ? ObjectAttributes->ObjectName : NULL);
|
ObjectAttributes ? ObjectAttributes->ObjectName : NULL);
|
||||||
|
|
||||||
|
PreviousMode = ExGetPreviousMode();
|
||||||
|
|
||||||
|
if(PreviousMode != KernelMode)
|
||||||
|
{
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
|
ProbeForWrite(KeyHandle,
|
||||||
|
sizeof(HANDLE),
|
||||||
|
sizeof(ULONG));
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
Status = _SEH_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
|
if(!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RemainingPath.Buffer = NULL;
|
RemainingPath.Buffer = NULL;
|
||||||
Status = ObFindObject(ObjectAttributes,
|
Status = ObFindObject(ObjectAttributes,
|
||||||
&Object,
|
&Object,
|
||||||
|
@ -990,7 +1020,7 @@ NtOpenKey(OUT PHANDLE KeyHandle,
|
||||||
Object,
|
Object,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
TRUE,
|
TRUE,
|
||||||
KeyHandle);
|
&hKey);
|
||||||
ObDereferenceObject(Object);
|
ObDereferenceObject(Object);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -998,7 +1028,17 @@ NtOpenKey(OUT PHANDLE KeyHandle,
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
_SEH_TRY
|
||||||
|
{
|
||||||
|
*KeyHandle = hKey;
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
Status = _SEH_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ CmiCreateDefaultRootKeyCell(PKEY_CELL RootKeyCell)
|
||||||
RootKeyCell->CellSize = -sizeof(KEY_CELL);
|
RootKeyCell->CellSize = -sizeof(KEY_CELL);
|
||||||
RootKeyCell->Id = REG_KEY_CELL_ID;
|
RootKeyCell->Id = REG_KEY_CELL_ID;
|
||||||
RootKeyCell->Flags = REG_KEY_ROOT_CELL | REG_KEY_NAME_PACKED;
|
RootKeyCell->Flags = REG_KEY_ROOT_CELL | REG_KEY_NAME_PACKED;
|
||||||
NtQuerySystemTime(&RootKeyCell->LastWriteTime);
|
ZwQuerySystemTime(&RootKeyCell->LastWriteTime);
|
||||||
RootKeyCell->ParentKeyOffset = 0;
|
RootKeyCell->ParentKeyOffset = 0;
|
||||||
RootKeyCell->NumberOfSubKeys = 0;
|
RootKeyCell->NumberOfSubKeys = 0;
|
||||||
RootKeyCell->HashTableOffset = -1;
|
RootKeyCell->HashTableOffset = -1;
|
||||||
|
@ -384,7 +384,7 @@ CmiCreateNewRegFile(HANDLE FileHandle)
|
||||||
/* The rest of the block is free */
|
/* The rest of the block is free */
|
||||||
FreeCell->CellSize = REG_BLOCK_SIZE - (REG_HBIN_DATA_OFFSET + sizeof(KEY_CELL));
|
FreeCell->CellSize = REG_BLOCK_SIZE - (REG_HBIN_DATA_OFFSET + sizeof(KEY_CELL));
|
||||||
|
|
||||||
Status = NtWriteFile(FileHandle,
|
Status = ZwWriteFile(FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -403,7 +403,7 @@ CmiCreateNewRegFile(HANDLE FileHandle)
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NtFlushBuffersFile(FileHandle,
|
Status = ZwFlushBuffersFile(FileHandle,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
|
@ -483,7 +483,7 @@ CmiCheckAndFixHive(PREGISTRY_HIVE RegistryHive)
|
||||||
else if (!NT_SUCCESS(Status))
|
else if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("ZwCreateFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwCreateFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(HiveHandle);
|
ZwClose(HiveHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ CmiCheckAndFixHive(PREGISTRY_HIVE RegistryHive)
|
||||||
|
|
||||||
/* Read hive base block */
|
/* Read hive base block */
|
||||||
FileOffset.QuadPart = 0ULL;
|
FileOffset.QuadPart = 0ULL;
|
||||||
Status = NtReadFile(HiveHandle,
|
Status = ZwReadFile(HiveHandle,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -510,7 +510,7 @@ CmiCheckAndFixHive(PREGISTRY_HIVE RegistryHive)
|
||||||
0);
|
0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtReadFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwReadFile() failed (Status %lx)\n", Status);
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ CmiCheckAndFixHive(PREGISTRY_HIVE RegistryHive)
|
||||||
|
|
||||||
/* Read log file header */
|
/* Read log file header */
|
||||||
FileOffset.QuadPart = 0ULL;
|
FileOffset.QuadPart = 0ULL;
|
||||||
Status = NtReadFile(LogHandle,
|
Status = ZwReadFile(LogHandle,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -552,7 +552,7 @@ CmiCheckAndFixHive(PREGISTRY_HIVE RegistryHive)
|
||||||
0);
|
0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtReadFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwReadFile() failed (Status %lx)\n", Status);
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,14 +585,14 @@ CmiCheckAndFixHive(PREGISTRY_HIVE RegistryHive)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Get file size */
|
/* Get file size */
|
||||||
Status = NtQueryInformationFile(LogHandle,
|
Status = ZwQueryInformationFile(LogHandle,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
&fsi,
|
&fsi,
|
||||||
sizeof(fsi),
|
sizeof(fsi),
|
||||||
FileStandardInformation);
|
FileStandardInformation);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwQueryInformationFile() failed (Status %lx)\n", Status);
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
}
|
}
|
||||||
FileSize = fsi.EndOfFile.u.LowPart;
|
FileSize = fsi.EndOfFile.u.LowPart;
|
||||||
|
@ -617,7 +617,7 @@ CmiCheckAndFixHive(PREGISTRY_HIVE RegistryHive)
|
||||||
|
|
||||||
/* Read log file header */
|
/* Read log file header */
|
||||||
FileOffset.QuadPart = 0ULL;
|
FileOffset.QuadPart = 0ULL;
|
||||||
Status = NtReadFile(LogHandle,
|
Status = ZwReadFile(LogHandle,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -628,7 +628,7 @@ CmiCheckAndFixHive(PREGISTRY_HIVE RegistryHive)
|
||||||
0);
|
0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtReadFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwReadFile() failed (Status %lx)\n", Status);
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,9 +656,9 @@ ByeBye:
|
||||||
ExFreePool(LogHeader);
|
ExFreePool(LogHeader);
|
||||||
|
|
||||||
if (LogHandle != INVALID_HANDLE_VALUE)
|
if (LogHandle != INVALID_HANDLE_VALUE)
|
||||||
NtClose(LogHandle);
|
ZwClose(LogHandle);
|
||||||
|
|
||||||
NtClose(HiveHandle);
|
ZwClose(HiveHandle);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -929,7 +929,7 @@ CmiInitNonVolatileRegistryHive (PREGISTRY_HIVE RegistryHive,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("CmiCreateNewRegFile() failed (Status %lx)\n", Status);
|
DPRINT("CmiCreateNewRegFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
RtlFreeUnicodeString(&RegistryHive->HiveFileName);
|
RtlFreeUnicodeString(&RegistryHive->HiveFileName);
|
||||||
RtlFreeUnicodeString(&RegistryHive->LogFileName);
|
RtlFreeUnicodeString(&RegistryHive->LogFileName);
|
||||||
return(Status);
|
return(Status);
|
||||||
|
@ -972,7 +972,7 @@ CmiInitNonVolatileRegistryHive (PREGISTRY_HIVE RegistryHive,
|
||||||
ObDereferenceObject(SectionObject);
|
ObDereferenceObject(SectionObject);
|
||||||
RtlFreeUnicodeString(&RegistryHive->HiveFileName);
|
RtlFreeUnicodeString(&RegistryHive->HiveFileName);
|
||||||
RtlFreeUnicodeString(&RegistryHive->LogFileName);
|
RtlFreeUnicodeString(&RegistryHive->LogFileName);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
DPRINT("ViewBase %p ViewSize %lx\n", ViewBase, ViewSize);
|
DPRINT("ViewBase %p ViewSize %lx\n", ViewBase, ViewSize);
|
||||||
|
@ -996,7 +996,7 @@ CmiInitNonVolatileRegistryHive (PREGISTRY_HIVE RegistryHive,
|
||||||
ObDereferenceObject(SectionObject);
|
ObDereferenceObject(SectionObject);
|
||||||
RtlFreeUnicodeString(&RegistryHive->HiveFileName);
|
RtlFreeUnicodeString(&RegistryHive->HiveFileName);
|
||||||
RtlFreeUnicodeString(&RegistryHive->LogFileName);
|
RtlFreeUnicodeString(&RegistryHive->LogFileName);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
RtlZeroMemory (RegistryHive->BlockList,
|
RtlZeroMemory (RegistryHive->BlockList,
|
||||||
|
@ -1013,7 +1013,7 @@ CmiInitNonVolatileRegistryHive (PREGISTRY_HIVE RegistryHive,
|
||||||
ObDereferenceObject(SectionObject);
|
ObDereferenceObject(SectionObject);
|
||||||
RtlFreeUnicodeString(&RegistryHive->HiveFileName);
|
RtlFreeUnicodeString(&RegistryHive->HiveFileName);
|
||||||
RtlFreeUnicodeString(&RegistryHive->LogFileName);
|
RtlFreeUnicodeString(&RegistryHive->LogFileName);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,7 +1023,7 @@ CmiInitNonVolatileRegistryHive (PREGISTRY_HIVE RegistryHive,
|
||||||
ObDereferenceObject(SectionObject);
|
ObDereferenceObject(SectionObject);
|
||||||
|
|
||||||
/* Close the hive file */
|
/* Close the hive file */
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
|
|
||||||
/* Initialize the free cell list */
|
/* Initialize the free cell list */
|
||||||
Status = CmiCreateHiveFreeCellList (RegistryHive);
|
Status = CmiCreateHiveFreeCellList (RegistryHive);
|
||||||
|
@ -1438,7 +1438,7 @@ CmiStartLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
|
|
||||||
/* Write hive block and block bitmap */
|
/* Write hive block and block bitmap */
|
||||||
FileOffset.QuadPart = (ULONGLONG)0;
|
FileOffset.QuadPart = (ULONGLONG)0;
|
||||||
Status = NtWriteFile(FileHandle,
|
Status = ZwWriteFile(FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1449,8 +1449,8 @@ CmiStartLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwWriteFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
ExFreePool(Buffer);
|
ExFreePool(Buffer);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -1479,7 +1479,7 @@ CmiStartLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
DPRINT("File offset %I64x\n", FileOffset.QuadPart);
|
DPRINT("File offset %I64x\n", FileOffset.QuadPart);
|
||||||
|
|
||||||
/* Write hive block */
|
/* Write hive block */
|
||||||
Status = NtWriteFile(FileHandle,
|
Status = ZwWriteFile(FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1490,8 +1490,8 @@ CmiStartLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtWriteFile() failed (Status %lx)\n", Status);
|
DPRINT1("ZwWriteFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1501,40 +1501,40 @@ CmiStartLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
|
|
||||||
/* Truncate log file */
|
/* Truncate log file */
|
||||||
EndOfFileInfo.EndOfFile.QuadPart = FileOffset.QuadPart;
|
EndOfFileInfo.EndOfFile.QuadPart = FileOffset.QuadPart;
|
||||||
Status = NtSetInformationFile(FileHandle,
|
Status = ZwSetInformationFile(FileHandle,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
&EndOfFileInfo,
|
&EndOfFileInfo,
|
||||||
sizeof(FILE_END_OF_FILE_INFORMATION),
|
sizeof(FILE_END_OF_FILE_INFORMATION),
|
||||||
FileEndOfFileInformation);
|
FileEndOfFileInformation);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtSetInformationFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwSetInformationFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAllocationInfo.AllocationSize.QuadPart = FileOffset.QuadPart;
|
FileAllocationInfo.AllocationSize.QuadPart = FileOffset.QuadPart;
|
||||||
Status = NtSetInformationFile(FileHandle,
|
Status = ZwSetInformationFile(FileHandle,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
&FileAllocationInfo,
|
&FileAllocationInfo,
|
||||||
sizeof(FILE_ALLOCATION_INFORMATION),
|
sizeof(FILE_ALLOCATION_INFORMATION),
|
||||||
FileAllocationInformation);
|
FileAllocationInformation);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtSetInformationFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwSetInformationFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush the log file */
|
/* Flush the log file */
|
||||||
Status = NtFlushBuffersFile(FileHandle,
|
Status = ZwFlushBuffersFile(FileHandle,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtFlushBuffersFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwFlushBuffersFile() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -1616,7 +1616,7 @@ CmiFinishLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
|
|
||||||
/* Write hive block and block bitmap */
|
/* Write hive block and block bitmap */
|
||||||
FileOffset.QuadPart = (ULONGLONG)0;
|
FileOffset.QuadPart = (ULONGLONG)0;
|
||||||
Status = NtWriteFile(FileHandle,
|
Status = ZwWriteFile(FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1627,8 +1627,8 @@ CmiFinishLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwWriteFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
ExFreePool(Buffer);
|
ExFreePool(Buffer);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -1636,14 +1636,14 @@ CmiFinishLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
ExFreePool(Buffer);
|
ExFreePool(Buffer);
|
||||||
|
|
||||||
/* Flush the log file */
|
/* Flush the log file */
|
||||||
Status = NtFlushBuffersFile(FileHandle,
|
Status = ZwFlushBuffersFile(FileHandle,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtFlushBuffersFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwFlushBuffersFile() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -1697,20 +1697,20 @@ CmiCleanupLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
|
|
||||||
/* Truncate log file */
|
/* Truncate log file */
|
||||||
EndOfFileInfo.EndOfFile.QuadPart = (ULONGLONG)BufferSize;
|
EndOfFileInfo.EndOfFile.QuadPart = (ULONGLONG)BufferSize;
|
||||||
Status = NtSetInformationFile(FileHandle,
|
Status = ZwSetInformationFile(FileHandle,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
&EndOfFileInfo,
|
&EndOfFileInfo,
|
||||||
sizeof(FILE_END_OF_FILE_INFORMATION),
|
sizeof(FILE_END_OF_FILE_INFORMATION),
|
||||||
FileEndOfFileInformation);
|
FileEndOfFileInformation);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtSetInformationFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwSetInformationFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileAllocationInfo.AllocationSize.QuadPart = (ULONGLONG)BufferSize;
|
FileAllocationInfo.AllocationSize.QuadPart = (ULONGLONG)BufferSize;
|
||||||
Status = NtSetInformationFile(FileHandle,
|
Status = ZwSetInformationFile(FileHandle,
|
||||||
&IoStatusBlock,
|
&IoStatusBlock,
|
||||||
&FileAllocationInfo,
|
&FileAllocationInfo,
|
||||||
sizeof(FILE_ALLOCATION_INFORMATION),
|
sizeof(FILE_ALLOCATION_INFORMATION),
|
||||||
|
@ -1718,19 +1718,19 @@ CmiCleanupLogUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtSetInformationFile() failed (Status %lx)\n", Status);
|
DPRINT("NtSetInformationFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush the log file */
|
/* Flush the log file */
|
||||||
Status = NtFlushBuffersFile(FileHandle,
|
Status = ZwFlushBuffersFile(FileHandle,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtFlushBuffersFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwFlushBuffersFile() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -1780,7 +1780,7 @@ CmiStartHiveUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
|
|
||||||
/* Write hive block */
|
/* Write hive block */
|
||||||
FileOffset.QuadPart = (ULONGLONG)0;
|
FileOffset.QuadPart = (ULONGLONG)0;
|
||||||
Status = NtWriteFile(FileHandle,
|
Status = ZwWriteFile(FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1791,8 +1791,8 @@ CmiStartHiveUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwWriteFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1819,7 +1819,7 @@ CmiStartHiveUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
DPRINT(" File offset %I64x\n", FileOffset.QuadPart);
|
DPRINT(" File offset %I64x\n", FileOffset.QuadPart);
|
||||||
|
|
||||||
/* Write hive block */
|
/* Write hive block */
|
||||||
Status = NtWriteFile(FileHandle,
|
Status = ZwWriteFile(FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1830,22 +1830,22 @@ CmiStartHiveUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwWriteFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockIndex++;
|
BlockIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NtFlushBuffersFile(FileHandle,
|
Status = ZwFlushBuffersFile(FileHandle,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtFlushBuffersFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwFlushBuffersFile() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -1892,7 +1892,7 @@ CmiFinishHiveUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
|
|
||||||
/* Write hive block */
|
/* Write hive block */
|
||||||
FileOffset.QuadPart = (ULONGLONG)0;
|
FileOffset.QuadPart = (ULONGLONG)0;
|
||||||
Status = NtWriteFile(FileHandle,
|
Status = ZwWriteFile(FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -1903,19 +1903,19 @@ CmiFinishHiveUpdate(PREGISTRY_HIVE RegistryHive)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwWriteFile() failed (Status %lx)\n", Status);
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NtFlushBuffersFile(FileHandle,
|
Status = ZwFlushBuffersFile(FileHandle,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtFlushBuffersFile() failed (Status %lx)\n", Status);
|
DPRINT("ZwFlushBuffersFile() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
@ -1939,7 +1939,7 @@ CmiFlushRegistryHive(PREGISTRY_HIVE RegistryHive)
|
||||||
&RegistryHive->LogFileName);
|
&RegistryHive->LogFileName);
|
||||||
|
|
||||||
/* Update hive header modification time */
|
/* Update hive header modification time */
|
||||||
NtQuerySystemTime(&RegistryHive->HiveHeader->DateModified);
|
ZwQuerySystemTime(&RegistryHive->HiveHeader->DateModified);
|
||||||
|
|
||||||
/* Start log update */
|
/* Start log update */
|
||||||
Status = CmiStartLogUpdate(RegistryHive);
|
Status = CmiStartLogUpdate(RegistryHive);
|
||||||
|
@ -2436,7 +2436,7 @@ CmiAddSubKey(PREGISTRY_HIVE RegistryHive,
|
||||||
{
|
{
|
||||||
NewKeyCell->Id = REG_KEY_CELL_ID;
|
NewKeyCell->Id = REG_KEY_CELL_ID;
|
||||||
NewKeyCell->Flags = 0;
|
NewKeyCell->Flags = 0;
|
||||||
NtQuerySystemTime(&NewKeyCell->LastWriteTime);
|
ZwQuerySystemTime(&NewKeyCell->LastWriteTime);
|
||||||
NewKeyCell->ParentKeyOffset = -1;
|
NewKeyCell->ParentKeyOffset = -1;
|
||||||
NewKeyCell->NumberOfSubKeys = 0;
|
NewKeyCell->NumberOfSubKeys = 0;
|
||||||
NewKeyCell->HashTableOffset = -1;
|
NewKeyCell->HashTableOffset = -1;
|
||||||
|
@ -2552,7 +2552,7 @@ CmiAddSubKey(PREGISTRY_HIVE RegistryHive,
|
||||||
ParentKeyCell->NumberOfSubKeys++;
|
ParentKeyCell->NumberOfSubKeys++;
|
||||||
}
|
}
|
||||||
|
|
||||||
NtQuerySystemTime (&ParentKeyCell->LastWriteTime);
|
ZwQuerySystemTime (&ParentKeyCell->LastWriteTime);
|
||||||
CmiMarkBlockDirty (RegistryHive, ParentKey->KeyCellOffset);
|
CmiMarkBlockDirty (RegistryHive, ParentKey->KeyCellOffset);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
|
@ -2710,7 +2710,7 @@ CmiRemoveSubKey(PREGISTRY_HIVE RegistryHive,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NtQuerySystemTime(&ParentKey->KeyCell->LastWriteTime);
|
ZwQuerySystemTime(&ParentKey->KeyCell->LastWriteTime);
|
||||||
CmiMarkBlockDirty(ParentKey->RegistryHive,
|
CmiMarkBlockDirty(ParentKey->RegistryHive,
|
||||||
ParentKey->KeyCellOffset);
|
ParentKey->KeyCellOffset);
|
||||||
}
|
}
|
||||||
|
@ -3210,7 +3210,7 @@ CmiDestroyValueCell(PREGISTRY_HIVE RegistryHive,
|
||||||
|
|
||||||
/* Update time of heap */
|
/* Update time of heap */
|
||||||
if (!IsNoFileHive(RegistryHive))
|
if (!IsNoFileHive(RegistryHive))
|
||||||
NtQuerySystemTime(&Bin->DateModified);
|
ZwQuerySystemTime(&Bin->DateModified);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy the value cell */
|
/* Destroy the value cell */
|
||||||
|
@ -3219,7 +3219,7 @@ CmiDestroyValueCell(PREGISTRY_HIVE RegistryHive,
|
||||||
/* Update time of heap */
|
/* Update time of heap */
|
||||||
if (!IsNoFileHive(RegistryHive) && CmiGetCell (RegistryHive, ValueCellOffset, &Bin))
|
if (!IsNoFileHive(RegistryHive) && CmiGetCell (RegistryHive, ValueCellOffset, &Bin))
|
||||||
{
|
{
|
||||||
NtQuerySystemTime(&Bin->DateModified);
|
ZwQuerySystemTime(&Bin->DateModified);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -3254,7 +3254,7 @@ CmiAddBin(PREGISTRY_HIVE RegistryHive,
|
||||||
RegistryHive->FileSize += BinSize;
|
RegistryHive->FileSize += BinSize;
|
||||||
tmpBin->BinSize = BinSize;
|
tmpBin->BinSize = BinSize;
|
||||||
tmpBin->Unused1 = 0;
|
tmpBin->Unused1 = 0;
|
||||||
NtQuerySystemTime(&tmpBin->DateModified);
|
ZwQuerySystemTime(&tmpBin->DateModified);
|
||||||
tmpBin->Unused2 = 0;
|
tmpBin->Unused2 = 0;
|
||||||
|
|
||||||
DPRINT (" BinOffset %lx BinSize %lx\n", tmpBin->BinOffset,tmpBin->BinSize);
|
DPRINT (" BinOffset %lx BinSize %lx\n", tmpBin->BinOffset,tmpBin->BinSize);
|
||||||
|
@ -3382,7 +3382,7 @@ CmiAllocateCell (PREGISTRY_HIVE RegistryHive,
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NtQuerySystemTime(&Bin->DateModified);
|
ZwQuerySystemTime(&Bin->DateModified);
|
||||||
CmiMarkBlockDirty(RegistryHive, RegistryHive->FreeListOffset[i]);
|
CmiMarkBlockDirty(RegistryHive, RegistryHive->FreeListOffset[i]);
|
||||||
|
|
||||||
if ((i + 1) < RegistryHive->FreeListSize)
|
if ((i + 1) < RegistryHive->FreeListSize)
|
||||||
|
@ -3471,7 +3471,7 @@ CmiDestroyCell (PREGISTRY_HIVE RegistryHive,
|
||||||
|
|
||||||
/* Update time of heap */
|
/* Update time of heap */
|
||||||
if (!IsNoFileHive(RegistryHive) && CmiGetCell (RegistryHive, CellOffset,&pBin))
|
if (!IsNoFileHive(RegistryHive) && CmiGetCell (RegistryHive, CellOffset,&pBin))
|
||||||
NtQuerySystemTime(&pBin->DateModified);
|
ZwQuerySystemTime(&pBin->DateModified);
|
||||||
|
|
||||||
CmiMarkBlockDirty(RegistryHive, CellOffset);
|
CmiMarkBlockDirty(RegistryHive, CellOffset);
|
||||||
}
|
}
|
||||||
|
@ -4247,7 +4247,7 @@ CmiSaveTempHive (PREGISTRY_HIVE Hive,
|
||||||
|
|
||||||
/* Write hive block */
|
/* Write hive block */
|
||||||
FileOffset.QuadPart = (ULONGLONG)0;
|
FileOffset.QuadPart = (ULONGLONG)0;
|
||||||
Status = NtWriteFile (FileHandle,
|
Status = ZwWriteFile (FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -4258,7 +4258,7 @@ CmiSaveTempHive (PREGISTRY_HIVE Hive,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1 ("NtWriteFile() failed (Status %lx)\n", Status);
|
DPRINT1 ("ZwWriteFile() failed (Status %lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4272,7 +4272,7 @@ CmiSaveTempHive (PREGISTRY_HIVE Hive,
|
||||||
DPRINT ("File offset %I64x\n", FileOffset.QuadPart);
|
DPRINT ("File offset %I64x\n", FileOffset.QuadPart);
|
||||||
|
|
||||||
/* Write hive block */
|
/* Write hive block */
|
||||||
Status = NtWriteFile (FileHandle,
|
Status = ZwWriteFile (FileHandle,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -4283,16 +4283,16 @@ CmiSaveTempHive (PREGISTRY_HIVE Hive,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1 ("NtWriteFile() failed (Status %lx)\n", Status);
|
DPRINT1 ("ZwWriteFile() failed (Status %lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NtFlushBuffersFile (FileHandle,
|
Status = ZwFlushBuffersFile (FileHandle,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1 ("NtFlushBuffersFile() failed (Status %lx)\n", Status);
|
DPRINT1 ("ZwFlushBuffersFile() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT ("CmiSaveTempHive() done\n");
|
DPRINT ("CmiSaveTempHive() done\n");
|
||||||
|
|
|
@ -73,7 +73,7 @@ CmiCheckSubKeys(BOOLEAN Verbose,
|
||||||
BufferSize = sizeof(KEY_NODE_INFORMATION) + 4096;
|
BufferSize = sizeof(KEY_NODE_INFORMATION) + 4096;
|
||||||
KeyInfo = ExAllocatePool(PagedPool, BufferSize);
|
KeyInfo = ExAllocatePool(PagedPool, BufferSize);
|
||||||
|
|
||||||
Status = NtEnumerateKey(Key,
|
Status = ZwEnumerateKey(Key,
|
||||||
Index,
|
Index,
|
||||||
KeyNodeInformation,
|
KeyNodeInformation,
|
||||||
KeyInfo,
|
KeyInfo,
|
||||||
|
@ -111,7 +111,7 @@ CmiCheckSubKeys(BOOLEAN Verbose,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtOpenKey(&SubKey,
|
Status = ZwOpenKey(&SubKey,
|
||||||
KEY_ALL_ACCESS,
|
KEY_ALL_ACCESS,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ CmiCheckSubKeys(BOOLEAN Verbose,
|
||||||
|
|
||||||
CmiCheckKey(Verbose, SubKey);
|
CmiCheckKey(Verbose, SubKey);
|
||||||
|
|
||||||
NtClose(SubKey);
|
ZwClose(SubKey);
|
||||||
|
|
||||||
Index++;
|
Index++;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ CmiCheckValues(BOOLEAN Verbose,
|
||||||
BufferSize = sizeof(KEY_NODE_INFORMATION) + 4096;
|
BufferSize = sizeof(KEY_NODE_INFORMATION) + 4096;
|
||||||
ValueInfo = ExAllocatePool(PagedPool, BufferSize);
|
ValueInfo = ExAllocatePool(PagedPool, BufferSize);
|
||||||
|
|
||||||
Status = NtEnumerateValueKey(Key,
|
Status = ZwEnumerateValueKey(Key,
|
||||||
Index,
|
Index,
|
||||||
KeyNodeInformation,
|
KeyNodeInformation,
|
||||||
ValueInfo,
|
ValueInfo,
|
||||||
|
@ -209,7 +209,7 @@ CmiCheckByName(BOOLEAN Verbose,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtOpenKey(&Key,
|
Status = ZwOpenKey(&Key,
|
||||||
KEY_ALL_ACCESS,
|
KEY_ALL_ACCESS,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ CmiCheckByName(BOOLEAN Verbose,
|
||||||
|
|
||||||
CmiCheckKey(Verbose, Key);
|
CmiCheckKey(Verbose, Key);
|
||||||
|
|
||||||
NtClose(Key);
|
ZwClose(Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ CmInitializeRegistry(VOID)
|
||||||
0,
|
0,
|
||||||
RootKeyHandle,
|
RootKeyHandle,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtCreateKey(&KeyHandle,
|
Status = ZwCreateKey(&KeyHandle,
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
0,
|
0,
|
||||||
|
@ -358,7 +358,7 @@ CmInitializeRegistry(VOID)
|
||||||
0,
|
0,
|
||||||
RootKeyHandle,
|
RootKeyHandle,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtCreateKey(&KeyHandle,
|
Status = ZwCreateKey(&KeyHandle,
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
0,
|
0,
|
||||||
|
@ -541,7 +541,7 @@ CmiCreateCurrentControlSetLink(VOID)
|
||||||
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_OPENLINK,
|
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_OPENLINK,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtCreateKey(&KeyHandle,
|
Status = ZwCreateKey(&KeyHandle,
|
||||||
KEY_ALL_ACCESS | KEY_CREATE_LINK,
|
KEY_ALL_ACCESS | KEY_CREATE_LINK,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
0,
|
0,
|
||||||
|
@ -550,13 +550,13 @@ CmiCreateCurrentControlSetLink(VOID)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status);
|
DPRINT1("ZwCreateKey() failed (Status %lx)\n", Status);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlRosInitUnicodeStringFromLiteral(&LinkValue,
|
RtlRosInitUnicodeStringFromLiteral(&LinkValue,
|
||||||
L"SymbolicLinkValue");
|
L"SymbolicLinkValue");
|
||||||
Status = NtSetValueKey(KeyHandle,
|
Status = ZwSetValueKey(KeyHandle,
|
||||||
&LinkValue,
|
&LinkValue,
|
||||||
0,
|
0,
|
||||||
REG_LINK,
|
REG_LINK,
|
||||||
|
@ -564,10 +564,10 @@ CmiCreateCurrentControlSetLink(VOID)
|
||||||
TargetNameLength);
|
TargetNameLength);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
|
DPRINT1("ZwSetValueKey() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NtClose(KeyHandle);
|
ZwClose(KeyHandle);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -721,7 +721,7 @@ CmiDisconnectHive (IN POBJECT_ATTRIBUTES KeyObjectAttributes,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
(PVOID*)&KeyObject,
|
(PVOID*)&KeyObject,
|
||||||
NULL);
|
NULL);
|
||||||
NtClose (KeyHandle);
|
ZwClose (KeyHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1 ("ObReferenceObjectByName() failed (Status %lx)\n", Status);
|
DPRINT1 ("ObReferenceObjectByName() failed (Status %lx)\n", Status);
|
||||||
|
@ -776,7 +776,7 @@ CmiInitControlSetLink (VOID)
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtCreateKey (&KeyHandle,
|
Status = ZwCreateKey (&KeyHandle,
|
||||||
KEY_ALL_ACCESS,
|
KEY_ALL_ACCESS,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
0,
|
0,
|
||||||
|
@ -785,10 +785,10 @@ CmiInitControlSetLink (VOID)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1 ("NtCreateKey() failed (Status %lx)\n", Status);
|
DPRINT1 ("ZwCreateKey() failed (Status %lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
NtClose (KeyHandle);
|
ZwClose (KeyHandle);
|
||||||
|
|
||||||
/* Link 'CurrentControlSet' to 'ControlSet001' key */
|
/* Link 'CurrentControlSet' to 'ControlSet001' key */
|
||||||
RtlRosInitUnicodeStringFromLiteral (&ControlSetLinkName,
|
RtlRosInitUnicodeStringFromLiteral (&ControlSetLinkName,
|
||||||
|
@ -798,7 +798,7 @@ CmiInitControlSetLink (VOID)
|
||||||
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_OPENLINK,
|
OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_OPENLINK,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtCreateKey (&KeyHandle,
|
Status = ZwCreateKey (&KeyHandle,
|
||||||
KEY_ALL_ACCESS | KEY_CREATE_LINK,
|
KEY_ALL_ACCESS | KEY_CREATE_LINK,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
0,
|
0,
|
||||||
|
@ -807,13 +807,13 @@ CmiInitControlSetLink (VOID)
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1 ("NtCreateKey() failed (Status %lx)\n", Status);
|
DPRINT1 ("ZwCreateKey() failed (Status %lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlRosInitUnicodeStringFromLiteral (&ControlSetValueName,
|
RtlRosInitUnicodeStringFromLiteral (&ControlSetValueName,
|
||||||
L"SymbolicLinkValue");
|
L"SymbolicLinkValue");
|
||||||
Status = NtSetValueKey (KeyHandle,
|
Status = ZwSetValueKey (KeyHandle,
|
||||||
&ControlSetValueName,
|
&ControlSetValueName,
|
||||||
0,
|
0,
|
||||||
REG_LINK,
|
REG_LINK,
|
||||||
|
@ -821,9 +821,9 @@ CmiInitControlSetLink (VOID)
|
||||||
ControlSetKeyName.Length);
|
ControlSetKeyName.Length);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1 ("NtSetValueKey() failed (Status %lx)\n", Status);
|
DPRINT1 ("ZwSetValueKey() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
NtClose (KeyHandle);
|
ZwClose (KeyHandle);
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -859,12 +859,12 @@ CmiInitHives(BOOLEAN SetupBoot)
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtOpenKey(&KeyHandle,
|
Status = ZwOpenKey(&KeyHandle,
|
||||||
KEY_ALL_ACCESS,
|
KEY_ALL_ACCESS,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
|
DPRINT1("ZwOpenKey() failed (Status %lx)\n", Status);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -876,17 +876,17 @@ CmiInitHives(BOOLEAN SetupBoot)
|
||||||
BufferSize);
|
BufferSize);
|
||||||
if (ValueInfo == NULL)
|
if (ValueInfo == NULL)
|
||||||
{
|
{
|
||||||
NtClose(KeyHandle);
|
ZwClose(KeyHandle);
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = NtQueryValueKey(KeyHandle,
|
Status = ZwQueryValueKey(KeyHandle,
|
||||||
&ValueName,
|
&ValueName,
|
||||||
KeyValuePartialInformation,
|
KeyValuePartialInformation,
|
||||||
ValueInfo,
|
ValueInfo,
|
||||||
BufferSize,
|
BufferSize,
|
||||||
&ResultSize);
|
&ResultSize);
|
||||||
NtClose(KeyHandle);
|
ZwClose(KeyHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePool(ValueInfo);
|
ExFreePool(ValueInfo);
|
||||||
|
|
|
@ -72,12 +72,12 @@ ExpLoadUuidSequence(PULONG Sequence)
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtOpenKey(&KeyHandle,
|
Status = ZwOpenKey(&KeyHandle,
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
|
DPRINT("ZwOpenKey() failed (Status %lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,16 +85,16 @@ ExpLoadUuidSequence(PULONG Sequence)
|
||||||
L"UuidSequenceNumber");
|
L"UuidSequenceNumber");
|
||||||
|
|
||||||
ValueInfo = (PKEY_VALUE_PARTIAL_INFORMATION)ValueBuffer;
|
ValueInfo = (PKEY_VALUE_PARTIAL_INFORMATION)ValueBuffer;
|
||||||
Status = NtQueryValueKey(KeyHandle,
|
Status = ZwQueryValueKey(KeyHandle,
|
||||||
&Name,
|
&Name,
|
||||||
KeyValuePartialInformation,
|
KeyValuePartialInformation,
|
||||||
ValueBuffer,
|
ValueBuffer,
|
||||||
VALUE_BUFFER_SIZE,
|
VALUE_BUFFER_SIZE,
|
||||||
&ValueLength);
|
&ValueLength);
|
||||||
NtClose(KeyHandle);
|
ZwClose(KeyHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtQueryValueKey() failed (Status %lx)\n", Status);
|
DPRINT("ZwQueryValueKey() failed (Status %lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,27 +122,27 @@ ExpSaveUuidSequence(PULONG Sequence)
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
Status = NtOpenKey(&KeyHandle,
|
Status = ZwOpenKey(&KeyHandle,
|
||||||
KEY_SET_VALUE,
|
KEY_SET_VALUE,
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
|
DPRINT("ZwOpenKey() failed (Status %lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlInitUnicodeString(&Name,
|
RtlInitUnicodeString(&Name,
|
||||||
L"UuidSequenceNumber");
|
L"UuidSequenceNumber");
|
||||||
Status = NtSetValueKey(KeyHandle,
|
Status = ZwSetValueKey(KeyHandle,
|
||||||
&Name,
|
&Name,
|
||||||
0,
|
0,
|
||||||
REG_DWORD,
|
REG_DWORD,
|
||||||
Sequence,
|
Sequence,
|
||||||
sizeof(ULONG));
|
sizeof(ULONG));
|
||||||
NtClose(KeyHandle);
|
ZwClose(KeyHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("NtSetValueKey() failed (Status %lx)\n", Status);
|
DPRINT("ZwSetValueKey() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
Loading…
Reference in a new issue