Two user mode app open handle of a keyboard filter , failed!! why??

Are you setting exclusive on IoCreateDevice? Some versions of ctrl2cap did
that, and this will produce the behavior you describe.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

“moris zhang” wrote in message news:xxxxx@ntdev…
I have write a keyboard filter ( just like Ctrl2Cap) , After install, two
usermode app try to get the handle of it using “CreateFile”, but the first
one success, the second one failed!! why??

any suggestion is appreciated.

hDevice = CreateFile(
“\…\Ctrl2Cap”, 0 ,
FILE_SHARE_WRITE|FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL
);
if ( hDevice == ((HANDLE)-1) )
{
DWORD DW = GetLastError();//dw =0x00000005( access is denied
return FALSE;
}