161{
165 size_t contextSize;
166
167 contextSize = 0;
169
171
172
173
174
175
177 (WmiInstanceConfig->UseContextForQuery ||
178 WmiInstanceConfig->EvtWmiInstanceQueryInstance !=
NULL ||
179 WmiInstanceConfig->EvtWmiInstanceSetInstance !=
NULL ||
180 WmiInstanceConfig->EvtWmiInstanceSetItem !=
NULL ||
181 WmiInstanceConfig->EvtWmiInstanceExecuteMethod !=
NULL)) {
182
184
187 "WDFWMIPROVIDER %p is event only and UseContextForQuery (%d) is TRUE,"
188 " or a callback (query instance %p, set instance %p, set item %p, "
189 "executue method %p) is not NULL, %!STATUS!",
190 Provider->GetHandle(), WmiInstanceConfig->UseContextForQuery,
191 WmiInstanceConfig->EvtWmiInstanceQueryInstance,
192 WmiInstanceConfig->EvtWmiInstanceSetInstance,
193 WmiInstanceConfig->EvtWmiInstanceSetItem,
194 WmiInstanceConfig->EvtWmiInstanceExecuteMethod,
status);
195
197 }
198
204 }
205
206 if (WmiInstanceConfig->UseContextForQuery) {
207
208
209
210
211 if (WmiInstanceConfig->EvtWmiInstanceSetInstance !=
NULL ||
212 WmiInstanceConfig->EvtWmiInstanceSetItem !=
NULL) {
214
217 "UseContextForQuery set, i.e. a read only instance, but "
218 "EvtWmiInstanceSetInstance %p or EvtWmiInstanceSetItem %p is "
219 "set, %!STATUS!",
220 WmiInstanceConfig->EvtWmiInstanceSetInstance,
221 WmiInstanceConfig->EvtWmiInstanceSetItem,
status);
222
224 }
225
226
227
228
232
235 "UseContextForQuery set, but InstanceAttributes %p is null or "
236 "there is no associated type, %!STATUS!",
238
240 }
241
243
245 status = RtlSizeTAdd(contextSize,
247 &contextSize);
251 "Overlfow adding contextSize %I64d with size override %I64d, "
252 "%!STATUS!", contextSize,
254
256 }
257 }
258
260
261
262
263
264
266
269 "context size %I64d can be %d large, %!STATUS!",
271
273 }
274
275
276
277
278 if (contextSize < Provider->GetMinInstanceBufferSize()) {
280
283 "context size %I64d is less then the WDFWMIPROVIDER %p min size "
284 "of %d, %!STATUS!",
287
289 }
290 }
291
294
297
300 "could not allocate memory for WDFWMIINSTANCE, %!STATUS!",
302
304 }
305
306 if (contextSize > 0) {
308 }
309
313
315
316
317
319 }
320 else {
321
322
323
324
325
327 }
328 }
329
332 }
333 else {
335 }
336
338}
VOID DeleteFromFailedCreate(VOID)
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
VOID SetContextForQueryLength(__in ULONG ContextSize)
#define NT_SUCCESS(StatCode)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
@ FX_VALIDATE_OPTION_PARENT_NOT_ALLOWED
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
FxWmiInstanceExternal * pInstance
#define STATUS_INTEGER_OVERFLOW
#define STATUS_BUFFER_TOO_SMALL
#define TRACE_LEVEL_ERROR
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES InstanceAttributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_WMI_INSTANCE_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_opt_ WDFWMIINSTANCE * Instance
_Must_inspect_result_ _In_ WDFWMIINSTANCE WmiInstance