ReactOS 0.4.17-dev-1281-g065abb3
hubmsos.cpp File Reference
#include "usbhub3.h"
#include "hubregistry.h"
#include <debug.h>
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for hubmsos.cpp:

Go to the source code of this file.

Classes

struct  HubMsOsExtPropHeader
 
struct  HubMsOsCustomProperty
 

Macros

#define NDEBUG
 
#define MSOS_FLAG_CONTAINER_ID   0x02
 
#define MSOS_EXT_PROPERTIES_INDEX   5
 
#define MSOS_EXT_PROPERTIES_VERSION   0x0100
 
#define MSOS_EXT_PROPERTIES_MAX   4096
 
#define MSOS20_TYPE_REGISTRY_PROPERTY   4
 
#define MSOS_CUSTOM_PROPERTY_FIXED   (sizeof(HubMsOsCustomProperty) + sizeof(ULONG))
 

Functions

 C_ASSERT (sizeof(HubMsOsExtPropHeader)==10)
 
 C_ASSERT (sizeof(HubMsOsCustomProperty)==10)
 
static BOOLEAN NTAPI HubMsOsVersionAllowed (_In_ HubChild *Child)
 
static BOOLEAN NTAPI HubHasMsOs20SetInfo (_In_ HubChild *Child)
 
