- Assign an instance path to the root device node and reports its arrival.

svn path=/trunk/; revision=13456
This commit is contained in:
Eric Kohl 2005-02-07 10:33:44 +00:00
parent e4e9497fb0
commit 30b7d49ae6
12 changed files with 159 additions and 141 deletions

View file

@ -207,32 +207,32 @@ IopCheckCdromDevices(PULONG DeviceNumber)
NULL, NULL,
NULL); NULL);
Status = NtOpenFile(&Handle, Status = ZwOpenFile(&Handle,
FILE_ALL_ACCESS, FILE_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
0, 0,
0); 0);
DPRINT("NtOpenFile() DeviceNumber %lu Status %lx\n", i, Status); DPRINT("ZwOpenFile() DeviceNumber %lu Status %lx\n", i, Status);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
Status = NtQueryVolumeInformationFile(Handle, Status = ZwQueryVolumeInformationFile(Handle,
&IoStatusBlock, &IoStatusBlock,
FileFsVolume, FileFsVolume,
FS_VOLUME_BUFFER_SIZE, FS_VOLUME_BUFFER_SIZE,
FileFsVolumeInformation); FileFsVolumeInformation);
DPRINT("NtQueryVolumeInformationFile() Status %lx\n", Status); DPRINT("ZwQueryVolumeInformationFile() Status %lx\n", Status);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
DPRINT("VolumeLabel: '%S'\n", FileFsVolume->VolumeLabel); DPRINT("VolumeLabel: '%S'\n", FileFsVolume->VolumeLabel);
if (_wcsicmp(FileFsVolume->VolumeLabel, L"REACTOS") == 0) if (_wcsicmp(FileFsVolume->VolumeLabel, L"REACTOS") == 0)
{ {
NtClose(Handle); ZwClose(Handle);
*DeviceNumber = i; *DeviceNumber = i;
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
} }
NtClose(Handle); ZwClose(Handle);
} }
#endif #endif
@ -252,17 +252,17 @@ IopCheckCdromDevices(PULONG DeviceNumber)
NULL, NULL,
NULL); NULL);
Status = NtOpenFile(&Handle, Status = ZwOpenFile(&Handle,
FILE_ALL_ACCESS, FILE_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
0, 0,
0); 0);
DPRINT("NtOpenFile() DeviceNumber %lu Status %lx\n", i, Status); DPRINT("ZwOpenFile() DeviceNumber %lu Status %lx\n", i, Status);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
DPRINT("Found ntoskrnl.exe on Cdrom%lu\n", i); DPRINT("Found ntoskrnl.exe on Cdrom%lu\n", i);
NtClose(Handle); ZwClose(Handle);
*DeviceNumber = i; *DeviceNumber = i;
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
@ -283,17 +283,17 @@ IopCheckCdromDevices(PULONG DeviceNumber)
NULL, NULL,
NULL); NULL);
Status = NtOpenFile(&Handle, Status = ZwOpenFile(&Handle,
FILE_ALL_ACCESS, FILE_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
0, 0,
0); 0);
DPRINT("NtOpenFile() DeviceNumber %lu Status %lx\n", i, Status); DPRINT("ZwOpenFile() DeviceNumber %lu Status %lx\n", i, Status);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
DPRINT("Found ntoskrnl.exe on Cdrom%lu\n", i); DPRINT("Found ntoskrnl.exe on Cdrom%lu\n", i);
NtClose(Handle); ZwClose(Handle);
*DeviceNumber = i; *DeviceNumber = i;
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
@ -407,14 +407,14 @@ IoCreateSystemRootLink(PCHAR ParameterLine)
NULL, NULL,
NULL); NULL);
Status = NtOpenSymbolicLinkObject(&Handle, Status = ZwOpenSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
RtlFreeUnicodeString(&BootPath); RtlFreeUnicodeString(&BootPath);
RtlFreeUnicodeString(&DeviceName); RtlFreeUnicodeString(&DeviceName);
CPRINT("NtOpenSymbolicLinkObject() '%wZ' failed (Status %x)\n", CPRINT("ZwOpenSymbolicLinkObject() '%wZ' failed (Status %x)\n",
&ArcName, &ArcName,
Status); Status);
RtlFreeUnicodeString(&ArcName); RtlFreeUnicodeString(&ArcName);
@ -423,15 +423,15 @@ IoCreateSystemRootLink(PCHAR ParameterLine)
} }
RtlFreeUnicodeString(&ArcName); RtlFreeUnicodeString(&ArcName);
Status = NtQuerySymbolicLinkObject(Handle, Status = ZwQuerySymbolicLinkObject(Handle,
&DeviceName, &DeviceName,
&Length); &Length);
NtClose (Handle); ZwClose (Handle);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
RtlFreeUnicodeString(&BootPath); RtlFreeUnicodeString(&BootPath);
RtlFreeUnicodeString(&DeviceName); RtlFreeUnicodeString(&DeviceName);
CPRINT("NtQuerySymbolicObject() failed (Status %x)\n", CPRINT("ZwQuerySymbolicObject() failed (Status %x)\n",
Status); Status);
return(Status); return(Status);
@ -466,7 +466,7 @@ IoCreateSystemRootLink(PCHAR ParameterLine)
NULL, NULL,
NULL); NULL);
Status = NtOpenFile(&Handle, Status = ZwOpenFile(&Handle,
FILE_ALL_ACCESS, FILE_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
@ -474,12 +474,12 @@ IoCreateSystemRootLink(PCHAR ParameterLine)
0); 0);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
CPRINT("NtOpenFile() failed to open '\\SystemRoot' (Status %x)\n", CPRINT("ZwOpenFile() failed to open '\\SystemRoot' (Status %x)\n",
Status); Status);
return(Status); return(Status);
} }
NtClose(Handle); ZwClose(Handle);
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }

View file

@ -86,12 +86,12 @@ IopBootLog(PUNICODE_STRING DriverName,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
NULL, NULL,
NULL); NULL);
Status = NtOpenKey(&ControlSetKey, Status = ZwOpenKey(&ControlSetKey,
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);
ExReleaseResourceLite(&IopBootLogResource); ExReleaseResourceLite(&IopBootLogResource);
return; return;
} }
@ -102,7 +102,7 @@ IopBootLog(PUNICODE_STRING DriverName,
OBJ_CASE_INSENSITIVE | OBJ_OPENIF, OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
ControlSetKey, ControlSetKey,
NULL); NULL);
Status = NtCreateKey(&BootLogKey, Status = ZwCreateKey(&BootLogKey,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
0, 0,
@ -111,21 +111,21 @@ IopBootLog(PUNICODE_STRING DriverName,
NULL); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtCreateKey() failed (Status %lx)\n", Status); DPRINT1("ZwCreateKey() failed (Status %lx)\n", Status);
NtClose(ControlSetKey); ZwClose(ControlSetKey);
ExReleaseResourceLite(&IopBootLogResource); ExReleaseResourceLite(&IopBootLogResource);
return; return;
} }
RtlInitUnicodeString(&ValueName, ValueNameBuffer); RtlInitUnicodeString(&ValueName, ValueNameBuffer);
Status = NtSetValueKey(BootLogKey, Status = ZwSetValueKey(BootLogKey,
&ValueName, &ValueName,
0, 0,
REG_SZ, REG_SZ,
(PVOID)Buffer, (PVOID)Buffer,
(wcslen(Buffer) + 1) * sizeof(WCHAR)); (wcslen(Buffer) + 1) * sizeof(WCHAR));
NtClose(BootLogKey); ZwClose(BootLogKey);
NtClose(ControlSetKey); ZwClose(ControlSetKey);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -160,7 +160,7 @@ IopWriteLogFile(PWSTR LogText)
NULL, NULL,
NULL); NULL);
Status = NtCreateFile(&FileHandle, Status = ZwCreateFile(&FileHandle,
FILE_APPEND_DATA, FILE_APPEND_DATA,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
@ -173,13 +173,13 @@ IopWriteLogFile(PWSTR LogText)
0); 0);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtCreateFile() failed (Status %lx)\n", Status); DPRINT1("ZwCreateFile() failed (Status %lx)\n", Status);
return Status; return Status;
} }
if (LogText != NULL) if (LogText != NULL)
{ {
Status = NtWriteFile(FileHandle, Status = ZwWriteFile(FileHandle,
NULL, NULL,
NULL, NULL,
NULL, NULL,
@ -190,14 +190,14 @@ IopWriteLogFile(PWSTR LogText)
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;
} }
} }
/* L"\r\n" */ /* L"\r\n" */
Status = NtWriteFile(FileHandle, Status = ZwWriteFile(FileHandle,
NULL, NULL,
NULL, NULL,
NULL, NULL,
@ -207,11 +207,11 @@ IopWriteLogFile(PWSTR LogText)
NULL, NULL,
NULL); NULL);
NtClose(FileHandle); ZwClose(FileHandle);
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;
@ -241,7 +241,7 @@ IopCreateLogFile(VOID)
NULL, NULL,
NULL); NULL);
Status = NtCreateFile(&FileHandle, Status = ZwCreateFile(&FileHandle,
FILE_ALL_ACCESS, FILE_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
&IoStatusBlock, &IoStatusBlock,
@ -254,14 +254,14 @@ IopCreateLogFile(VOID)
0); 0);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtCreateFile() failed (Status %lx)\n", Status); DPRINT1("ZwCreateFile() failed (Status %lx)\n", Status);
return Status; return Status;
} }
ByteOffset.QuadPart = (LONGLONG)0; ByteOffset.QuadPart = (LONGLONG)0;
Signature = 0xFEFF; Signature = 0xFEFF;
Status = NtWriteFile(FileHandle, Status = ZwWriteFile(FileHandle,
NULL, NULL,
NULL, NULL,
NULL, NULL,
@ -272,10 +272,10 @@ IopCreateLogFile(VOID)
NULL); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtWriteKey() failed (Status %lx)\n", Status); DPRINT1("ZwWriteKey() failed (Status %lx)\n", Status);
} }
NtClose(FileHandle); ZwClose(FileHandle);
return Status; return Status;
} }
@ -344,7 +344,7 @@ IopSaveBootLogToFile(VOID)
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))
@ -363,7 +363,7 @@ IopSaveBootLogToFile(VOID)
RtlInitUnicodeString(&ValueName, RtlInitUnicodeString(&ValueName,
ValueNameBuffer); ValueNameBuffer);
Status = NtQueryValueKey(KeyHandle, Status = ZwQueryValueKey(KeyHandle,
&ValueName, &ValueName,
KeyValuePartialInformation, KeyValuePartialInformation,
KeyInfo, KeyInfo,
@ -377,7 +377,7 @@ IopSaveBootLogToFile(VOID)
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
CHECKPOINT1; CHECKPOINT1;
NtClose(KeyHandle); ZwClose(KeyHandle);
ExFreePool(KeyInfo); ExFreePool(KeyInfo);
ExReleaseResourceLite(&IopBootLogResource); ExReleaseResourceLite(&IopBootLogResource);
return; return;
@ -387,18 +387,18 @@ IopSaveBootLogToFile(VOID)
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
CHECKPOINT1; CHECKPOINT1;
NtClose(KeyHandle); ZwClose(KeyHandle);
ExFreePool(KeyInfo); ExFreePool(KeyInfo);
ExReleaseResourceLite(&IopBootLogResource); ExReleaseResourceLite(&IopBootLogResource);
return; return;
} }
/* Delete keys */ /* Delete keys */
NtDeleteValueKey(KeyHandle, ZwDeleteValueKey(KeyHandle,
&ValueName); &ValueName);
} }
NtClose(KeyHandle); ZwClose(KeyHandle);
ExFreePool(KeyInfo); ExFreePool(KeyInfo);

