Комбинированное звуковое USB-устройство с функциями автономного MP3-плеера и поддержкой Bluetooth
NTSTATUS AT91UsbMassStorageDevice::OnStopDevice(KIrp I){
NTSTATUS status = STATUS_SUCCESS;
t << "Entering AT91UsbMassStorageDevice::OnStopDevice\n";
m_Lower.DeActivateConfiguration();
return status;
UNREFERENCED_PARAMETER(I);}
NTSTATUS AT91UsbMassStorageDevice::OnRemoveDevice(KIrp I){
t << "Entering AT91UsbMassStorageDevice::OnRemoveDevice\
n";
// Device removed, release the system resources used by the USB lower device.
m_Lower.ReleaseResources();
return STATUS_SUCCESS;
UNREFERENCED_PARAMETER(I);}
NTSTATUS AT91UsbMassStorageDevice::Create(KIrp I){
NTSTATUS status;
t << "Entering AT91UsbMassStorageDevice::Create, " << I << EOL;
status = I.PnpComplete(this, STATUS_SUCCESS, IO_NO_INCREMENT);
t << "AT91UsbMassStorageDevice::Create Status " << (ULONG)status << EOL;
return status;}
NTSTATUS AT91UsbMassStorageDevice::Close(KIrp I){
NTSTATUS status;
t << "Entering AT91UsbMassStorageDevice::Close, " << I << EOL;
status = I.PnpComplete(this, STATUS_SUCCESS, IO_NO_INCREMENT);
t << "AT91UsbMassStorageDevice::Close Status " << (ULONG)status << EOL;
return status;}
NTSTATUS AT91UsbMassStorageDevice::CleanUp(KIrp I){
t << "Entering CleanUp, " << I << EOL;
return I.PnpComplete(this, STATUS_SUCCESS);}
NTSTATUS AT91UsbMassStorageDevice::Read(KIrp I){
t << "Entering AT91UsbMassStorageDevice::Read, " << I << EOL;
if (FALSE) // If (Request is invalid)
{I.Information() = 0;// Invalid parameter in the Read request
return I.PnpComplete(this, STATUS_INVALID_PARAMETER);}
if (I.ReadSize() == 0)// Always ok to read 0 elements.
{I.Information() = 0;
return I.PnpComplete(this, STATUS_SUCCESS);}
NTSTATUS status = STATUS_SUCCESS;
KMemory Mem(I.Mdl()); // Declare a memory object
// Use the memory object to create a pointer to the caller's buffer
PUCHAR pBuffer = (PUCHAR) Mem.VirtualAddress();
ULONG dwTotalSize = I.ReadSize(CURRENT); // Requested read size
ULONG dwBytesRead = 0; // Count of bytes read
I.Information() = dwBytesRead;
return I.PnpComplete(this, status);}
NTSTATUS AT91UsbMassStorageDevice::Write(KIrp I){
t << "Entering AT91UsbMassStorageDevice::Write, " << I << EOL;
if (FALSE){
// Invalid parameter in the Write request
I.Information() = 0;
return I.PnpComplete(this, STATUS_INVALID_PARAMETER);}
// Always ok to write 0 elements.
if (I.WriteSize() == 0){
I.Information() = 0;
return I.PnpComplete(this, STATUS_SUCCESS);}
NTSTATUS status = STATUS_SUCCESS;
KMemory Mem(I.Mdl()); // Declare a memory object
// Use the memory object to create a pointer to the caller's buffer
PUCHAR pBuffer = (PUCHAR) Mem.VirtualAddress();
ULONG dwTotalSize = I.WriteSize(CURRENT);
ULONG dwBytesSent = 0;
I.Information() = dwBytesSent;
return I.PnpComplete(this, status);}
NTSTATUS AT91UsbMassStorageDevice::DeviceControl(KIrp I){
NTSTATUS status;
t << "Entering AT91UsbMassStorageDevice::Device Control, " << I << EOL;
switch (I.IoctlCode()){
default:
// Unrecognized IOCTL request
status = STATUS_INVALID_PARAMETER;
break;}
if (status == STATUS_PENDING){return status;}
else{return I.PnpComplete(this, status);}}
AT91UsbMassStorageDevice.h
// AT91UsbMassStorageDevice.h
// Generated by DriverWizard version DriverStudio 2.0.0 (Build 526)
// Requires Compuware's DriverWorks classes
#ifndef AT91UsbMassStorageDevice_h
#define AT91UsbMassStorageDevice_h
class AT91UsbMassStorageDevice : public KPnpDevice
{// Constructors
public:
SAFE_DESTRUCTORS;
AT91UsbMassStorageDevice(PDEVICE_OBJECT Pdo, ULONG Unit);
~AT91UsbMassStorageDevice();
// 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);
#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:
ULONG m_Unit;
KUsbLowerDevice m_Lower;
KUsbInterface m_Interface;};
#endif
interface.h
// interface.h - device interface classes for AT91UsbMassStorage
#define AT91UsbMassStorageDevice_CLASS_GUID \
{ 0x636be6b4, 0x408c, 0x4b38, { 0x93, 0x4e, 0xac, 0xf3, 0x75, 0x71, 0xff, 0x9d } }
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
AT91UsbMassStorage.inf
;--------- Version Section ---------------------------------------------------
[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]
AT91UsbMassStorage_Files_Driver = 10,System32\Drivers
;--------- Manufacturer and Models Sections ----------------------------------
[Manufacturer]
%MfgName%=Mfg0
[Mfg0]
%DeviceDesc%=AT91UsbMassStorage_DDI, USB\VID_FFF2&PID_FFF1
;---------- DDInstall Sections -----------------------------------------------
; --------- Windows 9X -----------------
; Experimentation has shown that DDInstall root names greater than 19 characters
; cause problems in Windows 98
[AT91UsbMassStorage_DDI]
CopyFiles=AT91UsbMassStorage_Files_Driver
AddReg=AT91UsbMassStorage_9X_AddReg
[AT91UsbMassStorage_9X_AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,AT91UsbMassStorage.sys
HKR, "Parameters", "BreakOnEntry", 0x00010001, 0
; --------- Windows NT -----------------
Другие рефераты на тему «Программирование, компьютеры и кибернетика»:
Поиск рефератов
Последние рефераты раздела
- Основные этапы объектно-ориентированного проектирования
- Основные структуры языка Java
- Основные принципы разработки графического пользовательского интерфейса
- Основы дискретной математики
- Программное обеспечение системы принятия решений адаптивного робота
- Программное обеспечение
- Проблемы сохранности информации в процессе предпринимательской деятельности