hi all,
i am very new to the windows device driver development.
now i am learning how to write a driver .
in this process i have created a sample driver having only these
functions i.e DriverEntry , AddDevice and Unload.
so with this code i am able to install the driver.


now my question is every time i install driver or uninstall driver
,system is asking for reboot.so,can any one give me a solution such
that i can avoid rebooting the system and still be able to
install/uninstall driver.
what i want is i don't want to restart my system once driver is
installed or uninstalled.my OS is WIN2000 and the DDK i am using is
WINDDK .so ,tell me what all changes i need to make.


the code i have written is as follows:


#include <wdm.h>


NTSTATUS myAddDevice(IN PDRIVER_OBJECT DriverObject, IN
PDEVICE_OBJECT pdo);
VOID DriverUnload(IN PDRIVER_OBJECT fdo)


///Driver Entery


NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN
PUNICODE_STRING RegistryPath )
{


DbgPrint ("Drv: Entered Driver Entry\n");
// Initialize Function Pointers


DriverObject->DriverUnload =3D DriverUnload;
DriverObject->DriverExtension->AddDevice =3D myAddDevice;


return STATUS_SUCCESS;


}


// DriverUnload

VOID DriverUnload(IN PDRIVER_OBJECT DriverObject)
{
DbgPrint ("Drv: Entered Driver unload\n");


} // DriverUnload


NTSTATUS myAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT
DeviceObject)
{
NTSTATUS status;
UNICODE_STRING ntDeviceName;
PDEVICE_OBJECT DeviceObject1 =3D NULL;


// Create a functional device object to represent the hardware
we're
managing.


DbgPrint ("Drv: Entered Add Device\n");


RtlInitUnicodeString(&ntDeviceName, L"\\Device\\myDummy");


status =3D IoCreateDevice(DriverObject,
1,
&ntDeviceName,
FILE_DEVICE_UNKNOWN,
0,
FALSE,
&DeviceObject1
);


if(!NT_SUCCESS(status))
DbgPrint ("Drv: IoCreateDevice() fails %x \n",status);
else
DbgPrint ("Drv: IoCreateDevice() success\n");


return status;}


and the .inf file i am using as follows:


; Driver.inf
;
; Installation file (.inf) for the Example Driver to Test device.
;
; (c) Copyright 2005 ESN Tech
;


[Version]
Signature=3D"$Windows NT$"
Provider=3D%ESN%
ClassGUID=3D{4d36e978-e325-11ce-bfc1-08002be10213}
Class=3D%ESN%
CatalogFile=3DDriver.cat
DriverVer=3D02/08/2005


[DestinationDirs]
DefaultDestDir =3D 12


;
; Driver information
;


[Manufacturer]
%ESN% =3D ESN.Mfg


[ESN.Mfg]
%ESN.DeviceDesc0% =3D Driver,


;
; General installation section
;


[Driver]


;
; File sections
;


;
; Service Installation
;


[Driver.Services]
AddService =3D Driver, 0x00000002 , Driver_Service_Inst,
Driver_EventLog_Inst


[Driver_Service_Inst]
ServiceType =3D 1 ; SERVICE_KERNEL_DRIVER
StartType =3D 3 ; SERVICE_DEMAND_START
ErrorControl =3D 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup =3D Pointer Port
ServiceBinary =3D %12%\Driver.sys


[Driver_EventLog_Inst]
AddReg =3D Driver_EventLog_AddReg


[Driver_EventLog_AddReg]
HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLo=ADgMsg.dll;%Sy=
stemRoot%\System32\drivers\Driver.sys"

HKR,,TypesSupported,0x00010001,7


[ClassInstall32]
AddReg=3DESN_addreg


[ESN_addreg]
HKR,,,,%ESN%
HKR,,Installer32,,"Desk.Cpl,DisplayClassInstaller"
HKR,,Icon,,"-1"


;
; Source file information
;


[SourceDisksNames.x86]
1 =3D %DiskId1%,,,""


[SourceDisksFiles]
; Files for disk ESN Tech Installation Disk #1 (Ports)


