Author: tfaber
Date: Wed Oct 22 19:34:46 2014
New Revision: 64906
URL:
http://svn.reactos.org/svn/reactos?rev=64906&view=rev
Log:
[NTOS:FORMATTING]
- Trip trailing whitespace in Io/Pnp
Modified:
trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c
trunk/reactos/ntoskrnl/io/iomgr/remlock.c
trunk/reactos/ntoskrnl/io/iomgr/volume.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c
trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/ramdisk.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/ramdisk.c [iso-8859-1] Wed Oct 22 19:34:46 2014
@@ -37,7 +37,7 @@
PLIST_ENTRY ListHead, NextEntry;
OBJECT_ATTRIBUTES ObjectAttributes;
WCHAR SourceString[54];
-
+
//
// Scan memory descriptors
//
@@ -52,7 +52,7 @@
MemoryDescriptor = CONTAINING_RECORD(NextEntry,
MEMORY_ALLOCATION_DESCRIPTOR,
ListEntry);
-
+
//
// Needs to be a ROM/RAM descriptor
//
@@ -63,7 +63,7 @@
//
NextEntry = NextEntry->Flink;
}
-
+
//
// Nothing found?
//
@@ -78,7 +78,7 @@
0,
0);
}
-
+
//
// Setup the input buffer
//
@@ -91,7 +91,7 @@
RamdiskCreate.DiskGuid = RAMDISK_BOOTDISK_GUID;
RamdiskCreate.DriveLetter = L'C';
RamdiskCreate.Options.Fixed = TRUE;
-
+
//
// Check for commandline parameters
//
@@ -102,7 +102,7 @@
// Make everything upper case
//
_strupr(CommandLine);
-
+
//
// Check for offset parameter
//
@@ -121,12 +121,12 @@
RamdiskCreate.DiskOffset = atol(OffsetValue + 1);
}
}
-
+
//
// Reduce the disk length
//
RamdiskCreate.DiskLength.QuadPart -= RamdiskCreate.DiskOffset;
-
+
//
// Check for length parameter
//
@@ -146,7 +146,7 @@
}
}
}
-
+
//
// Setup object attributes
//
@@ -156,7 +156,7 @@
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
NULL,
NULL);
-
+
//
// Open a handle to the driver
//
@@ -177,7 +177,7 @@
0,
0);
}
-
+
//
// Send create command
//
@@ -203,7 +203,7 @@
0,
0);
}
-
+
//
// Convert the GUID
//
@@ -219,7 +219,7 @@
0,
0);
}
-
+
//
// Build the symbolic link name and target
//
@@ -230,7 +230,7 @@
SymbolicLinkName.Length = 38;
SymbolicLinkName.MaximumLength = 38 + sizeof(UNICODE_NULL);
SymbolicLinkName.Buffer = L"\\ArcName\\ramdisk(0)";
-
+
//
// Create the symbolic link
//
@@ -248,7 +248,7 @@
0,
0);
}
-
+
//
// We made it
//
Modified: trunk/reactos/ntoskrnl/io/iomgr/remlock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/remlock.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/remlock.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/remlock.c [iso-8859-1] Wed Oct 22 19:34:46 2014
@@ -100,7 +100,7 @@
TrackingBlock = ExAllocatePoolWithTag(NonPagedPool,
sizeof(IO_REMOVE_LOCK_TRACKING_BLOCK), Lock->Dbg.AllocateTag);
if (!TrackingBlock)
{
- /* Keep count of failures for lock release and missing tags */
+ /* Keep count of failures for lock release and missing tags */
InterlockedIncrement(&(Lock->Dbg.LowMemoryCount));
}
else
Modified: trunk/reactos/ntoskrnl/io/iomgr/volume.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/volume.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/volume.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/volume.c [iso-8859-1] Wed Oct 22 19:34:46 2014
@@ -1365,7 +1365,7 @@
* name lengths than MAXUSHORT, we can't use
* them, because we have to return this in an UNICODE_STRING
* that stores length on USHORT.
- */
+ */
Length = VolumePath.MultiSzLength + sizeof(VolumePath);
if (Length > MAXUSHORT)
{
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpinit.c [iso-8859-1] Wed Oct 22 19:34:46 2014
@@ -55,7 +55,7 @@
UNICODE_STRING GroupString =
RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet"
L"\\Control\\ServiceGroupOrder");
-
+
/* ReactOS HACK for SETUPLDR */
if (KeLoaderBlock->SetupLdrBlock)
{
@@ -64,7 +64,7 @@
PiInitGroupOrderTable = (PVOID)0xBABEB00B;
return STATUS_SUCCESS;
}
-
+
/* Open the registry key */
Status = IopOpenRegistryKeyEx(&KeyHandle,
NULL,
@@ -75,7 +75,7 @@
/* Get the list */
Status = IopGetRegistryValue(KeyHandle, L"List",
&KeyValueInformation);
ZwClose(KeyHandle);
-
+
/* Make sure we got it */
if (NT_SUCCESS(Status))
{
@@ -87,7 +87,7 @@
Status = PnpRegMultiSzToUnicodeStrings(KeyValueInformation,
&GroupTable,
&Count);
-
+
/* Cache it for later */
PiInitGroupOrderTable = GroupTable;
PiInitGroupOrderTableCount = (USHORT)Count;
@@ -97,12 +97,12 @@
/* Fail */
Status = STATUS_UNSUCCESSFUL;
}
-
+
/* Free the information */
ExFreePool(KeyValueInformation);
}
}
-
+
/* Return status */
return Status;
}
@@ -117,13 +117,13 @@
PVOID Buffer;
UNICODE_STRING Group;
PAGED_CODE();
-
+
/* Make sure we have a cache */
if (!PiInitGroupOrderTable) return -1;
-
+
/* If we don't have a handle, the rest is easy -- return the count */
if (!ServiceHandle) return PiInitGroupOrderTableCount + 1;
-
+
/* Otherwise, get the group value */
Status = IopGetRegistryValue(ServiceHandle, L"Group",
&KeyValueInformation);
if (!NT_SUCCESS(Status)) return PiInitGroupOrderTableCount;
@@ -131,20 +131,20 @@
/* Make sure we have a valid string */
ASSERT(KeyValueInformation->Type == REG_SZ);
ASSERT(KeyValueInformation->DataLength);
-
+
/* Convert to unicode string */
Buffer = (PVOID)((ULONG_PTR)KeyValueInformation +
KeyValueInformation->DataOffset);
PnpRegSzToString(Buffer, KeyValueInformation->DataLength, &Group.Length);
Group.MaximumLength = (USHORT)KeyValueInformation->DataLength;
Group.Buffer = Buffer;
-
+
/* Loop the groups */
for (i = 0; i < PiInitGroupOrderTableCount; i++)
{
/* Try to find a match */
if (RtlEqualUnicodeString(&Group, &PiInitGroupOrderTable[i], TRUE))
break;
}
-
+
/* We're done */
ExFreePool(KeyValueInformation);
return i;
@@ -167,15 +167,15 @@
UNICODE_STRING GroupString =
RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet"
L"\\Control\\ServiceGroupOrder");
-
+
/* Open the key */
Status = IopOpenRegistryKeyEx(&KeyHandle, NULL, &GroupString, KEY_READ);
if (!NT_SUCCESS(Status)) goto Quickie;
-
+
/* Read the group */
Status = IopGetRegistryValue(ServiceHandle, L"Group",
&KeyValueInformation);
if (!NT_SUCCESS(Status)) goto Quickie;
-
+
/* Make sure we have a group */
if ((KeyValueInformation->Type == REG_SZ) &&
(KeyValueInformation->DataLength))
@@ -199,7 +199,7 @@
Tag = *(PULONG)((ULONG_PTR)KeyValueInformationTag +
KeyValueInformationTag->DataOffset);
}
-
+
/* We can get rid of this now */
ExFreePool(KeyValueInformationTag);
@@ -207,13 +207,13 @@
Status = IopGetRegistryValue(KeyHandle,
Group.Buffer,
&KeyValueInformationGroupOrderList);
-
+
/* We can get rid of this now */
Quickie:
if (KeyValueInformation) ExFreePool(KeyValueInformation);
if (KeyHandle) NtClose(KeyHandle);
if (!NT_SUCCESS(Status)) return -1;
-
+
/* We're on the success path -- validate the tag order*/
if ((KeyValueInformationGroupOrderList->Type == REG_BINARY) &&
(KeyValueInformationGroupOrderList->DataLength))
@@ -221,12 +221,12 @@
/* Get the order array */
GroupOrder = (PULONG)((ULONG_PTR)KeyValueInformationGroupOrderList +
KeyValueInformationGroupOrderList->DataOffset);
-
+
/* Get the count */
Count = *GroupOrder;
ASSERT(((Count + 1) * sizeof(ULONG)) <=
KeyValueInformationGroupOrderList->DataLength);
-
+
/* Now loop each tag */
GroupOrder++;
for (i = 1; i <= Count; i++)
@@ -238,7 +238,7 @@
GroupOrder++;
}
}
-
+
/* Last buffer to free */
ExFreePool(KeyValueInformationGroupOrderList);
return i;
@@ -258,7 +258,7 @@
RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class");
PKEY_VALUE_FULL_INFORMATION KeyValueInformation = NULL;
PWCHAR Buffer;
-
+
/* Open enumeration root key */
Status = IopOpenRegistryKeyEx(&EnumRootKey,
NULL,
@@ -269,7 +269,7 @@
DPRINT1("IopOpenRegistryKeyEx() failed with Status %08X\n", Status);
return Status;
}
-
+
/* Open instance subkey */
Status = IopOpenRegistryKeyEx(&SubKey,
EnumRootKey,
@@ -281,7 +281,7 @@
DPRINT1("IopOpenRegistryKeyEx() failed with Status %08X\n", Status);
return Status;
}
-
+
/* Get class GUID */
Status = IopGetRegistryValue(SubKey,
REGSTR_VAL_CLASSGUID,
@@ -293,7 +293,7 @@
PnpRegSzToString(Buffer, KeyValueInformation->DataLength,
&ClassGuid.Length);
ClassGuid.MaximumLength = (USHORT)KeyValueInformation->DataLength;
ClassGuid.Buffer = Buffer;
-
+
/* Open the key */
Status = IopOpenRegistryKeyEx(&ControlKey,
NULL,
@@ -320,7 +320,7 @@
ClassKey = NULL;
}
}
-
+
/* Check if we made it till here */
if (ClassKey)
{
@@ -342,11 +342,11 @@
ZwClose(PropertiesKey);
}
}
-
+
/* Free the registry data */
ExFreePool(KeyValueInformation);
}
-
+
/* Do ReactOS-style setup */
Status = IopAttachFilterDrivers(DeviceNode, TRUE);
if (!NT_SUCCESS(Status))
@@ -363,10 +363,10 @@
IopRemoveDevice(DeviceNode);
return Status;
}
-
+
Status = IopStartDevice(DeviceNode);
}
-
+
/* Return status */
return Status;
}
@@ -382,21 +382,21 @@
UNICODE_STRING KeyName =
RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
UNICODE_STRING PnpManagerDriverName = RTL_CONSTANT_STRING(DRIVER_ROOT_NAME
L"PnpManager");
PDEVICE_OBJECT Pdo;
-
+
/* Initialize locks and such */
KeInitializeSpinLock(&IopDeviceTreeLock);
-
+
/* Get the default interface */
PnpDefaultInterfaceType = IopDetermineDefaultInterfaceType();
-
+
/* Initialize arbiters */
Status = IopInitializeArbiters();
if (!NT_SUCCESS(Status)) return Status;
-
+
/* Setup the group cache */
Status = PiInitCacheGroupInformation();
if (!NT_SUCCESS(Status)) return Status;
-
+
/* Open the current control set */
Status = IopOpenRegistryKeyEx(&KeyHandle,
NULL,
@@ -443,14 +443,14 @@
REG_OPTION_NON_VOLATILE,
&Disposition);
if (!NT_SUCCESS(Status)) return Status;
-
+
/* Check if it's a new key */
if (Disposition == REG_CREATED_NEW_KEY)
{
/* FIXME: DACLs */
DPRINT1("Need to build DACL\n");
}
-
+
/* Create the root key */
ParentHandle = EnumHandle;
RtlInitUnicodeString(&KeyName, REGSTR_KEY_ROOTENUM);
@@ -463,7 +463,7 @@
NtClose(ParentHandle);
if (!NT_SUCCESS(Status)) return Status;
NtClose(EnumHandle);
-
+
/* Open the root key now */
RtlInitUnicodeString(&KeyName,
L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET\\ENUM");
Status = IopOpenRegistryKeyEx(&EnumHandle,
@@ -491,7 +491,7 @@
DPRINT1("IoCreateDriverObject() failed\n");
KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
-
+
/* Create the root PDO */
Status = IoCreateDevice(IopRootDriverObject,
sizeof(IOPNP_DEVICE_EXTENSION),
@@ -505,10 +505,10 @@
DPRINT1("IoCreateDevice() failed\n");
KeBugCheckEx(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0);
}
-
+
/* This is a bus enumerated device */
Pdo->Flags |= DO_BUS_ENUMERATED_DEVICE;
-
+
/* Create the root device node */
IopRootDeviceNode = PipAllocateDeviceNode(Pdo);
@@ -516,11 +516,11 @@
IopRootDeviceNode->Flags |= DNF_STARTED + DNF_PROCESSED + DNF_ENUMERATED +
DNF_MADEUP + DNF_NO_RESOURCE_REQUIRED +
DNF_ADDED;
-
+
/* Create instance path */
RtlCreateUnicodeString(&IopRootDeviceNode->InstancePath,
REGSTR_VAL_ROOT_DEVNODE);
-
+
/* Call the add device routine */
IopRootDriverObject->DriverExtension->AddDevice(IopRootDriverObject,
IopRootDeviceNode->PhysicalDeviceObject);
@@ -528,23 +528,23 @@
/* Initialize PnP-Event notification support */
Status = IopInitPlugPlayEvents();
if (!NT_SUCCESS(Status)) return Status;
-
+
/* Report the device to the user-mode pnp manager */
IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL,
&IopRootDeviceNode->InstancePath);
-
+
/* Initialize the Bus Type GUID List */
PnpBusTypeGuidList = ExAllocatePool(PagedPool, sizeof(IO_BUS_TYPE_GUID_LIST));
RtlZeroMemory(PnpBusTypeGuidList, sizeof(IO_BUS_TYPE_GUID_LIST));
ExInitializeFastMutex(&PnpBusTypeGuidList->Lock);
-
+
/* Launch the firmware mapper */
Status = IopUpdateRootKey();
if (!NT_SUCCESS(Status)) return Status;
-
+
/* Close the handle to the control set */
NtClose(KeyHandle);
-
+
/* We made it */
return STATUS_SUCCESS;
}
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Wed Oct 22 19:34:46 2014
@@ -87,7 +87,7 @@
PKEY_VALUE_PARTIAL_INFORMATION PartialInfo;
ULONG HidLength = 0, CidLength = 0, BufferLength;
PWCHAR IdBuffer, OriginalIdBuffer;
-
+
/* Open the device instance key */
Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, 0,
&InstanceKey);
if (Status != STATUS_SUCCESS)
@@ -174,7 +174,7 @@
ZwClose(InstanceKey);
return;
}
-
+
/* Copy CID next */
CidLength = PartialInfo->DataLength;
RtlCopyMemory(((PUCHAR)IdBuffer) + HidLength, PartialInfo->Data, CidLength);
@@ -182,7 +182,7 @@
/* Free our temp buffer */
ExFreePool(PartialInfo);
-
+
InitializeObjectAttributes(&ObjectAttributes,
&CriticalDeviceKeyU,
OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE,
@@ -203,15 +203,15 @@
while (*IdBuffer)
{
USHORT StringLength = (USHORT)wcslen(IdBuffer) + 1, Index;
-
+
IopFixupDeviceId(IdBuffer);
-
+
/* Look through all subkeys for a match */
for (Index = 0; TRUE; Index++)
{
ULONG NeededLength;
PKEY_BASIC_INFORMATION BasicInfo;
-
+
Status = ZwEnumerateKey(CriticalDeviceKey,
Index,
KeyBasicInformation,
@@ -415,7 +415,7 @@
/* Advance to the next ID */
IdBuffer += StringLength;
}
-
+
ExFreePool(OriginalIdBuffer);
ZwClose(InstanceKey);
ZwClose(CriticalDeviceKey);
@@ -428,7 +428,7 @@
{
PDEVICE_OBJECT Fdo;
NTSTATUS Status;
-
+
if (!DriverObject)
{
/* Special case for bus driven devices */
@@ -497,11 +497,11 @@
{
IO_STACK_LOCATION Stack;
PVOID Dummy;
-
+
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_EJECT;
-
+
return IopSynchronousCall(DeviceObject, &Stack, &Dummy);
}
@@ -512,11 +512,11 @@
{
IO_STACK_LOCATION Stack;
PVOID Dummy;
-
+
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_SURPRISE_REMOVAL;
-
+
/* Drivers should never fail a IRP_MN_SURPRISE_REMOVAL request */
IopSynchronousCall(DeviceObject, &Stack, &Dummy);
}
@@ -530,12 +530,12 @@
IO_STACK_LOCATION Stack;
PVOID Dummy;
NTSTATUS Status;
-
+
ASSERT(DeviceNode);
-
+
IopQueueTargetDeviceEvent(&GUID_DEVICE_REMOVE_PENDING,
&DeviceNode->InstancePath);
-
+
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_QUERY_REMOVE_DEVICE;
@@ -547,7 +547,7 @@
&GUID_TARGET_DEVICE_QUERY_REMOVE,
NULL,
NULL);
-
+
if (!NT_SUCCESS(Status))
{
DPRINT1("Removal vetoed by %wZ\n", &DeviceNode->InstancePath);
@@ -565,11 +565,11 @@
{
IO_STACK_LOCATION Stack;
PVOID Dummy;
-
+
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_QUERY_STOP_DEVICE;
-
+
return IopSynchronousCall(DeviceObject, &Stack, &Dummy);
}
@@ -584,7 +584,7 @@
/* Drop all our state for this device in case it isn't really going away */
DeviceNode->Flags &= DNF_ENUMERATED | DNF_PROCESSED;
-
+
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_REMOVE_DEVICE;
@@ -607,14 +607,14 @@
{
IO_STACK_LOCATION Stack;
PVOID Dummy;
-
+
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_CANCEL_REMOVE_DEVICE;
-
+
/* Drivers should never fail a IRP_MN_CANCEL_REMOVE_DEVICE request */
IopSynchronousCall(DeviceObject, &Stack, &Dummy);
-
+
IopNotifyPlugPlayNotification(DeviceObject,
EventCategoryTargetDeviceChange,
&GUID_TARGET_DEVICE_REMOVE_CANCELLED,
@@ -629,11 +629,11 @@
{
IO_STACK_LOCATION Stack;
PVOID Dummy;
-
+
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_STOP_DEVICE;
-
+
/* Drivers should never fail a IRP_MN_STOP_DEVICE request */
IopSynchronousCall(DeviceObject, &Stack, &Dummy);
}
@@ -647,17 +647,17 @@
NTSTATUS Status;
PVOID Dummy;
DEVICE_CAPABILITIES DeviceCapabilities;
-
+
/* Get the device node */
DeviceNode = IopGetDeviceNode(DeviceObject);
-
+
ASSERT(!(DeviceNode->Flags & DNF_DISABLED));
/* Build the I/O stack location */
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_START_DEVICE;
-
+
Stack.Parameters.StartDevice.AllocatedResources =
DeviceNode->ResourceList;
Stack.Parameters.StartDevice.AllocatedResourcesTranslated =
@@ -677,7 +677,7 @@
DPRINT1("Warning: PnP Start failed (%wZ) [Status: 0x%x]\n",
&DeviceNode->InstancePath, Status);
return;
}
-
+
DPRINT("Sending IRP_MN_QUERY_CAPABILITIES to device stack (after
start)\n");
Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities);
@@ -688,7 +688,7 @@
/* Invalidate device state so IRP_MN_QUERY_PNP_DEVICE_STATE is sent */
IoInvalidateDeviceState(DeviceObject);
-
+
/* Otherwise, mark us as started */
DeviceNode->Flags |= DNF_STARTED;
DeviceNode->Flags &= ~DNF_STOPPED;
@@ -704,23 +704,23 @@
PDEVICE_OBJECT DeviceObject;
NTSTATUS Status;
PAGED_CODE();
-
+
/* Sanity check */
ASSERT((DeviceNode->Flags & DNF_ADDED));
ASSERT((DeviceNode->Flags & (DNF_RESOURCE_ASSIGNED |
DNF_RESOURCE_REPORTED |
DNF_NO_RESOURCE_REQUIRED)));
-
+
/* Get the device object */
DeviceObject = DeviceNode->PhysicalDeviceObject;
-
+
/* Check if we're not started yet */
if (!(DeviceNode->Flags & DNF_STARTED))
{
/* Start us */
IopStartDevice2(DeviceObject);
}
-
+
/* Do we need to query IDs? This happens in the case of manual reporting */
#if 0
if (DeviceNode->Flags & DNF_NEED_QUERY_IDS)
@@ -730,7 +730,7 @@
ASSERT(FALSE);
}
#endif
-
+
/* Make sure we're started, and check if we need enumeration */
if ((DeviceNode->Flags & DNF_STARTED) &&
(DeviceNode->Flags & DNF_NEED_ENUMERATION_ONLY))
@@ -744,7 +744,7 @@
/* Nothing to do */
Status = STATUS_SUCCESS;
}
-
+
/* Return */
return Status;
}
@@ -1243,18 +1243,18 @@
NTSTATUS Status;
PDEVICE_OBJECT TopDeviceObject;
PAGED_CODE();
-
+
/* Call the top of the device stack */
TopDeviceObject = IoGetAttachedDeviceReference(DeviceObject);
-
+
/* Allocate an IRP */
Irp = IoAllocateIrp(TopDeviceObject->StackSize, FALSE);
if (!Irp) return STATUS_INSUFFICIENT_RESOURCES;
-
+
/* Initialize to failure */
Irp->IoStatus.Status = IoStatusBlock.Status = STATUS_NOT_SUPPORTED;
Irp->IoStatus.Information = IoStatusBlock.Information = 0;
-
+
/* Special case for IRP_MN_FILTER_RESOURCE_REQUIREMENTS */
if (IoStackLocation->MinorFunction == IRP_MN_FILTER_RESOURCE_REQUIREMENTS)
{
@@ -1262,22 +1262,22 @@
Irp->IoStatus.Information =
IoStatusBlock.Information =
(ULONG_PTR)IoStackLocation->Parameters.FilterResourceRequirements.IoResourceRequirementList;
}
-
+
/* Initialize the event */
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
-
+
/* Set them up */
Irp->UserIosb = &IoStatusBlock;
Irp->UserEvent = &Event;
-
+
/* Queue the IRP */
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
IoQueueThreadIrp(Irp);
-
+
/* Copy-in the stack */
IrpStack = IoGetNextIrpStackLocation(Irp);
*IrpStack = *IoStackLocation;
-
+
/* Call the driver */
Status = IoCallDriver(TopDeviceObject, Irp);
if (Status == STATUS_PENDING)
@@ -1307,7 +1307,7 @@
IN PIO_STACK_LOCATION Stack OPTIONAL)
{
IO_STACK_LOCATION IoStackLocation;
-
+
/* Fill out the stack information */
RtlZeroMemory(&IoStackLocation, sizeof(IO_STACK_LOCATION));
IoStackLocation.MajorFunction = IRP_MJ_PNP;
@@ -1319,7 +1319,7 @@
&Stack->Parameters,
sizeof(Stack->Parameters));
}
-
+
/* Do the PnP call */
IoStatusBlock->Status = IopSynchronousCall(DeviceObject,
&IoStackLocation,
@@ -3295,11 +3295,11 @@
UNICODE_STRING KeyString;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
-
+
/* P1 is start, pp is end */
p1 = KeyName->Buffer;
pp = (PVOID)((ULONG_PTR)p1 + KeyName->Length);
-
+
/* Create the target key */
InitializeObjectAttributes(&ObjectAttributes,
KeyName,
@@ -3320,31 +3320,31 @@
/* Target key failed, so we'll need to create its parent. Setup array */
HandleArray[0] = NULL;
HandleArray[1] = RootHandle;
-
+
/* Keep recursing for each missing parent */
while (Recursing)
{
/* And if we're deep enough, close the last handle */
if (NestedCloseLevel > 1) ZwClose(HandleArray[RootHandleIndex]);
-
+
/* We're setup to ping-pong between the two handle array entries */
RootHandleIndex = i;
i = (i + 1) & 1;
-
+
/* Clear the one we're attempting to open now */
HandleArray[i] = NULL;
-
+
/* Process the parent key name */
for (p = p1; ((p < pp) && (*p != OBJ_NAME_PATH_SEPARATOR)); p++);
Length = (USHORT)(p - p1) * sizeof(WCHAR);
-
+
/* Is there a parent name? */
if (Length)
{
/* Build the unicode string for it */
KeyString.Buffer = p1;
KeyString.Length = KeyString.MaximumLength = Length;
-
+
/* Now try opening the parent */
InitializeObjectAttributes(&ObjectAttributes,
&KeyString,
@@ -3377,7 +3377,7 @@
Recursing = FALSE;
continue;
}
-
+
/* Now see if there's more parents to create */
p1 = p + 1;
if ((p == pp) || (p1 == pp))
@@ -3386,11 +3386,11 @@
Recursing = FALSE;
}
}
-
+
/* Outer loop check for handle nesting that requires closing the top handle */
if (NestedCloseLevel > 1) ZwClose(HandleArray[RootHandleIndex]);
}
-
+
/* Check if we broke out of the loop due to success */
if (NT_SUCCESS(Status))
{
@@ -3398,7 +3398,7 @@
*Handle = HandleArray[i];
if (Disposition) *Disposition = KeyDisposition;
}
-
+
/* Return the success state */
return Status;
}
@@ -3543,14 +3543,14 @@
{
PDEVICE_NODE DeviceNode;
PAGED_CODE();
-
+
/* Allocate it */
DeviceNode = ExAllocatePoolWithTag(NonPagedPool, sizeof(DEVICE_NODE),
'donD');
if (!DeviceNode) return DeviceNode;
-
+
/* Statistics */
InterlockedIncrement(&IopNumberDeviceNodes);
-
+
/* Set it up */
RtlZeroMemory(DeviceNode, sizeof(DEVICE_NODE));
DeviceNode->InterfaceType = InterfaceTypeUndefined;
@@ -3564,7 +3564,7 @@
InitializeListHead(&DeviceNode->TargetDeviceNotify);
InitializeListHead(&DeviceNode->DockInfo.ListEntry);
InitializeListHead(&DeviceNode->PendedSetInterfaceState);
-
+
/* Check if there is a PDO */
if (PhysicalDeviceObject)
{
@@ -3573,7 +3573,7 @@
((PEXTENDED_DEVOBJ_EXTENSION)PhysicalDeviceObject->DeviceObjectExtension)->DeviceNode
= DeviceNode;
PhysicalDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
}
-
+
/* Return the node */
return DeviceNode;
}
@@ -3589,7 +3589,7 @@
/* Acquire the lock */
ExAcquireFastMutex(&PnpBusTypeGuidList->Lock);
-
+
/* Validate size */
if (Index < PnpBusTypeGuidList->GuidCount)
{
@@ -3601,7 +3601,7 @@
/* Failure path */
Status = STATUS_OBJECT_NAME_NOT_FOUND;
}
-
+
/* Release lock and return status */
ExReleaseFastMutex(&PnpBusTypeGuidList->Lock);
return Status;
@@ -3618,14 +3618,14 @@
PDEVICE_NODE DeviceNode;
UNICODE_STRING KeyName =
RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET\\ENUM");
PAGED_CODE();
-
+
/* Open the enum key */
Status = IopOpenRegistryKeyEx(&KeyHandle,
NULL,
&KeyName,
KEY_READ);
if (!NT_SUCCESS(Status)) return Status;
-
+
/* Make sure we have an instance path */
DeviceNode = IopGetDeviceNode(DeviceObject);
if ((DeviceNode) && (DeviceNode->InstancePath.Length))
@@ -3641,7 +3641,7 @@
/* Fail */
Status = STATUS_INVALID_DEVICE_REQUEST;
}
-
+
/* Close the handle and return status */
ZwClose(KeyHandle);
return Status;
@@ -3654,13 +3654,13 @@
ULONG FinalSize, PartialSize, EntrySize, i, j;
PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptor;
PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
-
+
/* If we don't have one, that's easy */
if (!ResourceList) return 0;
-
+
/* Start with the minimum size possible */
FinalSize = FIELD_OFFSET(CM_RESOURCE_LIST, List);
-
+
/* Loop each full descriptor */
FullDescriptor = ResourceList->List;
for (i = 0; i < ResourceList->Count; i++)
@@ -3668,35 +3668,35 @@
/* Start with the minimum size possible */
PartialSize = FIELD_OFFSET(CM_FULL_RESOURCE_DESCRIPTOR, PartialResourceList) +
FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors);
-
+
/* Loop each partial descriptor */
PartialDescriptor = FullDescriptor->PartialResourceList.PartialDescriptors;
for (j = 0; j < FullDescriptor->PartialResourceList.Count; j++)
{
/* Start with the minimum size possible */
EntrySize = sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
-
+
/* Check if there is extra data */
if (PartialDescriptor->Type == CmResourceTypeDeviceSpecific)
{
/* Add that data */
EntrySize += PartialDescriptor->u.DeviceSpecificData.DataSize;
}
-
+
/* The size of partial descriptors is bigger */
PartialSize += EntrySize;
-
+
/* Go to the next partial descriptor */
PartialDescriptor = (PVOID)((ULONG_PTR)PartialDescriptor + EntrySize);
}
-
+
/* The size of full descriptors is bigger */
FinalSize += PartialSize;
-
+
/* Go to the next full descriptor */
FullDescriptor = (PVOID)((ULONG_PTR)FullDescriptor + PartialSize);
}
-
+
/* Return the final size */
return FinalSize;
}
@@ -3829,34 +3829,34 @@
/* This is the format of the returned data */
PIP_RETURN_DATA(sizeof(GUID), &BusTypeGuid);
-
+
case DevicePropertyLegacyBusType:
-
+
/* Validate correct interface type */
if (DeviceNode->ChildInterfaceType == InterfaceTypeUndefined)
return STATUS_OBJECT_NAME_NOT_FOUND;
/* This is the format of the returned data */
PIP_RETURN_DATA(sizeof(INTERFACE_TYPE),
&DeviceNode->ChildInterfaceType);
-
+
case DevicePropertyBusNumber:
-
+
/* Validate correct bus number */
if ((DeviceNode->ChildBusNumber & 0x80000000) == 0x80000000)
return STATUS_OBJECT_NAME_NOT_FOUND;
-
+
/* This is the format of the returned data */
PIP_RETURN_DATA(sizeof(ULONG), &DeviceNode->ChildBusNumber);
-
+
case DevicePropertyEnumeratorName:
/* Get the instance path */
DeviceInstanceName = DeviceNode->InstancePath.Buffer;
-
+
/* Sanity checks */
ASSERT((BufferLength & 1) == 0);
ASSERT(DeviceInstanceName != NULL);
-
+
/* Get the name from the path */
EnumeratorNameEnd = wcschr(DeviceInstanceName, OBJ_NAME_PATH_SEPARATOR);
ASSERT(EnumeratorNameEnd);
@@ -3867,7 +3867,7 @@
/* This is the format of the returned data */
PIP_RETURN_DATA((ULONG)(EnumeratorNameEnd - DeviceInstanceName) *
sizeof(WCHAR),
DeviceInstanceName);
-
+
case DevicePropertyAddress:
/* Query the device caps */
@@ -3877,9 +3877,9 @@
/* This is the format of the returned data */
PIP_RETURN_DATA(sizeof(ULONG), &DeviceCaps.Address);
-
+
case DevicePropertyBootConfigurationTranslated:
-
+
/* Validate we have resources */
if (!DeviceNode->BootResources)
// if (!DeviceNode->BootResourcesTranslated) // FIXFIX: Need this field
@@ -3888,21 +3888,21 @@
*ResultLength = 0;
return STATUS_SUCCESS;
}
-
+
/* This is the format of the returned data */
PIP_RETURN_DATA(PnpDetermineResourceListSize(DeviceNode->BootResources),
// FIXFIX: Should use BootResourcesTranslated
DeviceNode->BootResources); // FIXFIX: Should use
BootResourcesTranslated
case DevicePropertyPhysicalDeviceObjectName:
-
+
/* Sanity check for Unicode-sized string */
ASSERT((BufferLength & 1) == 0);
-
+
/* Allocate name buffer */
Length = BufferLength + sizeof(OBJECT_NAME_INFORMATION);
ObjectNameInfo = ExAllocatePool(PagedPool, Length);
if (!ObjectNameInfo) return STATUS_INSUFFICIENT_RESOURCES;
-
+
/* Query the PDO name */
Status = ObQueryNameString(DeviceObject,
ObjectNameInfo,
@@ -3924,7 +3924,7 @@
/* Let the caller know how big the name is */
*ResultLength -= sizeof(OBJECT_NAME_INFORMATION);
break;
-
+
/* Handle the registry-based properties */
case DevicePropertyUINumber:
PIP_REGISTRY_DATA(REGSTR_VAL_UI_NUMBER, REG_DWORD);
@@ -3962,13 +3962,13 @@
default:
return STATUS_INVALID_PARAMETER_2;
}
-
+
/* Having a registry value name implies registry data */
if (ValueName)
{
/* We know up-front how much data to expect */
*ResultLength = BufferLength;
-
+
/* Go get the data, use the LogConf subkey if necessary */
Status = PiGetDeviceRegistryProperty(DeviceObject,
ValueType,
@@ -3994,7 +3994,7 @@
/* Terminate the string */
((PWCHAR)PropertyBuffer)[ReturnLength / sizeof(WCHAR)] = UNICODE_NULL;
}
-
+
/* This is the success path */
Status = STATUS_SUCCESS;
}
@@ -4004,7 +4004,7 @@
Status = STATUS_BUFFER_TOO_SMALL;
}
}
-
+
/* Free any allocation we may have made, and return the status code */
if (ObjectNameInfo) ExFreePool(ObjectNameInfo);
return Status;
@@ -4022,11 +4022,11 @@
ULONG PnPFlags;
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
-
+
RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION));
Stack.MajorFunction = IRP_MJ_PNP;
Stack.MinorFunction = IRP_MN_QUERY_PNP_DEVICE_STATE;
-
+
Status = IopSynchronousCall(PhysicalDeviceObject, &Stack,
(PVOID*)&PnPFlags);
if (!NT_SUCCESS(Status))
{
@@ -4055,11 +4055,11 @@
/* Send surprise removal */
IopSendSurpriseRemoval(PhysicalDeviceObject);
-
+
/* Tell the user-mode PnP manager that a device was removed */
IopQueueTargetDeviceEvent(&GUID_DEVICE_SURPRISE_REMOVAL,
&DeviceNode->InstancePath);
-
+
IopSendRemoveDevice(PhysicalDeviceObject);
}
else if ((PnPFlags & PNP_DEVICE_FAILED) && (PnPFlags &
PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED))
@@ -4074,12 +4074,12 @@
PnPFlags &= ~PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED;
}
}
-
+
/* Resource rebalance */
if (PnPFlags & PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED)
{
DPRINT("Sending IRP_MN_QUERY_RESOURCES to device stack\n");
-
+
Status = IopInitiatePnpIrp(PhysicalDeviceObject,
&IoStatusBlock,
IRP_MN_QUERY_RESOURCES,
@@ -4095,9 +4095,9 @@
DPRINT("IopInitiatePnpIrp() failed (Status %x) or
IoStatusBlock.Information=NULL\n", Status);
DeviceNode->BootResources = NULL;
}
-
+
DPRINT("Sending IRP_MN_QUERY_RESOURCE_REQUIREMENTS to device
stack\n");
-
+
Status = IopInitiatePnpIrp(PhysicalDeviceObject,
&IoStatusBlock,
IRP_MN_QUERY_RESOURCE_REQUIREMENTS,
@@ -4112,7 +4112,7 @@
DPRINT("IopInitiatePnpIrp() failed (Status %08lx)\n", Status);
DeviceNode->ResourceRequirements = NULL;
}
-
+
/* IRP_MN_FILTER_RESOURCE_REQUIREMENTS is called indirectly by IopStartDevice */
if (IopStartDevice(DeviceNode) != STATUS_SUCCESS)
{
@@ -4288,28 +4288,28 @@
PDEVICE_NODE ChildDeviceNode, NextDeviceNode, FailedRemoveDevice;
NTSTATUS Status;
KIRQL OldIrql;
-
+
KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql);
ChildDeviceNode = ParentDeviceNode->Child;
while (ChildDeviceNode != NULL)
{
NextDeviceNode = ChildDeviceNode->Sibling;
KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql);
-
+
Status = IopPrepareDeviceForRemoval(ChildDeviceNode->PhysicalDeviceObject,
Force);
if (!NT_SUCCESS(Status))
{
FailedRemoveDevice = ChildDeviceNode;
goto cleanup;
}
-
+
KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql);
ChildDeviceNode = NextDeviceNode;
}
KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql);
-
+
return STATUS_SUCCESS;
-
+
cleanup:
KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql);
ChildDeviceNode = ParentDeviceNode->Child;
@@ -4317,20 +4317,20 @@
{
NextDeviceNode = ChildDeviceNode->Sibling;
KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql);
-
+
IopCancelPrepareDeviceForRemoval(ChildDeviceNode->PhysicalDeviceObject);
-
+
/* IRP_MN_CANCEL_REMOVE_DEVICE is also sent to the device
* that failed the IRP_MN_QUERY_REMOVE_DEVICE request */
if (ChildDeviceNode == FailedRemoveDevice)
return Status;
-
+
ChildDeviceNode = NextDeviceNode;
-
+
KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql);
}
KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql);
-
+
return Status;
}
@@ -4340,18 +4340,18 @@
{
PDEVICE_NODE ChildDeviceNode, NextDeviceNode;
KIRQL OldIrql;
-
+
KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql);
ChildDeviceNode = ParentDeviceNode->Child;
while (ChildDeviceNode != NULL)
{
NextDeviceNode = ChildDeviceNode->Sibling;
KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql);
-
+
IopSendRemoveDevice(ChildDeviceNode->PhysicalDeviceObject);
-
+
ChildDeviceNode = NextDeviceNode;
-
+
KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql);
}
KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql);
@@ -4363,18 +4363,18 @@
{
PDEVICE_NODE ChildDeviceNode, NextDeviceNode;
KIRQL OldIrql;
-
+
KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql);
ChildDeviceNode = ParentDeviceNode->Child;
while (ChildDeviceNode != NULL)
{
NextDeviceNode = ChildDeviceNode->Sibling;
KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql);
-
+
IopCancelPrepareDeviceForRemoval(ChildDeviceNode->PhysicalDeviceObject);
-
+
ChildDeviceNode = NextDeviceNode;
-
+
KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql);
}
KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql);
@@ -4386,10 +4386,10 @@
{
/* This function DOES NOT dereference the device objects on SUCCESS
* but it DOES dereference device objects on FAILURE */
-
+
ULONG i, j;
NTSTATUS Status;
-
+
for (i = 0; i < DeviceRelations->Count; i++)
{
Status = IopPrepareDeviceForRemoval(DeviceRelations->Objects[i], Force);
@@ -4399,9 +4399,9 @@
goto cleanup;
}
}
-
+
return STATUS_SUCCESS;
-
+
cleanup:
/* IRP_MN_CANCEL_REMOVE_DEVICE is also sent to the device
* that failed the IRP_MN_QUERY_REMOVE_DEVICE request */
@@ -4417,7 +4417,7 @@
DeviceRelations->Objects[i] = NULL;
}
ExFreePool(DeviceRelations);
-
+
return Status;
}
@@ -4426,15 +4426,15 @@
IopSendRemoveDeviceRelations(PDEVICE_RELATIONS DeviceRelations)
{
/* This function DOES dereference the device objects in all cases */
-
+
ULONG i;
-
+
for (i = 0; i < DeviceRelations->Count; i++)
{
IopSendRemoveDevice(DeviceRelations->Objects[i]);
DeviceRelations->Objects[i] = NULL;
}
-
+
ExFreePool(DeviceRelations);
}
@@ -4443,16 +4443,16 @@
IopCancelRemoveDeviceRelations(PDEVICE_RELATIONS DeviceRelations)
{
/* This function DOES dereference the device objects in all cases */
-
+
ULONG i;
-
+
for (i = 0; i < DeviceRelations->Count; i++)
{
IopCancelPrepareDeviceForRemoval(DeviceRelations->Objects[i]);
ObDereferenceObject(DeviceRelations->Objects[i]);
DeviceRelations->Objects[i] = NULL;
}
-
+
ExFreePool(DeviceRelations);
}
@@ -4463,11 +4463,11 @@
IO_STATUS_BLOCK IoStatusBlock;
PDEVICE_RELATIONS DeviceRelations;
NTSTATUS Status;
-
+
IopCancelRemoveDevice(DeviceObject);
-
+
Stack.Parameters.QueryDeviceRelations.Type = RemovalRelations;
-
+
Status = IopInitiatePnpIrp(DeviceObject,
&IoStatusBlock,
IRP_MN_QUERY_DEVICE_RELATIONS,
@@ -4481,7 +4481,7 @@
{
DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
}
-
+
if (DeviceRelations)
IopCancelRemoveDeviceRelations(DeviceRelations);
}
@@ -4500,16 +4500,16 @@
DPRINT1("Removal not allowed for %wZ\n",
&DeviceNode->InstancePath);
return STATUS_UNSUCCESSFUL;
}
-
+
if (!Force && IopQueryRemoveDevice(DeviceObject) != STATUS_SUCCESS)
{
DPRINT1("Removal vetoed by failing the query remove request\n");
-
+
IopCancelRemoveDevice(DeviceObject);
-
+
return STATUS_UNSUCCESSFUL;
}
-
+
Stack.Parameters.QueryDeviceRelations.Type = RemovalRelations;
Status = IopInitiatePnpIrp(DeviceObject,
@@ -4544,7 +4544,7 @@
if (DeviceRelations)
IopSendRemoveDeviceRelations(DeviceRelations);
IopSendRemoveChildDevices(DeviceNode);
-
+
return STATUS_SUCCESS;
}
@@ -4580,17 +4580,17 @@
IO_STACK_LOCATION Stack;
DEVICE_CAPABILITIES Capabilities;
NTSTATUS Status;
-
+
IopQueueTargetDeviceEvent(&GUID_DEVICE_KERNEL_INITIATED_EJECT,
&DeviceNode->InstancePath);
-
+
if (IopQueryDeviceCapabilities(DeviceNode, &Capabilities) != STATUS_SUCCESS)
{
goto cleanup;
}
-
+
Stack.Parameters.QueryDeviceRelations.Type = EjectionRelations;
-
+
Status = IopInitiatePnpIrp(PhysicalDeviceObject,
&IoStatusBlock,
IRP_MN_QUERY_DEVICE_RELATIONS,
@@ -4604,14 +4604,14 @@
{
DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
}
-
+
if (DeviceRelations)
{
Status = IopQueryRemoveDeviceRelations(DeviceRelations, FALSE);
if (!NT_SUCCESS(Status))
goto cleanup;
}
-
+
Status = IopQueryRemoveChildDevices(DeviceNode, FALSE);
if (!NT_SUCCESS(Status))
{
@@ -4619,7 +4619,7 @@
IopCancelRemoveDeviceRelations(DeviceRelations);
goto cleanup;
}
-
+
if (IopPrepareDeviceForRemoval(PhysicalDeviceObject, FALSE) != STATUS_SUCCESS)
{
if (DeviceRelations)
@@ -4627,7 +4627,7 @@
IopCancelRemoveChildDevices(DeviceNode);
goto cleanup;
}
-
+
if (DeviceRelations)
IopSendRemoveDeviceRelations(DeviceRelations);
IopSendRemoveChildDevices(DeviceNode);
@@ -4644,12 +4644,12 @@
{
DeviceNode->Flags |= DNF_DISABLED;
}
-
+
IopQueueTargetDeviceEvent(&GUID_DEVICE_EJECT,
&DeviceNode->InstancePath);
-
+
return;
-
+
cleanup:
IopQueueTargetDeviceEvent(&GUID_DEVICE_EJECT_VETOED,
&DeviceNode->InstancePath);
@@ -4699,7 +4699,7 @@
IN DEVICE_RELATION_TYPE Type)
{
PAGED_CODE();
-
+
switch (Type)
{
case BusRelations:
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnprepo…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c [iso-8859-1] Wed Oct 22 19:34:46 2014
@@ -231,7 +231,7 @@
/* We're enumerated already */
IopDeviceNodeSetFlag(DeviceNode, DNF_ENUMERATED);
-
+
/* We don't call AddDevice for devices reported this way */
IopDeviceNodeSetFlag(DeviceNode, DNF_ADDED);
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpres.c [iso-8859-1] Wed Oct 22 19:34:46 2014
@@ -115,7 +115,7 @@
ASSERT(IoDesc->Type == CmDesc->Type);
ASSERT(IoDesc->Type == CmResourceTypePort);
-
+
/* HACK */
if (IoDesc->u.Port.Alignment == 0) IoDesc->u.Port.Alignment = 1;
@@ -251,7 +251,7 @@
PCM_PARTIAL_RESOURCE_LIST PartialList = (*ResourceList) ?
&(*ResourceList)->List[0].PartialResourceList : NULL;
PIO_RESOURCE_DESCRIPTOR IoDesc = &ResList->Descriptors[ii];
BOOLEAN Matched = FALSE;
-
+
/* Skip alternates if we don't need one */
if (!AlternateRequired && (IoDesc->Option &
IO_RESOURCE_ALTERNATIVE))
{
@@ -386,7 +386,7 @@
FoundResource = FALSE;
}
break;
-
+
case CmResourceTypePort:
/* Find an available port range */
if (!IopFindPortResource(IoDesc, &NewDesc))
@@ -398,7 +398,7 @@
FoundResource = FALSE;
}
break;
-
+
case CmResourceTypeMemory:
/* Find an available memory range */
if (!IopFindMemoryResource(IoDesc, &NewDesc))
@@ -410,7 +410,7 @@
FoundResource = FALSE;
}
break;
-
+
case CmResourceTypeBusNumber:
/* Find an available bus address range */
if (!IopFindBusNumberResource(IoDesc, &NewDesc))
@@ -422,7 +422,7 @@
FoundResource = FALSE;
}
break;
-
+
case CmResourceTypeDma:
/* Find an available DMA channel */
if (!IopFindDmaResource(IoDesc, &NewDesc))
@@ -433,7 +433,7 @@
FoundResource = FALSE;
}
break;
-
+
default:
DPRINT1("Unsupported resource type: %x\n",
IoDesc->Type);
FoundResource = FALSE;
@@ -825,7 +825,7 @@
ULONG OldLength = 0;
ASSERT(DeviceNode->ResourceListTranslated);
-
+
RtlInitUnicodeString(&TranslatedSuffix, L".Translated");
RtlInitUnicodeString(&RawSuffix, L".Raw");
@@ -837,17 +837,17 @@
if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
{
ASSERT(OldLength);
-
+
NameU.Buffer = ExAllocatePool(PagedPool, OldLength + TranslatedSuffix.Length);
if (!NameU.Buffer)
{
ZwClose(PnpMgrLevel2);
return STATUS_INSUFFICIENT_RESOURCES;
}
-
+
NameU.Length = 0;
NameU.MaximumLength = (USHORT)OldLength + TranslatedSuffix.Length;
-
+
Status = IoGetDeviceProperty(DeviceNode->PhysicalDeviceObject,
DevicePropertyPhysicalDeviceObjectName,
NameU.MaximumLength,
@@ -871,7 +871,7 @@
/* This should never happen */
ASSERT(FALSE);
}
-
+
NameU.Length = (USHORT)OldLength;
RtlAppendUnicodeStringToString(&NameU, &RawSuffix);
@@ -972,12 +972,12 @@
DPRINT1("Failed to translate port resource (Start:
0x%I64x)\n", DescriptorRaw->u.Port.Start.QuadPart);
goto cleanup;
}
-
+
if (AddressSpace == 0)
{
DPRINT1("Guessed incorrect address space: 1 -> 0\n");
- /* FIXME: I think all other CM_RESOURCE_PORT_XXX flags are
+ /* FIXME: I think all other CM_RESOURCE_PORT_XXX flags are
* invalid for this state but I'm not 100% sure */
DescriptorRaw->Flags =
DescriptorTranslated->Flags = CM_RESOURCE_PORT_MEMORY;
@@ -993,7 +993,7 @@
DescriptorRaw->u.Interrupt.Vector,
(PKIRQL)&DescriptorTranslated->u.Interrupt.Level,
&DescriptorTranslated->u.Interrupt.Affinity);
-
+
if (!DescriptorTranslated->u.Interrupt.Vector)
{
Status = STATUS_UNSUCCESSFUL;
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnputil…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnputil.c [iso-8859-1] Wed Oct 22 19:34:46 2014
@@ -22,7 +22,7 @@
IN ULONG StringCount)
{
ULONG i;
-
+
/* Go through the list */
if (UnicodeStringList)
{
@@ -36,7 +36,7 @@
ExFreePool(UnicodeStringList[i].Buffer);
}
}
-
+
/* Free the whole list */
ExFreePool(UnicodeStringList);
}
@@ -52,15 +52,15 @@
ULONG i = 0;
SIZE_T n;
ULONG Count = 0;
-
+
/* Validate the key information */
if (KeyValueInformation->Type != REG_MULTI_SZ) return STATUS_INVALID_PARAMETER;
-
+
/* Set the pointers */
p = (PWCHAR)((ULONG_PTR)KeyValueInformation +
KeyValueInformation->DataOffset);
pp = (PWCHAR)((ULONG_PTR)p + KeyValueInformation->DataLength);
-
+
/* Loop the data */
while (p != pp)
{
@@ -69,28 +69,28 @@
{
/* Add to our string count */
Count++;
-
+
/* Check for a double-NULL, which means we're done */
if (((p + 1) == pp) || !(*(p + 1))) break;
}
-
+
/* Go to the next character */
p++;
}
/* If we looped the whole list over, we missed increment a string, do it */
if (p == pp) Count++;
-
+
/* Allocate the list now that we know how big it is */
*UnicodeStringList = ExAllocatePoolWithTag(PagedPool,
sizeof(UNICODE_STRING) * Count,
'sUpP');
if (!(*UnicodeStringList)) return STATUS_INSUFFICIENT_RESOURCES;
-
+
/* Set pointers for second loop */
ps = p = (PWCHAR)((ULONG_PTR)KeyValueInformation +
KeyValueInformation->DataOffset);
-
+
/* Loop again, to do the copy this time */
while (p != pp)
{
@@ -99,7 +99,7 @@
{
/* Check how long this string is */
n = (ULONG_PTR)p - (ULONG_PTR)ps + sizeof(UNICODE_NULL);
-
+
/* Allocate the buffer */
(*UnicodeStringList)[i].Buffer = ExAllocatePoolWithTag(PagedPool,
n,
@@ -110,34 +110,34 @@
PnpFreeUnicodeStringList(*UnicodeStringList, i);
return STATUS_INSUFFICIENT_RESOURCES;
}
-
+
/* Copy the string into the buffer */
RtlCopyMemory((*UnicodeStringList)[i].Buffer, ps, n);
-
+
/* Set the lengths */
(*UnicodeStringList)[i].MaximumLength = (USHORT)n;
(*UnicodeStringList)[i].Length = (USHORT)(n - sizeof(UNICODE_NULL));
-
+
/* One more entry done */
i++;
-
+
/* Check for a double-NULL, which means we're done */
if (((p + 1) == pp) || !(*(p + 1))) break;
/* New string */
ps = p + 1;
}
-
+
/* New string */
p++;
}
-
+
/* Check if we've reached the last string */
if (p == pp)
{
/* Calculate the string length */
n = (ULONG_PTR)p - (ULONG_PTR)ps;
-
+
/* Allocate the buffer for it */
(*UnicodeStringList)[i].Buffer = ExAllocatePoolWithTag(PagedPool,
n +
@@ -149,18 +149,18 @@
PnpFreeUnicodeStringList(*UnicodeStringList, i);
return STATUS_INSUFFICIENT_RESOURCES;
}
-
+
/* Make sure there's an actual string here */
if (n) RtlCopyMemory((*UnicodeStringList)[i].Buffer, ps, n);
/* Null-terminate the string ourselves */
(*UnicodeStringList)[i].Buffer[n / sizeof(WCHAR)] = UNICODE_NULL;
-
+
/* Set the lengths */
(*UnicodeStringList)[i].Length = (USHORT)n;
(*UnicodeStringList)[i].MaximumLength = (USHORT)(n + sizeof(UNICODE_NULL));
}
-
+
/* And we're done */
*UnicodeStringCount = Count;
return STATUS_SUCCESS;
@@ -173,11 +173,11 @@
OUT PUSHORT StringLength OPTIONAL)
{
PWCHAR p, pp;
-
+
/* Find the end */
pp = RegSzData + RegSzLength;
for (p = RegSzData; p < pp; p++) if (!*p) break;
-
+
/* Return it */
if (StringLength) *StringLength = (USHORT)(p - RegSzData) * sizeof(WCHAR);
return TRUE;