Prev: Issue with REMOTE_NDIS_RESET_MSG
Next: WdfUsbTargetDeviceSendControlTransferSynchronously from TimerExpired function causes access violation
From: Vijairaj R on 28 May 2007 21:27 Hi, The SMARTCARD_EXTENSION structure has a member OsData->DeviceObject. What purpose does DeviceObject server here? Why woul'd smclib need the drivers DeviceObject. -- Vijairaj
From: Subodh Radheshyam Gupta on 29 May 2007 11:46 smclib uses it to callback the driver and IRP management purposes. >From DDK >> drivers should copy the pointer of the smart card device object to DeviceObject. Otherwise, the Smart Card Driver Library will not work. Do not use this structure to store driver-dependent information. However, when the smart card driver library calls one of your driver's callback functions, it sets CurrentIrp to the requesting IRP, unless the request is a smart card-tracking request. >> Hope this helps... Subodh
From: Subodh Radheshyam Gupta on 29 May 2007 12:44 smclib uses it to callback the driver and IRP management purposes. >From DDK >> drivers should copy the pointer of the smart card device object to DeviceObject. Otherwise, the Smart Card Driver Library will not work. Do not use this structure to store driver-dependent information. However, when the smart card driver library calls one of your driver's callback functions, it sets CurrentIrp to the requesting IRP, unless the request is a smart card-tracking request. >> Hope this helps... Subodh
From: Vijairaj R on 29 May 2007 21:56 On May 29, 8:46 pm, Subodh Radheshyam Gupta <Subodh.Radheshyam.Gu...(a)gmail.com> wrote: > smclib uses it to callback the driver and IRP management purposes. Why would smclib need DeviceObject for callback? Pointers to callback are already in SmartcardExtension. >From what I understand, the SmartcardDeviceControl should be something like the following: NTSTATUS SmartcardDeviceControl( __in PSMARTCARD_EXTENSION SmartcardExtension, __in PIRP Irp) { ULONG ioctl = _get_ioctl_from_irp(Irp); if (! _is_valid(ioctl)) { status = STATUS_INVALID_DEVICE_REQUEST; } else if (_need_driver_help(SmartcardExtension, ioctl)) { /* Validate parameters */ /* Get drivers help to satisfy the request */ status = SmartcardExtension ->ReaderFunction[_rdf_id(ioctl)] (SmartcardExtension); /* Validate the response */ } else { /* SMCLIB has all info to satisfy this request */ /* Do whatever is needed */ status = _requested_operation(SmartcardExtension, Irp); } if (status != STATUS_PENDING) { IoCompleteRequest(Irp, IO_NO_INCREMENT); } return status; } I don't see the need for DeviceObject in smclib but as per the document it is needed for proper working of the library. 1. Is there registry access or something of that kind, that requires DeviceObject, taking place in smclib? 2. Am I allowed to use a single DeviceObject for multiple SmartcardExtension? (I have used it successfully, just wanted to confirm if it's legal) -- Vijairaj
From: Eliyas Yakub [MSFT] on 30 May 2007 02:04
From looking at the source, the obvious ones are 1) the deviceobject is used for event logging purposes, 2) it's used in calling back into the driver if the driver registers for StartIo routine to handle I/Os. -Eliyas |