Driver.sys =3D 1,objchk_wxp_x86\i386,


[Driver]
CopyFil...@Driver.sys


[Strings]


;
; Non-Localizable Strings
;


REG_SZ =3D 0x00000000
REG_MULTI_SZ =3D 0x00010000
REG_EXPAND_SZ =3D 0x00020000
REG_BINARY =3D 0x00000001
REG_DWORD =3D 0x00010001
SERVICEROOT =3D "System\CurrentControlSet\Services"


;
; Localizable Strings
;


ESN.DeviceDesc0 =3D "Example Driver to Test"
DiskId1 =3D "ESN Tech Installation Disk #1 (ESN)"
ESN =3D "ESN Tech"


so i am expecting to provide me all the options that are available.
thanks for your replay=20
regards,=20
bharati.

Re: this is regarding rebooting system after driver install or uninstall by Maxim

Maxim
Thu Feb 10 05:12:58 CST 2005

I think that something is wrong with the INF. Use some INF file as a
template, the INF file which does not require a reboot.

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

<bharatkv@gmail.com> wrote in message
news:1108027010.259891.77900@g14g2000cwa.googlegroups.com...
hi all,
i am very new to the windows device driver development.
now i am learning how to write a driver .
in this process i have created a sample driver having only these
functions i.e DriverEntry , AddDevice and Unload.
so with this code i am able to install the driver.


now my question is every time i install driver or uninstall driver
,system is asking for reboot.so,can any one give me a solution such
that i can avoid rebooting the system and still be able to
install/uninstall driver.
what i want is i don't want to restart my system once driver is
installed or uninstalled.my OS is WIN2000 and the DDK i am using is
WINDDK .so ,tell me what all changes i need to make.


the code i have written is as follows:


#include <wdm.h>


NTSTATUS myAddDevice(IN PDRIVER_OBJECT DriverObject, IN
PDEVICE_OBJECT pdo);
VOID DriverUnload(IN PDRIVER_OBJECT fdo)


///Driver Entery


NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN
PUNICODE_STRING RegistryPath )
{


DbgPrint ("Drv: Entered Driver Entry\n");
// Initialize Function Pointers


DriverObject->DriverUnload = DriverUnload;
DriverObject->DriverExtension->AddDevice = myAddDevice;


return STATUS_SUCCESS;


}


// DriverUnload

VOID DriverUnload(IN PDRIVER_OBJECT DriverObject)
{
DbgPrint ("Drv: Entered Driver unload\n");


} // DriverUnload


NTSTATUS myAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT
DeviceObject)
{
NTSTATUS status;
UNICODE_STRING ntDeviceName;
PDEVICE_OBJECT DeviceObject1 = NULL;


// Create a functional device object to represent the hardware
we're
managing.


DbgPrint ("Drv: Entered Add Device\n");


RtlInitUnicodeString(&ntDeviceName, L"\\Device\\myDummy");


status = IoCreateDevice(DriverObject,
1,
&ntDeviceName,
FILE_DEVICE_UNKNOWN,
0,
FALSE,
&DeviceObject1
);


if(!NT_SUCCESS(status))
DbgPrint ("Drv: IoCreateDevice() fails %x \n",status);
else
DbgPrint ("Drv: IoCreateDevice() success\n");


return status;}


and the .inf file i am using as follows:


; Driver.inf
;
; Installation file (.inf) for the Example Driver to Test device.
;
; (c) Copyright 2005 ESN Tech
;


[Version]
Signature="$Windows NT$"
Provider=%ESN%
ClassGUID={4d36e978-e325-11ce-bfc1-08002be10213}
Class=%ESN%
CatalogFile=Driver.cat
DriverVer=02/08/2005


[DestinationDirs]
DefaultDestDir = 12


;
; Driver information
;


[Manufacturer]
%ESN% = ESN.Mfg


[ESN.Mfg]
%ESN.DeviceDesc0% = Driver,


;
; General installation section
;


[Driver]


;
; File sections
;


;
; Service Installation
;


