case IRP_MN_START_DEVICE:
// The device is starting.
// We cannot touch the device (send it any non pnp irps) until a
// start device has been passed down to the lower drivers.
KeInitializeEvent(&event, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(Irp);
IoSetCompletionRoutine(Irp,
(PIO_COMPLETION_ROUTINE) FilterStartCompletionRoutine,
&event,
TRUE,
TRUE,
TRUE);
status = IoCallDriver(pdx->NextLowerDriver, Irp);
//Wait for lower drivers to be done with the Irp. Important thing to
//note here is when you allocate memory for an event in the stack
//you must do a KernelMode wait instead of UserMode to prevent
//the stack from getting paged out.
if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = Irp->IoStatus.Status;
}
if (NT_SUCCESS (status))
{
//As we are successfully now back, we will
//first set our state to Started.
SET_NEW_PNP_STATE(pdx, Started);
//On the way up inherit FILE_REMOVABLE_MEDIA during Start.
//This characteristic is available only after the driver stack is started!.
if (pdx->NextLowerDriver->Characteristics & FILE_REMOVABLE_MEDIA)
DeviceObject->Characteristics |= FILE_REMOVABLE_MEDIA;
//If the PreviousPnPState is stopped then we are being stopped temporarily
//and restarted for resource rebalance.
if (Stopped != pdx->PreviousPnPState)
{
//Device is started for the first time.
CreateControlObject(DeviceObject);
}
}
Irp->IoStatus.Status = status;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
IoReleaseRemoveLock(&pdx->RemoveLock, Irp);
if (UnicodeEqualWstr(&(pdx->className), L"USB"))
GetUSBDeviceInfo(DeviceObject);
return status;
Вот функция с помощью которой пытаюсь определить класс устройства
NTSTATUS GetUSBDeviceInfo(PDEVICE_OBJECT fltdo)
{
NTSTATUS status = STATUS_SUCCESS;
PIRP pIrp = NULL;
PIO_STACK_LOCATION nextStack = NULL;
IO_STATUS_BLOCK ioStatus;
KEVENT event;
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fltdo->DeviceExtension;
PURB pUrb = ExAllocatePool(NonPagedPool, sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST)) ;
PUSB_DEVICE_DESCRIPTOR pDevDesc = ExAllocatePool(NonPagedPool, sizeof(USB_DEVICE_DESCRIPTOR));
if (NULL == pUrb || NULL == pDevDesc)
{
status = STATUS_MEMORY_NOT_ALLOCATED;
goto exit;
}
UsbBuildGetDescriptorRequest(pUrb,
sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST),
USB_DEVICE_DESCRIPTOR_TYPE,
0,
0,
pDevDesc,
NULL,
sizeof(USB_DEVICE_DESCRIPTOR),
NULL);
KeInitializeEvent(&event, NotificationEvent, FALSE);
pIrp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_SUBMIT_URB,
pdx->NextLowerDriver,
NULL,
0,
NULL,
0,
TRUE,
&event,
&ioStatus);
if (NULL == pIrp)
{
status = ioStatus.Status;
goto exit;
}
nextStack = IoGetNextIrpStackLocation(pIrp);
nextStack->Parameters.Others.Argument1 = pUrb;
status = IoCallDriver(pdx->NextLowerDriver, pIrp);
if (STATUS_PENDING == status)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = ioStatus.Status;
}
KdPrint(("USBLink Device Descriptor:\n"));
KdPrint(("-------------------------\n"));
KdPrint(("bDescriptorType 0x%x\n", pDevDesc->bDescriptorType));
KdPrint(("bcdUSB 0x%x\n", pDevDesc->bcdUSB));
KdPrint(("bDeviceClass 0x%x\n", pDevDesc->bDeviceClass));
KdPrint(("bDeviceSubClass 0x%x\n", pDevDesc->bDeviceSubClass));
KdPrint(("bDeviceProtocol 0x%x\n", pDevDesc->bDeviceProtocol));
KdPrint(("idVendor 0x%x\n", pDevDesc->idVendor));
KdPrint(("idProduct 0x%x\n", pDevDesc->idProduct));
KdPrint(("bcdDevice 0x%x\n", pDevDesc->bcdDevice));
KdPrint(("iManufacturer 0x%x\n", pDevDesc->iManufacturer));
KdPrint(("iProduct 0x%x\n", pDevDesc->iProduct));
KdPrint(("iSerialNumber 0x%x\n", pDevDesc->iSerialNumber));
pdx->deviceClass = pDevDesc->bDeviceClass;
exit:
if (pUrb)
ExFreePool(pUrb);
if (pDevDesc)
ExFreePool(pDevDesc);
return status;
}
во время загрузки системы получаю ткую вот вдачу
bDescriptorType 0x0
bcdUSB 0x0
bDeviceClass 0xc8
bDeviceSubClass 0xc8
bDeviceProtocol 0xb9
idVendor 0x6ea
idProduct 0x0
bcdDevice 0x0
iManufacturer 0x0
iProduct 0x0
iSerialNumber 0x50
bDescriptorType 0x0
bcdUSB 0x0
bDeviceClass 0xc8
bDeviceSubClass 0xc8
bDeviceProtocol 0xb9
idVendor 0x717
idProduct 0x0
bcdDevice 0x0
iManufacturer 0x0
iProduct 0x0
iSerialNumber 0x50
другая загрузка
bDescriptorType 0x0
bcdUSB 0x0
bDeviceClass 0x90
bDeviceSubClass 0x85
bDeviceProtocol 0xba
idVendor 0x26b
idProduct 0x0
bcdDevice 0x0
iManufacturer 0x0
iProduct 0x0
iSerialNumber 0x50
bDescriptorType 0x0
bcdUSB 0x0
bDeviceClass 0x90
bDeviceSubClass 0x85
bDeviceProtocol 0xba
idVendor 0x2ae
idProduct 0x0
bcdDevice 0x0
iManufacturer 0x0
iProduct 0x0
iSerialNumber 0x50
помогите с определением usb устройств
Есть ловер фильтр на основе примера из ддк
Вот обработчик IRP_MN_START_DEVICE
Код:
Почему вендор ид и классы устройств разные ? И почему тип дескриптора = 0 ? Это значит данные не валидные ?
А как вытащить правильные ?
Идём сюда------->>>> http://forum.codenet.ru/showthread.php?t=36339
Если нужна инфа, то скину тебе на мыло, пиши в личку :)
[/LEFT]
А причем здесь ассемблер? Что-то я не заметил в словах автора слово Ассемблер.