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