42#include "classwmi.tmh"
45#define TIME_STRING_LENGTH 25
80#define MOFRESOURCENAME L"MofResourceName"
85#pragma alloc_text(PAGE, ClassSystemControl)
86#pragma alloc_text(PAGE, ClassFindGuid)
87#pragma alloc_text(PAGE, ClassFindInternalGuid)
91#define MSStorageDriver_ClassErrorLogGuid {0xD5A9A51E, 0x03F9, 0x404d, {0x97, 0x22, 0x15, 0xF9, 0x0E, 0xB0, 0x70, 0x38}}
100 MSStorageDriver_ClassErrorLogGuid, 1, 0
104#define MSStorageDriver_ClassErrorLogGuid_Index 0
105#define NUM_CLASS_WMI_GUIDS (sizeof(wmiClassGuids) / sizeof(GUIDREGINFO))
144 for (
i = 0;
i < GuidCount;
i++)
282 isInternalGuid =
FALSE;
286 isInternalGuid =
TRUE;
324 classWmiInfo = commonExtension->
IsFdo ?
327 switch(minorFunction)
338 ULONG registryPathOffset;
339 ULONG mofResourceOffset;
343 ULONG nameSize, nameOffset, nameFlags;
345 PCLASS_QUERY_WMI_REGINFO_EX ClassQueryWmiRegInfoEx;
349 name.MaximumLength = 0;
352 ClassQueryWmiRegInfoEx = commonExtension->
IsFdo ?
358 (ClassQueryWmiRegInfoEx ==
NULL))
370 status = (*ClassQueryWmiRegInfoEx)(
402 nameInfo = commonExtension->
IsFdo ?
408 nameInfo = nameOffset;
411 mofResourceOffset = nameOffset + nameSize;
413 registryPathOffset = mofResourceOffset +
418 bufferNeeded = registryPathOffset + regPath->
Length;
419 bufferNeeded +=
sizeof(
USHORT);
423 retSize = bufferNeeded;
454 bufferNeeded = nameOffset +
sizeof(
WCHAR);
455 bufferNeeded +=
name.Length;
459 *stringPtr++ =
name.Length;
468 bufferNeeded = mofResourceOffset +
sizeof(
WCHAR);
469 bufferNeeded += mofName.
Length;
473 *stringPtr++ = mofName.
Length;
481 bufferNeeded = registryPathOffset +
sizeof(
WCHAR);
482 bufferNeeded += regPath->
Length;
486 *stringPtr++ = regPath->
Length;
500 retSize =
sizeof(
ULONG);
509 Irp->IoStatus.Information = retSize;
555 ULONG dataBlockOffset;
570 (
PUCHAR)wnode + dataBlockOffset);
577 (
PUCHAR)wnode + dataBlockOffset);
829 sizeNeeded = MSStorageDriver_ClassErrorLog_SIZE;
831 PMSStorageDriver_ClassErrorLog errorLog = (PMSStorageDriver_ClassErrorLog)
Buffer;
832 PMSStorageDriver_ClassErrorLogEntry logEntry;
833 PMSStorageDriver_ScsiRequestBlock srbBlock;
834 PMSStorageDriver_SenseData senseData;
842 fdoSRBBlock = &fdoLogEntry->
Srb;
844 logEntry = &errorLog->logEntries[
i];
845 srbBlock = &logEntry->srb;
846 senseData = &logEntry->senseData;
848 logEntry->portNumber = fdoLogEntry->
PortNumber;
856 srbBlock->length = fdoSRBBlock->
Length;
857 srbBlock->function = fdoSRBBlock->
Function;
858 srbBlock->srbStatus = fdoSRBBlock->
SrbStatus;
859 srbBlock->scsiStatus = fdoSRBBlock->
ScsiStatus;
860 srbBlock->pathID = fdoSRBBlock->
PathId;
861 srbBlock->targetID = fdoSRBBlock->
TargetId;
862 srbBlock->lun = fdoSRBBlock->
Lun;
863 srbBlock->queueTag = fdoSRBBlock->
QueueTag;
865 srbBlock->cdbLength = fdoSRBBlock->
CdbLength;
867 srbBlock->srbFlags = fdoSRBBlock->
SrbFlags;
877 srbBlock->reserved = fdoSRBBlock->Reserved;
879 srbBlock->reserved = 0;
887 senseData->errorCode = fdoSenseData->
ErrorCode;
890 senseData->senseKey = fdoSenseData->
SenseKey;
913 ULONG sizeNeeded = 0;
1020 UCHAR minorFunction;
1025 switch(minorFunction)
1039 retSize = bufferNeeded;
1072 retSize = bufferNeeded;
1103 retSize = bufferNeeded;
1133 Irp->IoStatus.Information = retSize;
1184 if (EventData ==
NULL)
1195 event->WnodeHeader.Guid = *
Guid;
1197 event->WnodeHeader.BufferSize = sizeNeeded;
1206 if (EventData !=
NULL)
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define FREE_POOL(_PoolPtr)
#define NUM_ERROR_LOG_ENTRIES
_In_ LPGUID _In_ ULONG InstanceIndex
#define ClassAcquireRemoveLock(devobj, tag)
_In_ PIRP _In_ ULONG GuidIndex
_In_ PIRP _In_ ULONG _In_ ULONG BufferAvail
BOOLEAN ClassFindGuid(PGUIDREGINFO GuidList, ULONG GuidCount, LPGUID Guid, PULONG GuidIndex)
NTSTATUS NTAPI ClassSystemControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
NTSTATUS ClassQueryInternalDataBlock(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN ULONG GuidIndex, IN ULONG BufferAvail, OUT PUCHAR Buffer)
GUIDREGINFO wmiClassGuids[]
#define MSStorageDriver_ClassErrorLogGuid_Index
BOOLEAN ClassFindInternalGuid(LPGUID Guid, PULONG GuidIndex)
#define NUM_CLASS_WMI_GUIDS
#define TIME_STRING_LENGTH
PWCHAR ConvertTickToDateTime(IN LARGE_INTEGER Tick, _Out_writes_(TIME_STRING_LENGTH) PWCHAR String)
SCSIPORT_API NTSTATUS NTAPI ClassWmiCompleteRequest(_In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp, _In_ NTSTATUS Status, _In_ ULONG BufferUsed, _In_ CCHAR PriorityBoost)
#define NT_SUCCESS(StatCode)
VOID NTAPI ClassCompleteRequest(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ CCHAR PriorityBoost)
VOID NTAPI ClassReleaseRemoveLock(_In_ PDEVICE_OBJECT DeviceObject, _In_opt_ PIRP Tag)
#define _IRQL_requires_max_(irql)
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeQuerySystemTime(t)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define _In_reads_bytes_(size)
#define _Out_writes_(size)
#define _Analysis_assume_(expr)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define IoSkipCurrentIrpStackLocation(Irp)
ULONG NTAPI KeQueryTimeIncrement(VOID)
NTSTATUS NTAPI IoWMIWriteEvent(_Inout_ PVOID WnodeEventItem)
#define STATUS_INVALID_BUFFER_SIZE
#define STATUS_WMI_INSTANCE_NOT_FOUND
#define STATUS_WMI_GUID_NOT_FOUND
#define STATUS_DEVICE_DOES_NOT_EXIST
NTSTRSAFEVAPI RtlStringCbPrintfW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
#define IsEqualGUID(rguid1, rguid2)
#define KeQueryTickCount(CurrentCount)
#define STATUS_BUFFER_TOO_SMALL
#define TRACE_LEVEL_WARNING
#define TRACE_LEVEL_VERBOSE
CLASS_WMI_INFO ClassWmiInfo
PCLASS_QUERY_WMI_REGINFO_EX ClassFdoQueryWmiRegInfoEx
PCLASS_QUERY_WMI_REGINFO_EX ClassPdoQueryWmiRegInfoEx
UNICODE_STRING RegistryPath
CLASS_ERROR_LOG_DATA ErrorLogs[NUM_ERROR_LOG_ENTRIES]
PCLASS_WMI_FUNCTION_CONTROL ClassWmiFunctionControl
PCLASS_SET_WMI_DATAITEM ClassSetWmiDataItem
PCLASS_SET_WMI_DATABLOCK ClassSetWmiDataBlock
PCLASS_EXECUTE_WMI_METHOD ClassExecuteWmiMethod
PCLASS_QUERY_WMI_DATABLOCK ClassQueryWmiDataBlock
PCLASS_QUERY_WMI_REGINFO ClassQueryWmiRegInfo
PCLASS_DRIVER_EXTENSION DriverExtension
PDEVICE_OBJECT LowerDeviceObject
struct _IO_STACK_LOCATION::@3974::@4012 WMI
union _IO_STACK_LOCATION::@1575 Parameters
UCHAR SenseInfoBufferLength
struct _SCSI_REQUEST_BLOCK * NextSrb
UCHAR AdditionalSenseLength
UCHAR AdditionalSenseCode
UCHAR FieldReplaceableUnitCode
UCHAR SenseKeySpecific[3]
UCHAR AdditionalSenseCodeQualifier
UCHAR CommandSpecificInformation[4]
struct _WNODE_HEADER WnodeHeader
struct _WNODE_HEADER WnodeHeader
struct _WNODE_HEADER WnodeHeader
struct _WNODE_HEADER WnodeHeader
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define RtlMoveMemory(Destination, Source, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
_In_ WDFREQUEST _In_ NTSTATUS _In_ CCHAR PriorityBoost
_In_ ULONG _Out_ PULONG BufferUsed
_Must_inspect_result_ _In_ WDFWMIINSTANCE _In_opt_ ULONG EventDataSize
struct tagWNODE_METHOD_ITEM * PWNODE_METHOD_ITEM
#define WMIREG_FLAG_INSTANCE_PDO
#define WNODE_FLAG_TOO_SMALL
#define WNODE_FLAG_FIXED_INSTANCE_SIZE
#define WNODE_FLAG_STATIC_INSTANCE_NAMES
struct tagWNODE_ALL_DATA WNODE_ALL_DATA
#define WNODE_FLAG_EVENT_ITEM
#define WMIREG_FLAG_INSTANCE_LIST
struct tagWNODE_ALL_DATA * PWNODE_ALL_DATA
struct tagWNODE_SINGLE_INSTANCE WNODE_SINGLE_INSTANCE
struct tagWNODE_SINGLE_ITEM * PWNODE_SINGLE_ITEM
struct tagWNODE_SINGLE_INSTANCE * PWNODE_SINGLE_INSTANCE
struct tagWNODE_TOO_SMALL * PWNODE_TOO_SMALL
struct tagWNODE_TOO_SMALL WNODE_TOO_SMALL
#define WNODE_FLAG_SINGLE_INSTANCE
_Must_inspect_result_ _In_ ULONG Flags
#define IoWMIDeviceObjectToProviderId(DeviceObject)
#define IRP_MN_EXECUTE_METHOD
#define IRP_MN_DISABLE_COLLECTION
#define IRP_MN_CHANGE_SINGLE_ITEM
#define IRP_MN_QUERY_ALL_DATA
#define IRP_MN_DISABLE_EVENTS
#define IRP_MN_ENABLE_EVENTS
#define IRP_MN_ENABLE_COLLECTION
#define IRP_MN_CHANGE_SINGLE_INSTANCE
#define IRP_MN_QUERY_SINGLE_INSTANCE