⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testdrv.h

📁 usb开发的资料!!USB标准
💻 H
字号:


// ===================================================================

//        Testdrv.h

//        Header file for the Test USB Device Driver;

//        Kernel & user mode

//

// ===================================================================



#ifdef DRIVER



#define Test_NAME_MAX  64



//modes

#define Test_MODE_USE_POOL    0

#define Test_MODE_USE_MDL     1



//options

#define Test_OPT_NONE         0





// This is an unused structure in this driver, but is provided here

// so when you extend the driver to deal with USB pipes, you may wish

// to use this structure as an example or model.



typedef struct _Test_PIPE {

    ULONG Mode;

    ULONG Option;

    ULONG Param1;

    ULONG Param2;

    PUSBD_PIPE_INFORMATION PipeInfo;

} Test_PIPE, *PTest_PIPE;



// The interface number on this device that this driver expects to use

// This would be in the bInterfaceNumber field of the Interface Descriptor, hence

// this device driver would need to know this value.



#define SAMPLE_INTERFACE_NBR 0x00



// This driver supports only interface

#define MAX_INTERFACE 0x01





// A structure representing the instance information associated with

// this particular device.



#if DBG



#define Test_KdPrint(_x_) DbgPrint("Test.SYS: "); \

                             DbgPrint _x_ ;

#define TRAP() DbgBreakPoint()

#else

#define Test_KdPrint(_x_)

#define TRAP()

#endif



#ifndef max

#define max(a,b)            (((a) > (b)) ? (a) : (b))

#endif





#endif      //DRIVER section





ULONG

Test_GetDeviceDescriptor(

    IN PDEVICE_OBJECT DeviceObject,

    PVOID             pvOutputBuffer

    );



ULONG

Test_GetConfigDescriptor(

    IN PDEVICE_OBJECT DeviceObject,

    PVOID             pvOutputBuffer,

    ULONG             ulLength

    );



NTSTATUS

Test_ProcessIOCTL(

    IN PDEVICE_OBJECT DeviceObject,

    IN PIRP Irp

    );



NTSTATUS

Test_Create(

    IN PDEVICE_OBJECT DeviceObject,

    IN PIRP Irp

    );



NTSTATUS

Test_Read(

    IN PDEVICE_OBJECT DeviceObject,

    IN PIRP Irp

    );



NTSTATUS

Test_Write(

    IN PDEVICE_OBJECT DeviceObject,

    IN PIRP Irp

    );



// ===================================================================

//

// IRP IOCTL Definitions

//

// User mode applications wishing to send IOCTLs to a kernel mode driver

// must use this file to set up the correct type of IOCTL code permissions.

//

// Note: this file depends on the file DEVIOCTL.H which contains the macro

// definition for "CTL_CODE" below.  Include that file before  you include

// this one in your source code.

//

// ===================================================================



#define Test_IOCTL_INDEX  0x0800



#define IRP_Test_GET_PIPE_INFO     CTL_CODE(FILE_DEVICE_UNKNOWN,  \

                                                   Test_IOCTL_INDEX+0,\

                                                   METHOD_BUFFERED,  \

                                                   FILE_ANY_ACCESS)



#define IRP_Test_GET_DEVICE_DESCRIPTOR CTL_CODE(FILE_DEVICE_UNKNOWN,  \

                                                   Test_IOCTL_INDEX+1,\

                                                   METHOD_BUFFERED,  \

                                                   FILE_ANY_ACCESS)



#define IRP_Test_GET_CONFIGURATION_DESCRIPTOR CTL_CODE(FILE_DEVICE_UNKNOWN,  \

                                                   Test_IOCTL_INDEX+2,\

                                                   METHOD_BUFFERED,  \

                                                   FILE_ANY_ACCESS)





#define IRP_TEST_GETONE                       CTL_CODE(FILE_DEVICE_UNKNOWN,  \

                                                   Test_IOCTL_INDEX+5,\

                                                   METHOD_BUFFERED,  \

                                                   FILE_ANY_ACCESS)



#define IRP_TEST_GETTWO                       CTL_CODE(FILE_DEVICE_UNKNOWN,  \

                                                   Test_IOCTL_INDEX+6,\

                                                   METHOD_BUFFERED,  \

                                                   FILE_ANY_ACCESS)



#define IRP_TEST_SETONE                       CTL_CODE(FILE_DEVICE_UNKNOWN,  \

                                                   Test_IOCTL_INDEX+7,\

                                                   METHOD_BUFFERED,  \

                                                   FILE_ANY_ACCESS)



#define IRP_TEST_SETTWO                       CTL_CODE(FILE_DEVICE_UNKNOWN,  \

                                                   Test_IOCTL_INDEX+8,\

                                                   METHOD_BUFFERED,  \

                                                   FILE_ANY_ACCESS)





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -