Thanks for the help.
I have implemented the code in my AddDevice entry point and got the 12V.
However, I lost the 12V after I called the driver from user mode
(CreateFile) and close the handle (CloseHandle). If I try to call the
driver again from user mode, I don’t get the 12V. I also tried to unstall
the driver and install it again, in which case the AddDevice routine is
called again, I did not get the 12V either. The only way to get the 12V
back is to reboot the machine.
Below is the code I used to set vpp in AddDevice routine. Any idea what I
might have done wrong?
Thanks,
Wendy
//**********************************************************
//Pdo was passed to AddDevice by the system
KEVENT event;
NTSTATUS status;
PIRP irp;
PIO_STACK_LOCATION irpStackPointer;
IO_STATUS_BLOCK statBlock;
PCMCIA_INTERFACE_STANDARD *pm_interface;
pm_interface = new (PagedPool) PCMCIA_INTERFACE_STANDARD;
if (!pm_interface)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
// Initiate an event to block on
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP, Pdo, NULL, 0, 0,
&event, &statBlock);
if (!irp) {
status = STATUS_INSUFFICIENT_RESOURCES;
goto cleanup;
}
irp->IoStatus.Status = STATUS_NOT_SUPPORTED ;
irp->IoStatus.Information = 0;
irpStackPointer = IoGetNextIrpStackLocation(irp);
irpStackPointer->MinorFunction = IRP_MN_QUERY_INTERFACE;
irpStackPointer->Parameters.QueryInterface.InterfaceType =
(LPGUID) &GUID_PCMCIA_INTERFACE_STANDARD;
irpStackPointer->Parameters.QueryInterface.Size =
sizeof(PCMCIA_INTERFACE_STANDARD);
irpStackPointer->Parameters.QueryInterface.Version = 1;
irpStackPointer->Parameters.QueryInterface.Interface =
(PINTERFACE) pm_interface;
// send the request down
status = IoCallDriver(Pdo, irp);
if (status == STATUS_PENDING) {
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = statBlock.Status;
}
if (!NT_SUCCESS(status)) {
goto cleanup;
}
// set Vpp
(*pm_interface -> SetVpp) (pm_interface -> Context, PCMCIA_VPP_12V);
// dereference
(*pm_interface -> InterfaceDereference) (pm_interface -> Context);
cleanup:
delete pm_interface;
pm_interface = NULL;
return status;
You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com