static const HubMsOsExtPropHeader *NTAPI HubExtPropHeader (_In_ HubChild *Child)
 
 _IRQL_requires_ (PASSIVE_LEVEL) static NTSTATUS NTAPI HubInstallMsOs20Property(_In_ HubChild *Child
 Sends a synchronous IOCTL to the specified device object.
 
RtlCopyMemory & DataLength (DataLength)
 
 while (ValueName.Length< Property->wPropertyNameLength &&ValueName.Buffer[ValueName.Length/sizeof(WCHAR)] !=UNICODE_NULL)
 
return HubWriteDeviceValue (Child, &ValueName, Property->wPropertyDataType, DataLength,(PVOID)(Tail+sizeof(DataLength)))
 
static BOOLEAN NTAPI HubCustomPropertyValid (_In_reads_bytes_(Total) const UCHAR *Buffer, _In_ ULONG Total, _In_ ULONG Offset, _Out_ PULONG Size)
 

Variables

_In_ const HubMsOs20Registry * Property
 
const UCHAR * Tail = Name + Property->wPropertyNameLength
 
UNICODE_STRING ValueName
 
USHORT DataLength
 
ValueName Buffer = (PWCHAR)Name
 
ValueName Length = 0
 
ValueName MaximumLength = ValueName.Length
 

Macro Definition Documentation

◆ MSOS20_TYPE_REGISTRY_PROPERTY

#define MSOS20_TYPE_REGISTRY_PROPERTY   4

Definition at line 23 of file hubmsos.cpp.

◆ MSOS_CUSTOM_PROPERTY_FIXED

#define MSOS_CUSTOM_PROPERTY_FIXED   (sizeof(HubMsOsCustomProperty) + sizeof(ULONG))

Definition at line 50 of file hubmsos.cpp.

◆ MSOS_EXT_PROPERTIES_INDEX

#define MSOS_EXT_PROPERTIES_INDEX   5

Definition at line 18 of file hubmsos.cpp.

◆ MSOS_EXT_PROPERTIES_MAX

#define MSOS_EXT_PROPERTIES_MAX   4096

Definition at line 20 of file hubmsos.cpp.

◆ MSOS_EXT_PROPERTIES_VERSION

#define MSOS_EXT_PROPERTIES_VERSION   0x0100

Definition at line 19 of file hubmsos.cpp.

◆ MSOS_FLAG_CONTAINER_ID

#define MSOS_FLAG_CONTAINER_ID   0x02

Definition at line 15 of file hubmsos.cpp.

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file hubmsos.cpp.

Function Documentation

◆ _IRQL_requires_()

_IRQL_requires_ ( PASSIVE_LEVEL  )

Sends a synchronous IOCTL to the specified device object.

Parameters
[in]IoControlCodeThe IOCTL to send to the device.
[in]DeviceObjectPointer to the device object that will handle the IOCTL.
[in]InputBufferOptional pointer to a buffer containing input data for the IOCTL. When specified, the buffer should be at least of InputBufferLength size.
[in]InputBufferLengthSize in bytes, of the buffer pointed by InputBuffer.
[out]OutputBufferOptional pointer to a buffer that will receive output data from the IOCTL. When specified, the buffer should be at least of OutputBufferLength size.
[in]OutputBufferLengthSize in bytes, of the buffer pointed by OutputBuffer.
[in]FileObjectOptional pointer to a file object that may be necessary for the IOCTL.
Returns
An NTSTATUS code indicating success or failure of this function.
Note
Must be called at PASSIVE_LEVEL with all APCs enabled.

Nothing is found unless the PCI bus driver publishes the properties.

The root hub name without its prefix; NULL when the PDO has no name.

Grows a private buffer to what the helper asks for.

Lets KMDF handle the IRP, then hands it back here still uncompleted.

Waits for the device machine to answer a PnP or power event; returns the PnP status.

Deletes the UCX endpoints of the disabled pipes, then the interface record.

One 4 byte value; the registry type is not checked.

Reread whenever user experience settings change; the open status is returned.

Sends a synchronous IOCTL to the specified device object.

STATUS_SUCCESS when the caller's token is an administrator's.

Definition at line 2121 of file class.c.

13175{
13177
13178 PAGED_CODE();
13179
13180 TracePrint((TRACE_LEVEL_VERBOSE,
13181 TRACE_FLAG_PNP,
13182 "ClassDetermineTokenOperationCommandSupport (%p): Entering function.\n",
13183 DeviceObject));
13184
13185 //
13186 // Send down Inquiry for VPD_THIRD_PARTY_COPY_PAGE and cache away the device parameters
13187 // from WINDOWS_BLOCK_DEVICE_TOKEN_LIMITS_DESCRIPTOR.
13188 //
13190
13191 if (NT_SUCCESS(status)) {
13192
13193 ULONG maxListIdentifier = MaxTokenOperationListIdentifier;
13194
13195 //
13196 // Query the maximum list identifier to use for TokenOperation commands.
13197 //
13198 if (NT_SUCCESS(ClasspGetMaximumTokenListIdentifier(DeviceObject, REG_DISK_CLASS_CONTROL, &maxListIdentifier))) {
13199 if (maxListIdentifier >= MIN_TOKEN_LIST_IDENTIFIERS) {
13200
13201 NT_ASSERT(maxListIdentifier <= MAX_TOKEN_LIST_IDENTIFIERS);
13202 MaxTokenOperationListIdentifier = maxListIdentifier;
13203 }
13204 }
13205
13206 }
13207
13208 TracePrint((TRACE_LEVEL_VERBOSE,
13209 TRACE_FLAG_PNP,
13210 "ClassDetermineTokenOperationCommandSupport (%p): Exiting function with status %x.\n",
13212 status));
13213
13214 return status;
13215}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define REG_DISK_CLASS_CONTROL
Definition: classp.h:218
#define MAX_TOKEN_LIST_IDENTIFIERS
Definition: classp.h:215
#define MIN_TOKEN_LIST_IDENTIFIERS
Definition: classp.h:214
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
ULONG MaxTokenOperationListIdentifier
Definition: class.c:107
_IRQL_requires_same_ NTSTATUS ClasspGetBlockDeviceTokenLimitsInfo(_Inout_ PDEVICE_OBJECT DeviceObject)
Definition: class.c:13220
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
#define NT_ASSERT
Definition: rtlfuncs.h:3334

◆ C_ASSERT() [1/2]

C_ASSERT ( sizeof(HubMsOsCustomProperty)  = =10)

◆ C_ASSERT() [2/2]

C_ASSERT ( sizeof(HubMsOsExtPropHeader)  = =10)

◆ DataLength()

◆ HubCustomPropertyValid()

static BOOLEAN NTAPI HubCustomPropertyValid ( _In_reads_bytes_(Total) const UCHAR *  Buffer,
_In_ ULONG  Total,
_In_ ULONG  Offset,
_Out_ PULONG  Size 
)
static

Definition at line 433 of file hubmsos.cpp.

438{
440 ULONG Remaining = Total - Offset;
443 const WCHAR* Name;
444
445 if (Remaining < MSOS_CUSTOM_PROPERTY_FIXED)
446 return FALSE;
447
448 *Size = Property->dwSize;
449 if (*Size > Remaining || *Size < MSOS_CUSTOM_PROPERTY_FIXED)
450 return FALSE;
451
452 if (Property->dwPropertyDataType < REG_SZ || Property->dwPropertyDataType > REG_MULTI_SZ)
453 return FALSE;
454
455 NameLength = Property->wPropertyNameLength;
457 return FALSE;
458
459 Name = (const WCHAR*)(Property + 1);
460 if (Name[0] == UNICODE_NULL || Name[NameLength / sizeof(WCHAR) - 1] != UNICODE_NULL)
461 return FALSE;
462
464
466}
#define REG_SZ
Definition: layer.c:22
Definition: bufpool.h:45
LPWSTR Name
Definition: desk.c:124
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG DataLength
Definition: dispmprt.h:233
#define FALSE
Definition: types.h:117
USHORT DataLength
Definition: hubmsos.cpp:147
#define MSOS_CUSTOM_PROPERTY_FIXED
Definition: hubmsos.cpp:50
ULONG Total
Definition: hubwmi.cpp:548
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define UNICODE_NULL
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
short WCHAR
Definition: pedump.c:58
Input NameLength
Definition: portacpi.cpp:298
unsigned char UCHAR
Definition: typedefs.h:53
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539

Referenced by DeviceMachine::ExtPropertiesValid().

◆ HubExtPropHeader()

static const HubMsOsExtPropHeader *NTAPI HubExtPropHeader ( _In_ HubChild *  Child)
static

Definition at line 76 of file hubmsos.cpp.

78{
79 return (const HubMsOsExtPropHeader*)Child->m_ScratchBuffer;
80}
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536

Referenced by DeviceMachine::AllocateExtPropertiesBuffer(), DeviceMachine::ExtPropertiesHeaderValid(), and DeviceMachine::ExtPropertiesValid().

◆ HubHasMsOs20SetInfo()

static BOOLEAN NTAPI HubHasMsOs20SetInfo ( _In_ HubChild *  Child)
static

◆ HubMsOsVersionAllowed()

static BOOLEAN NTAPI HubMsOsVersionAllowed ( _In_ HubChild *  Child)
static

Definition at line 56 of file hubmsos.cpp.

58{
59 USHORT BcdUsb = Child->m_DeviceDescriptor.bcdUSB;
60
61 return BcdUsb >= 0x0200 || BcdUsb < 0x0100;
62}
unsigned short USHORT
Definition: pedump.c:61

Referenced by DeviceMachine::ContainerIdWanted(), DeviceMachine::MsOsExtendedConfigSupported(), and DeviceMachine::MsOsQueryWanted().

◆ HubWriteDeviceValue()

return HubWriteDeviceValue ( Child  ,
&  ValueName,
Property->  wPropertyDataType,
DataLength  ,
(PVOID)(Tail+sizeof(DataLength))   
)

◆ while()

while ( ValueName.Length< Property->wPropertyNameLength &&ValueName.Buffer !  [ValueName.Length/sizeof(WCHAR)] = UNICODE_NULL)

Definition at line 154 of file hubmsos.cpp.

156 {
157 ValueName.Length += sizeof(WCHAR);
158 }
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243

Variable Documentation

◆ Buffer

Definition at line 152 of file hubmsos.cpp.

◆ DataLength

Definition at line 147 of file hubmsos.cpp.

Referenced by HubCustomPropertyValid().

◆ Length

Definition at line 153 of file hubmsos.cpp.

◆ MaximumLength

Definition at line 159 of file hubmsos.cpp.

◆ Property

Initial value:
{
const UCHAR* Name = (const UCHAR*)(Property + 1)

Definition at line 142 of file hubmsos.cpp.

◆ Tail

const UCHAR* Tail = Name + Property->wPropertyNameLength

Definition at line 145 of file hubmsos.cpp.

Referenced by AfdCancelHandler(), AfdCleanupSocket(), AfdDisconnect(), AtaDeviceFlushPowerIrpQueue(), AtaPortDeviceProcessPowerChange(), BeepCleanup(), CaptureAvoidPipeStarvationWorker(), ClasspDequeueIdleRequest(), ClasspRetryRequestDpc(), ClassRemoveCScanList(), ConvertLargeMCBToDataRuns(), CsqPeekNextIrp(), DECLSPEC_ALIGN(), DequeueDeferredClientIrp(), DisconnectComplete(), DiskFlushComplete(), Ext2FirstUnusedMcb(), FDO_HandleResetCyclePort(), FltpGetNextMessageWaiter(), FreeBT_DispatchClean(), FsRtlCancelNotify(), FsRtlCancelOplockIIIrp(), FsRtlNotifyCompleteIrpList(), FsRtlNotifyFilterReportChange(), FsRtlOplockBreakToNone(), FsRtlOplockCleanup(), FsRtlRequestExclusiveOplock(), FsRtlUninitializeOplock(), HidClass_Close(), HidClass_GetIrp(), IoGetNextIrpStackLocation(), IopAbortIrpKernelApc(), IopCompleteRequest(), IopDeleteIoCompletion(), IopFreeIrpKernelApc(), IopStartNextPacket(), IopStartNextPacketByKey(), KsCancelIo(), KsMoveIrpsOnCancelableQueue(), KspCompletePendingIrps(), KsRemoveIrpFromCancelableQueue(), LanCloseProtocol(), XhciIsochRing::LayoutStage(), ListenComplete(), LockPeekNextIrp(), MkFinalize(), MkIndxFixup(), MountMgrCleanup(), MountMgrNotify(), MsfsPeekNextIrp(), NpCancelWaiter(), NpCheckForNotify(), NpCompleteDeferredIrps(), NpSetClosingPipeState(), NpSetConnectedPipeState(), NpSetDisconnectedPipeState(), NtRemoveIoCompletion(), PacketSocketRecvComplete(), PacketSocketSendComplete(), PinCaptureProcess(), PinGetIrpFromReadyList(), PortStarvedCsqPeekNextIrp(), ProcessQueuedRequests(), ProtocolTransferDataComplete(), ReceiveActivity(), ReceiveComplete(), RemoveHeadList_IRP(), RtlExpandEnvironmentStrings(), ScsiPortDispatchScsi(), SendComplete(), SpiGetNextRequestFromLun(), StartCaptureIsocTransfer(), StreamSocketConnectComplete(), StreamSocketConnectSendComplete(), USBPORT_FlushAbortList(), USBPORT_PeekNextBadRequest(), USBPORT_PeekNextIdleIrp(), USBSTOR_RemoveIrp(), VfdDeviceThread(), and DeviceMachine::WriteCustomProperties().

◆ ValueName

Definition at line 146 of file hubmsos.cpp.