|
|
1.1 ! root 1: // genport.h Include file for Generic Port I/O Example Driver ! 2: // ! 3: // Robert R. Howell January 6, 1993 ! 4: // Robert B. Nelson (MS) January 12, 1993 ! 5: // Modified comments prior to posting to Compuserve ! 6: // Changed Wkd* to Gpd* ! 7: // Robert B. Nelson (MS) March 1, 1993 ! 8: // Cleanup and bug fixes for Beta 2 ! 9: // ! 10: #include <ntddk.h> ! 11: #include <string.h> ! 12: #include <devioctl.h> ! 13: #include "gpioctl.h" // Get IOCTL interface definitions ! 14: ! 15: /* Default base port, and # of ports */ ! 16: #define BASE_PORT 0x300 ! 17: #define NUMBER_PORTS 4 ! 18: ! 19: // NT device name ! 20: #define GPD_DEVICE_NAME L"\\Device\\Gpd0" ! 21: ! 22: // File system device name. When you execute a CreateFile call to open the ! 23: // device, use "\\.\GpdDev", or, given C's conversion of \\ to \, use ! 24: // "\\\\.\\GpdDev" ! 25: ! 26: #define DOS_DEVICE_NAME L"\\DosDevices\\GpdDev" ! 27: ! 28: ! 29: // driver local data structure specific to each device object ! 30: typedef struct _LOCAL_DEVICE_INFO { ! 31: ULONG DeviceType; // Our private Device Type ! 32: BOOLEAN PortWasMapped; // If TRUE, we have to unmap on unload ! 33: PVOID PortBase; // base port address ! 34: ULONG PortCount; // Count of I/O addresses used. ! 35: ULONG PortMemoryType; // HalTranslateBusAddress MemoryType ! 36: PDEVICE_OBJECT DeviceObject; // The Gpd device object. ! 37: } LOCAL_DEVICE_INFO, *PLOCAL_DEVICE_INFO; ! 38: ! 39: /********************* function prototypes ***********************************/ ! 40: // ! 41: ! 42: NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, ! 43: IN PUNICODE_STRING RegistryPath ); ! 44: ! 45: NTSTATUS GpdCreateDevice( IN PWSTR szPrototypeName, ! 46: IN DEVICE_TYPE DeviceType, ! 47: IN PDRIVER_OBJECT DriverObject, ! 48: OUT PDEVICE_OBJECT *ppDevObj ); ! 49: ! 50: NTSTATUS GpdDispatch( IN PDEVICE_OBJECT pDO, ! 51: IN PIRP pIrp ); ! 52: ! 53: NTSTATUS GpdIoctlReadPort( IN PLOCAL_DEVICE_INFO pLDI, ! 54: IN PIRP pIrp, ! 55: IN PIO_STACK_LOCATION IrpStack, ! 56: IN ULONG IoctlCode ); ! 57: ! 58: NTSTATUS GpdIoctlWritePort( IN PLOCAL_DEVICE_INFO pLDI, ! 59: IN PIRP pIrp, ! 60: IN PIO_STACK_LOCATION IrpStack, ! 61: IN ULONG IoctlCode ); ! 62: ! 63: VOID GpdUnload( IN PDRIVER_OBJECT DriverObject ); ! 64:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.