The general consensus here is to NOT use pipes between user and kernel
modes. There are timing issues that simply cannot be overcome when using
pipes. The recommended solution is defining the IOCTL codes you need and
using DeviceIoControl in an invereted callback if needed.
Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@airspan.com
Sent: Tuesday, December 08, 2009 1:37 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] ObReferenceObjectByHandle issue
Hi,
My question refers to Windows XP. I am working on an application + driver
package, where the driver informs the application using events.
The following code is used:
Application side:
m_ testHandle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
the driver receives the handle using DeviceIoContol, checks the handle
validity and use the handle returned by ObReferenceObjectByHandle.
if(ObReferenceObjectByHandle(testHandle,
EVENT_MODIFY_STATE,
*ExEventObjectType,
UserMode,
(PVOID*)&TestEvent,
NULL) == STATUS_SUCCESS)
{
//everything is OK
}
Else
{
//set handle to NULL
}
The application worked perfectly until the following changes took place:
- The application now uses a named pipe to connect to a service, the
service sends the DeviceIoContol message to the driver.
Nothing else changed, the application still defines the handle using
CreateFile, and the driver runs the same ObReferenceObjectByHandle function
as before.
For some reason the driver determines that the handle is invalid and will
not return STATUS_SUCCESS.
Thanks.
Guy
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
__________ Information from ESET Smart Security, version of virus signature
database 4671 (20091208) __________
The message was checked by ESET Smart Security.
http://www.eset.com
__________ Information from ESET Smart Security, version of virus signature
database 4671 (20091208) __________
The message was checked by ESET Smart Security.
http://www.eset.com