Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
È necessario acquisire un puntatore alla struttura USBCAMD_INTERFACE prima di poter usare le nuove funzionalità USBCAMD2. Per acquisire il puntatore, compilare e inviare una richiesta di IRP_MN_QUERY_INTERFACE dal gestore di SRB_INITIALIZATION_COMPLETE del minidriver della fotocamera nella funzione di callback AdapterReceivePacket. La libreria minidriver USBCAMD2 elabora l'IRP e restituisce un'interfaccia di chiamata diretta di tipo USBCAMD_INTERFACE al minidriver della fotocamera. L'interfaccia è essenzialmente una tabella di puntatori a funzioni.
Il codice seguente illustra come compilare e inviare la richiesta di IRP_MN_QUERY_INTERFACE dal minidriver della fotocamera:
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = IoBuildSynchronousFsdRequest(
IRP_MJ_PNP,
pDeviceObject,
NULL,
0,
NULL,
&Event,
&IoStatusBlock);
if (NULL != Irp)
{
Irp->RequestorMode = KernelMode;
IrpStackNext = IoGetNextIrpStackLocation(Irp);
//
// Create an interface query out of the Irp.
//
IrpStackNext->MinorFunction = IRP_MN_QUERY_INTERFACE;
IrpStackNext->Parameters.QueryInterface.InterfaceType = (GUID*)&GUID_USBCAMD_INTERFACE;
IrpStackNext->Parameters.QueryInterface.Size = sizeof(*pUsbcamdInterface);
IrpStackNext->Parameters.QueryInterface.Version = USBCAMD_VERSION_200;
IrpStackNext->Parameters.QueryInterface.Interface = (PINTERFACE)pUsbcamdInterface;
IrpStackNext->Parameters.QueryInterface.InterfaceSpecificData = NULL;
Status = IoCallDriver(pDeviceObject, Irp);
if (STATUS_PENDING == Status)
{
//
// This waits using KernelMode so that the stack, and therefore the
// event on that stack, is not paged out.
//
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = IoStatusBlock.Status;
}
}
else
{
Status = STATUS_INSUFFICIENT_RESOURCES;
}