[1046] | 1 | /*
|
---|
| 2 | * scsiwmi.h
|
---|
| 3 | *
|
---|
| 4 | * SCSI WMILIB interface.
|
---|
| 5 | *
|
---|
| 6 | * This file is part of the w32api package.
|
---|
| 7 | *
|
---|
| 8 | * Contributors:
|
---|
| 9 | * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
---|
| 10 | *
|
---|
| 11 | * THIS SOFTWARE IS NOT COPYRIGHTED
|
---|
| 12 | *
|
---|
| 13 | * This source code is offered for use in the public domain. You may
|
---|
| 14 | * use, modify or distribute it freely.
|
---|
| 15 | *
|
---|
| 16 | * This code is distributed in the hope that it will be useful but
|
---|
| 17 | * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
---|
| 18 | * DISCLAIMED. This includes but is not limited to warranties of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 20 | *
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | #ifndef __SCSIWMI_H
|
---|
| 24 | #define __SCSIWMI_H
|
---|
| 25 |
|
---|
| 26 | #if __GNUC__ >=3
|
---|
| 27 | #pragma GCC system_header
|
---|
| 28 | #endif
|
---|
| 29 |
|
---|
| 30 | #ifdef __cplusplus
|
---|
| 31 | extern "C" {
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | #pragma pack(push,4)
|
---|
| 35 |
|
---|
| 36 | #include "ntddk.h"
|
---|
| 37 | #include "srb.h"
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | typedef struct _SCSIWMI_REQUEST_CONTEXT {
|
---|
| 41 | PVOID UserContext;
|
---|
| 42 | ULONG BufferSize;
|
---|
| 43 | PUCHAR Buffer;
|
---|
| 44 | UCHAR MinorFunction;
|
---|
| 45 | UCHAR ReturnStatus;
|
---|
| 46 | ULONG ReturnSize;
|
---|
| 47 | } SCSIWMI_REQUEST_CONTEXT, *PSCSIWMI_REQUEST_CONTEXT;
|
---|
| 48 |
|
---|
| 49 | #ifdef _GUID_DEFINED
|
---|
| 50 | # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
|
---|
| 51 | #endif
|
---|
| 52 |
|
---|
| 53 | #if ! (defined _GUID_DEFINED || defined GUID_DEFINED)
|
---|
| 54 | #define GUID_DEFINED
|
---|
| 55 | typedef struct _GUID {
|
---|
| 56 | unsigned long Data1;
|
---|
| 57 | unsigned short Data2;
|
---|
| 58 | unsigned short Data3;
|
---|
| 59 | unsigned char Data4[ 8 ];
|
---|
| 60 | } GUID;
|
---|
| 61 | #endif
|
---|
| 62 |
|
---|
| 63 | #ifndef _LPCGUID_DEFINED
|
---|
| 64 | #define _LPCGUID_DEFINED
|
---|
| 65 | typedef const GUID *LPCGUID;
|
---|
| 66 | #endif
|
---|
| 67 |
|
---|
| 68 | typedef struct _SCSIWMIGUIDREGINFO {
|
---|
| 69 | LPCGUID Guid;
|
---|
| 70 | ULONG InstanceCount;
|
---|
| 71 | ULONG Flags;
|
---|
| 72 | } SCSIWMIGUIDREGINFO, *PSCSIWMIGUIDREGINFO;
|
---|
| 73 |
|
---|
| 74 | typedef UCHAR DDKAPI
|
---|
| 75 | (*PSCSIWMI_QUERY_REGINFO)(
|
---|
| 76 | /*IN*/ PVOID DeviceContext,
|
---|
| 77 | /*IN*/ PSCSIWMI_REQUEST_CONTEXT RequestContext,
|
---|
| 78 | /*OUT*/ PWCHAR *MofResourceName);
|
---|
| 79 |
|
---|
| 80 | typedef BOOLEAN DDKAPI
|
---|
| 81 | (*PSCSIWMI_QUERY_DATABLOCK)(
|
---|
| 82 | /*IN*/ PVOID Context,
|
---|
| 83 | /*IN*/ PSCSIWMI_REQUEST_CONTEXT DispatchContext,
|
---|
| 84 | /*IN*/ ULONG GuidIndex,
|
---|
| 85 | /*IN*/ ULONG InstanceIndex,
|
---|
| 86 | /*IN*/ ULONG InstanceCount,
|
---|
| 87 | /*IN OUT*/ PULONG InstanceLengthArray,
|
---|
| 88 | /*IN*/ ULONG BufferAvail,
|
---|
| 89 | /*OUT*/ PUCHAR Buffer);
|
---|
| 90 |
|
---|
| 91 | typedef BOOLEAN DDKAPI
|
---|
| 92 | (*PSCSIWMI_SET_DATABLOCK)(
|
---|
| 93 | /*IN*/ PVOID DeviceContext,
|
---|
| 94 | /*IN*/ PSCSIWMI_REQUEST_CONTEXT RequestContext,
|
---|
| 95 | /*IN*/ ULONG GuidIndex,
|
---|
| 96 | /*IN*/ ULONG InstanceIndex,
|
---|
| 97 | /*IN*/ ULONG BufferSize,
|
---|
| 98 | /*IN*/ PUCHAR Buffer);
|
---|
| 99 |
|
---|
| 100 | typedef BOOLEAN DDKAPI
|
---|
| 101 | (*PSCSIWMI_SET_DATAITEM)(
|
---|
| 102 | /*IN*/ PVOID DeviceContext,
|
---|
| 103 | /*IN*/ PSCSIWMI_REQUEST_CONTEXT RequestContext,
|
---|
| 104 | /*IN*/ ULONG GuidIndex,
|
---|
| 105 | /*IN*/ ULONG InstanceIndex,
|
---|
| 106 | /*IN*/ ULONG DataItemId,
|
---|
| 107 | /*IN*/ ULONG BufferSize,
|
---|
| 108 | /*IN*/ PUCHAR Buffer);
|
---|
| 109 |
|
---|
| 110 | typedef BOOLEAN DDKAPI
|
---|
| 111 | (*PSCSIWMI_EXECUTE_METHOD)(
|
---|
| 112 | /*IN*/ PVOID DeviceContext,
|
---|
| 113 | /*IN*/ PSCSIWMI_REQUEST_CONTEXT RequestContext,
|
---|
| 114 | /*IN*/ ULONG GuidIndex,
|
---|
| 115 | /*IN*/ ULONG InstanceIndex,
|
---|
| 116 | /*IN*/ ULONG MethodId,
|
---|
| 117 | /*IN*/ ULONG InBufferSize,
|
---|
| 118 | /*IN*/ ULONG OutBufferSize,
|
---|
| 119 | /*IN OUT*/ PUCHAR Buffer);
|
---|
| 120 |
|
---|
| 121 | typedef enum _SCSIWMI_ENABLE_DISABLE_CONTROL {
|
---|
| 122 | ScsiWmiEventControl,
|
---|
| 123 | ScsiWmiDataBlockControl
|
---|
| 124 | } SCSIWMI_ENABLE_DISABLE_CONTROL;
|
---|
| 125 |
|
---|
| 126 | typedef BOOLEAN DDKAPI
|
---|
| 127 | (*PSCSIWMI_FUNCTION_CONTROL)(
|
---|
| 128 | /*IN*/ PVOID DeviceContext,
|
---|
| 129 | /*IN*/ PSCSIWMI_REQUEST_CONTEXT RequestContext,
|
---|
| 130 | /*IN*/ ULONG GuidIndex,
|
---|
| 131 | /*IN*/ SCSIWMI_ENABLE_DISABLE_CONTROL Function,
|
---|
| 132 | /*IN*/ BOOLEAN Enable);
|
---|
| 133 |
|
---|
| 134 | typedef struct _SCSIWMILIB_CONTEXT {
|
---|
| 135 | ULONG GuidCount;
|
---|
| 136 | PSCSIWMIGUIDREGINFO GuidList;
|
---|
| 137 | PSCSIWMI_QUERY_REGINFO QueryWmiRegInfo;
|
---|
| 138 | PSCSIWMI_QUERY_DATABLOCK QueryWmiDataBlock;
|
---|
| 139 | PSCSIWMI_SET_DATABLOCK SetWmiDataBlock;
|
---|
| 140 | PSCSIWMI_SET_DATAITEM SetWmiDataItem;
|
---|
| 141 | PSCSIWMI_EXECUTE_METHOD ExecuteWmiMethod;
|
---|
| 142 | PSCSIWMI_FUNCTION_CONTROL WmiFunctionControl;
|
---|
| 143 | } SCSI_WMILIB_CONTEXT, *PSCSI_WMILIB_CONTEXT;
|
---|
| 144 |
|
---|
| 145 | SCSIPORTAPI
|
---|
| 146 | BOOLEAN
|
---|
| 147 | DDKAPI
|
---|
| 148 | ScsiPortWmiDispatchFunction(
|
---|
| 149 | /*IN*/ PSCSI_WMILIB_CONTEXT WmiLibInfo,
|
---|
| 150 | /*IN*/ UCHAR MinorFunction,
|
---|
| 151 | /*IN*/ PVOID DeviceContext,
|
---|
| 152 | /*IN*/ PSCSIWMI_REQUEST_CONTEXT RequestContext,
|
---|
| 153 | /*IN*/ PVOID DataPath,
|
---|
| 154 | /*IN*/ ULONG BufferSize,
|
---|
| 155 | /*IN*/ PVOID Buffer);
|
---|
| 156 |
|
---|
| 157 | #define ScsiPortWmiFireAdapterEvent( \
|
---|
| 158 | HwDeviceExtension, \
|
---|
| 159 | Guid, \
|
---|
| 160 | InstanceIndex, \
|
---|
| 161 | EventDataSize, \
|
---|
| 162 | EventData) \
|
---|
| 163 | ScsiPortWmiFireLogicalUnitEvent( \
|
---|
| 164 | HwDeviceExtension, \
|
---|
| 165 | 0xff, \
|
---|
| 166 | 0, \
|
---|
| 167 | 0, \
|
---|
| 168 | Guid, \
|
---|
| 169 | InstanceIndex, \
|
---|
| 170 | EventDataSize, \
|
---|
| 171 | EventData)
|
---|
| 172 |
|
---|
| 173 | /*
|
---|
| 174 | * ULONG
|
---|
| 175 | * ScsiPortWmiGetReturnSize(
|
---|
| 176 | * PSCSIWMI_REQUEST_CONTEXT RequestContext);
|
---|
| 177 | */
|
---|
| 178 | #define ScsiPortWmiGetReturnSize(RequestContext) \
|
---|
| 179 | ((RequestContext)->ReturnSize)
|
---|
| 180 |
|
---|
| 181 | /* UCHAR
|
---|
| 182 | * ScsiPortWmiGetReturnStatus(
|
---|
| 183 | * PSCSIWMI_REQUEST_CONTEXT RequestContext);
|
---|
| 184 | */
|
---|
| 185 | #define ScsiPortWmiGetReturnStatus(RequestContext) \
|
---|
| 186 | ((RequestContext)->ReturnStatus)
|
---|
| 187 |
|
---|
| 188 | SCSIPORTAPI
|
---|
| 189 | VOID
|
---|
| 190 | DDKAPI
|
---|
| 191 | ScsiPortWmiPostProcess(
|
---|
| 192 | /*IN*/ PSCSIWMI_REQUEST_CONTEXT RequestContext,
|
---|
| 193 | /*IN*/ UCHAR SrbStatus,
|
---|
| 194 | /*IN*/ ULONG BufferUsed);
|
---|
| 195 |
|
---|
| 196 | SCSIPORTAPI
|
---|
| 197 | VOID
|
---|
| 198 | DDKAPI
|
---|
| 199 | ScsiPortWmiFireLogicalUnitEvent(
|
---|
| 200 | /*IN*/ PVOID HwDeviceExtension,
|
---|
| 201 | /*IN*/ UCHAR PathId,
|
---|
| 202 | /*IN*/ UCHAR TargetId,
|
---|
| 203 | /*IN*/ UCHAR Lun,
|
---|
| 204 | /*IN*/ LPGUID Guid,
|
---|
| 205 | /*IN*/ ULONG InstanceIndex,
|
---|
| 206 | /*IN*/ ULONG EventDataSize,
|
---|
| 207 | /*IN*/ PVOID EventData);
|
---|
| 208 |
|
---|
| 209 | #pragma pack(pop)
|
---|
| 210 |
|
---|
| 211 | #ifdef __cplusplus
|
---|
| 212 | }
|
---|
| 213 | #endif
|
---|
| 214 |
|
---|
| 215 | #endif /* __SCSIWMI_H */
|
---|