RE: ***SPAM*** Re: Question on CreateFile

The “Start” value in registry for my driver is 2 (Auto). Note that I
dont have any service (I mean a NT service) associated with this driver.
So I dont see see anything under
My Computer" -> Manage -> Services and applications ->services.

My driver is definitely not UP before I run the app. What does “Auto”
mean here? I thought it will automatically start the driver once the
registry keys are created.
However, once I reboot the PC, then I can see my driver loaded (within
Softice debugger) and then CreateFile also works fine.

Sanjay

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of priya priya
Sent: Wednesday, June 09, 2004 9:26 PM
To: Windows System Software Devs Interest List
Subject: ***SPAM*** Re: [ntdev] Question on CreateFile

Hi,

What is the load order in which your driver is
getting loaded?
Is it boot or auto or manual?

CreateFile call in your application will not
load the driver or go to
driver entry. CreateFile call in the application
will be mapped to
IRP_MJ_CREATE in the driver routine.The driver
should be loaded
during boot or manually. This setting should be
made in the ini or
inf file.Before running your application check
whether the driver is
up.

Right click “My Computer” -> Manage -> Services
and applications ->
services

Check whether ur driver status is started. If it
is not started ,
go to command prompt and type net start
“drivername”.Now it will go
and hit the driverentry of your driver.(if there
are breakpoints)

After this step run your application.The create
file should be called
with your win32device name(Symbolic link created
for your driver).
To view this use the DeviceTree and under ??
check whther the
symbolic name you created appears.I think if all
these are proper
when you call createfile it will map to the
IRP_MJ_CREATE of your
driver without giving any error.

Regards,
Priya

Get your Free E-mail at
http://freelancewriting.zzn.com


Get your own Web-based E-mail Service at
http://www.zzn.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@netscreen.com
To unsubscribe send a blank email to
xxxxx@lists.osr.com

Auto means driver is automatically started by service control manager

when the system is starting up.

So your driver is already started.So i think you can see your driver

name under computer->manage.

Is createfile working right now?

priya


Get your Free E-mail at http://freelancewriting.zzn.com
___________________________________________________________
Get your own Web-based E-mail Service at http://www.zzn.com

I would suggest you go thru the sample

src\general\instdrv

in NT4 Ddk which tell how to load driver using a service where you have
an option
to demand/auto start it…

Pls check with one more sample, in

www.codeproject.com/system

which has a GUI based driver loading utility…

regds,

Shiva P

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Sanjay Chadda
Sent: Thursday, June 10, 2004 10:17 AM
To: Windows System Software Devs Interest List
Subject: RE: ***SPAM*** Re: [ntdev] Question on CreateFile

The “Start” value in registry for my driver is 2 (Auto). Note that I
dont have any service (I mean a NT service) associated with this driver.
So I dont see see anything under
My Computer" -> Manage -> Services and applications ->services.

My driver is definitely not UP before I run the app. What does “Auto”
mean here? I thought it will automatically start the driver once the
registry keys are created.
However, once I reboot the PC, then I can see my driver loaded (within
Softice debugger) and then CreateFile also works fine.

Sanjay

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of priya priya
Sent: Wednesday, June 09, 2004 9:26 PM
To: Windows System Software Devs Interest List
Subject: ***SPAM*** Re: [ntdev] Question on CreateFile

Hi,

What is the load order in which your driver is getting loaded?
Is it boot or auto or manual?

CreateFile call in your application will not load the driver or go to
driver entry. CreateFile call in the application will be mapped to
IRP_MJ_CREATE in the driver routine.The driver should be loaded
during boot or manually. This setting should be made in the ini or
inf file.Before running your application check whether the driver is
up.

Right click “My Computer” -> Manage -> Services and applications ->
services

Check whether ur driver status is started. If it is not started ,
go to command prompt and type net start “drivername”.Now it will go
and hit the driverentry of your driver.(if there are breakpoints)

After this step run your application.The create file should be called
with your win32device name(Symbolic link created for your driver).
To view this use the DeviceTree and under ?? check whther the
symbolic name you created appears.I think if all these are proper
when you call createfile it will map to the IRP_MJ_CREATE of your
driver without giving any error.

Regards,
Priya

Get your Free E-mail at http://freelancewriting.zzn.com


Get your own Web-based E-mail Service at http://www.zzn.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@netscreen.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@wipro.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi Sanjay,

Auto does not mean that service will automatically start when the
registry entries are create manually or programmatically.

Auto means, SCM will automatically start the service during system
startup. So behavior you are seeing is correct.

If you want Service entry in “Services and applications ->services”,
then you will have to register the service using SCM API calls.

  • Rajesh

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Sanjay Chadda
Sent: Thursday, June 10, 2004 10:17 AM
To: Windows System Software Devs Interest List
Subject: RE: ***SPAM*** Re: [ntdev] Question on CreateFile

The “Start” value in registry for my driver is 2 (Auto). Note that I dont
have any service (I mean a NT service) associated with this driver. So I
dont see see anything under
My Computer" -> Manage -> Services and applications ->services.

My driver is definitely not UP before I run the app. What does “Auto” mean
here? I thought it will automatically start the driver once the registry
keys are created.
However, once I reboot the PC, then I can see my driver loaded (within
Softice debugger) and then CreateFile also works fine.

Sanjay

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of priya priya
Sent: Wednesday, June 09, 2004 9:26 PM
To: Windows System Software Devs Interest List
Subject: ***SPAM*** Re: [ntdev] Question on CreateFile

Hi,

What is the load order in which your driver is getting loaded?
Is it boot or auto or manual?

CreateFile call in your application will not load the driver or go to
driver entry. CreateFile call in the application will be mapped to
IRP_MJ_CREATE in the driver routine.The driver should be loaded
during boot or manually. This setting should be made in the ini or
inf file.Before running your application check whether the driver is
up.

Right click “My Computer” -> Manage -> Services and applications ->
services

Check whether ur driver status is started. If it is not started ,
go to command prompt and type net start “drivername”.Now it will go
and hit the driverentry of your driver.(if there are breakpoints)

After this step run your application.The create file should be called
with your win32device name(Symbolic link created for your driver).
To view this use the DeviceTree and under ?? check whther the
symbolic name you created appears.I think if all these are proper
when you call createfile it will map to the IRP_MJ_CREATE of your
driver without giving any error.

Regards,
Priya

Get your Free E-mail at http://freelancewriting.zzn.com


Get your own Web-based E-mail Service at http://www.zzn.com

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@netscreen.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@patni.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Question on CreateFile No. CreateFile will never load a driver (unless this is a SWENUM enumerated driver, which exist only in KS world).

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Sanjay Chadda
To: Windows System Software Devs Interest List
Sent: Thursday, June 10, 2004 1:31 AM
Subject: [ntdev] Question on CreateFile

I have a kernel mode TDI filter driver. I install the driver by copying it to \windows\system32\drivers directory and modifying the registry entries to change the load order (i.e. to load after TCP/IP but before NetBT).

Then, I have a application which uses CreateFile to get handle to driver, but it returns INVALID_HANDLE_VALUE and Getlasterror() always returns 2 (file not found). I was under the impression that calling CreateFile() would load the driver and ultimately call DriverEntry() fn of driver? Am I missing something here? I am calling as follows:

h = CreateFile(
“\\.\”,
GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
NULL
);

Appreciate any responses here…
Sanjay


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com