WDF_DECLARE_CONTEXT_TYPE マクロ
The WDF_DECLARE_CONTEXT_TYPE macro creates a name and an accessor method for a driver's object-specific context space.
構文
void WDF_DECLARE_CONTEXT_TYPE(
_contexttype
);
パラメーター
- _contexttype
The symbol name of a driver-defined structure. The structure must describe the contents of an object's context space.
戻り値
This マクロ は値を返しません。
解説
For more information about using this macro, see Framework Object Context Space.
例
The following code example defines a context structure (MY_REQUEST_CONTEXT) for a request object, registers the structure, and then invokes the WDF_DECLARE_CONTEXT_TYPE macro. The macro creates an accessor method for the context structure and names the method WdfObjectGet_MY_REQUEST_CONTEXT.
typedef struct _MY_REQUEST_CONTEXT {
LIST_ENTRY ListEntry;
WDFMEMORY Memory;
} MY_REQUEST_CONTEXT, *PMY_REQUEST_CONTEXT;
WDF_DECLARE_CONTEXT_TYPE(MY_REQUEST_CONTEXT)
The following code example creates a request object, and then it uses the WdfObjectGet_MY_REQUEST_CONTEXT accessor method to obtain a pointer to the object's context space.
WDFREQUEST Request;
WDF_OBJECT_ATTRIBUTES MyRequestObjectAttributes;
PMY_REQUEST_CONTEXT pMyContext;
WDF_OBJECT_ATTRIBUTES_INIT(&MyRequestObjectAttributes);
WDF_OBJECT_ATTRIBUTES_SET_CONTEXT_TYPE(
&MyRequestObjectAttributes,
MY_REQUEST_CONTEXT
);
status = WdfRequestCreate(
&MyRequestObjectAttributes
NULL,
&Request
);
if (!NT_SUCCESS(status)) {
return status;
}
pMyContext = WdfObjectGet_MY_REQUEST_CONTEXT(Request);
要件
バージョン |
Available in version 1.0 and later versions of KMDF. |
ヘッダー |
Wdfobject.h (includeWdf.h) |