lib7
asked on
CreateFile to open a filter driver
Hi,
I am using the Filemon code available on net and I am trying to write an application, of
my own to make IOCTL calls into the Filemon driver. When my application calls CreateFile()
i get an error ERROR_FILE_NOT_FOUND
if((SysHandle = CreateFile( "\\\\.\\FILEMON", // lpFileName GENERIC_READ | GENERIC_WRITE, // dwDesiredAccess
FILE_SHARE_READ | FILE_SHARE_WRITE, // dwShareMode
NULL, // lpSecurityAttributes
OPEN_EXISTING, // dwCreationDistribution
FILE_ATTRIBUTE_NORMAL, // dwFlagsAndAttributes
NULL // hTemplateFile
)) == INVALID_HANDLE_VALUE
Could someone please help !!
Regards,
Lib
----
I am using the Filemon code available on net and I am trying to write an application, of
my own to make IOCTL calls into the Filemon driver. When my application calls CreateFile()
i get an error ERROR_FILE_NOT_FOUND
if((SysHandle = CreateFile( "\\\\.\\FILEMON", // lpFileName GENERIC_READ | GENERIC_WRITE, // dwDesiredAccess
FILE_SHARE_READ | FILE_SHARE_WRITE, // dwShareMode
NULL, // lpSecurityAttributes
OPEN_EXISTING, // dwCreationDistribution
FILE_ATTRIBUTE_NORMAL, // dwFlagsAndAttributes
NULL // hTemplateFile
)) == INVALID_HANDLE_VALUE
Could someone please help !!
Regards,
Lib
----
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>Is it true that two applications cannot get a handle to the same driver at the same time?
Depends on the driver design. In case of FileMon, it would make sense. So, I suggest you load and start filemon.sys from your own application.
Depends on the driver design. In case of FileMon, it would make sense. So, I suggest you load and start filemon.sys from your own application.
ASKER
Thanx for your replies.
I am using the entire code of filemon as it is !
I am just writting an application of my own which will make IOCTL calls into the filemon driver. To communicate with the driver i am getting the handle to it through the CreateFile() call.
To test the application -- i am first running the Filemon.exe (GUI part) which should install the driver. And then i am running my application. And i am getting the error code 5 this time ie ACCESS DENIED.!
Is it true that two applications cannot get a handle to the same driver at the same time?
This could be happening in this case ?
Lib7
-----