- Handle user logoff in user mode driver and application?
- Posted by zxli on January 18th, 2007
Hello,
I write a simple user mode driver which supports ReadFile from a client
application. When the client application is making an asynchronous reading
operation to the device and I log off the current user, the application
seems to be hung in the non user mode code.
Is there any special code requirement for the user mode driver or the
application to support user logoff scenario?
Thanks!
zxli
- Posted by Maxim S. Shatskih on January 18th, 2007
You must support the IO request cancellation.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com
"zxli" <imzxli@hotmail.com> wrote in message
news:%23jRwxpxOHHA.5064@TK2MSFTNGP04.phx.gbl...
- Posted by zxli on January 19th, 2007
I think I did implement IO request cancellation but the problem still
occurs. Could you help to review my code?
STDMETHODIMP_ (void)
CMyReadWriteQueue::OnRead(
/* [in] */ IWDFIoQueue *pWdfQueue,
/* [in] */ IWDFIoRequest *pWdfRequest,
/* [in] */ SIZE_T BytesToRead
)
{
IRequestCallbackCancel *pCallback = QueryIRequestCallbackCancel();
pWdfRequest->MarkCancelable(pCallback);
pCallback->Release();
m_Device->WaitForInput();
{
// Blocking operation here...
}
hr = pWdfRequest->UnmarkCancelable();
if ( FAILED(hr) )
{
return;
}
}
STDMETHODIMP_ (void)
CMyReadWriteQueue::OnCancel(
IN IWDFIoRequest* pWdfRequest
)
{
pWdfRequest->Complete(HRESULT_FROM_WIN32(ERROR_CANCELLED));
}
Thanks!
zxli
"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:eqgWBVyOHHA.4992@TK2MSFTNGP04.phx.gbl...