View file

@ -339,7 +339,7 @@ IoGetDeviceObjectPointer(
NULL, NULL,
NULL); NULL);
Status = NtOpenFile( Status = ZwOpenFile(
&FileHandle, &FileHandle,
DesiredAccess, DesiredAccess,
&ObjectAttributes, &ObjectAttributes,
@ -364,7 +364,7 @@ IoGetDeviceObjectPointer(
*FileObject = LocalFileObject; *FileObject = LocalFileObject;
} }
NtClose(FileHandle); ZwClose(FileHandle);
return Status; return Status;
} }

View file

@ -959,7 +959,7 @@ IoCreateDriverList(VOID)
NULL, NULL,
NULL); NULL);
Status = NtOpenKey(&KeyHandle, Status = ZwOpenKey(&KeyHandle,
0x10001, 0x10001,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
@ -971,14 +971,14 @@ IoCreateDriverList(VOID)
KeyInfo = ExAllocatePool(NonPagedPool, KeyInfoLength); KeyInfo = ExAllocatePool(NonPagedPool, KeyInfoLength);
if (KeyInfo == NULL) if (KeyInfo == NULL)
{ {
NtClose(KeyHandle); ZwClose(KeyHandle);
return(STATUS_INSUFFICIENT_RESOURCES); return(STATUS_INSUFFICIENT_RESOURCES);
} }
Index = 0; Index = 0;
while (TRUE) while (TRUE)
{ {
Status = NtEnumerateKey(KeyHandle, Status = ZwEnumerateKey(KeyHandle,
Index, Index,
KeyBasicInformation, KeyBasicInformation,
KeyInfo, KeyInfo,
@ -1006,7 +1006,7 @@ IoCreateDriverList(VOID)
} }
ExFreePool(KeyInfo); ExFreePool(KeyInfo);
NtClose(KeyHandle); ZwClose(KeyHandle);
DPRINT("IoCreateDriverList() done\n"); DPRINT("IoCreateDriverList() done\n");
@ -1270,7 +1270,7 @@ IopLoadDriver(PSERVICE Service)
NTSTATUS Status = STATUS_UNSUCCESSFUL; NTSTATUS Status = STATUS_UNSUCCESSFUL;
IopDisplayLoadingMessage(Service->ServiceName.Buffer); IopDisplayLoadingMessage(Service->ServiceName.Buffer);
Status = NtLoadDriver(&Service->RegistryPath); Status = ZwLoadDriver(&Service->RegistryPath);
IopBootLog(&Service->ImagePath, NT_SUCCESS(Status) ? TRUE : FALSE); IopBootLog(&Service->ImagePath, NT_SUCCESS(Status) ? TRUE : FALSE);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {

View file

@ -135,7 +135,7 @@ IopConnectLogPort (VOID)
RtlInitUnicodeString (&PortName, RtlInitUnicodeString (&PortName,
L"\\ErrorLogPort"); L"\\ErrorLogPort");
Status = NtConnectPort (&IopLogPort, Status = ZwConnectPort (&IopLogPort,
&PortName, &PortName,
NULL, NULL,
NULL, NULL,
@ -145,7 +145,7 @@ IopConnectLogPort (VOID)
NULL); NULL);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT ("NtConnectPort() failed (Status %lx)\n", Status); DPRINT ("ZwConnectPort() failed (Status %lx)\n", Status);
return FALSE; return FALSE;
} }
@ -290,7 +290,7 @@ IopLogWorker (PVOID Parameter)
Request->Header.DataSize + sizeof(LPC_MESSAGE); Request->Header.DataSize + sizeof(LPC_MESSAGE);
/* Send the error message to the log port */ /* Send the error message to the log port */
Status = NtRequestPort (IopLogPort, Status = ZwRequestPort (IopLogPort,
&Request->Header); &Request->Header);
/* Release request buffer */ /* Release request buffer */
@ -298,7 +298,7 @@ IopLogWorker (PVOID Parameter)
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT ("NtRequestPort() failed (Status %lx)\n", Status); DPRINT ("ZwRequestPort() failed (Status %lx)\n", Status);
/* Requeue log message and restart the worker */ /* Requeue log message and restart the worker */
ExInterlockedInsertTailList (&IopLogListHead, ExInterlockedInsertTailList (&IopLogListHead,

View file

@ -32,14 +32,14 @@ static GENERIC_MAPPING ExIoCompletionMapping =
NTSTATUS NTSTATUS
STDCALL STDCALL
NtpCreateIoCompletion( IopCreateIoCompletion(
PVOID ObjectBody, PVOID ObjectBody,
PVOID Parent, PVOID Parent,
PWSTR RemainingPath, PWSTR RemainingPath,
POBJECT_ATTRIBUTES ObjectAttributes POBJECT_ATTRIBUTES ObjectAttributes
) )
{ {
DPRINT("NtpCreateIoCompletion(ObjectBody %x, Parent %x, RemainingPath %S)\n", DPRINT("IopCreateIoCompletion(ObjectBody %x, Parent %x, RemainingPath %S)\n",
ObjectBody, Parent, RemainingPath); ObjectBody, Parent, RemainingPath);
if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL) if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
@ -51,11 +51,11 @@ NtpCreateIoCompletion(
} }
VOID STDCALL VOID STDCALL
NtpDeleteIoCompletion(PVOID ObjectBody) IopDeleteIoCompletion(PVOID ObjectBody)
{ {
PKQUEUE Queue = ObjectBody; PKQUEUE Queue = ObjectBody;
DPRINT("NtpDeleteIoCompletion()\n"); DPRINT("IopDeleteIoCompletion()\n");
KeRundownQueue(Queue); KeRundownQueue(Queue);
} }
@ -132,12 +132,12 @@ IopInitIoCompletionImplementation(VOID)
ExIoCompletionType->Dump = NULL; ExIoCompletionType->Dump = NULL;
ExIoCompletionType->Open = NULL; ExIoCompletionType->Open = NULL;
ExIoCompletionType->Close = NULL; ExIoCompletionType->Close = NULL;
ExIoCompletionType->Delete = NtpDeleteIoCompletion; ExIoCompletionType->Delete = IopDeleteIoCompletion;
ExIoCompletionType->Parse = NULL; ExIoCompletionType->Parse = NULL;
ExIoCompletionType->Security = NULL; ExIoCompletionType->Security = NULL;
ExIoCompletionType->QueryName = NULL; ExIoCompletionType->QueryName = NULL;
ExIoCompletionType->OkayToClose = NULL; ExIoCompletionType->OkayToClose = NULL;
ExIoCompletionType->Create = NtpCreateIoCompletion; ExIoCompletionType->Create = IopCreateIoCompletion;
ExIoCompletionType->DuplicationNotify = NULL; ExIoCompletionType->DuplicationNotify = NULL;
ExInitializeNPagedLookasideList(&IoCompletionPacketLookaside, ExInitializeNPagedLookasideList(&IoCompletionPacketLookaside,

View file

@ -465,7 +465,7 @@ IoInit (VOID)
0, 0,
NULL, NULL,
NULL); NULL);
NtCreateDirectoryObject(&Handle, ZwCreateDirectoryObject(&Handle,
0, 0,
&ObjectAttributes); &ObjectAttributes);
@ -479,7 +479,7 @@ IoInit (VOID)
0, 0,
NULL, NULL,
NULL); NULL);
NtCreateDirectoryObject(&Handle, ZwCreateDirectoryObject(&Handle,
0, 0,
&ObjectAttributes); &ObjectAttributes);

View file

@ -791,7 +791,7 @@ IopCreateDeviceKeyPath(PWSTR Path,
DPRINT("Create '%S'\n", KeyName.Buffer); DPRINT("Create '%S'\n", KeyName.Buffer);
Status = NtCreateKey (&KeyHandle, Status = ZwCreateKey (&KeyHandle,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
0, 0,
@ -800,7 +800,7 @@ IopCreateDeviceKeyPath(PWSTR Path,
NULL); NULL);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS (Status))
{ {
DPRINT ("NtCreateKey() failed with status %x\n", Status); DPRINT ("ZwCreateKey() failed with status %x\n", Status);
return Status; return Status;
} }
@ -811,7 +811,7 @@ IopCreateDeviceKeyPath(PWSTR Path,
} }
else else
{ {
NtClose (KeyHandle); ZwClose (KeyHandle);
*Next = L'\\'; *Next = L'\\';
} }
@ -843,7 +843,7 @@ IopSetDeviceInstanceData(HANDLE InstanceKey,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
InstanceKey, InstanceKey,
NULL); NULL);
Status = NtCreateKey(&LogConfKey, Status = ZwCreateKey(&LogConfKey,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
0, 0,
@ -862,7 +862,7 @@ IopSetDeviceInstanceData(HANDLE InstanceKey,
RtlInitUnicodeString(&KeyName, RtlInitUnicodeString(&KeyName,
L"BootConfig"); L"BootConfig");
Status = NtSetValueKey(LogConfKey, Status = ZwSetValueKey(LogConfKey,
&KeyName, &KeyName,
0, 0,
REG_RESOURCE_LIST, REG_RESOURCE_LIST,
@ -877,7 +877,7 @@ IopSetDeviceInstanceData(HANDLE InstanceKey,
{ {
RtlInitUnicodeString(&KeyName, RtlInitUnicodeString(&KeyName,
L"BasicConfigVector"); L"BasicConfigVector");
Status = NtSetValueKey(LogConfKey, Status = ZwSetValueKey(LogConfKey,
&KeyName, &KeyName,
0, 0,
REG_RESOURCE_REQUIREMENTS_LIST, REG_RESOURCE_REQUIREMENTS_LIST,
@ -885,7 +885,7 @@ IopSetDeviceInstanceData(HANDLE InstanceKey,
DeviceNode->ResourceRequirements->ListSize); DeviceNode->ResourceRequirements->ListSize);
} }
NtClose(LogConfKey); ZwClose(LogConfKey);
} }
DPRINT("IopSetDeviceInstanceData() done\n"); DPRINT("IopSetDeviceInstanceData() done\n");
@ -1069,7 +1069,7 @@ IopActionInterrogateDeviceStack(
/* Set 'Capabilities' value */ /* Set 'Capabilities' value */
RtlInitUnicodeString(&ValueName, RtlInitUnicodeString(&ValueName,
L"Capabilities"); L"Capabilities");
Status = NtSetValueKey(InstanceKey, Status = ZwSetValueKey(InstanceKey,
&ValueName, &ValueName,
0, 0,
REG_DWORD, REG_DWORD,
@ -1081,7 +1081,7 @@ IopActionInterrogateDeviceStack(
{ {
RtlInitUnicodeString(&ValueName, RtlInitUnicodeString(&ValueName,
L"UINumber"); L"UINumber");
Status = NtSetValueKey(InstanceKey, Status = ZwSetValueKey(InstanceKey,
&ValueName, &ValueName,
0, 0,
REG_DWORD, REG_DWORD,
@ -1120,7 +1120,7 @@ IopActionInterrogateDeviceStack(
RtlInitUnicodeString(&ValueName, RtlInitUnicodeString(&ValueName,
L"HardwareID"); L"HardwareID");
Status = NtSetValueKey(InstanceKey, Status = ZwSetValueKey(InstanceKey,
&ValueName, &ValueName,
0, 0,
REG_MULTI_SZ, REG_MULTI_SZ,
@ -1128,7 +1128,7 @@ IopActionInterrogateDeviceStack(
(TotalLength + 1) * sizeof(WCHAR)); (TotalLength + 1) * sizeof(WCHAR));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status); DPRINT1("ZwSetValueKey() failed (Status %lx)\n", Status);
} }
} }
else else
@ -1166,7 +1166,7 @@ IopActionInterrogateDeviceStack(
RtlInitUnicodeString(&ValueName, RtlInitUnicodeString(&ValueName,
L"CompatibleIDs"); L"CompatibleIDs");
Status = NtSetValueKey(InstanceKey, Status = ZwSetValueKey(InstanceKey,
&ValueName, &ValueName,
0, 0,
REG_MULTI_SZ, REG_MULTI_SZ,
@ -1174,7 +1174,7 @@ IopActionInterrogateDeviceStack(
(TotalLength + 1) * sizeof(WCHAR)); (TotalLength + 1) * sizeof(WCHAR));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status); DPRINT1("ZwSetValueKey() failed (Status %lx)\n", Status);
} }
} }
else else
@ -1196,7 +1196,7 @@ IopActionInterrogateDeviceStack(
{ {
RtlInitUnicodeString(&ValueName, RtlInitUnicodeString(&ValueName,
L"DeviceDesc"); L"DeviceDesc");
Status = NtSetValueKey(InstanceKey, Status = ZwSetValueKey(InstanceKey,
&ValueName, &ValueName,
0, 0,
REG_SZ, REG_SZ,
@ -1204,7 +1204,7 @@ IopActionInterrogateDeviceStack(
(wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR)); (wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status); DPRINT1("ZwSetValueKey() failed (Status %lx)\n", Status);
} }
} }
else else
@ -1226,7 +1226,7 @@ IopActionInterrogateDeviceStack(
DPRINT("LocationInformation: %S\n", (PWSTR)IoStatusBlock.Information); DPRINT("LocationInformation: %S\n", (PWSTR)IoStatusBlock.Information);
RtlInitUnicodeString(&ValueName, RtlInitUnicodeString(&ValueName,
L"LocationInformation"); L"LocationInformation");
Status = NtSetValueKey(InstanceKey, Status = ZwSetValueKey(InstanceKey,
&ValueName, &ValueName,
0, 0,
REG_SZ, REG_SZ,
@ -1234,7 +1234,7 @@ IopActionInterrogateDeviceStack(
(wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR)); (wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status); DPRINT1("ZwSetValueKey() failed (Status %lx)\n", Status);
} }
} }
else else
@ -1315,7 +1315,7 @@ IopActionInterrogateDeviceStack(
IopSetDeviceInstanceData(InstanceKey, DeviceNode); IopSetDeviceInstanceData(InstanceKey, DeviceNode);
} }
NtClose(InstanceKey); ZwClose(InstanceKey);
DeviceNode->Flags |= DNF_PROCESSED; DeviceNode->Flags |= DNF_PROCESSED;
@ -1733,7 +1733,7 @@ IopInvalidateDeviceRelations(
NULL, NULL,
NULL); NULL);
Status = NtOpenFile( Status = ZwOpenFile(
&Handle, &Handle,
FILE_ALL_ACCESS, FILE_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
@ -1743,7 +1743,7 @@ IopInvalidateDeviceRelations(
BootDrivers = NT_SUCCESS(Status) ? FALSE : TRUE; BootDrivers = NT_SUCCESS(Status) ? FALSE : TRUE;
NtClose(Handle); ZwClose(Handle);
/* /*
* Initialize services for discovered children. Only boot drivers will * Initialize services for discovered children. Only boot drivers will
@ -1805,6 +1805,18 @@ PnpInit(VOID)
KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0); KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
} }
if (!IopCreateUnicodeString(&IopRootDeviceNode->InstancePath,
L"HTREE\\Root\\0",
PagedPool))
{
CPRINT("Failed to create the instance path!\n");
KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, STATUS_UNSUCCESSFUL, 0, 0, 0);
}
/* Report the device to the user-mode pnp manager */
IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL,
&IopRootDeviceNode->InstancePath);
IopRootDeviceNode->PhysicalDeviceObject->Flags |= DO_BUS_ENUMERATED_DEVICE; IopRootDeviceNode->PhysicalDeviceObject->Flags |= DO_BUS_ENUMERATED_DEVICE;
PnpRootDriverEntry(IopRootDriverObject, NULL); PnpRootDriverEntry(IopRootDriverObject, NULL);
IopRootDriverObject->DriverExtension->AddDevice( IopRootDriverObject->DriverExtension->AddDevice(

View file

@ -20,7 +20,8 @@
/* DATA **********************************************************************/ /* DATA **********************************************************************/
typedef struct _PNPROOT_DEVICE { typedef struct _PNPROOT_DEVICE
{
// Entry on device list // Entry on device list
LIST_ENTRY ListEntry; LIST_ENTRY ListEntry;
// Physical Device Object of device // Physical Device Object of device
@ -35,7 +36,8 @@ typedef struct _PNPROOT_DEVICE {
UNICODE_STRING DeviceDescription; UNICODE_STRING DeviceDescription;
} PNPROOT_DEVICE, *PPNPROOT_DEVICE; } PNPROOT_DEVICE, *PPNPROOT_DEVICE;
typedef enum { typedef enum
{
dsStopped, dsStopped,
dsStarted, dsStarted,
dsPaused, dsPaused,
@ -285,10 +287,6 @@ PdoQueryResourceRequirements(
} }
NTSTATUS
PnpRootPdoPnpControl(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/* /*
* FUNCTION: Handle Plug and Play IRPs for the child device * FUNCTION: Handle Plug and Play IRPs for the child device
* ARGUMENTS: * ARGUMENTS:
@ -297,6 +295,10 @@ PnpRootPdoPnpControl(
* RETURNS: * RETURNS:
* Status * Status
*/ */
NTSTATUS
PnpRootPdoPnpControl(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{ {
PIO_STACK_LOCATION IrpSp; PIO_STACK_LOCATION IrpSp;
NTSTATUS Status; NTSTATUS Status;
@ -353,10 +355,7 @@ PnpRootPdoPnpControl(
return Status; return Status;
} }
NTSTATUS
PnpRootPdoPowerControl(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/* /*
* FUNCTION: Handle power management IRPs for the child device * FUNCTION: Handle power management IRPs for the child device
* ARGUMENTS: * ARGUMENTS:
@ -365,6 +364,10 @@ PnpRootPdoPowerControl(
* RETURNS: * RETURNS:
* Status * Status
*/ */
NTSTATUS
PnpRootPdoPowerControl(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{ {
PIO_STACK_LOCATION IrpSp; PIO_STACK_LOCATION IrpSp;
NTSTATUS Status; NTSTATUS Status;
@ -484,10 +487,10 @@ PnpRootFdoEnumerateDevices(
NULL, NULL,
NULL); NULL);
Status = NtOpenKey(&KeyHandle, KEY_ALL_ACCESS, &ObjectAttributes); Status = ZwOpenKey(&KeyHandle, KEY_ALL_ACCESS, &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("NtOpenKey() failed (Status %x)\n", Status); DPRINT("ZwOpenKey() failed (Status %x)\n", Status);
ExFreePool(KeyInfo); ExFreePool(KeyInfo);
return Status; return Status;
} }
@ -570,7 +573,7 @@ PnpRootFdoEnumerateDevices(
DPRINT("Entries found: %d\n", Index); DPRINT("Entries found: %d\n", Index);
NtClose(KeyHandle); ZwClose(KeyHandle);
ExFreePool(KeyInfo); ExFreePool(KeyInfo);
@ -668,8 +671,8 @@ PnpRootQueryBusRelations(
/* FIXME: */ /* FIXME: */
} }
DPRINT("DeviceID: %S PDO %x\n", DPRINT1("DeviceID: %wZ PDO %p\n",
PdoDeviceExtension->DeviceID.Buffer, &PdoDeviceExtension->DeviceID,
Device->Pdo); Device->Pdo);
if (!IopCreateUnicodeString( if (!IopCreateUnicodeString(
@ -681,6 +684,9 @@ PnpRootQueryBusRelations(
/* FIXME: */ /* FIXME: */
} }
DPRINT1("InstanceID: %wZ PDO %p\n",
&PdoDeviceExtension->InstanceID,
Device->Pdo);
} }
/* Reference the physical device object. The PnP manager /* Reference the physical device object. The PnP manager
@ -730,11 +736,6 @@ PnpRootQueryDeviceRelations(
} }
NTSTATUS
STDCALL
PnpRootFdoPnpControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
/* /*
* FUNCTION: Handle Plug and Play IRPs for the root bus device object * FUNCTION: Handle Plug and Play IRPs for the root bus device object
* ARGUMENTS: * ARGUMENTS:
@ -743,6 +744,11 @@ PnpRootFdoPnpControl(
* RETURNS: * RETURNS:
* Status * Status
*/ */
NTSTATUS
STDCALL
PnpRootFdoPnpControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{ {
PPNPROOT_FDO_DEVICE_EXTENSION DeviceExtension; PPNPROOT_FDO_DEVICE_EXTENSION DeviceExtension;
PIO_STACK_LOCATION IrpSp; PIO_STACK_LOCATION IrpSp;
@ -788,11 +794,6 @@ PnpRootFdoPnpControl(
} }
NTSTATUS
STDCALL
PnpRootFdoPowerControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
/* /*
* FUNCTION: Handle power management IRPs for the root bus device object * FUNCTION: Handle power management IRPs for the root bus device object
* ARGUMENTS: * ARGUMENTS:
@ -801,6 +802,11 @@ PnpRootFdoPowerControl(
* RETURNS: * RETURNS:
* Status * Status
*/ */
NTSTATUS
STDCALL
PnpRootFdoPowerControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{ {
PIO_STACK_LOCATION IrpSp; PIO_STACK_LOCATION IrpSp;
NTSTATUS Status; NTSTATUS Status;
@ -827,11 +833,6 @@ PnpRootFdoPowerControl(
} }
NTSTATUS
STDCALL
PnpRootPnpControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
/* /*
* FUNCTION: Handle Plug and Play IRPs * FUNCTION: Handle Plug and Play IRPs
* ARGUMENTS: * ARGUMENTS:
@ -840,6 +841,11 @@ PnpRootPnpControl(
* RETURNS: * RETURNS:
* Status * Status
*/ */
NTSTATUS
STDCALL
PnpRootPnpControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{ {
PPNPROOT_COMMON_DEVICE_EXTENSION DeviceExtension; PPNPROOT_COMMON_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status; NTSTATUS Status;
@ -861,11 +867,6 @@ PnpRootPnpControl(
} }
NTSTATUS
STDCALL
PnpRootPowerControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
/* /*
* FUNCTION: Handle power management IRPs * FUNCTION: Handle power management IRPs
* ARGUMENTS: * ARGUMENTS:
@ -874,6 +875,11 @@ PnpRootPowerControl(
* RETURNS: * RETURNS:
* Status * Status
*/ */
NTSTATUS
STDCALL
PnpRootPowerControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{ {
PPNPROOT_COMMON_DEVICE_EXTENSION DeviceExtension; PPNPROOT_COMMON_DEVICE_EXTENSION DeviceExtension;
NTSTATUS Status; NTSTATUS Status;

View file

@ -836,7 +836,7 @@ IoReportHalResourceUsage(PUNICODE_STRING HalDescription,
OBJ_CASE_INSENSITIVE | OBJ_OPENIF, OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
0, 0,
NULL); NULL);
Status = NtCreateKey(&ResourcemapKey, Status = ZwCreateKey(&ResourcemapKey,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
0, 0,
@ -854,14 +854,14 @@ IoReportHalResourceUsage(PUNICODE_STRING HalDescription,
OBJ_CASE_INSENSITIVE | OBJ_OPENIF, OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
ResourcemapKey, ResourcemapKey,
NULL); NULL);
Status = NtCreateKey(&HalKey, Status = ZwCreateKey(&HalKey,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,
REG_OPTION_VOLATILE, REG_OPTION_VOLATILE,
&Disposition); &Disposition);
NtClose(ResourcemapKey); ZwClose(ResourcemapKey);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return(Status); return(Status);
@ -871,21 +871,21 @@ IoReportHalResourceUsage(PUNICODE_STRING HalDescription,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
HalKey, HalKey,
NULL); NULL);
Status = NtCreateKey(&DescriptionKey, Status = ZwCreateKey(&DescriptionKey,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
0, 0,
NULL, NULL,
REG_OPTION_VOLATILE, REG_OPTION_VOLATILE,
&Disposition); &Disposition);
NtClose(HalKey); ZwClose(HalKey);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return(Status); return(Status);
/* Add '.Raw' value. */ /* Add '.Raw' value. */
RtlRosInitUnicodeStringFromLiteral(&Name, RtlRosInitUnicodeStringFromLiteral(&Name,
L".Raw"); L".Raw");
Status = NtSetValueKey(DescriptionKey, Status = ZwSetValueKey(DescriptionKey,
&Name, &Name,
0, 0,
REG_RESOURCE_LIST, REG_RESOURCE_LIST,
@ -893,20 +893,20 @@ IoReportHalResourceUsage(PUNICODE_STRING HalDescription,
ListSize); ListSize);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
NtClose(DescriptionKey); ZwClose(DescriptionKey);
return(Status); return(Status);
} }
/* Add '.Translated' value. */ /* Add '.Translated' value. */
RtlRosInitUnicodeStringFromLiteral(&Name, RtlRosInitUnicodeStringFromLiteral(&Name,
L".Translated"); L".Translated");
Status = NtSetValueKey(DescriptionKey, Status = ZwSetValueKey(DescriptionKey,
&Name, &Name,
0, 0,
REG_RESOURCE_LIST, REG_RESOURCE_LIST,
TranslatedList, TranslatedList,
ListSize); ListSize);
NtClose(DescriptionKey); ZwClose(DescriptionKey);
return(Status); return(Status);
} }

View file

@ -51,17 +51,17 @@ IoCreateSymbolicLink(PUNICODE_STRING SymbolicLinkName,
NULL, NULL,
SePublicDefaultSd); SePublicDefaultSd);
Status = NtCreateSymbolicLinkObject(&Handle, Status = ZwCreateSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
DeviceName); DeviceName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtCreateSymbolicLinkObject() failed (Status %lx)\n", Status); DPRINT1("ZwCreateSymbolicLinkObject() failed (Status %lx)\n", Status);
return(Status); return(Status);
} }
NtClose(Handle); ZwClose(Handle);
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
@ -120,17 +120,17 @@ IoCreateUnprotectedSymbolicLink(PUNICODE_STRING SymbolicLinkName,
NULL, NULL,
&SecurityDescriptor); &SecurityDescriptor);
Status = NtCreateSymbolicLinkObject(&Handle, Status = ZwCreateSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes, &ObjectAttributes,
DeviceName); DeviceName);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtCreateSymbolicLinkObject() failed (Status %lx)\n", Status); DPRINT1("ZwCreateSymbolicLinkObject() failed (Status %lx)\n", Status);
return(Status); return(Status);
} }
NtClose(Handle); ZwClose(Handle);
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
@ -168,14 +168,14 @@ IoDeleteSymbolicLink(PUNICODE_STRING SymbolicLinkName)
NULL, NULL,
NULL); NULL);
Status = NtOpenSymbolicLinkObject(&Handle, Status = ZwOpenSymbolicLinkObject(&Handle,
SYMBOLIC_LINK_ALL_ACCESS, SYMBOLIC_LINK_ALL_ACCESS,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
return(Status); return(Status);
Status = NtMakeTemporaryObject(Handle); Status = ZwMakeTemporaryObject(Handle);
NtClose(Handle); ZwClose(Handle);
return(Status); return(Status);
} }

View file

@ -446,7 +446,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
NULL, NULL,
NULL); NULL);
Status = NtOpenFile(&FileHandle, Status = ZwOpenFile(&FileHandle,
0x10001, 0x10001,
&ObjectAttributes, &ObjectAttributes,
&StatusBlock, &StatusBlock,
@ -454,7 +454,7 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
FILE_SYNCHRONOUS_IO_NONALERT); FILE_SYNCHRONOUS_IO_NONALERT);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
NtClose(FileHandle); ZwClose(FileHandle);
swprintf(Buffer2, swprintf(Buffer2,
L"\\??\\PhysicalDrive%d", L"\\??\\PhysicalDrive%d",