mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 07:46:29 +00:00
Fix indentation. No code changes.
svn path=/trunk/; revision=44912
This commit is contained in:
parent
302578ff72
commit
d9a4e205a7
1 changed files with 128 additions and 125 deletions
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
typedef struct _PNP_EVENT_ENTRY
|
typedef struct _PNP_EVENT_ENTRY
|
||||||
{
|
{
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
PLUGPLAY_EVENT_BLOCK Event;
|
PLUGPLAY_EVENT_BLOCK Event;
|
||||||
} PNP_EVENT_ENTRY, *PPNP_EVENT_ENTRY;
|
} PNP_EVENT_ENTRY, *PPNP_EVENT_ENTRY;
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,21 +95,21 @@ IopQueueTargetDeviceEvent(const GUID *Guid,
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
IopRemovePlugPlayEvent(VOID)
|
IopRemovePlugPlayEvent(VOID)
|
||||||
{
|
{
|
||||||
/* Remove a pnp event entry from the tail of the queue */
|
/* Remove a pnp event entry from the tail of the queue */
|
||||||
if (!IsListEmpty(&IopPnpEventQueueHead))
|
if (!IsListEmpty(&IopPnpEventQueueHead))
|
||||||
{
|
{
|
||||||
ExFreePool(RemoveTailList(&IopPnpEventQueueHead));
|
ExFreePool(RemoveTailList(&IopPnpEventQueueHead));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Signal the next pnp event in the queue */
|
/* Signal the next pnp event in the queue */
|
||||||
if (!IsListEmpty(&IopPnpEventQueueHead))
|
if (!IsListEmpty(&IopPnpEventQueueHead))
|
||||||
{
|
{
|
||||||
KeSetEvent(&IopPnpNotifyEvent,
|
KeSetEvent(&IopPnpNotifyEvent,
|
||||||
0,
|
0,
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PDEVICE_OBJECT
|
static PDEVICE_OBJECT
|
||||||
|
@ -148,8 +148,7 @@ IopGetDeviceObjectFromDeviceInstance(PUNICODE_STRING DeviceInstance)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (DeviceInstance == NULL ||
|
if (DeviceInstance == NULL ||
|
||||||
DeviceInstance->Length == 0
|
DeviceInstance->Length == 0)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (IopRootDeviceNode->PhysicalDeviceObject)
|
if (IopRootDeviceNode->PhysicalDeviceObject)
|
||||||
{
|
{
|
||||||
|
@ -173,35 +172,39 @@ IopCaptureUnicodeString(PUNICODE_STRING DstName, PUNICODE_STRING SrcName)
|
||||||
Name.Buffer = NULL;
|
Name.Buffer = NULL;
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
Name.Length = SrcName->Length;
|
Name.Length = SrcName->Length;
|
||||||
Name.MaximumLength = SrcName->MaximumLength;
|
Name.MaximumLength = SrcName->MaximumLength;
|
||||||
if (Name.Length > Name.MaximumLength)
|
if (Name.Length > Name.MaximumLength)
|
||||||
{
|
{
|
||||||
Status = STATUS_INVALID_PARAMETER;
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
_SEH2_LEAVE;
|
_SEH2_LEAVE;
|
||||||
}
|
}
|
||||||
if (Name.MaximumLength)
|
|
||||||
{
|
if (Name.MaximumLength)
|
||||||
ProbeForRead(SrcName->Buffer,
|
{
|
||||||
Name.MaximumLength,
|
ProbeForRead(SrcName->Buffer,
|
||||||
sizeof(WCHAR));
|
Name.MaximumLength,
|
||||||
Name.Buffer = ExAllocatePool(NonPagedPool, Name.MaximumLength);
|
sizeof(WCHAR));
|
||||||
if (Name.Buffer == NULL)
|
Name.Buffer = ExAllocatePool(NonPagedPool, Name.MaximumLength);
|
||||||
{
|
if (Name.Buffer == NULL)
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
{
|
||||||
_SEH2_LEAVE;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
_SEH2_LEAVE;
|
||||||
memcpy(Name.Buffer, SrcName->Buffer, Name.MaximumLength);
|
}
|
||||||
}
|
|
||||||
*DstName = Name;
|
memcpy(Name.Buffer, SrcName->Buffer, Name.MaximumLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
*DstName = Name;
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
if (Name.Buffer) ExFreePool(Name.Buffer);
|
if (Name.Buffer)
|
||||||
|
ExFreePool(Name.Buffer);
|
||||||
Status = _SEH2_GetExceptionCode();
|
Status = _SEH2_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,12 +224,12 @@ IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
|
||||||
Status = IopCaptureUnicodeString(&DeviceInstance, &PropertyData->DeviceInstance);
|
Status = IopCaptureUnicodeString(&DeviceInstance, &PropertyData->DeviceInstance);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
Property = PropertyData->Property;
|
Property = PropertyData->Property;
|
||||||
BufferSize = PropertyData->BufferSize;
|
BufferSize = PropertyData->BufferSize;
|
||||||
ProbeForWrite(PropertyData->Buffer,
|
ProbeForWrite(PropertyData->Buffer,
|
||||||
BufferSize,
|
BufferSize,
|
||||||
|
@ -238,7 +241,7 @@ IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
|
||||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
|
|
||||||
/* Get the device object */
|
/* Get the device object */
|
||||||
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
|
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceInstance);
|
||||||
ExFreePool(DeviceInstance.Buffer);
|
ExFreePool(DeviceInstance.Buffer);
|
||||||
|
@ -250,10 +253,9 @@ IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
|
||||||
Buffer = ExAllocatePool(NonPagedPool, BufferSize);
|
Buffer = ExAllocatePool(NonPagedPool, BufferSize);
|
||||||
if (Buffer == NULL)
|
if (Buffer == NULL)
|
||||||
{
|
{
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Status = IoGetDeviceProperty(DeviceObject,
|
Status = IoGetDeviceProperty(DeviceObject,
|
||||||
Property,
|
Property,
|
||||||
BufferSize,
|
BufferSize,
|
||||||
|
@ -264,17 +266,18 @@ IopGetDeviceProperty(PPLUGPLAY_CONTROL_PROPERTY_DATA PropertyData)
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
memcpy(Buffer, PropertyData->Buffer, BufferSize);
|
memcpy(Buffer, PropertyData->Buffer, BufferSize);
|
||||||
PropertyData->BufferSize = BufferSize;
|
PropertyData->BufferSize = BufferSize;
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
Status = _SEH2_GetExceptionCode();
|
Status = _SEH2_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(Buffer);
|
ExFreePool(Buffer);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -298,16 +301,16 @@ IopGetRelatedDevice(PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData)
|
||||||
Status = IopCaptureUnicodeString(&TargetDeviceInstance, &RelatedDeviceData->TargetDeviceInstance);
|
Status = IopCaptureUnicodeString(&TargetDeviceInstance, &RelatedDeviceData->TargetDeviceInstance);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
Relation = RelatedDeviceData->Relation;
|
Relation = RelatedDeviceData->Relation;
|
||||||
MaximumLength = RelatedDeviceData->RelatedDeviceInstanceLength;
|
MaximumLength = RelatedDeviceData->RelatedDeviceInstanceLength;
|
||||||
ProbeForWrite(RelatedDeviceData->RelatedDeviceInstance,
|
ProbeForWrite(RelatedDeviceData->RelatedDeviceInstance,
|
||||||
MaximumLength,
|
MaximumLength,
|
||||||
sizeof(WCHAR));
|
sizeof(WCHAR));
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
|
@ -323,13 +326,13 @@ IopGetRelatedDevice(PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData)
|
||||||
TRUE))
|
TRUE))
|
||||||
{
|
{
|
||||||
DeviceNode = IopRootDeviceNode;
|
DeviceNode = IopRootDeviceNode;
|
||||||
ExFreePool(TargetDeviceInstance.Buffer);
|
ExFreePool(TargetDeviceInstance.Buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Get the device object */
|
/* Get the device object */
|
||||||
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&TargetDeviceInstance);
|
DeviceObject = IopGetDeviceObjectFromDeviceInstance(&TargetDeviceInstance);
|
||||||
ExFreePool(TargetDeviceInstance.Buffer);
|
ExFreePool(TargetDeviceInstance.Buffer);
|
||||||
if (DeviceObject == NULL)
|
if (DeviceObject == NULL)
|
||||||
return STATUS_NO_SUCH_DEVICE;
|
return STATUS_NO_SUCH_DEVICE;
|
||||||
|
|
||||||
|
@ -424,12 +427,12 @@ IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
Operation = StatusData->Operation;
|
Operation = StatusData->Operation;
|
||||||
if (Operation == PNP_SET_DEVICE_STATUS)
|
if (Operation == PNP_SET_DEVICE_STATUS)
|
||||||
{
|
{
|
||||||
DeviceStatus = StatusData->DeviceStatus;
|
DeviceStatus = StatusData->DeviceStatus;
|
||||||
DeviceProblem = StatusData->DeviceProblem;
|
DeviceProblem = StatusData->DeviceProblem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
|
@ -469,16 +472,16 @@ IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData)
|
||||||
|
|
||||||
if (Operation == PNP_GET_DEVICE_STATUS)
|
if (Operation == PNP_GET_DEVICE_STATUS)
|
||||||
{
|
{
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
StatusData->DeviceStatus = DeviceStatus;
|
StatusData->DeviceStatus = DeviceStatus;
|
||||||
StatusData->DeviceProblem = DeviceProblem;
|
StatusData->DeviceProblem = DeviceProblem;
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
Status = _SEH2_GetExceptionCode();
|
Status = _SEH2_GetExceptionCode();
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -499,7 +502,7 @@ IopGetDeviceDepth(PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
|
||||||
Status = IopCaptureUnicodeString(&DeviceInstance, &DepthData->DeviceInstance);
|
Status = IopCaptureUnicodeString(&DeviceInstance, &DepthData->DeviceInstance);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the device object */
|
/* Get the device object */
|
||||||
|
@ -512,7 +515,7 @@ IopGetDeviceDepth(PPLUGPLAY_CONTROL_DEPTH_DATA DepthData)
|
||||||
|
|
||||||
_SEH2_TRY
|
_SEH2_TRY
|
||||||
{
|
{
|
||||||
DepthData->Depth = DeviceNode->Level;
|
DepthData->Depth = DeviceNode->Level;
|
||||||
}
|
}
|
||||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
{
|
{
|
||||||
|
@ -630,59 +633,59 @@ NtGetPlugPlayEvent(IN ULONG Reserved1,
|
||||||
OUT PPLUGPLAY_EVENT_BLOCK Buffer,
|
OUT PPLUGPLAY_EVENT_BLOCK Buffer,
|
||||||
IN ULONG BufferSize)
|
IN ULONG BufferSize)
|
||||||
{
|
{
|
||||||
PPNP_EVENT_ENTRY Entry;
|
PPNP_EVENT_ENTRY Entry;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("NtGetPlugPlayEvent() called\n");
|
DPRINT("NtGetPlugPlayEvent() called\n");
|
||||||
|
|
||||||
/* Function can only be called from user-mode */
|
/* Function can only be called from user-mode */
|
||||||
if (KeGetPreviousMode() == KernelMode)
|
if (KeGetPreviousMode() == KernelMode)
|
||||||
{
|
{
|
||||||
DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n");
|
DPRINT1("NtGetPlugPlayEvent cannot be called from kernel mode!\n");
|
||||||
return STATUS_ACCESS_DENIED;
|
return STATUS_ACCESS_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for Tcb privilege */
|
/* Check for Tcb privilege */
|
||||||
if (!SeSinglePrivilegeCheck(SeTcbPrivilege,
|
if (!SeSinglePrivilegeCheck(SeTcbPrivilege,
|
||||||
UserMode))
|
UserMode))
|
||||||
{
|
{
|
||||||
DPRINT1("NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
|
DPRINT1("NtGetPlugPlayEvent: Caller does not hold the SeTcbPrivilege privilege!\n");
|
||||||
return STATUS_PRIVILEGE_NOT_HELD;
|
return STATUS_PRIVILEGE_NOT_HELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for a PnP event */
|
/* Wait for a PnP event */
|
||||||
DPRINT("Waiting for pnp notification event\n");
|
DPRINT("Waiting for pnp notification event\n");
|
||||||
Status = KeWaitForSingleObject(&IopPnpNotifyEvent,
|
Status = KeWaitForSingleObject(&IopPnpNotifyEvent,
|
||||||
UserRequest,
|
UserRequest,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("KeWaitForSingleObject() failed (Status %lx)\n", Status);
|
DPRINT1("KeWaitForSingleObject() failed (Status %lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get entry from the tail of the queue */
|
/* Get entry from the tail of the queue */
|
||||||
Entry = CONTAINING_RECORD(IopPnpEventQueueHead.Blink,
|
Entry = CONTAINING_RECORD(IopPnpEventQueueHead.Blink,
|
||||||
PNP_EVENT_ENTRY,
|
PNP_EVENT_ENTRY,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
|
|
||||||
/* Check the buffer size */
|
/* Check the buffer size */
|
||||||
if (BufferSize < Entry->Event.TotalSize)
|
if (BufferSize < Entry->Event.TotalSize)
|
||||||
{
|
{
|
||||||
DPRINT1("Buffer is too small for the pnp-event\n");
|
DPRINT1("Buffer is too small for the pnp-event\n");
|
||||||
return STATUS_BUFFER_TOO_SMALL;
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy event data to the user buffer */
|
/* Copy event data to the user buffer */
|
||||||
memcpy(Buffer,
|
memcpy(Buffer,
|
||||||
&Entry->Event,
|
&Entry->Event,
|
||||||
Entry->Event.TotalSize);
|
Entry->Event.TotalSize);
|
||||||
|
|
||||||
DPRINT("NtGetPlugPlayEvent() done\n");
|
DPRINT("NtGetPlugPlayEvent() done\n");
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue