Комбинированное звуковое USB-устройство с функциями автономного MP3-плеера и поддержкой Bluetooth
ULONG dwTotalSize = I.ReadSize(CURRENT); // Requested read size
ULONG dwBytesRead = 0; // Count of bytes read
I.Information() = dwBytesRead;
return I.PnpComplete(this, status);}
NTSTATUS AT91UsbSounCardDevice::Write(KIrp I){
t << "Entering AT91UsbSounCardDevice::Write, " << I << EOL;
if (FALSE)
{I.Information() = 0;// Invalid parameter in
the Write request
return I.PnpComplete(this, STATUS_INVALID_PARAMETER);}
if (I.WriteSize() == 0)// Always ok to write 0 elements.
{I.Information() = 0;
return I.PnpComplete(this, STATUS_SUCCESS);}
NTSTATUS status = STATUS_SUCCESS;
KMemory Mem(I.Mdl());// Declare a memory object
PUCHAR pBuffer = (PUCHAR) Mem.VirtualAddress();// Use the memory object to create a pointer to the caller's buffer
ULONG dwTotalSize = I.WriteSize(CURRENT);
ULONG dwBytesSent = 0;
I.Information() = dwBytesSent;
return I.PnpComplete(this, status);}
NTSTATUS AT91UsbSounCardDevice::DeviceControl(KIrp I){
NTSTATUS status;
t << "Entering AT91UsbSounCardDevice::Device Control, " << I << EOL;
switch (I.IoctlCode())
{default:status = STATUS_INVALID_PARAMETER;// Unrecognized IOCTL request
break;}
if (status == STATUS_PENDING){return status;}
else{return I.PnpComplete(this, status);}}
AT91UsbSounCardDevice.h
// AT91UsbSounCardDevice.h // Generated by DriverWizard version DriverStudio 2.0.0 (Build 526)
// Requires Compuware's DriverWorks classes
#ifndef AT91UsbSounCardDevice_h
#define AT91UsbSounCardDevice_h
class AT91UsbSounCardDevice : public KPnpDevice
{// Constructors
public:
SAFE_DESTRUCTORS;
AT91UsbSounCardDevice(PDEVICE_OBJECT Pdo, ULONG Unit);
~AT91UsbSounCardDevice();
// Member Functions
public:
DEVMEMBER_DISPATCHERS
virtual NTSTATUS OnStartDevice(KIrp I);
virtual NTSTATUS OnStopDevice(KIrp I);
virtual NTSTATUS OnRemoveDevice(KIrp I);
virtual NTSTATUS DefaultPnp(KIrp I);
virtual NTSTATUS DefaultPower(KIrp I);
virtual NTSTATUS OnDevicePowerUp(KIrp I);
virtual NTSTATUS OnDeviceSleep(KIrp I);
#ifdef _COMMENT_ONLY
virtual NTSTATUS CleanUp(KIrp I); // COMMENT_ONLY
virtual NTSTATUS Create(KIrp I); // COMMENT_ONLY
virtual NTSTATUS Close(KIrp I); // COMMENT_ONLY
virtual NTSTATUS DeviceControl(KIrp I); // COMMENT_ONLY
virtual NTSTATUS SystemControl(KIrp I); // COMMENT_ONLY
virtual NTSTATUS Read(KIrp I); // COMMENT_ONLY
virtual NTSTATUS Write(KIrp I); // COMMENT_ONLY
#endif
// Member Data
protected:
// Unit number for this device (0-9)
ULONG m_Unit;
KUsbLowerDevice m_Lower;
KUsbInterface m_Interface;};
#endif
interface.h
// interface.h - device interface classes for AT91UsbSounCard
// This GUID identifies the device interface class used by the AT91UsbSounCardDevice device
#define AT91UsbSounCardDevice_CLASS_GUID \
{ 0xb46f2426, 0x8406, 0x49bc, { 0xb6, 0xbd, 0xb4, 0x51, 0x40, 0xf1, 0xcc, 0x39 } }
function.h
// function.h This file controls which driver functions are enabled.
#ifndef function_h
#define function_h
#define DRIVER_FUNCTION_CREATE
#define DRIVER_FUNCTION_CLOSE
#define DRIVER_FUNCTION_DEVICE_CONTROL
#define DRIVER_FUNCTION_READ
#define DRIVER_FUNCTION_WRITE
#define DRIVER_FUNCTION_ADD_DEVICE
#define DRIVER_FUNCTION_PNP
#define DRIVER_FUNCTION_POWER
#define DRIVER_FUNCTION_SYSTEM_CONTROL
#define DRIVER_FUNCTION_UNLOAD
#define DRIVER_FUNCTION_CLEANUP
#endif
AT91UsbSounCard.inf
[Version]
Signature="$Windows 95$"
Provider=%ProviderName%
Class=NewDeviceClass
ClassGUID={ff646f80-8def-11d2-9449-00105a075f6b}
; 9X Style
[ClassInstall]
Addreg=Class_AddReg
; NT Style
[ClassInstall32]
Addreg=Class_AddReg
[Class_AddReg]
HKR,,,,%DeviceClassName%
HKR,,Icon,,"-18"
;--------- DestinationDirs Section -------------------------------------------
[DestinationDirs]
AT91UsbSounCard_Files_Driver = 10,System32\Drivers
;--------- Manufacturer and Models Sections ----------------------------------
[Manufacturer]
%MfgName%=Mfg0
[Mfg0]
%DeviceDesc%=AT91UsbSounCard_DDI, USB\VID_FFF1&PID_FFF0
;---------- DDInstall Sections -----------------------------------------------
; --------- Windows 9X -----------------
; Experimentation has shown that DDInstall root names greater than 19 characters
; cause problems in Windows 98
[AT91UsbSounCard_DDI]
CopyFiles=AT91UsbSounCard_Files_Driver
AddReg=AT91UsbSounCard_9X_AddReg
[AT91UsbSounCard_9X_AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,AT91UsbSounCard.sys
HKR, "Parameters", "BreakOnEntry", 0x00010001, 0
; --------- Windows NT -----------------
[AT91UsbSounCard_DDI.NT]
CopyFiles=AT91UsbSounCard_Files_Driver
AddReg=AT91UsbSounCard_NT_AddReg
[AT91UsbSounCard_DDI.NT.Services]
Addservice = AT91UsbSounCard, 0x00000002, AT91UsbSounCard_AddService
[AT91UsbSounCard_AddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\System32\Drivers\AT91UsbSounCard.sys
[AT91UsbSounCard_NT_AddReg]
HKLM, "System\CurrentControlSet\Services\AT91UsbSounCard\Parameters",\
"BreakOnEntry", 0x00010001, 0
; --------- Files (common) -------------
[AT91UsbSounCard_Files_Driver]
AT91UsbSounCard.sys
;--------- Strings Section ---------------------------------------------------
[Strings]
ProviderName="Your Company Name here"
MfgName="Name of HW Manufacturer here"
DeviceDesc="Description of Device here"
DeviceClassName="Description of Device class here"
SvcDesc="Description of NT service here"
AT91UsbMassStorage.cpp
// AT91UsbMassStorage.cpp // Generated by DriverWizard version DriverStudio 2.0.0 (Build 526)
// Requires Compuware's DriverWorks classes
#define VDW_MAIN
#include <vdw.h>
#include <kusb.h>
#include "AT91UsbMassStorage.h"
#include "AT91UsbMassStorageDevice.h"
#pragma hdrstop("AT91UsbMassStorage.pch")
POOLTAG DefaultPoolTag('19TA');
KTrace t("AT91UsbMassStorage");
// Begin INIT section
#pragma code_seg("INIT")
DECLARE_DRIVER_CLASS(AT91UsbMassStorage, NULL)
NTSTATUS AT91UsbMassStorage::DriverEntry(PUNICODE_STRING RegistryPath){
t << "In DriverEntry\n";
KRegistryKey Params(RegistryPath, L"Parameters");// Open the "Parameters" key under the driver
if ( NT_SUCCESS(Params.LastError()) )
{#if DBG
ULONG bBreakOnEntry = FALSE;
Params.QueryValue(L"BreakOnEntry", &bBreakOnEntry);// Read "BreakOnEntry" value from registry
Другие рефераты на тему «Программирование, компьютеры и кибернетика»:
- Бросание игральной кости на VBA
- Проектирование АРМ сотрудника отдела автоматизации информационного обеспечения Ивановского филиала ФОМС
- Использование сети Интернет в юридической деятельности
- Классификация информационных технологий
- Комбинированное звуковое USB-устройство с функциями автономного MP3-плеера и поддержкой Bluetooth
Поиск рефератов
Последние рефераты раздела
- Основные этапы объектно-ориентированного проектирования
- Основные структуры языка Java
- Основные принципы разработки графического пользовательского интерфейса
- Основы дискретной математики
- Программное обеспечение системы принятия решений адаптивного робота
- Программное обеспечение
- Проблемы сохранности информации в процессе предпринимательской деятельности