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

Go to the source code of this file.

Classes

struct  HubReportWork
 

Macros

#define NDEBUG
 

Functions

 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME (HubReportWork, HubGetReportWork)
 
 _IRQL_requires_ (PASSIVE_LEVEL) static NTSTATUS NTAPI HubOpenThrottleKey(_In_ WDFDEVICE Device
 Sends a synchronous IOCTL to the specified device object.
 
 if (!NT_SUCCESS(Status))
 
 WdfRegistryClose (HardwareKey)
 
 if (HubReadThrottleMask(Device) &(1UL<<(Code &0x1F)))
 
 DPRINT1 ("USBHUB3 live dump 0x%lx, reason 0x%lx, not supported\n", Code, SubReason)
 
static ULONG NTAPI HubReportCode (_In_ HubReport Type)
 
static VOID NTAPI HubEvtReportWorkItem (_In_ WDFWORKITEM WorkItem)
 
NTSTATUS NTAPI HubCreateReport (_In_ WDFDEVICE HubFdo, _In_ HubReport Type, _In_ ULONG SubReason)
 

Variables

_Out_ WDFKEY * WerKey
 
WDFKEY HardwareKey
 
NTSTATUS Status
 
 Device
 
_In_ ULONG Code
 
_In_ ULONG _In_ ULONG SubReason
 
return STATUS_NOT_SUPPORTED
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file errreport.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.

Definition at line 65 of file errreport.cpp.

71{
72 DECLARE_CONST_UNICODE_STRING(MaskName, L"ThrottleMask");
73 WDFKEY Key;
74 ULONG Mask = 0;
76
77 if (!NT_SUCCESS(HubOpenThrottleKey(Device, &Key)))
78 return 0;
79
80 Status = WdfRegistryQueryULong(Key, &MaskName, &Mask);
81 if (!NT_SUCCESS(Status))
82 {
84 DPRINT1("Reading the WER throttle failed 0x%lx\n", Status);
85 Mask = 0;
86 }
87
89 return Mask;
90}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define L(x)
Definition: resources.c:13
WdfRegistryClose(HardwareKey)
NTSTATUS Status
Definition: errreport.cpp:36
unsigned int Mask
Definition: fpcontrol.c:82
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PUCXHUB_DEVICE_CREATE_INFO _Out_ UCXUSBDEVICE * Device
Definition: hubucx.h:258
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
Definition: wdfcore.h:161

◆ DPRINT1()

DPRINT1 ( "USBHUB3 live dump 0x%  lx,
reason 0x%  lx,
not supported\n"  ,
Code  ,
SubReason   
)

◆ HubCreateReport()

NTSTATUS NTAPI HubCreateReport ( _In_ WDFDEVICE  HubFdo,
_In_ HubReport  Type,
_In_ ULONG  SubReason 
)

Device enumeration failures are throttled per hub, since no device is passed.

Definition at line 151 of file errreport.cpp.

155{
158 WDFWORKITEM WorkItem;
160
162 return HubSubmitLiveDump(HubFdo, HubReportCode(Type), SubReason);
163
166 Attributes.ParentObject = HubFdo;
167
168 Status = WdfWorkItemCreate(&Config, &Attributes, &WorkItem);
169 if (!NT_SUCCESS(Status))
170 {
171 DPRINT1("Hub %p report work item create failed 0x%lx\n", HubFdo, Status);
172 return Status;
173 }
174
175 HubGetReportWork(WorkItem)->Type = Type;
176 HubGetReportWork(WorkItem)->SubReason = SubReason;
178
179 return STATUS_SUCCESS;
180}
Type
Definition: Type.h:7
Definition: fdo.h:132
_In_ ULONG Attributes
Definition: dispmprt.h:1077
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
static VOID NTAPI HubEvtReportWorkItem(_In_ WDFWORKITEM WorkItem)
Definition: errreport.cpp:139
_In_ ULONG _In_ ULONG SubReason
Definition: errreport.cpp:100
static ULONG NTAPI HubReportCode(_In_ HubReport Type)
Definition: errreport.cpp:117
WdfWorkItemEnqueue(WorkItem)
_In_opt_ PVOID _In_ PUCXHUB_WORKITEM WorkItem
Definition: hubucx.h:227
#define STATUS_SUCCESS
Definition: shellext.h:65
_Must_inspect_result_ _In_ WDFDEVICE _In_ PUCX_CONTROLLER_CONFIG Config
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:170
FORCEINLINE VOID WDF_WORKITEM_CONFIG_INIT(_Out_ PWDF_WORKITEM_CONFIG Config, _In_ PFN_WDF_WORKITEM EvtWorkItemFunc)
Definition: wdfworkitem.h:85

Referenced by HubEvtReportWorkItem(), and DeviceMachine::ReportEnumFailure().

◆ HubEvtReportWorkItem()

static VOID NTAPI HubEvtReportWorkItem ( _In_ WDFWORKITEM  WorkItem)
static

Definition at line 139 of file errreport.cpp.

141{
142 HubReportWork* Work = HubGetReportWork(WorkItem);
143
144 HubCreateReport((WDFDEVICE)WdfWorkItemGetParentObject(WorkItem), Work->Type, Work->SubReason);
146}
NTSTATUS NTAPI HubCreateReport(_In_ WDFDEVICE HubFdo, _In_ HubReport Type, _In_ ULONG SubReason)
Definition: errreport.cpp:151
ULONG SubReason
Definition: errreport.cpp:17
HubReport Type
Definition: errreport.cpp:16
WdfObjectDelete(String)

Referenced by HubCreateReport().

◆ HubReportCode()

static ULONG NTAPI HubReportCode ( _In_ HubReport  Type)
static

Definition at line 117 of file errreport.cpp.

119{
120 switch (Type)
121 {
124
127
130
131 default:
132 return 0;
133 }
134}
@ DeviceEnumerationFailed
@ HubResetSucceeded
#define HUB_LIVEDUMP_HUB_RESET_FAILED
Definition: hubdriver.h:152
#define HUB_LIVEDUMP_ENUMERATION_FAILED
Definition: hubdriver.h:154
#define HUB_LIVEDUMP_HUB_RESET_OK
Definition: hubdriver.h:151

Referenced by HubCreateReport().

◆ if() [1/2]

if ( !  NT_SUCCESSStatus)

Definition at line 45 of file errreport.cpp.

46 {
47 DPRINT1("Hub %p hardware key open failed 0x%lx\n", Device, Status);
48 return Status;
49 }

◆ if() [2/2]

if ( HubReadThrottleMask(Device) &(1UL<<(Code &0x1F))  )

Definition at line 103 of file errreport.cpp.

104 {
105 DPRINT("Hub %p live dump 0x%lx throttled\n", Device, Code);
106 return STATUS_UNSUCCESSFUL;
107 }
#define DPRINT
Definition: sndvol32.h:73
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_In_ UCHAR _In_ UCHAR _In_ ULONG Code
Definition: wdfdevice.h:1707

◆ WDF_DECLARE_CONTEXT_TYPE_WITH_NAME()

WDF_DECLARE_CONTEXT_TYPE_WITH_NAME ( HubReportWork  ,
HubGetReportWork   
)

◆ WdfRegistryClose()

Variable Documentation

◆ Code

Definition at line 98 of file errreport.cpp.

◆ Device

Definition at line 59 of file errreport.cpp.

◆ HardwareKey

WDFKEY HardwareKey

Definition at line 35 of file errreport.cpp.

◆ Status

Initial value:
WDFKEY HardwareKey
Definition: errreport.cpp:35
return WdfDeviceOpenRegistryKey(Child->m_Pdo->m_Device, PLUGPLAY_REGKEY_DEVICE, Access, WDF_NO_OBJECT_ATTRIBUTES, Key)
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1021
#define WDF_NO_OBJECT_ATTRIBUTES
Definition: wdftypes.h:105
#define PLUGPLAY_REGKEY_DEVICE
Definition: iofuncs.h:2812

Definition at line 36 of file errreport.cpp.

Referenced by _IRQL_requires_(), HubCreateReport(), and if().

◆ STATUS_NOT_SUPPORTED

return STATUS_NOT_SUPPORTED

Definition at line 111 of file errreport.cpp.

◆ SubReason

_In_ ULONG _In_ ULONG SubReason
Initial value:
{
#define PAGED_CODE()

Definition at line 99 of file errreport.cpp.

Referenced by HubCreateReport().

◆ WerKey

* WerKey
Initial value:

Definition at line 32 of file errreport.cpp.