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.