[Driver.Services]
AddService = Driver, 0x00000002 , Driver_Service_Inst,
Driver_EventLog_Inst


[Driver_Service_Inst]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup = Pointer Port
ServiceBinary = %12%\Driver.sys


[Driver_EventLog_Inst]
AddReg = Driver_EventLog_AddReg


[Driver_EventLog_AddReg]
HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLo­gMsg.dll;%SystemRo
ot%\System32\drivers\Driver.sys"

HKR,,TypesSupported,0x00010001,7


[ClassInstall32]
AddReg=ESN_addreg


[ESN_addreg]
HKR,,,,%ESN%
HKR,,Installer32,,"Desk.Cpl,DisplayClassInstaller"
HKR,,Icon,,"-1"


;
; Source file information
;


[SourceDisksNames.x86]
1 = %DiskId1%,,,""


[SourceDisksFiles]
; Files for disk ESN Tech Installation Disk #1 (Ports)


Driver.sys = 1,objchk_wxp_x86\i386,


[Driver]
CopyFil...@Driver.sys


[Strings]


;
; Non-Localizable Strings
;


REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = "System\CurrentControlSet\Services"


;
; Localizable Strings
;


ESN.DeviceDesc0 = "Example Driver to Test"
DiskId1 = "ESN Tech Installation Disk #1 (ESN)"
ESN = "ESN Tech"


so i am expecting to provide me all the options that are available.
thanks for your replay
regards,
bharati.



RE: this is regarding rebooting system after driver install or uninsta by JimE

JimE
Thu Feb 10 10:49:21 CST 2005

Your problem may be that you have no handler for IRP_MJ_PNP. The system can
add your device but can not start it, so it suggests a restart. I have had
this problem when one of my PNP routines returned an unsuccessful status, too.

"bharatkv@gmail.com" wrote:

