Ramya.
To get started, Pls Check out CD Samples and explanations from
“Programming the Microsoft windows driver model” by Walter oney, which
has Good examples on how pnp works…Chapter on Inf is also
given…Reading this will clear most of your doubts…
Thanks,
Shiva P
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ramya Desai
Sent: Friday, February 11, 2005 10:52 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Need Restarting System after installation of
driver??
Dear all,
Thanq for the response I got for my mail.
I haven’t implemented any PNP in my driver.
Here I am attaching my driver code with this mail.
One more thing I want to ask you is, when I am giving device type as
“unknown” in inf file, windows (2000) is not asking for restart. But I
can not see the driver in device manager. Is it a strange behavior???
I am attaching my inf file along with driver file.
Thanks n regards,
Ramya.
$$$$$$$$$ Driver code $$$$$$$$$$$$$$$$
#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 (“MyDrv: Entered Driver Entry\n”);
DbgPrint (“MyNDrv: Entered Driver Entry2\n”);
// Initialize Function Pointers
DriverObject->DriverUnload = DriverUnload;
DriverObject->DriverExtension->AddDevice = ESNAddDevice;
return STATUS_SUCCESS;
}
// DriverUnload
VOID DriverUnload(IN PDRIVER_OBJECT DriverObject)
{ DbgPrint
(“MyDrv: Entered Driver Unload\n”);
} //
DriverUnload
// AddDevice
NTSTATUS MyAddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT
DeviceObject)
{
// PAGED_CODE();
NTSTATUS status;
UNICODE_STRING ntDeviceName;
PDEVICE_OBJECT DeviceObject1 = NULL;
// Create a functional device object to represent the hardware
we’re managing.
DbgPrint (“MyDrv: Entered Add Device\n”);
DbgPrint (“MyDrv: Entered Add Device2\n”);
RtlInitUnicodeString(&ntDeviceName, L"\Device\MyDummy");
status = IoCreateDevice(DriverObject,
1,
&ntDeviceName,
FILE_DEVICE_UNKNOWN,
0,
FALSE,
&DeviceObject1
);
if(!NT_SUCCESS(status))
DbgPrint (“MyDrv: IoCreateDevice() fails %x
\n”,status);
else
DbgPrint (“MyDrv: IoCreateDevice() success\n”);
return status;
}
$$$$$$$$$$$$ End of driver code $$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$ inf code starts$$$$$$$$$$$$$$$$$$$$$$$$$$
; Driver.inf
;
; Installation file (.inf) for the Example Driver to Test device.
;
; (c) Copyright 2005 My Tech
;
[Version]
Signature=“$Windows NT$”
Provider=%My%
;ClassGUID={4d36e978-e325-11ce-bfc1-08002be10888}
Class=unknown ;if I gave some other name (like…myDDrv) windows is
asking for reboot.
DriverVer=02/08/2005
[DestinationDirs]
DefaultDestDir = 12
;
; Driver information
;
[Manufacturer]
%My% = My.Mfg
[My.Mfg]
%My.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 = SERVICE_ERROR_NORMAL ; SERVICE_ERROR_IGNORE
ServiceBinary = %10%\System32\Drivers\Driver.sys
[Driver_EventLog_Inst]
AddReg = Driver_EventLog_AddReg
[Driver_EventLog_AddReg]
HKR,EventMessageFile,0x00020000,“%SystemRoot%\System32\IoLogMsg.dll;%Sy
stemRoot%\System32\drivers\Driver.sys”
HKR,TypesSupported,0x00010001,7
[ClassInstall32]
AddReg=My_addreg
[My_addreg]
HKR,%My%
HKR,Installer32,“Desk.Cpl,DisplayClassInstaller”
HKR,Icon,“-1”
;
; Source file information
;
[SourceDisksNames]
1=“Driverexample build directory”,
[SourceDisksFiles]
driver.sys=1,objchk\i386<br>
[Driver]
CopyFiles=@Driver.sys,%COPYFLG_NOSKIP%
CopyFiles=@Driver.cat
[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
;
My.DeviceDesc0 = “Example Driver to Test”
DiskId1 = “My Tech Installation Disk #1 (My)”
My = “My Tech”
—
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</wdm.h>