Ashok Jeev
Ashok Jeev

Reputation: 737

How to load and start windows driver?

Hi I have a simple driver helloworld.sys inside that it has some print statements like kdprint("loaded successfully") etc.. now i need to load the driver and start the service. how to do that..?? Thanks in advance

Upvotes: 2

Views: 5531

Answers (2)

Arash
Arash

Reputation: 393

See the below link where you can find everything you need to know from writing a driver to compiling and starting it:

Introduction to Device Drivers

Upvotes: 1

valdo
valdo

Reputation: 12943

Basically the driver should be registered as a service. Use OpenSCManager to access the service manager functions, then use CreateService to register your driver for the first time.

During the registration you select the driver start type. SERVICE_BOOT_START means the driver should be loaded during the boot time (very early stage of OS loading), SERVICE_SYSTEM_START means the driver should be loaded during the system load (this is typical more-or-less). You may also use SERVICE_DEMAND_START - the driver won't be loaded automatically.

Unless your driver is loaded automatically you should use OpenService to get access to its service, and StartService to actually start it.

The rest depends on what your driver actually does. If it creates a virtual device - you may access it by using CreateFile. Then use DeviceIoControl to actually communicate with it.

Upvotes: 3

Related Questions