> hi all,
> i am very new to the windows device driver development.
> now i am learning how to write a driver .
> in this process i have created a sample driver having only these
> functions i.e DriverEntry , AddDevice and Unload.
> so with this code i am able to install the driver.
>
>
> now my question is every time i install driver or uninstall driver
> ,system is asking for reboot.so,can any one give me a solution such
> that i can avoid rebooting the system and still be able to
> install/uninstall driver.
> what i want is i don't want to restart my system once driver is
> installed or uninstalled.my OS is WIN2000 and the DDK i am using is
> WINDDK .so ,tell me what all changes i need to make.
>
>
> the code i have written is as follows:
>
>
> #include <wdm.h>
>
>
> NTSTATUS myAddDevice(IN PDRIVER_OBJECT DriverObject, IN
> PDEVICE_OBJECT pdo);
> VOID DriverUnload(IN PDRIVER_OBJECT fdo)
>
>
> ///Driver Entery
>
>
> NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN
> PUNICODE_STRING RegistryPath )
> {
>
>
> DbgPrint ("Drv: Entered Driver Entry\n");
> // Initialize Function Pointers
>
>
> DriverObject->DriverUnload = DriverUnload;
> DriverObject->DriverExtension->AddDevice = myAddDevice;
>
>
> return STATUS_SUCCESS;
>
>
> }
>
>
> // DriverUnload
>
> VOID DriverUnload(IN PDRIVER_OBJECT DriverObject)
> {
> DbgPrint ("Drv: Entered Driver unload\n");
>
>
> } // DriverUnload
>
>
> NTSTATUS myAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT
> DeviceObject)
> {
> NTSTATUS status;
> UNICODE_STRING ntDeviceName;
> PDEVICE_OBJECT DeviceObject1 = NULL;
>
>
> // Create a functional device object to represent the hardware
> we're
> managing.
>
>
> DbgPrint ("Drv: Entered Add Device\n");
>
>
> RtlInitUnicodeString(&ntDeviceName, L"\\Device\\myDummy");
>
>
> status = IoCreateDevice(DriverObject,
> 1,
> &ntDeviceName,
> FILE_DEVICE_UNKNOWN,
> 0,
> FALSE,
> &DeviceObject1
> );
>
>
> if(!NT_SUCCESS(status))
> DbgPrint ("Drv: IoCreateDevice() fails %x \n",status);
> else
> DbgPrint ("Drv: IoCreateDevice() success\n");
>
>
> return status;}
>
>
> and the .inf file i am using as follows:
>
>
> ; Driver.inf
> ;
> ; Installation file (.inf) for the Example Driver to Test device.
> ;
> ; (c) Copyright 2005 ESN Tech
> ;
>
>
> [Version]
> Signature="$Windows NT$"
> Provider=%ESN%
> ClassGUID={4d36e978-e325-11ce-bfc1-08002be10213}
> Class=%ESN%
> CatalogFile=Driver.cat
> DriverVer=02/08/2005
>
>
> [DestinationDirs]
> DefaultDestDir = 12
>
>
> ;
> ; Driver information
> ;
>
>
> [Manufacturer]
> %ESN% = ESN.Mfg
>
>
> [ESN.Mfg]
> %ESN.DeviceDesc0% = Driver,
>
>
> ;
> ; General installation section
> ;
>
>
> [Driver]
>
>
> ;
> ; File sections
> ;
>
>
> ;
> ; Service Installation
> ;
>
>
> [Driver.Services]
> AddService = Driver, 0x00000002 , Driver_Service_Inst,
> Driver_EventLog_Inst
>
>
> [Driver_Service_Inst]
> ServiceType = 1 ; SERVICE_KERNEL_DRIVER
> StartType = 3 ; SERVICE_DEMAND_START
> ErrorControl = 0 ; SERVICE_ERROR_IGNORE
> LoadOrderGroup = Pointer Port
> ServiceBinary = %12%\Driver.sys
>
>
> [Driver_EventLog_Inst]
> AddReg = Driver_EventLog_AddReg
>
>
> [Driver_EventLog_AddReg]
> HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLo­gMsg.dll;%SystemRoot%\System32\drivers\Driver.sys"
>
> HKR,,TypesSupported,0x00010001,7
>
>
> [ClassInstall32]
> AddReg=ESN_addreg
>
>
> [ESN_addreg]
> HKR,,,,%ESN%
> HKR,,Installer32,,"Desk.Cpl,DisplayClassInstaller"
> HKR,,Icon,,"-1"
>
>
> ;
> ; Source file information
> ;
>
>
> [SourceDisksNames.x86]
> 1 = %DiskId1%,,,""
>
>
> [SourceDisksFiles]
> ; Files for disk ESN Tech Installation Disk #1 (Ports)
>
>
> Driver.sys = 1,objchk_wxp_x86\i386,
>
>
> [Driver]
> CopyFil...@Driver.sys
>
>
> [Strings]
>
>
> ;
> ; Non-Localizable Strings
> ;
>
>
> REG_SZ = 0x00000000
> REG_MULTI_SZ = 0x00010000
> REG_EXPAND_SZ = 0x00020000
> REG_BINARY = 0x00000001
> REG_DWORD = 0x00010001
> SERVICEROOT = "System\CurrentControlSet\Services"
>
>
> ;
> ; Localizable Strings
> ;
>
>
> ESN.DeviceDesc0 = "Example Driver to Test"
> DiskId1 = "ESN Tech Installation Disk #1 (ESN)"
> ESN = "ESN Tech"
>
>
> so i am expecting to provide me all the options that are available.
> thanks for your replay
> regards,
> bharati.
>
>

Re: this is regarding rebooting system after driver install or uninstall by James

James
Thu Feb 10 14:46:09 CST 2005

The Toaster sample in the DDK does all this nicely. It's a good place to
start for lots of PnP stuff.

--
James Antognini
Windows Driver Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

<bharatkv@gmail.com> wrote in message
news:1108027010.259891.77900@g14g2000cwa.googlegroups.com...
hi all,
i am very new to the windows device driver development.
now i am learning how to write a driver .
in this process i have created a sample driver having only these
functions i.e DriverEntry , AddDevice and Unload.
so with this code i am able to install the driver.


now my question is every time i install driver or uninstall driver
,system is asking for reboot.so,can any one give me a solution such
that i can avoid rebooting the system and still be able to
install/uninstall driver.
what i want is i don't want to restart my system once driver is
installed or uninstalled.my OS is WIN2000 and the DDK i am using is
WINDDK .so ,tell me what all changes i need to make.


the code i have written is as follows:


#include <wdm.h>


NTSTATUS myAddDevice(IN PDRIVER_OBJECT DriverObject, IN
PDEVICE_OBJECT pdo);
VOID DriverUnload(IN PDRIVER_OBJECT fdo)


///Driver Entery


NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, IN
PUNICODE_STRING RegistryPath )
{


DbgPrint ("Drv: Entered Driver Entry\n");
// Initialize Function Pointers


DriverObject->DriverUnload = DriverUnload;
DriverObject->DriverExtension->AddDevice = myAddDevice;


return STATUS_SUCCESS;


}


// DriverUnload

VOID DriverUnload(IN PDRIVER_OBJECT DriverObject)
{
DbgPrint ("Drv: Entered Driver unload\n");


} // DriverUnload


NTSTATUS myAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT
DeviceObject)
{
NTSTATUS status;
UNICODE_STRING ntDeviceName;
PDEVICE_OBJECT DeviceObject1 = NULL;


// Create a functional device object to represent the hardware
we're
managing.


DbgPrint ("Drv: Entered Add Device\n");


RtlInitUnicodeString(&ntDeviceName, L"\\Device\\myDummy");


status = IoCreateDevice(DriverObject,
1,
&ntDeviceName,
FILE_DEVICE_UNKNOWN,
0,
FALSE,
&DeviceObject1
);


if(!NT_SUCCESS(status))
DbgPrint ("Drv: IoCreateDevice() fails %x \n",status);
else
DbgPrint ("Drv: IoCreateDevice() success\n");


return status;}


and the .inf file i am using as follows:


; Driver.inf
;
; Installation file (.inf) for the Example Driver to Test device.
;
; (c) Copyright 2005 ESN Tech
;


[Version]
Signature="$Windows NT$"
Provider=%ESN%
ClassGUID={4d36e978-e325-11ce-bfc1-08002be10213}
Class=%ESN%
CatalogFile=Driver.cat
DriverVer=02/08/2005


[DestinationDirs]
DefaultDestDir = 12


;
; Driver information
;


[Manufacturer]
%ESN% = ESN.Mfg


[ESN.Mfg]
%ESN.DeviceDesc0% = Driver,


;
; General installation section
;


[Driver]


;
; File sections
;


;
; Service Installation
;


[Driver.Services]
AddService = Driver, 0x00000002 , Driver_Service_Inst,
Driver_EventLog_Inst


[Driver_Service_Inst]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup = Pointer Port
ServiceBinary = %12%\Driver.sys


[Driver_EventLog_Inst]
AddReg = Driver_EventLog_AddReg


[Driver_EventLog_AddReg]
HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLo­gMsg.dll;%SystemRoot%\System32\drivers\Driver.sys"

HKR,,TypesSupported,0x00010001,7


[ClassInstall32]
AddReg=ESN_addreg


[ESN_addreg]
HKR,,,,%ESN%
HKR,,Installer32,,"Desk.Cpl,DisplayClassInstaller"
HKR,,Icon,,"-1"


;
; Source file information
;


[SourceDisksNames.x86]
1 = %DiskId1%,,,""


[SourceDisksFiles]
; Files for disk ESN Tech Installation Disk #1 (Ports)


Driver.sys = 1,objchk_wxp_x86\i386,


[Driver]
CopyFil...@Driver.sys


[Strings]


;
; Non-Localizable Strings
;


REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = "System\CurrentControlSet\Services"


;
; Localizable Strings
;


ESN.DeviceDesc0 = "Example Driver to Test"
DiskId1 = "ESN Tech Installation Disk #1 (ESN)"
ESN = "ESN Tech"


so i am expecting to provide me all the options that are available.
thanks for your replay
regards,
bharati.