Click here to Skip to main content
15,884,846 members
Articles / Web Development / HTML

A simple demo for WDM Driver development

Rate me:
Please Sign up or sign in to vote.
4.95/5 (131 votes)
25 Oct 2004CPOL7 min read 423K   10.9K   319  
WDM Driver programming introduction with three Pseudo Drivers.
/*************************************************************************
/*
/*      Copyright 2004/02/03
/*      Author : Meng-Jer Tsai(Taiwan R.O.C)
/*      Email : mjtsai87@ms31.hinet.net
/*      Declaration and Agreement Statements:
/*      [1]This Program is free for redistribution with
/*         or without any modify of the source code containing
/*         in this source file on conditions that the Declaration
/*         and Agreement Statements is included.
/*      [2]If any damanage done to your computer system due to the
/*         execution of the source code in this file, no responsibility
/*         will be taken by the Author.
/*      [3]Any commercial binary executable product developed based on
/*         this source code must have the Copyright and all items in
/*         this Declaration and Agreement Statements in its User License
/*         Agreement, or will be regarded as inappropriate occupy of
/*         software creativity.
/*
/*************************************************************************/

/*************************************************************************
/*
/*      this is the definion header file for pseudo driver's mandantory
/*      routines
*/
/*************************************************************************/

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

NTSTATUS
  AddDevice(
    IN PDRIVER_OBJECT  DriverObject,
    IN PDEVICE_OBJECT  PhysicalDeviceObject 
    );

VOID 
  DriverUnload( 
    IN PDRIVER_OBJECT  DriverObject 
    ); 

NTSTATUS
  PsdoDispatchCreate(
    IN PDEVICE_OBJECT  DeviceObject,
    IN PIRP  Irp
    );

NTSTATUS
  PsdoDispatchClose(
    IN PDEVICE_OBJECT  DeviceObject,
    IN PIRP  Irp
    );

NTSTATUS
  PsdoDispatchDeviceControl(
    IN PDEVICE_OBJECT  DeviceObject,
    IN PIRP  Irp
    );

/*
Per-Binding state information structure
*/


/*
Self-Defined I/O Control Code
*/
//I/O Control Code for Device Information retrieval
#define IOCTL_READ_DEVICE_INFO	          \
	CTL_CODE(		          \
		 FILE_DEVICE_UNKNOWN,	  \
		 0x800,			  \
		 METHOD_BUFFERED,	  \
		 FILE_ANY_ACCESS)

//I/O Control Code for Power Information retrieval
#define IOCTL_READ_POWER_INFO \
        CTL_CODE(	      \
        FILE_DEVICE_UNKNOWN,  \
        0x801,                \
        METHOD_BUFFERED,      \
        FILE_ANY_ACCESS)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Taiwan Taiwan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions