From: Alex F on
Looking at OSR USD sample KMDF driver, I see that that the first place where
DEVICE_CONTEXT is available is EvtDevicePrepareHardware callback, and all
DEVICE_CONTEXT fields are NULL. Can I be sure that this is always the case,
or it is better to fill some fields to NULL, if this is required by driver
algorithm?
For example, I have some PKEVENT field in DEVICE_CONTEXT. In some place, I
fill it with event. In another place, I signal this event if it is not NULL.
So, I must be sure that initially it is nULL, or I need to initialize it.
From: Doron Holan [MSFT] on
your context is available right after a successful call to WdfDeviceCreate.
KMDF will zero initialize the entire context, so any pointer values
contained in your context will be NULL and there is no need for you to set
an initial zero value.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Alex F" <AlexF(a)discussions.microsoft.com> wrote in message
news:AC104054-A392-4BBE-BBC9-F509D7D31F91(a)microsoft.com...
> Looking at OSR USD sample KMDF driver, I see that that the first place
> where
> DEVICE_CONTEXT is available is EvtDevicePrepareHardware callback, and all
> DEVICE_CONTEXT fields are NULL. Can I be sure that this is always the
> case,
> or it is better to fill some fields to NULL, if this is required by driver
> algorithm?
> For example, I have some PKEVENT field in DEVICE_CONTEXT. In some place, I
> fill it with event. In another place, I signal this event if it is not
> NULL.
> So, I must be sure that initially it is nULL, or I need to initialize it.